Skip to main content

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 with DATABASE.extensions_dir in the config.

Development

  • Create and activate a virtualenv: python -m venv .venv && source .venv/bin/activate.
  • Install dependencies: pip install -e .[dev].
  • Build SQLite extensions (sqlite-vec + bfsvtab): python scripts/build_sqlite_extensions.py.
  • Initialize the database: code-graph-rag-mcp init-db --config config.yaml (optional if using defaults).
  • Launch the MCP 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 default config.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_BFSVTAB can 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

code_graph_rag_mcp-0.1.0.tar.gz (94.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

code_graph_rag_mcp-0.1.0-py3-none-any.whl (104.9 kB view details)

Uploaded Python 3

File details

Details for the file code_graph_rag_mcp-0.1.0.tar.gz.

File metadata

  • Download URL: code_graph_rag_mcp-0.1.0.tar.gz
  • Upload date:
  • Size: 94.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for code_graph_rag_mcp-0.1.0.tar.gz
Algorithm Hash digest
SHA256 a9adb9580d2e24c02bcae617af928698bc73a93d9fc1e54e9e076d9c75a5ea89
MD5 620d108d1908811cfc0b4bbc8f04fe55
BLAKE2b-256 115cd6a3ca29e64c6ec75b883308c6afe72f9fe6ece41dd721d8adc2acb6508b

See more details on using hashes here.

File details

Details for the file code_graph_rag_mcp-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for code_graph_rag_mcp-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 168e79e67e2b531cd6bb2f0634459e593593d86ff5cc33783176b60cda9e818d
MD5 2ef28de9aa7ef9b83ab2a2e85682b7c9
BLAKE2b-256 b1031fedbd0547f14a18db590444263cfb8fc11f2d82bd95aaadb4c41290e455

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page