Back to MCP Servers

Octocode

AI-powered developer assistant that enables advanced research, analysis and discovery across GitHub and NPM realms in realtime.

developer-toolsgithubai
By bgauryy
92077Updated 1 week agoTypeScriptMIT

Installation

npx -y octocode-mcp

Configuration

{
  "mcpServers": {
    "octocode-mcp": {
      "command": "npx",
      "args": ["-y", "octocode-mcp"]
    }
  }
}

How to use

  1. Run the installation command above (if needed)
  2. Open your Claude Code settings file (~/.claude/settings.json)
  3. Add the configuration to the mcpServers section
  4. Restart Claude Code to apply changes

Octocode: agentic research platform

<div align="center"> <img src="https://github.com/bgauryy/octocode/raw/main/packages/octocode-mcp/assets/logo_white.png" width="400px" alt="Octocode Logo">

MCP Community Server Ask DeepWiki Glama score

Website YouTube

</div>

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

Prerequisites: Node.js 20.12+

1. Run the Octocode CLI with npx

npx octocode --help

2. Authenticate with GitHub - optional, but unlocks private repositories and higher API rate limits:

npx octocode auth login
npx octocode status       # verify the active token source

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:

npx octocode

🤖 MCP - one-click install:

<details> <summary><b>Show more install options (Windsurf, Kiro, Goose, LM Studio, Claude Code)</b></summary> <br>

Claude Code:

claude mcp add-json octocode --scope user '{"command":"npx","type":"stdio","args":["octocode-mcp@latest"]}'
</details>

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

{
  "octocode": {
    "command": "npx",
    "type": "stdio",
    "args": ["octocode-mcp@latest"]
  }
}

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.

npx octocode                                         # self-describing usage for agents
npx octocode tools                                   # list every tool
npx octocode tools localSearchCode --scheme          # inspect a tool's schema

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.

npx octocode tools localSearchCode \
  --queries '{"path":".","searchText":"authenticate","maxFiles":20}'
results:
  - id: localSearchCode-1
    data:
      files:
        - path: src/auth.ts
          matches:
            - line: 12
              value: "export async function authenticate(req: Request) {"

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

NeedUse Octocode to
Codebase questionsSearch local or GitHub code, read exact regions, browse trees, and carry file/line anchors into the answer.
Implementation researchCompare patterns across repositories, npm packages, pull requests, commits, and local files before changing code.
Semantic navigationResolve definitions, references, callers/callees, call hierarchy, hovers, symbols, diagnostics, and type relationships through LSP.
Structural matchingRun AST-shaped searches with patterns or YAML rules so comments and strings do not become false positives.
Large-file contextMinify, skeletonize, or paginate code so agents spend tokens on relevant structure instead of boilerplate.
Agent workflowsSame engine through MCP, CLI, and Agent Skills.

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:

SurfaceRegistersWhat that set is
MCP, no flags8GitHub search and read, plus npmSearch
MCP, ENABLE_LOCAL=true14Adds the five local tools and lspGetSemantics
MCP, + ENABLE_CLONE=true15Adds ghCloneRepo
MCP, + ENABLE_TOOLS allowlist17Adds ghListReleases and ghSearchDiscussions
CLI, no flags15Local tools and clone are on by default
CLI, + ENABLE_RELEASES=1 ENABLE_DISCUSSIONS=117Adds the same two GitHub tools

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

ToolWhat it doesKnob
ghSearchCodeCode and path search across GitHub by owner, repository, path, filename, extension, and match filters. Accepts 1 to 5 parallel queries.concise
ghGetFileContentRead a GitHub file or region: full file, line range, match slice, or paginated chars.

View source on GitHub