Local-first code knowledge graph MCP server
Project description
Code GraphRAG MCP Server
This module implements the local-first Code GraphRAG MCP server described in ../docs/code-graph-rag-mcp.md. The spec covers the full architecture: repository watcher, Tree-sitter based symbol extraction, AST-aligned chunking, EmbeddingGemma integration, SQLite (sqlite-vec, bfsvtab) storage, and MCP tools for ingest/search/status.
Next Steps
- Port the spec content into actionable tasks (schema, watcher, parsers, retrieval).
- Initialize the codebase structure (
src/,tests/, configuration) following the deliverables checklist.
Refer back to the spec for detailed requirements and pseudo-code snippets.
SQLite Extensions
- Wheels built from this project bundle sqlite-vec and bfsvtab automatically; no manual steps are required after
pip install. - To rebuild native libraries locally (for development or alternative platforms), run
python scripts/build_sqlite_extensions.py. - Override inputs via
--sqlite-vec-src/--bfsvtab-src, and customize discovery withDATABASE.extensions_dirin the config.
Quick Start
- Run directly with
uvx(recommended for MCP manifests):uvx code-graph-rag-mcp serve --config /path/to/config.yaml
The published wheel bundlessqlite-vecandbfsvtab, so no manual build step is required. - To override the repo or database locations via environment variables, add them in the MCP manifest
envblock (see “Environment Overrides”). - A minimal
config.yamlmight look like:watch: dir: "/workspace/repo" database: sqlite_path: "/workspace/data/code.sqlite"
Development
- Create and activate a virtualenv:
python -m venv .venv && source .venv/bin/activate. - Install dependencies:
pip install -e .[dev]. - Rebuild native extensions (if you need local copies):
python scripts/build_sqlite_extensions.py. - Initialize the database:
code-graph-rag-mcp init-db --config config.yaml(optional). - Launch the server over stdio:
code-graph-rag-mcp serve.
Testing
- Run the pytest suite (includes building extensions in a temp dir):
pytest.
Runtime Features
- File watcher + job queue keeps the database in sync with repo changes.
- Hybrid search returns BFS neighbor context using configurable hop depth.
Environment Overrides
CODE_GRAPH_RAG_CONFIG: optional path to override the defaultconfig.yaml.CODE_GRAPH_RAG_WATCH_DIR,CODE_GRAPH_RAG_DB_PATH,CODE_GRAPH_RAG_EXTENSIONS_DIR, etc., adjust watcher and database settings at runtime.CODE_GRAPH_RAG_SQLITE_VEC/CODE_GRAPH_RAG_BFSVTABcan point to custom extension locations if you don’t want to use the bundled binaries.- Embedding overrides:
CODE_GRAPH_RAG_EMBED_MODEL,CODE_GRAPH_RAG_EMBED_ENDPOINT,CODE_GRAPH_RAG_EMBED_DIM,CODE_GRAPH_RAG_EMBED_QUANTIZE. - Retrieval overrides:
CODE_GRAPH_RAG_RETRIEVAL_K,CODE_GRAPH_RAG_RETRIEVAL_HOPS.
The MCP manifest’s env block is the recommended place to set these.
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 code_graph_rag_mcp-0.1.1.tar.gz.
File metadata
- Download URL: code_graph_rag_mcp-0.1.1.tar.gz
- Upload date:
- Size: 94.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e7f25d22f6033ac87cbae24ae2e6a0ae0ba35a4024f14ab3d52a4f8e436895a8
|
|
| MD5 |
dbe76a93e5fece114b23b23c3d338ac6
|
|
| BLAKE2b-256 |
997237d091a3dbaebf40f94802e11f52c21fe08167acf34ad4c94edf0ced20f9
|
File details
Details for the file code_graph_rag_mcp-0.1.1-py3-none-any.whl.
File metadata
- Download URL: code_graph_rag_mcp-0.1.1-py3-none-any.whl
- Upload date:
- Size: 105.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
865acc2c28cdffc6a6a8f4b2c61bd8c320445a72a8586b093c47150b3c95ea27
|
|
| MD5 |
0329919ba4b516a30cf7c3a25205f668
|
|
| BLAKE2b-256 |
862a4e5f2c84d73114622cdcf9e911cfc7c7ca0c91638d14ae3513290c772628
|