语义搜索依赖先运行 octocode index 建索引,MCP 服务默认不会自动更新索引;LSP 工具需另装语言服务器并加 --with-lsp;从源码构建需 Rust 1.95+ 和 protoc;非 Git 目录建索引要加 --no-git。
octocode
MuvonApache-2.0活跃维护用 Rust 单二进制为 AI 编程助手提供代码库深度理解,集语义搜索、知识图谱和内置 MCP 服务器于一体,让 Claude、Cursor 等客户端读懂你的代码。
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.
curl -fsSL https://raw.githubusercontent.com/Muvon/octocode/master/install.sh | sh
cd /path/to/your/project && octocode index && octocode search "authentication middleware"README 未说明显存或 GPU 要求;默认嵌入与重排模型在本地运行,首次使用时下载模型文件。
给 AI 助手提供语义搜索、结构搜索和依赖图的 Rust 单二进制 MCP 服务
用 Rust 单二进制为 AI 编程助手提供代码库深度理解,集语义搜索、知识图谱和内置 MCP 服务器于一体,让 Claude、Cursor 等客户端读懂你的代码。
核心能力
- 用向量与关键词混合检索按意图查找代码
- 用 Tree-sitter 从当前源码提取符号与依赖关系
- 无需索引即可查定义、引用和函数签名
- 内置 MCP 服务,可接入 Claude Code、Cursor 等客户端
- 默认本地 FastEmbed 模型做嵌入与重排,无需 API Key
容易踩的坑
- 0.29.2Release 0.29.2最新正式版2026-11-08 · 2026-11-08 07:00 UTC
🔄 Other Changes
1 maintenance, dependency, and tooling update not listed individually.
- 0.29.1Release 0.29.12026-11-03 · 2026-11-03 10:21 UTC
查看更新说明
📋 Release Summary
Structural searches through MCP now support paths outside the repository. Project and MCP documentation has been refreshed.
🔧 Improvements & Optimizations
- dependencies: refresh locked dependency versions
d006f2b3 - workflows: pin selected workflow action references
eb7f496f
🐛 Bug Fixes & Stability
- mcp: support structural search paths outside the repository
cc06ab42
📚 Documentation & Examples
- docs: refresh project and MCP documentation
65266c4f
🔄 Other Changes
1 maintenance, dependency, and tooling update not listed individually.
- dependencies: refresh locked dependency versions
- 0.29.0Release 0.29.02026-10-28 · 2026-10-28 09:23 UTC
查看更新说明
📋 Release Summary
Remote LanceDB support is now enabled. Graph table handles refresh after appends, and MCP structural search source rendering is corrected.
✨ New Features & Enhancements
- lancedb: enable remote LanceDB support
051fcd27
🔧 Improvements & Optimizations
- store: cover graph and batch append behavior
45b40370 - dependencies: upgrade project dependencies
e88e283c - dependencies: update registry dependencies
ca64a302
🐛 Bug Fixes & Stability
- graphrag: refresh table handles after graph appends
7652d045 - mcp: fix structural search source rendering
e63a5c19
- lancedb: enable remote LanceDB support
- 0.28.1Release 0.28.12026-10-25 · 2026-10-25 10:26 UTC
查看更新说明
🔧 Improvements & Optimizations
- dependencies: update locked dependency versions
b6c92319 - mcp: update rmcp and clarify transport comment
d340fd93 - dependencies: refresh locked dependency versions
06168e8e
🔄 Other Changes
1 maintenance, dependency, and tooling update not listed individually.
- dependencies: update locked dependency versions
- 0.28.0Release 0.28.02026-10-24 · 2026-10-24 10:50 UTC
查看更新说明
📋 Release Summary
Release versioning now supports plain version files.
🚨 Breaking Changes
- support model-purpose routing and CLI co-authors
02c6bf18
✨ New Features & Enhancements
- release: support plain version files
4c0800fe
🔧 Improvements & Optimizations
- dependencies: refresh locked dependency versions
7e24a9df
- support model-purpose routing and CLI co-authors
用户点评
登录用户的真实使用记录,可按版本和硬件筛选还没有人点评。第一个说出真实体验的人最有价值。
Octocode
Code search and dependency graphs for AI assistants.
Quick start · MCP integration · OctoFS · Documentation · Contributing · Website
Octocode is a Rust CLI and MCP server for exploring codebases. It combines semantic search, structural search, and a live graph of symbols and dependencies. Connect it to Claude Code, Codex, Cursor, Windsurf, or another MCP client, or search directly from your terminal.
- Find code by intent with hybrid vector and keyword search, plus configurable reranking.
- Locate definitions and usages with structural search over the current source.
- Trace relationships between files and symbols: imports, calls, inheritance, and implementations.
- Read signatures without loading entire files; add a language server for definitions, references, and hover information.
- Run locally with the default embedding and reranking models, or configure remote providers.
Quick start
1. Install
Use the installer on Linux or macOS, or in a Unix-compatible shell on Windows:
curl -fsSL https://raw.githubusercontent.com/Muvon/octocode/master/install.sh | sh
Alternatively, on macOS:
brew install muvon/tap/octocode
Download a binary from GitHub Releases, or install the published crate:
cargo install octocode
Building from source requires Rust 1.95 or later and protoc. See the installation guide for platform requirements, build features, and manual installation.
Verify the installation:
octocode --version
2. Index and search
Run these commands in your project's Git repository:
cd /path/to/your/project
octocode index
octocode search "authentication middleware"
The default configuration uses local FastEmbed models for embeddings and reranking. No API key is required; model files download on first use. For a directory without Git, use octocode index --no-git.
# Combine related queries
octocode search "auth" "middleware" "session"
# Filter code results by language
octocode search "database connection pool" --language rust
# Search documentation
octocode search "deployment configuration" --mode docs
3. Connect your AI assistant
Choose your client in MCP integration. Structural search, signatures, and the live dependency graph read the current source directly and work without an index. Semantic search uses the index created above.
MCP integration
Install Octocode where your client can find it on PATH, and replace /path/to/your/project with your project's absolute directory path.
Claude Code
claude mcp add --transport stdio octocode -- octocode mcp --path /path/to/your/project
claude mcp list
See the Claude Code MCP documentation for configuration scopes and connection details.
Codex CLI
codex mcp add octocode -- octocode mcp --path /path/to/your/project
codex mcp list
See the Codex MCP documentation for CLI and configuration-file options.
Claude Desktop, Cursor, and Windsurf
Add an Octocode entry to your client's MCP configuration:
{
"mcpServers": {
"octocode": {
"command": "octocode",
"args": ["mcp", "--path", "/path/to/your/project"]
}
}
}
Restart the client after saving. The MCP client setup guide covers configuration locations and other clients.
Octomind
Octomind is a companion AI agent runtime. Its developer:general agent includes Octocode and OctoFS capabilities. After installing Octomind, start it in your project:
cd /path/to/your/project
octomind run developer:general
The first run may install required tools and ask for model credentials. See the Octomind quick start for installation and model access.
Available tools
| Tool | Use it for | Requires an index |
|---|---|---|
semantic_search | Find code, documentation, and indexed history by meaning | Yes |
structural_search | Find definitions, usages, and AST patterns in current source | No |
view_signatures | Read function signatures, declarations, and imports | No |
graphrag | Explore live file and symbol relationships and dependency paths | No |
lsp_* | Definitions, references, hover information, symbols, and completion | No; requires a language server |
To enable LSP tools, install a language server and add --with-lsp to the server command, for example:
octocode mcp --path /path/to/your/project --with-lsp rust-analyzer
By default, the MCP server uses the existing semantic index without updating it. Rerun octocode index after changes, or run octocode watch separately in the project directory. In-process indexing is available through index.mcp_index = true.
See the MCP integration guide for tool parameters, HTTP transport, and serving multiple repositories, and the LSP guide for language server setup.
Use Octocode with OctoFS
OctoFS adds file reading and atomic editing tools to your assistant. Run both MCP servers against the same project directory.
Octocode's structural_search returns source lines as N:hh|content, with the same line IDs used by OctoFS view. An agent can use these IDs directly in OctoFS batch_edit, without reading the same lines again to obtain edit targets. Exact-name lookups include complete definitions up to 32 lines; larger results identify omitted ranges for a targeted read.
Each ID hashes the original line, including indentation. OctoFS checks IDs before applying edits and reports stale targets when the content no longer matches. Group known edits to a file into one atomic batch, then use the fresh IDs returned by the edit for follow-up changes. The N:hh| prefix is metadata, not part of the source code.
After installing OctoFS, add it alongside the Octocode server configured above. Choose your client:
Claude Code:
claude mcp add --transport stdio octofs -- octofs mcp --path /path/to/your/project
Codex CLI:
codex mcp add octofs -- octofs mcp --path /path/to/your/project
Use the same absolute project path for both servers. OctoFS is optional; Octocode's search and navigation tools work independently.
How it works
Current source → Language parsers → Live file and symbol graph → MCP tools
Indexed code → Embeddings + BM25 → Hybrid search + reranking → CLI / MCP
The live graph uses Tree-sitter to extract symbols and relationships from current source, without embeddings or an LLM. It remains available through MCP when [graphrag].enabled = false.
Enabling indexed GraphRAG adds persisted file-level enrichment, including semantic file discovery and optional LLM descriptions and architectural relationships. The octocode graphrag CLI uses this persisted layer:
octocode config --graphrag-enabled true
octocode index
octocode graphrag overview
See the architecture guide for module boundaries and storage details.
Supported languages
| Language | Extensions |
|---|---|
| Rust | .rs |
| Python | .py |
| TypeScript / JavaScript | .ts, .tsx, .js, .jsx |
| Go | .go |
| PHP | .php |
| C / C++ | .c, .cpp, .cc, .cxx, .c++, .h, .hpp, .hxx, .cppm, .ixx, .mxx, .ccm, .cxxm |
| Ruby | .rb |
| Elixir | .ex, .exs |
| Java | .java |
| Swift | .swift |
| Svelte | .svelte |
| Lua | .lua |
| CSS | .css, .scss, .sass |
| JSON | .json |
| Bash | .sh, .bash |
| Markdown | .md, .markdown |
Retrieval benchmark
The repository includes ground truth, scoring scripts, and reproduction instructions. The published local matrix used 127 code-search queries, corpus commit b1771ba, Octocode 0.17.1, and fastembed:jinaai/jina-embeddings-v2-base-code, with reranking disabled for the variants below.
| Configuration | Hit@5 | Hit@10 | MRR | NDCG@10 | Recall@10 |
|---|---|---|---|---|---|
| Dense vector only | 0.598 | 0.717 | 0.485 | 0.528 | 0.671 |
| Hybrid, vector/keyword weights 0.7/0.3 | 0.598 | 0.717 | 0.485 | 0.528 | 0.671 |
| Hybrid, vector/keyword weights 0.3/0.7 | 0.732 | 0.835 | 0.572 | 0.620 | 0.807 |
These are historical results from June 21, 2026; they do not measure the current release or its default configuration. See the full variant matrix for settings and reranker comparisons.
Privacy and configuration
- Local models by default. Embedding and reranking run locally after model downloads. Remote embedding, reranking, and LLM providers are optional; when enabled, they receive the queries and source content needed for those features.
- Local storage. Indexes live outside your repository in Octocode's per-project data directory.
- File exclusions. Indexing respects
.gitignoreand.noindex. Configure exclusions for files you do not want indexed. - Client access. The default MCP transport is stdio. The model used by your AI client may receive source content returned by tools, even when Octocode uses local models.
- Provider credentials. API keys can be supplied through environment variables. See the API key guide before enabling remote providers.
The configuration guide explains model selection and indexing options. The embedded default template contains the current defaults.
Documentation
- Getting started — basic workflow
- Installation — binaries, source builds, and platform requirements
- MCP clients — client setup and configuration locations
- MCP integration — tools, transports, and multiple repositories
- LSP integration — language server tools
- Commands — CLI reference
- Configuration — models and customization
- API keys — remote provider setup
- Architecture — internals
- Changelog — release history
Contributing
Bug reports, documentation improvements, and code contributions are welcome. Read the contributing guide for development setup and the engineering standards before changing code.
Use GitHub Issues for bugs and feature requests, Discussions for questions, or contact [email protected].
License
Apache License 2.0. Maintained by Muvon.