A search API that combines keyword-based and vector-based searches to find relevant code snippets and documents. The API is meant for consumption from an LLM library or tool for Retrieval Augmented Search (RAG) and is configured to run as an MCP server with FastMCP, usable by Claude.
- Postgres Uses PostgreSQL's native full-text search and pgvector.
- Keyword Search: Full-text search on document and chunk contents, summaries, and filenames.
- Vector Search: Semantic search using vector embeddings.
- Hybrid Relevance: Uses Reciprocal Rank Fusion (RRF) to merge results from keyword and vector searches.
- Recursive Summarization: Shares some insights from RAPTOR - modules, classes, and functions are recursively summarized.
- Python 3.11+
- PostgreSQL with pgvector extension
- Clone the Repository
git clone https://github.com/PrefectHQ/code-helper-search-api.git
cd code-helper-search-api
- Create and Activate a Virtual Environment
python -m venv env
source env/bin/activate # On Windows, use `env\Scripts\activate`
- Install Dependencies
pip install -r requirements.lock
I usually install the package too:
pip install -e .
- Configure the Database
Update the DATABASE_URL
in your configuration to point to your PostgreSQL database.
Initialize the Database
alembic upgrade head
To start the server, run:
make run-api
But you most likely want to run the server in dev mode:
make run-api-dev
Then you can test it in the MCP Inspector at http://localhost:5173.
When you're ready to use it in Claude, you'll need to install the MCP server in Claude (see next section).
This server is more complex than the examples in the FastMCP docs, so I recommend editing your MCP server config by hand (in ~/Library/Application Support/Claude/claude_desktop_config.json
):
{
"mcpServers": {
"Code search MCP server": {
"command": "/Users/andrew/src/code-helper/env/bin/uv",
"args": [
"run",
"-p",
"/Users/andrew/src/code-helper/env/bin/python",
"fastmcp",
"run",
"/Users/andrew/src/code-helper/src/code_helper/app.py"
]
}
}
}
NOTE: You'll need to replace the path to the Python binary and the path to the app.py
file. After editing the config, restart Claude.