← Back to directory
O

Octocode MCP Server

Community
Structural code intelligence for AI agents — semantic search, knowledge graph, and a built-in MCP server in one Rust binary.
GitHub source repository ↗
★ 475 Stars Category · Dev Tools Very popular
62FMRS · C

Octocode is an open-source (Apache-2.0) code intelligence tool by Muvon, written in Rust, delivered as a single binary that combines semantic search, a tree-sitter-based symbol/file knowledge graph, and a built-in MCP server usable from Claude Desktop, Cursor, Windsurf, Claude Code, Octomind, and other MCP clients. Its differentiator is understanding code structure (imports, calls, extends, implements) rather than treating code as flat text chunks, plus optional LSP support for go-to-definition and find-references. The project ships a reproducible retrieval benchmark showing that keyword-tuned hybrid retrieval notably improves Hit@5 and Recall@10. It is local-first and needs no API key by default, making it attractive to privacy-conscious teams that want structural understanding; however, it is a community project rather than an official product, and adopters should evaluate cloud data egress and index permissions before rolling it out.

Reliability
9/20
Security and permissions
12/20
Maintenance
13/20
Documentation
15/20
Setup experience
13/20
Read the FMRS scoring method →

Octocode is a Rust-built code intelligence tool that turns a project into a navigable knowledge graph so that Claude, Cursor, and other MCP clients can search, understand, and navigate the codebase structure. It builds a live graph of file and symbol nodes with deterministic contains, imports, calls, extends, and implements relationships directly from the current source via tree-sitter AST parsing; the MCP graphrag tool works from this graph without an index, embeddings, or an LLM. Optional indexed GraphRAG overlays semantic file matches, LLM descriptions, and broader file-level architectural relationships. Retrieval is hybrid: semantic similarity combined with BM25 full-text search and reranking. It is local-first by default, using fastembed so embeddings can run without an API key, while cloud embedding providers such as Voyage, OpenAI, Jina, and Google are also supported. It supports full tree-sitter AST parsing for 17 languages and is licensed under Apache-2.0.

Tools

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, and specific patterns.
lsp_goto_definition
Jump to a symbol's definition (requires starting with --with-lsp).
lsp_find_references
Find all usages of a symbol across the workspace (requires starting with --with-lsp).
lsp_hover
Type info and documentation for a symbol (requires starting with --with-lsp).
lsp_document_symbols
List the symbols defined in a single file (requires starting with --with-lsp).
lsp_workspace_symbols
Search symbols by name across the whole workspace (requires starting with --with-lsp).
lsp_completion
Provide code completion suggestions at a position (requires starting with --with-lsp).

Setup

  1. Install: use the universal installer curl -fsSL https://raw.githubusercontent.com/Muvon/octocode/master/install.sh | sh, or on macOS brew install muvon/tap/octocode, or cargo install octocode, or from source cargo install --git https://github.com/Muvon/octocode, or download a binary from GitHub Releases.
  2. API keys (optional): embeddings default to local FastEmbed with no key required; for cloud embeddings or an LLM, set VOYAGE_API_KEY, OPENROUTER_API_KEY, and so on, e.g. export VOYAGE_API_KEY="your-voyage-api-key".
  3. Index your codebase: cd /your/project then run octocode index.
  4. Search your code: octocode search "authentication middleware"; filter by language with --language rust, or search commit history with --mode commits.
  5. Connect your AI assistant: add {"mcpServers":{"octocode":{"command":"octocode","args":["mcp","--path","/your/project"]}}} to your MCP client config. With Claude Code you can run claude mcp add octocode -- octocode mcp --path /path/to/your/project.
  6. (Optional) Enable LSP tools: octocode mcp --path /your/project --with-lsp="rust-analyzer".
  7. (Optional) Enable indexed GraphRAG: octocode config --graphrag-enabled true then re-run octocode index.
claude_desktop_config.json
{
  "mcpServers": {
    "octocode": {
      "command": "octocode",
      "args": [
        "mcp",
        "--path",
        "/your/project"
      ]
    }
  }
}

Fit and risk

Best for

  • Developers who want Claude, Cursor, Windsurf, or other MCP clients to deeply understand codebase structure and dependencies.
  • Privacy-conscious teams that prefer local embeddings and a local-only MCP server.
  • Engineering teams working in supported languages such as Rust, Python, TypeScript/JavaScript, Go, PHP, and C++.
  • Code intelligence scenarios that need semantic search, a symbol graph, and LSP-precise navigation together.

Not for

  • Workflows that only need plain-text grep and no structural understanding.
  • Users who do not use an MCP client and only want a traditional IDE indexer.
  • Enterprise procurement needing official vendor support or an SLA (this is a community open-source project maintained by Muvon).
  • Situations where code must never leave the machine but local embedding models are also not acceptable.

Required permissions

  • Read source files under the specified project path (respects .gitignore by default and does not index sensitive files).
  • Write and update local index data inside the project.
  • Read local API key configuration and environment variables (VOYAGE_API_KEY, OPENROUTER_API_KEY, OPENAI_API_KEY, JINA_API_KEY, GOOGLE_API_KEY, etc., all optional).
  • When started with --with-lsp, launch and call the specified local language server (e.g. rust-analyzer).
  • Run as a local MCP server; search itself performs no external network access.

Risks and side effects

  • When a cloud embedding provider is enabled, only the code chunks being embedded are sent to that provider; use local models for fully offline indexing.
  • Indexing writes project content into a local index store, so the storage location and permissions should match team policy.
  • LSP tools depend on an external language server; misconfiguration or crashes affect those tools, though not the graph or semantic search.
  • Semantic search results are relevance-ranked candidates; an AI may draw conclusions from incomplete results, so important changes still need human review.
  • A generic local cross-encoder reranker (e.g. bge-reranker-base) can actually regress code retrieval; a code-aware reranker is needed.

Troubleshooting

  1. Verify that the `octocode` executable is on PATH so the MCP client's command launches correctly.
  2. Check that `--path` points to the correct project directory; a wrong path yields an empty graph and no search results.
  3. If using cloud embeddings or an LLM, confirm the matching API key is set and rate limits are not exceeded (see the rate-limit notes in GETTING_STARTED).
  4. If LSP tools are unavailable, confirm the server was started with --with-lsp and that the language server is installed and runnable.
  5. The graphrag tool works without an index, but indexed GraphRAG requires `octocode config --graphrag-enabled true` followed by a re-run of `octocode index`.
  6. For weak retrieval results, try adjusting hybrid search weights or switching to a code-aware reranker; see the comparison data in benchmark/RESULTS.md.

Use cases

Let an AI assistant find code by meaning instead of keywords, e.g. "where is authentication handled".
Query dependencies between files, e.g. "what files depend on the payment module".
Inspect function signatures and file structure without reading entire files.
Use AST pattern matching to surface risky calls such as .unwrap().
Combine LSP precision for go-to-definition, find-references, and hover documentation.
Switch between local and cloud embedding providers for hybrid code and commit-history retrieval.

Supported clients

Claude DesktopFull support
Claude CodeFull support
CursorFull support
WindsurfFull support
OctomindFull support
VS Code (Cline/Continue)Full support
ZedFull support
ReplitFull support