CLI + MCP server that indexes local codebases into Qdrant using OpenAI-compatible embeddings, then exposes semantic search to Claude Code and other MCP clients
Project description
codebase-mcp
Vector search MCP server for codebases. Index repos locally with AST-aware chunking; let Claude (or any MCP client) search them via semantic similarity.
How it works
- Index — walks repo files, chunks them using tree-sitter AST (function/method boundaries) with line-based fallback, embeds via OpenAI-compatible API, stores in in-process Qdrant.
- Serve — exposes two MCP tools (
search_codebase,list_indexed_repos) over stdio. - Search — embeds the query, retrieves top-8 chunks across all indexed repos (or a specific one), returns ranked results with file path and line numbers.
Install
uv tool install /path/to/codebase-mcp
Or for development:
uv sync
CLI
# Index a repo (fails if already indexed)
codebase-mcp index ~/Code/myproject
# Re-index after changes (replaces existing index)
codebase-mcp reindex ~/Code/myproject
# List indexed repos with chunk counts
codebase-mcp list
# Remove a repo from the index
codebase-mcp remove ~/Code/myproject
# Start MCP server (stdio, used by Claude Code)
codebase-mcp serve
Config commands
# Show current settings
codebase-mcp config list
# Set embedding model (known models auto-resolve vector size)
codebase-mcp config set embedding-model text-embedding-3-large
codebase-mcp config set embedding-model my-custom-model --vector-size 768
# Set API credentials
codebase-mcp config set api-key sk-...
codebase-mcp config set api-base https://my-provider.com/v1
# Revert a setting to default / env var fallback
codebase-mcp config unset embedding-model
codebase-mcp config unset api-key
codebase-mcp config unset api-base
Known models (vector size auto-detected):
| Model | Vector size |
|---|---|
text-embedding-3-small |
1536 |
text-embedding-3-large |
3072 |
text-embedding-ada-002 |
1536 |
Default: text-embedding-3-small.
Claude Code config
Add to ~/.claude/settings.json:
{
"mcpServers": {
"codebase-search": {
"command": "codebase-mcp",
"args": ["serve"],
"env": { "OPENAI_API_KEY": "sk-..." }
}
}
}
API key can also be set via codebase-mcp config set api-key sk-... (persisted in ~/.codebase-mcp/settings.json), which takes precedence over the env var.
MCP tools
search_codebase
Search indexed repos for relevant code and docs.
| Parameter | Type | Description |
|---|---|---|
query |
string | Natural language description of what to find |
repo_path |
string (optional) | Absolute path to a specific repo; omit to search all |
Returns top-8 results ranked by similarity, each with file path, line range, score, and code block.
list_indexed_repos
List all indexed repos with chunk count and last indexed timestamp. No parameters.
Supported languages (AST chunking)
| Language | Extensions | Chunk boundary |
|---|---|---|
| Python | .py |
function_definition, decorated_definition |
| TypeScript | .ts |
function_declaration, method_definition, arrow_function |
| TSX | .tsx |
same as TypeScript |
| JavaScript | .js, .jsx |
function_declaration, method_definition, arrow_function |
| Go | .go |
function_declaration, method_declaration |
| Rust | .rs |
function_item |
| Java | .java |
method_declaration, constructor_declaration |
| HCL/Terraform | .tf |
block |
Files without AST support (.md, .yaml, .toml, .json, .rb, .cpp, .c, .h) fall back to 100-line sliding window with 20-line overlap.
Data storage
All data lives in ~/.codebase-mcp/:
~/.codebase-mcp/
config.json # indexed repo metadata (paths, repo_ids, chunk counts, timestamps)
settings.json # embedding model, vector size, api_key, api_base
qdrant/ # Qdrant in-process storage (one collection per repo)
Each repo gets a stable repo_id derived from its absolute path (used as Qdrant collection name). Reindexing replaces the collection in-place.
OpenAI-compatible providers
Set api-base to use any OpenAI-compatible embedding API (e.g. Ollama, vLLM, Azure):
codebase-mcp config set api-base http://localhost:11434/v1
codebase-mcp config set api-key ollama
codebase-mcp config set embedding-model nomic-embed-text --vector-size 768
After changing the model, reindex all repos (vector dimensions must match).
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file yacodebase_mcp-0.1.0.tar.gz.
File metadata
- Download URL: yacodebase_mcp-0.1.0.tar.gz
- Upload date:
- Size: 143.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d7ea2f2076c35edad5a4a734f265bb94b6e78bc0df99bf6900b417f756973b30
|
|
| MD5 |
b3a93e3c1e8fc7d1e0f16f3522654bf6
|
|
| BLAKE2b-256 |
5b09aef62fb2737c9664db16a7ff08820ae9c250a0f04e8ce5743b54558cfe11
|
Provenance
The following attestation bundles were made for yacodebase_mcp-0.1.0.tar.gz:
Publisher:
publish.yml on gzamboni/codebase-mcp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
yacodebase_mcp-0.1.0.tar.gz -
Subject digest:
d7ea2f2076c35edad5a4a734f265bb94b6e78bc0df99bf6900b417f756973b30 - Sigstore transparency entry: 1589531599
- Sigstore integration time:
-
Permalink:
gzamboni/codebase-mcp@6c3ff00da6612b4c5cea06eb7055fb83d701c096 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/gzamboni
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@6c3ff00da6612b4c5cea06eb7055fb83d701c096 -
Trigger Event:
release
-
Statement type:
File details
Details for the file yacodebase_mcp-0.1.0-py3-none-any.whl.
File metadata
- Download URL: yacodebase_mcp-0.1.0-py3-none-any.whl
- Upload date:
- Size: 12.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6cdf1b4f740ee1fb0100f2b6d1831528e090df9a4c21eb35341471f402914414
|
|
| MD5 |
f259a74f6db26a5e5ecb38c4d4b840ea
|
|
| BLAKE2b-256 |
34c06377a5d1aaa422164ed272d1235423c9287fca895163f0227847a449a11a
|
Provenance
The following attestation bundles were made for yacodebase_mcp-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on gzamboni/codebase-mcp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
yacodebase_mcp-0.1.0-py3-none-any.whl -
Subject digest:
6cdf1b4f740ee1fb0100f2b6d1831528e090df9a4c21eb35341471f402914414 - Sigstore transparency entry: 1589531667
- Sigstore integration time:
-
Permalink:
gzamboni/codebase-mcp@6c3ff00da6612b4c5cea06eb7055fb83d701c096 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/gzamboni
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@6c3ff00da6612b4c5cea06eb7055fb83d701c096 -
Trigger Event:
release
-
Statement type: