code-rag-mcp
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@code-rag-mcpsearch codebases for how JWT auth is validated across repos"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
โก Multi-Repository Code Search Engine
A production-grade code retrieval and search system engineered for querying and navigating multiple source code repositories simultaneously, designed and planned using the OpenSpec Spec-Driven Development framework. Ranked results (with repository, file, line, symbol, and graph metadata) are the integration boundary for external cloud LLM clients, which perform generation in their own environment.
๐ Key Features
Multi-Repository Ingestion & Incremental Sync:
Manages local codebase directories and remote Git repositories.
Respects
.gitignorerules and excludes binaries/lockfiles automatically.SHA-256 hash tracking and Git commit detection for instantaneous incremental updates.
AST-Aware Semantic Code Chunking:
Language-aware structural parsing for Python, TypeScript/JavaScript, Go, Rust, Java, C/C++, HTML/CSS, SQL, and Markdown.
Preserves function, method, class, and interface boundaries.
Injects scope headers (
// [Context] Repository | File | Scope | Imports | Doc).
Hybrid Dense + Lexical Indexing:
Dense Vector Search: Semantic subword feature vectors with cosine similarity + support for external embeddings (Gemini, OpenAI, Voyage AI, Ollama). Local Ollama embeddings default to
qwen3-embedding:0.6b, loaded on demand and released when idle.Sparse BM25 Search: Code-tailored tokenizer splitting
camelCaseandsnake_casetokens with symbol boosting.Reciprocal Rank Fusion (RRF): Merges dense and sparse rankings with exact identifier boosts.
Symbol Graph & Cross-Repository Dependency Linkage:
Extracts symbol definitions, callers, callees, and imports in SQLite.
Automatically maps frontend client API calls (e.g.
apiClient.post('/api/v1/auth/login')) to backend API route handlers across different repositories.
Interfaces:
Modern Web UI: Hybrid Search as the primary query experience, repository manager, cross-repo API contract map, and code inspector drawer.
Model Context Protocol (MCP) Server: Exposes stdio tools (
search_codebases,get_symbol_definition,get_call_hierarchy,list_repositories) to AI coding assistants (Antigravity, Cursor, Claude Code, Windsurf).CLI: Fast terminal commands for indexing and searching.
REST API:
POST /api/v1/searchreturns ranked code chunks for external cloud LLM consumers.
Related MCP server: CodeGraph
๐ OpenSpec Spec-Driven Planning
All specifications, architectural contracts, and task breakdowns are maintained under openspec/:
openspec/
โโโ config.json # OpenSpec project configuration
โโโ specs/ # Living System Specifications (Source of Truth)
โ โโโ repository-management.md # Repo ingestion & git tracking
โ โโโ ast-code-chunking.md # AST semantic parsing & context injection
โ โโโ hybrid-indexing.md # Dense vector + BM25 lexical index
โ โโโ symbol-graph-retrieval.md # Call graph & cross-repo API linkage
โ โโโ context-fusion-reranking.md # RRF fusion & citation packaging
โ โโโ rag-generation.md # LLM prompting & grounded citations
โ โโโ mcp-server.md # Model Context Protocol tools
โ โโโ api-and-web-ui.md # REST & Web UI specifications
โโโ changes/
โโโ 01-foundation-and-core-rag/ # Phase 1 Change Proposal
โโโ proposal.md # Goals, scope, and motivation
โโโ design.md # Technical architecture & contracts
โโโ tasks.md # Implementation checklist (Completed)๐ Quick Start
1. Register & Index Repositories
# Add a local repository
python3 main.py add auth-service ./fixtures/repo_auth_service
# Add another repository
python3 main.py add web-client ./fixtures/repo_web_client
# List all indexed repositories
python3 main.py list2. Manage Repository Groups & Dependency Relations
# Create a repository group
python3 main.py group create platform --repos auth-service shared-schemas
# Declare a dependency edge: web-client depends on auth-service
python3 main.py relation add web-client auth-service
# Inspect relations for a repository
python3 main.py relation show web-client
# Search with group scoping and upstream dependency expansion
python3 main.py search "jwt token" --group platform --expand upstream --expand-depth 13. Search Across Repositories (CLI)
# Hybrid search across all codebases
python3 main.py search "login user authenticate"
# Search scoped to a group with upstream dependency expansion
python3 main.py search "How does authentication flow between web-client and auth-service?" --group platform --expand upstream4. Launch the Interactive Web UI
python3 main.py serve --host 127.0.0.1 --port 8000Open http://localhost:8000 in your browser.
5. Connect to AI IDEs via MCP (Model Context Protocol)
Add this MCP server entry to your AI IDE configuration (Antigravity / Cursor / Claude Code):
{
"mcpServers": {
"multi-repo-code-rag": {
"command": "python3",
"args": ["/Users/nick-work-pc/.gemini/antigravity/scratch/multi-repo-code-rag/main.py", "mcp"]
}
}
}๐ง Embedding Model Runtime
The engine runs as a single instance per data directory and keeps the local embedding model resident only while it is working.
Default model:
qwen3-embedding:0.6b(install once withollama pull qwen3-embedding:0.6b). Override with--embedding-modelor$OLLAMA_EMBEDDING_MODEL.On-demand residency: the model is never loaded at startup. It loads on the first embedding of an indexing run or search, and is released once the last in-flight operation finishes and the idle grace elapses. Overlapping requests share one load and produce one release.
Residency policy via
--keep-aliveor$EMBEDDING_KEEP_ALIVE:Value
Behavior
(unset)
Release after 30s of inactivity (default)
0Release immediately after the last operation
45s,5mRelease after that idle grace
alwaysKeep the model resident for the process lifetime
Single instance: startup takes an exclusive lock on
<data-dir>/.rag-instance.lock. A second instance fails fast with the owning pid; pass--allow-multi-instanceto downgrade this to a warning.Inspect / release manually:
GET /api/v1/models/statusreports residency, active operations, policy, and index provenance.POST /api/v1/models/unload(orpython3 main.py unload) releases the model, returning409 busywhile an operation is in flight.
Automatic reindex on model change
The dense index records the provider, model, and vector dimension that produced its vectors (<data-dir>/index_meta.json). When the configured embedding model changes โ for example on upgrade from qwen3-embedding:4b (2560 dims) to the qwen3-embedding:0.6b default (1024 dims) โ the affected repositories are automatically re-embedded before search results are served:
chunk text, symbol graph, and BM25 lexical index are preserved (embedding-only pass, not a re-parse);
progress is reported through the normal indexing progress output;
provenance is written per repository, so an interrupted rebuild resumes with the repositories still outstanding;
searches arriving during a rebuild get
503 reindexinginstead of being scored against vectors from another model.
Rollback to the previous behavior: OLLAMA_EMBEDDING_MODEL=qwen3-embedding:4b EMBEDDING_KEEP_ALIVE=always restores the old model and always-resident policy; the provenance check then rebuilds back into the 4b vector space with no code change.
๐ท๏ธ Repository Groups & Dependency Relations Architecture
Topology & Domain Rules
Named Repository Groups: Flat collections of repositories (e.g.
core,platform,billing). Deleting a group never deletes underlying repositories.Directed Dependency DAG: Explicit dependency edges
A -> depends on -> B. Adding an edge runs write-time cycle detection (raisingDependencyCycleErroron cycles).Scope Resolution: Combines explicit repository IDs and group members into a primary set, then expands along the graph in
upstream(dependencies),downstream(dependents), orbothdirections up toexpand_depth.Hop-Decay Ranking: Chunks retrieved from expanded repositories receive a score multiplier penalty
(0.85 ** hops)to ensure primary repositories rank first.Provenance Metadata: Results originating from expanded repositories carry metadata (
repo_relation='expanded',relation_direction,relation_hops) and are visually badged in the UI.
REST API Endpoints
Method | Endpoint | Description |
|
| List all repository groups and their members |
|
| Create a new repository group |
|
| Delete a repository group |
|
| Add members to group |
|
| Remove a member from a group |
|
| Embedding model residency, policy, and dense index provenance |
|
| Release models now ( |
|
| Get repository groups, direct dependencies, and direct dependents |
|
| Add dependency edge |
|
| Remove a dependency edge |
|
| Search with optional |
MCP Tools
manage_repository_relations: Actionscreate_group,delete_group,add_to_group,remove_from_group,add_dependency,remove_dependency.get_repository_relations: Returns relations for a single repository or the entire relation graph.search_codebases: Extended with optionalgroups,expand, andexpand_deptharguments.
๐งช Running Tests
python3 -m unittest discover -s tests -p "test_*.py" -vAll unit and integration test suites pass verifying AST chunking, symbol extraction, cross-repo API detection, repository relation DAG & cycle detection, scope resolution & hop-decay retrieval, REST API handlers, MCP protocol, and end-to-end hybrid search retrieval.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables semantic code search across multiple repositories using natural language queries. Provides intelligent code discovery, symbol lookups, and cross-repo dependency analysis for AI coding agents.MIT
- AlicenseNot gradedqualityCmaintenanceEnables AI agents to search code by meaning, explore codebase structure, store and query knowledge with temporal facts, and read source code through a set of MCP tools.4537MIT
- AlicenseNot gradedqualityAmaintenanceProvides code intelligence for AI coding agents by indexing repositories into a hybrid knowledge graph, enabling agents to query dependencies, impact, and context through 28 MCP tools.3Apache 2.0
- FlicenseNot gradedqualityCmaintenanceProvides structural code intelligence via 26 MCP tools, enabling AI assistants to query code symbols, dependencies, and call graphs accurately without file-pasting.
Related MCP Connectors
Persistent memory and cross-session learning for AI coding assistants (hosted remote MCP).
Code intelligence for coding agents: semantic, AST, graph, and full-text search. 279+ languages.
Your memory, everywhere AI goes. Build knowledge once, access it via MCP anywhere.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/nicksulia/code-rag-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server