
Octocode MCP - AI Context Platform
io.github.bgauryy由 GitHub 帳號 bgauryy 發布v7.0.9更新於 Oct 24, 2026
AI code research platform. Search, analyze, and extract insights from any GitHub repository.
概覽
Octocode MCP 是本地 stdio 伺服器,讓 AI 助理透過搜尋、讀取、AST 與 LSP 能力研究 GitHub 儲存庫、npm 套件和本機程式碼。
- 可以做什麼
- 搜尋並讀取 GitHub 程式碼、檔案、儲存庫目錄樹、儲存庫、拉取請求、議題和提交,依開關可額外啟用發行版與討論工具。將儲存庫或稀疏子樹複製到本機快取以供分析。搜尋和讀取本機檔案,瀏覽目錄樹,依名稱、路徑、正規表示式、大小或時間尋找檔案,並找出疑似未被引用的死程式碼。執行結構化 AST 搜尋,並透過語言伺服器進行語意導覽(定義、參照、呼叫端、被呼叫端、診斷)。查詢 npm 套件及其原始碼儲存庫。回傳精簡、壓縮或分頁的結果,並附上下一步提示。
- 適用情境
- 適合在助理說明、審查、重構或規劃程式碼變更前需要真實程式碼證據的情況,尤其是跨儲存庫、拉取請求和 npm 套件比較實作模式,或在大型單體儲存庫與本機工作區中追蹤程式碼時。
- 執行需求
- 透過 npx 以 stdio 在本機執行,需要 Node.js 20.12 以上。GitHub 相關工具需要驗證:Octocode 瀏覽器 OAuth、gh auth login,或在 OCTOCODE_TOKEN、GH_TOKEN 或 GITHUB_TOKEN 提供權杖,權限範圍為 repo、read:user、read:org。在 MCP 上使用本機工具需設定 ENABLE_LOCAL,複製需設定 ENABLE_CLONE。LSP 導覽需已安裝語言伺服器。需要連線 GitHub 和 npm 的網路。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 Octocode MCP - AI Context Platform,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
Octocode: agentic research platform
Evidence-first code research for AI agents and developers.
Octocode researches your local code and external code alike (GitHub repositories, PRs, npm) with one toolset: ripgrep + AST search, trees, precise reads, and LSP. Use it as a CLI or MCP server, backed by a Rust engine for fast, token-efficient results across single files or mega-repos.
Table of contents
- Quick start
- Why Octocode
- Built for research (benchmarks)
- Tools
- MCP
- CLI
- Configuration
- Authentication methods
- Security
- Language support
- Skills
- Architecture
- Documentation
- Troubleshooting
- Agent workflows
Quick start
Prerequisites: Node.js 20.12+
1. Run the Octocode CLI with npx
2. Authenticate with GitHub - optional, but unlocks private repositories and higher API rate limits:
3. Choose your interface. Same tools and Rust engine on both. (Clone is on by default in the CLI, opt-in for MCP.)
🖥️ CLI - research straight from your terminal:
🤖 MCP - one-click install:
Show more install options (Windsurf, Kiro, Goose, LM Studio, Claude Code)
- [Install in VS Code Insiders]
- [Install in Windsurf]
- [Install in Kiro]
- [Install in Goose]
- [Install in LM Studio]
Claude Code:
Any other client: npx octocode install
Use it as an MCP server
Add to your MCP client config (or use a one-click install above):
Put a GitHub token and options under env (see Configuration).
Use it as an agentic-friendly CLI
Run npx octocode and agents figure out the rest. The bare command prints built-in usage and the full tool catalog, so any coding agent knows how to drive it out of the box, no MCP client or extra wiring required.
Every MCP tool is also a plain command: JSON in, token-efficient YAML out. Local paths route to local tools; owner/repo[/path] routes to GitHub.
Learn more at octocode.ai.
Why Octocode
Agents code better from evidence than from guesses. Octocode researches two worlds with one flow, your local code and external code on GitHub and npm, and hands back compact, citable context before an agent changes, reviews, or explains code. Code is truth; context is the map.
Most tools do one slice (web search, or grep your repository) and hand back a fixed blob. Octocode covers the whole loop and lets the agent decide what data it needs next:
- Agent-driven, efficient flows. Instead of one-shot dumps, Octocode chains cheap steps into an optimized research flow: broad code search, then fetch only the exact matched lines/region, with smart pagination and out-of-the-box minification so the model never over-fetches. Every result carries next-step hints to the cheapest follow-up.
- Scales to monorepos. Spot a pattern in one repository, follow the PR that introduced it, then trace it across other repositories and your own files, without leaving the chat. Clone any repository and study it locally.
- Smart GitHub flow. Parallel bulk queries across code, PRs, commits, issues, and repositories, all with the same search-broad, read-narrow, trace-semantically discipline.
- Works without GitHub. Clone any repository and point the local tools (search, AST, LSP, content) at it, same evidence-first flow.
- Reads shape, not noise. On-the-fly minify/skeletonize across 70+ languages: a 100 KB file in a few hundred tokens, not walls of boilerplate.
- Fast, self-contained. Search, parsing, navigation, and redaction run in one prebuilt Rust engine: quick on a laptop or a mega-repo, nothing extra to install.
- Safe by default. Every byte to the model is scanned and secrets redacted first (see Security).
What you can do (whenever the next step needs proven context, not a guess):
Built for research (benchmarks)
A blind, head-to-head test on research-oriented flows rather than plain lookups (multi-hop traces, dependency/call-graph chains, commit ranges, blast-radius, PR reviews across repositories).
[Octocode benchmark — same answers, a fraction of the context]
How it works: 30 GitHub questions × 3 passes; Octocode vs gh, gh+Headroom, and gh+RTK on
identical questions (only the CLI differs). A blind judge (gpt-5.5) grades correctness; the metric is
characters through the model, counted from instrumented logs (characters, not tokens). Result: at
near-parity correctness, Octocode answers with ~2.0× fewer characters than plain gh, ~2.6× fewer
than gh+Headroom, and ~3.2× fewer than gh+RTK in the local-build headline runs.
▶ Open the interactive report · run it / method · questions · all reports
Tools
17 tools in the full catalog. How many register depends on the surface and the flags you set:
ghListReleases and ghSearchDiscussions need two settings on MCP, not one:
ENABLE_RELEASES=1 or ENABLE_DISCUSSIONS=1 puts the tool in the catalog, and
ENABLE_TOOLS="ghListReleases,ghSearchDiscussions" registers it. Either setting
alone leaves the tool unregistered, because both carry isDefault: false and the
MCP registration filter admits only default or explicitly allowlisted tools. The
CLI needs only the ENABLE_RELEASES and ENABLE_DISCUSSIONS flags. ENABLE_LOCAL
and ENABLE_CLONE accept true or 1; ENABLE_RELEASES and ENABLE_DISCUSSIONS
also accept yes and on.
Flags: Configuration.
Token knobs. concise:true returns path/title-only lists. minify controls file read density: symbols = skeleton with line numbers, standard = comments/blanks stripped (default), none = exact bytes.
GitHub tools
Local tools
Package search
LSP
Full schemas, fields, and examples for every tool live in docs/OCTOCODE_TOOLS.md (linked under Documentation).
MCP
The MCP server exposes the Octocode tool catalog directly to your AI assistant over stdio.
https://github.com/user-attachments/assets/de8d14c0-2ead-46ed-895e-09144c9b5071
Manual configuration
Add to your MCP client config, using octocode-mcp:
Add a GitHub token and options under env - see Authentication and Configuration.
CLI
Same research engine, no MCP client needed. Local paths route to local tools; owner/repo[/path] routes to GitHub. Authenticate once with npx octocode auth login (see Authentication); run npx octocode --help for full usage.
Commands
Tool commands
More commands
- Cache and clone —
npx octocode clone,npx octocode cache fetch|status|clear - Skills —
npx octocode skill list|install|check|info|removefor bundled Octocode skills - Language servers —
npx octocode lsp-server list|install|status|uninstall|clean - Setup and introspection —
npx octocode install,npx octocode auth,npx octocode status,npx octocode context
Full syntax, flags, and exit codes: Octocode CLI guide
Configuration
Everything is optional; Octocode runs on sensible defaults. Settings resolve from three sources, in priority order:
- MCP / environment variables (highest): per client or per project, set in your MCP config
envor your shell. - Global config:
<octocode-home>/.octocoderc, machine-wide defaults read by both the CLI and the MCP server. - Built-in defaults: used when neither is set.
Octocode home (<octocode-home>) holds the global config, encrypted credentials, sessions, stats, and tmp materialization caches. On every platform it is .octocode inside the OS home directory — ~/.octocode on macOS and Linux, %USERPROFILE%\.octocode on Windows. Override it with OCTOCODE_HOME.
Set values as MCP env entries (per client; these win over .octocoderc) or globally in <octocode-home>/.octocoderc (JSON with comments). Tokens never go in .octocoderc — use env or npx octocode auth login.
Common settings
Most-used settings (both CLI and MCP unless noted):
OCTOCODE_HOME, GitHub Enterprise (GITHUB_API_URL), MCP tool allowlisting (TOOLS_TO_RUN/ENABLE_TOOLS/DISABLE_TOOLS), and network timeouts/retries: see the Configuration Reference.
Example configuration
~/.octocode/.octocoderc:
Per-project overrides and custom LSP servers live in a workspace .octocode/ folder. For the full .octocoderc schema, a ready-to-copy example, clone-cache tuning, GitHub Enterprise setup, and precedence details, see the Configuration Reference.
Authentication methods
GitHub-backed tools require authentication. Any one method is enough. Full details: Authentication Setup.
Option 1: Octocode CLI (recommended)
Interactive login lets you choose Octocode browser OAuth or gh auth login. Octocode OAuth credentials are stored encrypted on disk.
Option 2: GitHub CLI (also supported)
Octocode reads the gh token automatically — no further config needed.
Option 3: Personal access token (also supported)
Set OCTOCODE_TOKEN, GH_TOKEN, or GITHUB_TOKEN in your shell. Required scopes: repo, read:user, read:org.
Create a token at github.com/settings/tokens.
Note: Never commit tokens to version control. Use environment variables or secure secret management.
Security
Every byte to the model is scanned and redacted first. All content passes through the Rust engine's secret scanner on the way in and out, so secrets never reach the model. That covers local files, GitHub and npm responses, errors, and tool output. The behavior is identical under MCP and the CLI.
- Secret redaction, in and out. 300+ provider credential patterns (AWS, Azure, GCP, GitHub, OpenAI, Anthropic, Stripe, Slack, 1Password, and more) plus generic JWTs, PEM/private keys, bearer tokens, database connection strings, and high-entropy strings. Masked values surface a redaction warning so the agent knows.
- Content sanitized at the source. Local reads (
localGetFileContent, ripgrep, structural search, binary, file discovery, structure) and external fetches (GitHub code/files, npm) are scanned as they are read, not only at the boundary. - Path safety. Relative inputs resolve from
WORKSPACE_ROOT/ config /cwd, then local reads are bounded to the engine's allowed roots (home by default, plusALLOWED_PATHSand Octocode-registered roots). Symlinks are resolved and the real target is re-validated, so a link cannot escape into a blocked location. - Sensitive files blocked by default. Reads of known secret-bearing files and folders return a redacted error instead of contents: keys/certs,
.env*,.npmrc/.netrc, cloud/infra credentials (.aws/,.kube/,*.tfstate),.git/, browser logins, OS keychains, and wallets. Full list in SECURITY.md. - Command safety. Normal local search runs in-process inside
octocode-engine. External helpers are fixed per lane, command/argument allowlisted, and run throughspawnwith argument arrays: no shell strings, no injection. - Schema validation runs before any tool executes; untrusted input size and shape are bounded.
- Credentials. GitHub auth through env tokens, AES-256-GCM-encrypted on-disk OAuth, or the
ghCLI; tokens are never logged.
Full security model, pipeline, and threat coverage: SECURITY.md. Related: Configuration and authentication · Credentials
Language support
Four code-intelligence axes; three are native to the Rust engine and need no external tooling:
📋 Full support matrix: every extension with its exact AST, signature, LSP, and minify capability lives in the Full format support matrix.
Skills
Agent Skills are a lightweight, open format for extending AI agent capabilities. Browse and install on skills.sh/bgauryy/octocode-mcp
13 skills under skills/, bundled in the octocode package. Each is a lean SKILL.md that loads references only when needed, so they compose. Start with ⭐ Research for evidence-first code work.
Core research and extraction
Planning and architecture
Evaluation and review
Agent orchestration
Web automation workflow: octocode-scraping performs the safe static pass first (fetch/crawl/extract → local corpus → graph v2). When the graph exposes dynamic actions or static output is blocked/thin, octocode-chrome-devtools validates live actionability, cookies/storage, network/HAR bodies, screenshots, or auth-gated state; discovered URLs/data/artifacts can be fed back into the scraping corpus for continued proof.
Architecture
A yarn-workspaces monorepo. The MCP server and the CLI are thin front-ends over one shared TypeScript tool core, which delegates every CPU-heavy path to a single Rust engine (compiled through napi-rs to prebuilt .node binaries). One tool catalog, one security layer, one response shaper, reached two ways.
Request flow is identical whether a call arrives over MCP or the CLI:
One Rust engine owns secret detection, sanitization, path and command validation, minification (70+ languages), signature extraction, structural AST search, ripgrep parsing, diff filtering, YAML serialization, and LSP. The Node event loop therefore stays unblocked, and there is no duplicate native loader. The engine ships prebuilt for darwin (arm64/x64), linux (arm64/x64, gnu and musl), and win32-x64; no Rust toolchain is needed at runtime.
Packages
packages/octocode-benchmark (private, not published) holds benchmark methodology, evals, and run artifacts - see Documentation.
Documentation
Website: octocode.ai · Product docs: github.com/bgauryy/octocode/tree/main/docs. This section is the canonical documentation index; benchmark methodology, evals, and run artifacts live in packages/octocode-benchmark.
Troubleshooting
Node.js or environment issues? Run the built-in doctor command to check your environment:
Common pitfalls:
- GitHub auth failures: Ensure your Personal Access Token (PAT) has the
repoandread:userscopes. If using the CLI, runnpx octocode auth loginto refresh. - MCP connection issues: If your AI assistant (like Cursor or Windsurf) fails to connect, ensure you have run
npx octocode auth loginin your terminal first, or explicitly pass yourOCTOCODE_TOKENin the MCPenvconfiguration. - Native engine errors: Octocode uses a prebuilt Rust engine. If it fails to load on Linux, ensure your system has
glibcormuslcompatibility. On macOS/Windows, ensure you are on a supported architecture (x64 or arm64).
Agent workflows
Recommended dev mode: Pi + Octocode
Pi is a fast, local-first coding agent whose stated philosophy is "CLI tools with READMEs (Skills) over MCP." Pairing it with Octocode gives a lean, evidence-driven dev loop — Pi edits, Octocode researches. Two routes, pick by how much surface you need:
-
Skill route — recommended, leanest. Drop the
octocode-researchskill into Pi's global skills dir. It drives the Octocode CLI directly — no MCP transport, minimal token overhead — and Pi auto-discovers it: -
Adapter route — full tool surface. Install
pi-mcp-adapterto expose Octocode MCP tools behind a single ~200-token proxy tool, so servers stay disconnected until a tool is called. Enable clone tools withENABLE_CLONE=true.
Research-driven loop
Most agent failures happen before the edit: guessing who owns a behavior, trusting a snippet without reading the source, editing before proving blast radius. Run a cheaper loop instead: orient with trees, search, read exact evidence, use AST/LSP when identity matters, then patch and verify. The host edits, Octocode is the map, and skills encode the habit.
The Manifest
"Code is Truth, but Context is the Map." Read the Manifest of Octocode for Research Driven Development to understand the philosophy behind Octocode.
來源:README.md,提交 c265e3f
工具
0版本歷史
1- v7.0.9最新Sep 16, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分