Logo de Octocode

Octocode

Organisation
Muvon

Structural code intelligence for AI agents — semantic search, knowledge graphs, and a built-in MCP server in one Rust binary. Give Claude, Cursor, and any MCP client a deep understanding of your codebase.

ÉditeurMuvon
Dépôtoctocode
LangueRust
Forks
50
Étoiles
477
Outils disponibles
0
Type de transportstdio
Catégories
LicenceApache-2.0
Liens
  • Connectez des outils à vos workflows IA

    Octocode propose des fonctionnalités MCP utilisables par les clients et agents IA compatibles.

  • 0 outils disponibles

    Parcourez les actions invocables ci-dessous, avec leurs noms et descriptions lorsque le serveur les fournit.

  • Configuration prête à copier

    Utilisez les exemples de configuration pour configurer ce serveur dans votre client MCP préféré.

  • Indicateurs de popularité open source

    477 étoiles et 50 forks sur le dépôt associé.

Structural Code Intelligence for AI Agents — MCP Server + Knowledge Graph + Semantic Search

CI Coverage Crates.io 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


🤖 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
  • 🧭 LSP precision — Go-to-definition, find-references, and hover docs via your language server

Works with: Claude Desktop • Cursor • Windsurf • Any MCP-compatible AI

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: "Find every call site of this function"
AI: *uses LSP find-references* "process_payment() is called from 4 places:
    checkout.rs:87, refund.rs:134, billing.rs:56, and tests/payment_test.rs:23"

🤔 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.9234

# The GraphRAG CLI queries the optional persisted graph
octocode config --graphrag-enabled true
octocode index
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 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.

🔬 How It Works

Current Source → Tree-sitter AST → Live Symbol Graph ──────────────→ MCP `graphrag`
                                           ↑                              ↑
Indexed Code → Embeddings + Optional LLM → Persisted File Enrichment ─────┘
  1. Live AST Graph — tree-sitter extracts file and symbol nodes plus deterministic contains, imports, calls, extends, and implements relationships directly from current source
  2. Always-on Graph Navigation — MCP graph lookup, relationship traversal, path finding, and overview work with [graphrag].enabled = false
  3. Optional Enrichment — enabling indexed GraphRAG overlays semantic file matches, LLM descriptions, and broader file-level architectural relationships; symbols are never embedded or LLM-generated
  4. Hybrid Search — semantic similarity + BM25 full-text search + reranking handles meaning-based code retrieval separately
  5. MCP Server — exposes semantic_search, view_signatures, graphrag, and structural_search 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.

bash
git clone https://github.com/Muvon/octocode && cd octocode
git worktree add /tmp/corpus b1771ba   # pin the corpus to the ground-truth commit
CORPUS=/tmp/corpus python3 benchmark/run_matrix.py   # set OCTO_BIN to use a custom binary

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

🚀 Quick Start

1. Install

bash
# 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
bash
# From crates.io
cargo install octocode

# Or from source (latest)
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

bash
# Optional: embedding provider (defaults to local FastEmbed — no key needed)
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)

Octocode supports multiple embedding providers:

bash
# 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

bash
cd /your/project
octocode index
# → ✓ Indexing complete! 342 of 342 files processed (342 new, 0 unchanged)

4. Search Your Code

bash
# 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" --language 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):

json
{
  "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
graphragAlways-on file/symbol graph — search nodes, inspect relationships, and find paths without indexing
structural_searchAST pattern matching — find .unwrap() calls, new instantiations, specific patterns
lsp_goto_definitionJump to a symbol's definition (requires --with-lsp)
lsp_find_referencesFind all usages of a symbol across the workspace (requires --with-lsp)
lsp_hoverType info and documentation for a symbol (requires --with-lsp)
lsp_document_symbols / lsp_workspace_symbols / lsp_completionFile symbols, workspace-wide symbol search, completions (requires --with-lsp)

Enable the LSP tools by starting the server with your language server:

bash
octocode mcp --path /your/project --with-lsp="rust-analyzer"

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:

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

Claude Code (CLI) — Command-line setup:

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

Claude Desktop / Cursor / Windsurf — Add to config:

json
{
  "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.

🌐 Supported Languages

17 languages with full tree-sitter AST parsing:

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
Elixir.ex, .exsModule/protocol extraction, function and macro definitions
Java.javaImport analysis, class/method extraction
Swift.swiftClass/struct/protocol extraction, import analysis
Svelte.svelteComponent structure, script/style block extraction
Lua.luaFunction and table extraction
CSS.css, .scss, .sassRule and selector extraction
JSON.jsonStructure analysis, key extraction
Bash.sh, .bashFunction and variable extraction
Markdown.md, .markdownDocument section indexing, header extraction

📚 Documentation

🔒 Privacy & Security

  • 🏠 Local-first — fully local embedding via fastembed (no API key required); cloud providers optional
  • 🔐 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 — cloud providers receive only the code chunks being embedded; use local models for fully offline indexing

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.

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
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

Installation

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

Utilisez le serveur MCP Octocode avec plusieurs modèles IA

TypingMind connecte les outils MCP au niveau de l’espace de travail. Une fois Octocode connecté, vous pouvez donc l’utiliser avec différents modèles IA dans TypingMind sans avoir à le configurer séparément pour chaque modèle. Cette intégration MCP s’exécute localement sur votre appareil via le connecteur MCP de TypingMind.

Guide de configuration du connecteur local

Choisissez cette méthode si le serveur MCP doit accéder à des fichiers locaux, à des applications ou à des ressources privées sur votre ordinateur.

1

Ouvrir les paramètres MCP

Dans TypingMind, accédez à « Paramètres », puis à « Paramètres avancés » et à « Model Context Protocol », et choisissez « Configurer connecteur ».

  1. Ouvrez TypingMind dans votre navigateur.
  2. Cliquez sur l’icône Paramètres.
  3. Accédez aux paramètres avancés.
  4. Ouvrez la section Model Context Protocol.
  5. Cliquez sur « Configurer connecteur » et choisissez « Cet appareil ».
Écran de configuration du connecteur MCP de TypingMind avec l’option « Cet appareil » sélectionnée
2

Exécuter la commande du connecteur

Choisissez « Cet appareil », copiez la commande depuis TypingMind et exécutez-la dans Terminal. Laissez le processus en cours d’exécution pendant que vous utilisez MCP.

  1. Copiez la commande de configuration affichée par TypingMind.
  2. Ouvrez Terminal sur macOS ou Windows Terminal sur Windows.
  3. Collez et exécutez la commande.
  4. Autorisez l’installation du paquet si Terminal vous demande de confirmer.
  5. Gardez la fenêtre de Terminal ouverte et le processus en cours d’exécution pendant que vous utilisez les outils MCP.
3

Ajoutez Octocode en tant que serveur

Lorsque l’état du connecteur affiche « Prêt », cliquez sur « Éditer serveurs » et collez la configuration du serveur MCP.

  1. Attendez que l’état du connecteur affiche « Prêt ».
  2. Cliquez sur « Éditer serveurs ».
  3. Collez la configuration du serveur MCP Octocode.
  4. Enregistrez la liste des serveurs.
  5. Actualisez pour vérifier que le connecteur est toujours prêt.
Paramètres MCP de TypingMind affichant un serveur actif et le bouton « Éditer serveurs »
{
  "mcpServers": {
    "muvon-octocode": {
      "command": "npx",
      "args": [
        "-y",
        "octocode"
      ]
    }
  }
}
4

Utiliser la connexion avec différents modèles

Enregistrez la liste des serveurs, ouvrez « Plugins », activez les outils MCP de Octocode, puis sélectionnez un modèle IA compatible dans TypingMind et utilisez les outils dans une discussion ou attribuez-les à un agent IA.

  1. Ouvrez la page Plugins dans TypingMind.
  2. Activez les outils MCP de Octocode.
  3. Démarrez une discussion et choisissez le modèle IA que vous souhaitez utiliser.
  4. Utilisez les outils MCP dans le chat ou attribuez-les à un agent IA.
  5. Passez à un autre modèle IA selon vos besoins sans rétablir la connexion MCP.
Discussion TypingMind utilisant des outils MCP activés avec un modèle d’IA sélectionné
Pouvez-vous utiliser Octocode pour m’aider dans cette tâche ?
Octocode
Bien sûr. J’ai tout lu.
Voici ce que j’ai trouvé avec Octocode.

Foire aux questions

À quoi sert le serveur MCP Octocode ?

Octocode est un serveur MCP qui permet aux applications IA compatibles d’accéder à des outils et à des informations contextuelles externes. Dans TypingMind, il vous suffit d’ajouter ce serveur MCP une seule fois pour rendre ses outils disponibles dans votre espace de travail IA.

Puis-je utiliser le serveur MCP Octocode avec plusieurs modèles IA dans TypingMind ?

Oui. TypingMind connecte les outils MCP au niveau de l’espace de travail. Vous pouvez donc utiliser Octocode avec différents modèles IA comme Claude, ChatGPT, Gemini ou d’autres modèles configurés dans TypingMind, sans avoir à configurer le serveur MCP séparément pour chaque modèle.

Pourquoi utiliser le connecteur MCP Octocode avec TypingMind ?

TypingMind est l’une des meilleures interfaces de chat avec les LLM, car elle réunit plusieurs modèles IA, prompts, plugins, agents IA, clés API et outils MCP dans un seul espace de travail. Une fois Octocode connecté, vous pouvez utiliser ses outils MCP avec vos modèles préférés tout en gardant vos discussions bien organisées dans TypingMind.

Comment connecter le serveur MCP Octocode à TypingMind ?

Octocode fonctionne via le connecteur MCP local de TypingMind. C’est l’option idéale lorsque le serveur MCP doit accéder à des fichiers locaux, des applications de bureau, des outils en ligne de commande ou des ressources privées sur votre ordinateur.

Quels outils le serveur MCP Octocode propose-t-il dans TypingMind ?

Octocode propose des fonctionnalités MCP que vous pouvez activer depuis la page Plugins de TypingMind et utiliser dans les discussions ou attribuer à des agents IA.

Dois-je partager mes clés API avec TypingMind pour utiliser le serveur MCP Octocode ?

Non. TypingMind privilégie le fonctionnement local et vous permet de garder le contrôle de vos fournisseurs de modèles, clés API, prompts et paramètres MCP. Si Octocode nécessite une authentification, ajoutez les en-têtes, les paramètres OAuth ou la configuration locale requis pour ce serveur MCP lors de la création de la connexion.

Serveurs MCP similaires

Tout voir

Créez votre propre espace IA dès maintenant

Abonnez-vous à notre newsletter pour être informé des nouvelles fonctionnalités et des prochains cadeaux à gagner 👇