Skip to main content

Package Search MCP Server

The Package Search MCP Server is an MCP server designed to add ground truth context about code packages to AI agents. Our research demonstrates that by exposing the source code of a project’s dependencies to a model, we improve its performance on coding tasks and reduce its potential for hallucination. Chroma’s Package Search MCP server achieves this by exposing tools to allow the model to retrieve necessary context:
Tool NameUsage
package_search_grepUse regex pattern matching to retrieve relevant lines from source code
package_search_hybridUse semantic search with optional regex filtering to explore source code without existing knowledge of its structure
package_search_read_fileReads specific lines from a single file in the code package

Getting Started

To guarantee that your model uses package search when desired, add use package search to either the system prompt (to use the MCP server whenever applicable) or to each task prompt (to use it only when you instruct the model to do so).
  1. Visit Chroma’s Package Search page.
  2. Click “Get API Key” to create or log into your Chroma account and issue an API key for Package Search.
  3. After issuing your API key, click the “Other” tab and copy your API key.
  4. Connect to the Chroma MCP server to search code packages. In this example, we search for how the Fast Fourier Transform algorithm is implemented in the numpy package from PyPI.
import anthropic

client = anthropic.Anthropic(
    api_key="<YOUR_ANTHROPIC_API_KEY>"
)

response = client.beta.messages.create(
    model="claude-sonnet-4-20250514",
    max_tokens=1000,
    messages=[
        {
            "role": "user",
            "content": "Explain how numpy implements its FFT. Use package search.",
        }
    ],
    mcp_servers=[
        {
            "type": "url",
            "url": "https://mcp.trychroma.com/package-search/v1",
            "name": "package-search",
            "authorization_token": "<YOUR_CHROMA_API_KEY>",
        }
    ],
    betas=["mcp-client-2025-04-04"],
)

print(response)