muvon/octocode

πŸ’» Developer Tools
0 Views
0 Installs

πŸ¦€ 🏠 🍎 πŸͺŸ 🐧 - Semantic code indexer with GraphRAG knowledge graph. Index your codebase, search in natural language, and expose everything via MCP so AI agents understand architecture β€” not just files.

Quick Install

One-Click IDE Configuration
claude_desktop_config.json
{
  "mcpServers": {
    "muvon-octocode": {
      "command": "npx",
      "args": [
        "-y",
        "muvon-octocode"
      ]
    }
  }
}
Or

Using an AI coding agent (Claude Code, Cursor, etc.)? Copy a ready-made prompt that tells it to fetch the setup instructions and install this server for you.

Documentation Overview

Octocode

Structural Code Intelligence for AI Agents β€” MCP Server + Knowledge Graph + Semantic Search

GitHub stars License Rust Release

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

Octocode MCP server

πŸ€– Built for AI Agents

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:

  • πŸ” Semantic search β€” Find code by meaning, not keywords
  • πŸ•ΈοΈ Knowledge graph β€” Navigate imports, calls, and dependencies
  • πŸ“ Code signatures β€” View structure without reading entire files
  • 🧠 Persistent memory β€” Remember decisions across conversations

Works with: Claude Desktop β€’ Cursor β€’ Windsurf β€’ Any MCP-compatible AI

// Add to your AI assistant config
{
  "mcpServers": {
    "octocode": {
      "command": "octocode",
      "args": ["mcp", "--path", "/your/project"]
    }
  }
}

Now your AI assistant can:

You: "Where is authentication handled?"
AI: *searches your codebase* "Authentication is in src/middleware/auth.rs,
    which imports jwt.rs for token validation and calls user_store.rs for lookup."

You: "What files depend on the payment module?"
AI: *queries knowledge graph* "src/api/handlers/payment.rs imports payment/mod.rs,
    which is also used by src/workers/refund.rs and src/cron/billing.rs"

You: "Remember this bug fix for future reference"
AI: *stores in memory* "Got it. I'll remember this authentication bypass fix
    and apply similar patterns when reviewing security code."

πŸ€” Why Octocode?

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.

# Semantic search finds the right code
octocode search "authentication middleware"
β†’ src/middleware/auth.rs | Similarity 0.923

# GraphRAG reveals the full dependency chain
octocode graphrag get-relationships --node_id src/middleware/auth.rs
Outgoing:
  imports β†’ jwt (src/auth/jwt.rs): token validation logic
  calls   β†’ user_store (src/db/user_store.rs): user lookup by token
Incoming:
  imports ← router (src/router.rs): wires auth into the request pipeline

Octocode uses tree-sitter AST parsing to extract real symbols (functions, imports, dependencies), builds a GraphRAG knowledge graph of relationships between files, and exposes everything via MCP β€” so AI tools can navigate your project architecture, not just search it.

πŸ”¬ How It Works

Source Code β†’ Tree-sitter AST β†’ Symbols & Relationships β†’ Knowledge Graph
                                        ↓
                    Embeddings + Hybrid Search + Reranking β†’ MCP Server
  1. AST Parsing β€” tree-sitter extracts real code symbols (functions, classes, imports), not arbitrary text chunks
  2. Knowledge Graph β€” GraphRAG maps relationships between files: imports, calls, implements, extends, configures, and 9 more types β€” each with importance weighting
  3. Hybrid Search β€” semantic similarity + BM25 full-text search + reranking β€” not just vector embeddings
  4. MCP Server β€” exposes semantic_search, view_signatures, and graphrag tools to any MCP-compatible client

✨ What Makes It Different

Standard RAGDoc Lookup ToolsOctocode
IndexesText chunksExternal library docsYour codebase structure (AST)
UnderstandsSimilar textAPI specs & usageFunctions, imports, dependencies
Cross-fileNoNoYes β€” navigates the dependency graph
RelationshipsNoNoimports, calls, implements, extends...
AI integrationVariesMCPNative 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.

πŸ“Š Retrieval Quality

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:

ConfigHit@5Hit@10MRRNDCG@10Recall@10
Dense vector only0.5980.7170.4850.5280.671
Hybrid, default RRF weights (0.7/0.3)0.5980.7170.4850.5280.671
Hybrid, keyword-tuned (0.3/0.7)0.7320.8350.5720.6200.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.

git worktree add /tmp/corpus b1771ba        # pin the corpus to the ground-truth commit
CORPUS=/tmp/corpus python3 benchmark/run_matrix.py

See benchmark/README.md for methodology and metric definitions.

πŸš€ Quick Start

1. Install

# Universal installer (Linux, macOS, Windows)
curl -fsSL https://raw.githubusercontent.com/Muvon/octocode/master/install.sh | sh

# macOS with Homebrew
brew install muvon/tap/octocode
Other installation methods
# Cargo (build from source)
cargo install --git https://github.com/Muvon/octocode

# Download binary from releases
# https://github.com/Muvon/octocode/releases

See Installation Guide for platform-specific instructions.

2. Set Up API Keys

# Required: Embedding provider (Voyage AI has 200M free tokens/month)
export VOYAGE_API_KEY="your-voyage-api-key"

# Optional: LLM for commit messages, code review
export OPENROUTER_API_KEY="your-openrouter-api-key"

Get your Voyage API key: voyageai.com (free tier available)

Other embedding providers

Octocode supports multiple embedding providers:

# OpenAI
export OPENAI_API_KEY="your-key"
octocode config --code-embedding-model "openai:text-embedding-3-small"

# Jina AI
export JINA_API_KEY="your-key"
octocode config --code-embedding-model "jina:jina-embeddings-v3"

# Google
export GOOGLE_API_KEY="your-key"
octocode config --code-embedding-model "google:text-embedding-005"

See API Keys guide for all supported providers.

3. Index Your Codebase

cd /your/project
octocode index
# β†’ Indexed 12,847 blocks across 342 files

4. Search Your Code

# Natural language search
octocode search "authentication middleware"

# Multi-query for broader results
octocode search "auth" "middleware" "session"

# Filter by language
octocode search "database connection pool" --lang rust

# Search commit history
octocode search "authentication refactor" --mode commits

5. Connect Your AI Assistant

Add to your MCP client config (Claude Desktop, Cursor, Windsurf):

{
  "mcpServers": {
    "octocode": {
      "command": "octocode",
      "args": ["mcp", "--path", "/your/project"]
    }
  }
}

Done! Your AI assistant now understands your codebase structure.

πŸ”Œ MCP Server Integration

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.

Available Tools

ToolWhat It Does
semantic_searchFind code by meaning β€” "authentication flow", "error handling", "database queries"
view_signaturesView file structure β€” function signatures, class definitions, imports
graphragQuery relationships β€” "what calls this function?", "what does this module import?"
structural_searchAST pattern matching β€” find .unwrap() calls, new instantiations, specific patterns

Conversational AI Examples

Once connected, your AI assistant can answer questions about your codebase:

You: "Where is user authentication implemented?"
AI: *uses semantic_search* "Found in src/auth/login.rs. The authenticate() function
    validates credentials against the database, generates a JWT token, and stores
    the session in Redis."

You: "What files depend on the payment module?"
AI: *uses graphrag* "src/api/handlers/payment.rs imports payment/mod.rs, which is also
    used by src/workers/refund.rs and src/cron/billing.rs. The payment module exports
    process_payment() and validate_transaction() functions."

You: "Show me all error handling in the API layer"
AI: *uses structural_search* "Found 23 error handling patterns in src/api/:
    - 15 use Result<T, ApiError> with explicit error types
    - 8 use .unwrap() (potential panics in handlers/user.rs:42, handlers/auth.rs:87)
    - 3 use .expect() with custom messages"

Quick Setup

Octomind (Recommended) β€” Zero setup, Octocode pre-configured:

curl -fsSL https://raw.githubusercontent.com/muvon/octomind/master/install.sh | bash
octomind run developer:rust

Claude Code (CLI) β€” Command-line setup:

claude mcp add octocode -- octocode mcp --path /path/to/your/project

Claude Desktop / Cursor / Windsurf β€” Add to config:

{
  "mcpServers": {
    "octocode": {
      "command": "octocode",
      "args": ["mcp", "--path", "/path/to/your/project"]
    }
  }
}

Config locations:

  • Claude Desktop: ~/Library/Application Support/Claude/claude_desktop_config.json (macOS)
  • Cursor: ~/.cursor/mcp.json or Settings β†’ MCP Servers
  • Windsurf: Settings β†’ MCP

πŸ“– Complete MCP Client Setup Guide β€” Detailed instructions for 15+ clients including VS Code (Cline/Continue), Zed, Replit, and more.

🎯 What Can You Do With It?

New developer onboarding:

You: "How does the authentication system work?"
AI: *searches and navigates* "Authentication starts in src/middleware/auth.rs which
    validates JWT tokens. It calls src/auth/jwt.rs for token verification, which uses
    the public key from config. Failed auth returns 401 via src/errors/auth_error.rs.
    Sessions are stored in Redis via src/cache/session.rs."

Code archaeology:

You: "Find all places we handle database errors"
AI: *structural search* "Found 47 error handling patterns:
    - 32 use Result<T, DbError> with proper error types
    - 15 use .unwrap() (potential issues in src/db/user.rs:23, src/db/order.rs:156)
    - Recommend adding proper error handling to those locations"

Refactoring with confidence:

You: "What depends on the PaymentProcessor trait?"
AI: *queries graph* "src/api/handlers/checkout.rs, src/workers/refund_worker.rs,
    and src/cron/billing.rs all depend on PaymentProcessor. The trait is defined
    in src/domain/payment.rs and implemented by src/infrastructure/stripe.rs
    and src/infrastructure/paypal.rs."

Code review assistance:

You: "Review this PR for security issues"
AI: *analyzes changes* "The PR adds password hashing in src/auth/hash.rs. However,
    it uses SHA256 which is fast and vulnerable to brute force. Recommend using
    bcrypt or argon2 instead. Also found 3 instances of .unwrap() that could panic
    in production."

🌐 Supported Languages

LanguageExtensionsFeatures
Rust.rsFull AST parsing, pub/use detection, module structure
Python.pyImport/class/function extraction, docstring parsing
TypeScript/JavaScript.ts, .tsx, .js, .jsxES6 imports/exports, type definitions
Go.goPackage/import analysis, struct/interface parsing
PHP.phpClass/function extraction, namespace support
C++.cpp, .cc, .cxx, .c++, .c, .h, .hpp, .hxx, .cppm, .ixx, .mxx, .ccm, .cxxmInclude analysis, class/function extraction, C++20 module support
Ruby.rbClass/module extraction, method definitions
Java.javaImport analysis, class/method extraction
JSON.jsonStructure analysis, key extraction
Bash.sh, .bashFunction and variable extraction
Markdown.mdDocument section indexing, header extraction

Plus: CSS, Lua, Svelte, and more via tree-sitter

πŸ“š Documentation

πŸ”’ Privacy & Security

  • 🏠 Local-first β€” local embedding models available on supported platforms (macOS ARM default builds); cloud providers on all platforms
  • πŸ” Secure β€” API keys stored locally, env vars supported
  • 🚫 Respects .gitignore β€” Never indexes sensitive files
  • πŸ›‘οΈ MCP security β€” Local-only server, no external network for search
  • πŸ“€ Cloud-safe β€” Embeddings process only metadata, never source code
πŸ“Š Retrieval Quality Benchmark

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.

Tested on commit b1771ba with benchmark config (contextual retrieval, Voyage reranker, RaBitQ quantization).

Documentation search (--mode docs) β€” Hit@10: 0.953, MRR: 0.776
MetricScore
Hit@50.929 (118/127)
Hit@100.953 (121/127)
MRR0.776
NDCG@100.801
Recall@50.902
Recall@100.921

Missed queries (6 of 127):

#QueryExpectedGot (top 1)
43how to set up MCP proxy for managing multiple repositoriesdoc/MCP_INTEGRATION.md:286-311doc/MCP_INTEGRATION.md:286-4
51what are the prerequisites before using octocodedoc/GETTING_STARTED.md:6-12doc/CONTRIBUTING.md:7-33
59what to do when hitting API rate limitsdoc/GETTING_STARTED.md:209-216doc/PERFORMANCE.md:304-356
75typical performance metrics for small medium and large projectsdoc/PERFORMANCE.md:4-13doc/PERFORMANCE.md:414-14
112how to install octocode on different operating systemsINSTALL.md:4-14INSTALL.md:49-70
115how to fix macOS Gatekeeper blocking the binaryINSTALL.md:199-206INSTALL.md:198-119
Code search (--mode code) β€” Hit@10: 0.992, MRR: 0.895
MetricScore
Hit@50.992 (126/127)
Hit@100.992 (126/127)
MRR0.895
NDCG@100.906
Recall@50.962
Recall@100.974

Missed queries (1 of 127):

#QueryExpectedGot (top 1)
105how does the system ensure two developers get the same database pathsrc/storage.rs:60-83src/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.

🀝 Community & Support

βš–οΈ License

Apache License 2.0 β€” See LICENSE for details.


Built with πŸ¦€ Rust by Muvon in Hong Kong

⭐ Star β€’ 🍴 Fork β€’ πŸ“£ Share

mcp-name: io.github.Muvon/octocode

Related MCP Servers

Moxie-Docs-MCPβ˜… Featured

MCP & Agent Skills for Automated Documentation, and codebase conventions + context

πŸ’» Developer Tools2 views
3KniGHtcZ/codebeamer-mcp

πŸ“‡ ☁️ 🍎 πŸͺŸ 🐧 - Codebeamer ALM integration for managing work items, trackers, and projects. Provides 17 tools for reading and writing items, associations, references, comments, and risk management data via Codebeamer REST API v3.

πŸ’» Developer Tools1 views
21st-dev/Magic-MCP

Create crafted UI components inspired by the best 21st.dev design engineers.

πŸ’» Developer Tools0 views
a-25/ios-mcp-code-quality-server

πŸ“‡ 🏠 🍎 - iOS code quality analysis and test automation server. Provides comprehensive Xcode test execution, SwiftLint integration, and detailed failure analysis. Operates in both CLI and MCP server modes for direct developer usage and AI assistant integration.

πŸ’» Developer Tools0 views

Engagement

Views
0
Installs
0
Upvotes
0

Views and upvotes are unique per visitor network (hashed IP). Installs count copy actions.

Status

Health: Not checked yet

We have not completed a health check for this listing yet.

No check timestamp yet.

Unclaimed listing (imported or pending owner verification). Claim it β†’
β˜… Spotlight Slot

Feature Your MCP Server

Get maximum visibility for your server across our directory, search results, and detail pages.

Spotlight Your Server

Own this project?

This directory is pre-filled from public sources. Claim via GitHub README, site badge, or DNS TXT to get the verified badge and attach your website.

Claim this listing

Promote this listing

Optional paid placement. Free listings stay free forever.

Share & Embed

Add our SVG badge (dark/light directory styles) or embeddable widget to your site.