The full upstream README, mirrored here for reference. Install config, tool schemas, adoption signals, and an original overview live on the Octocode listing page.
Give your AI assistant a brain for your codebase. Octocode transforms your project into a navigable knowledge graph that Claude, Cursor, and other AI agents can search, understand, and navigate.
🚀 Quick Start • 🤖 MCP Integration • 📖 Documentation • 🌐 Website
The Problem: AI assistants are blind to your codebase. They can't search your files, understand dependencies, or remember context across sessions.
The Solution: Octocode's MCP server gives AI agents:
Works with: Claude Desktop • Cursor • Windsurf • Any MCP-compatible AI
Now your AI assistant can:
Standard RAG treats your code as flat text chunks. It finds similar-sounding snippets but has no idea that auth_middleware.rs imports jwt.rs, calls user_store.rs, and is wired into router.rs. Octocode understands structure.
Octocode uses tree-sitter AST parsing to build a live graph of files, symbols, imports, calls, inheritance, and implementations. The MCP graphrag tool builds this graph lazily from the current source tree, without an index, embeddings, or an LLM. Optional indexed GraphRAG adds semantic file discovery, descriptions, and broader architectural relationships.
contains, imports, calls, extends, and implements relationships directly from current source[graphrag].enabled = falsesemantic_search, view_signatures, graphrag, and structural_search to any MCP-compatible client| Standard RAG | Doc Lookup Tools | Octocode | |
|---|---|---|---|
| Indexes | Text chunks | External library docs | Your codebase structure (AST) |
| Understands | Similar text | API specs & usage | Functions, imports, dependencies |
| Cross-file | No | No | Yes — navigates the dependency graph |
| Relationships | No | No | imports, calls, implements, extends... |
| AI integration | Varies | MCP | Native MCP server + LSP |
Doc tools give AI the manual for libraries you use. Octocode gives AI the blueprint of how you put them together.
Built with Rust for performance. Local-first for privacy. Open source (Apache 2.0) for transparency.
Octocode ships a reproducible retrieval benchmark (benchmark/): 127 curated code-search queries with line-range ground truth, run against octocode's own source (pinned at b1771ba so annotations never drift). The numbers below use a fully local, no-API-key stack — jina-embeddings-v2-base-code via fastembed, no reranker — so they are a floor, not a ceiling:
| Config | Hit@5 | Hit@10 | MRR | NDCG@10 | Recall@10 |
|---|---|---|---|---|---|
| Dense vector only | 0.598 | 0.717 | 0.485 | 0.528 | 0.671 |
| Hybrid, default RRF weights (0.7/0.3) | 0.598 | 0.717 | 0.485 | 0.528 | 0.671 |
| Hybrid, keyword-tuned (0.3/0.7) | 0.732 | 0.835 | 0.572 | 0.620 | 0.807 |
Tilting RRF fusion toward the BM25/keyword signal — which carries disproportionate weight for code's exact identifiers — lifts Hit@5 by +22% and Recall@10 by +20% at zero added cost.
The benchmark also flags what doesn't help here (full 6-variant matrix in benchmark/RESULTS.md): a generic local cross-encoder reranker (bge-reranker-base) actually regressed results (Hit@5 0.732 → 0.598) — code retrieval needs a code-aware reranker (e.g. voyage:rerank-2.5), not an off-the-shelf one.
See benchmark/README.md for methodology and metric definitions.
See Installation Guide for platform-specific instructions.
Get your Voyage API key: voyageai.com (free tier available)
Octocode supports multiple embedding providers:
See API Keys guide for all supported providers.
Add to your MCP client config (Claude Desktop, Cursor, Windsurf):
Done! Your AI assistant now understands your codebase structure.
Octocode includes a built-in MCP server that exposes your codebase as tools to AI assistants. This is the primary way to use Octocode — give your AI assistant direct access to search and navigate your code.
| Tool | What It Does |
|---|---|
semantic_search | Find code by meaning — "authentication flow", "error handling", "database queries" |
view_signatures | View file structure — function signatures, class definitions, imports |
graphrag | Always-on file/symbol graph — search nodes, inspect relationships, and find paths without indexing |
structural_search | AST pattern matching — find .unwrap() calls, new instantiations, specific patterns |
lsp_goto_definition | Jump to a symbol's definition (requires --with-lsp) |
lsp_find_references | Find all usages of a symbol across the workspace (requires --with-lsp) |
lsp_hover | Type info and documentation for a symbol (requires --with-lsp) |
lsp_document_symbols / lsp_workspace_symbols / lsp_completion | File symbols, workspace-wide symbol search, completions (requires --with-lsp) |
Enable the LSP tools by starting the server with your language server:
Once connected, your AI assistant can answer questions about your codebase:
Octomind (Recommended) — Zero setup, Octocode pre-configured:
Claude Code (CLI) — Command-line setup:
Claude Desktop / Cursor / Windsurf — Add to config:
Config locations:
~/Library/Application Support/Claude/claude_desktop_config.json (macOS)~/.cursor/mcp.json or Settings → MCP Servers📖 Complete MCP Client Setup Guide — Detailed instructions for 15+ clients including VS Code (Cline/Continue), Zed, Replit, and more.
16 languages with full tree-sitter AST parsing:
| Language | Extensions | Features |
|---|---|---|
| Rust | .rs | Full AST parsing, pub/use detection, module structure |
| Python | .py | Import/class/function extraction, docstring parsing |
| TypeScript/JavaScript | .ts, .tsx, .js, .jsx | ES6 imports/exports, type definitions |
| Go | .go | Package/import analysis, struct/interface parsing |
| PHP | .php | Class/function extraction, namespace support |
| C++ | .cpp, .cc, .cxx, .c++, .c, .h, .hpp, .hxx, .cppm, .ixx, .mxx, .ccm, .cxxm | Include analysis, class/function extraction, C++20 module support |
| Ruby | .rb | Class/module extraction, method definitions |
| Elixir | .ex, .exs | Module/protocol extraction, function and macro definitions |
| Java | .java | Import analysis, class/method extraction |
| Swift | .swift | Class/struct/protocol extraction, import analysis |
| Svelte | .svelte | Component structure, script/style block extraction |
| Lua | .lua | Function and table extraction |
| CSS | .css | Rule and selector extraction |
| JSON | .json | Structure analysis, key extraction |
| Bash | .sh, .bash | Function and variable extraction |
| Markdown | .md | Document section indexing, header extraction |
We measure semantic search quality using a hand-annotated ground truth dataset of 254 queries (127 code + 127 docs) with precise line-range annotations. Each query has 1–3 expected results scored by relevance.
These numbers use the full cloud stack — contextual retrieval, Voyage reranker, RaBitQ quantization — on commit b1771ba with benchmark config. For the fully local baseline and the complete variant matrix, see Retrieval Quality above and benchmark/RESULTS.md.
--mode docs) — Hit@10: 0.953, MRR: 0.776| Metric | Score |
|---|---|
| Hit@5 | 0.929 (118/127) |
| Hit@10 | 0.953 (121/127) |
| MRR | 0.776 |
| NDCG@10 | 0.801 |
| Recall@5 | 0.902 |
| Recall@10 | 0.921 |
Missed queries (6 of 127):
| # | Query | Expected | Got (top 1) |
|---|---|---|---|
| 43 | how to set up MCP proxy for managing multiple repositories | doc/MCP_INTEGRATION.md:286-311 | doc/MCP_INTEGRATION.md:286-4 |
| 51 | what are the prerequisites before using octocode | doc/GETTING_STARTED.md:6-12 | doc/CONTRIBUTING.md:7-33 |
| 59 | what to do when hitting API rate limits | doc/GETTING_STARTED.md:209-216 | doc/PERFORMANCE.md:304-356 |
| 75 | typical performance metrics for small medium and large projects | doc/PERFORMANCE.md:4-13 | doc/PERFORMANCE.md:414-14 |
| 112 | how to install octocode on different operating systems | INSTALL.md:4-14 | INSTALL.md:49-70 |
| 115 | how to fix macOS Gatekeeper blocking the binary | INSTALL.md:199-206 | INSTALL.md:198-119 |
--mode code) — Hit@10: 0.992, MRR: 0.895| Metric | Score |
|---|---|
| Hit@5 | 0.992 (126/127) |
| Hit@10 | 0.992 (126/127) |
| MRR | 0.895 |
| NDCG@10 | 0.906 |
| Recall@5 | 0.962 |
| Recall@10 | 0.974 |
Missed queries (1 of 127):
| # | Query | Expected | Got (top 1) |
|---|---|---|---|
| 105 | how does the system ensure two developers get the same database path | src/storage.rs:60-83 | src/mcp/proxy.rs:631-644 |
Metrics: Hit@k (did the answer appear?), MRR (how high?), NDCG@10 (are best results ranked first?), Recall@k (how many found?). See benchmark/ for methodology, scoring script, and the full dataset.
Apache License 2.0 — See LICENSE for details.