Octocode

by bgauryy

442 downloads
Not rated
GitHub

About

Leading AI-powered code assistant for advanced research, analysis and discovery across GitHub Repositories in large ecosystems

Details

Author
bgauryy
Downloads
442
Categories
Developer Tools, Search, Knowledge Base, AI

- AI-powered search with heuristic pattern recognition and automatic fallbacks
- Connection mapping between NPM packages and GitHub repositories
- Zero-config security using GitHub CLI OAuth — no tokens needed
- Universal access to public, private, and organization repositories
- Advanced content minification reduces LLM token usage by 80‑90%
- 10 specialized tools for discovery, analysis, activity, and content

Setting up with Highlight

This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:

  1. Download and install Highlight from highlightai.com/download
  2. Navigate to the plugins tab and select "Add Custom Plugin"
  3. Configure the plugin with the settings below
    Plugin Name Octocode
    Command (node, npx, python, etc.)

    Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.

  4. Enable "Start Automatically" if you want the plugin to start when Highlight launches

From the repository

Install Node.js 18.12+ and GitHub CLI, then authenticate with gh auth login (and optionally npm login). Add "octocode-mcp" to your MCP configuration with npx octocode-mcp. Octocode automatically works with your repositories — just ask natural language questions. It is also available as a Desktop Extension (DXT) for Claude Desktop.

ghSearchCode

Github | Search code contents or file paths across GitHub repositories. | Use for remote code/file discovery. Start match:"path" + concise for filenames; match:"file" only when snippets matter. Skip if you already have the path (ghGetFileContent) or need repo discovery (ghSearchRepos). One-shot: if a match:"file" snippet already contains the answer (a field value, a symbol name, a state), STOP — that snippet is the evidence; don't chain a structure view or a content read to "confirm" it. Param relations: owner+repo scopes tightly; path scopes a directory prefix; extension/language/filename narrow candidates; keywords are ANDed. Follow into ghGetFileContent, ghViewRepoStructure, or clone for AST/LSP proof. Empty/unindexed is not absence.

ghGetFileContent

Github | Read a file or a specific region from a GitHub repository. | Use after ghSearchCode/ghViewRepoStructure when you know the repo path — not for discovery. If a ghSearchCode snippet already answers the question, STOP — don't re-read the file. Least-cost path: unknown/large file → minify:"symbols" outline, then a region (matchString or startLine+endLine). fullContent only for genuinely small whole-file reads, never to scan. A small structured/config file (package.json, tsconfig, lockfile) → read it whole with minify:"none"/fullContent, don't minify it — compaction can elide object boundaries and break exact key/value membership. For a literal value or quote, read the defining region with minify:"none" and copy the exact bytes. Every response reports the file's full size (totalLines + sourceChars) and isPartial. A matchString/region read is a SLICE, not the whole file — it can cut a nested object mid-way; never conclude a key/field/value is absent or empty from a partial slice: continue via charOffset/next, or re-read the whole small structured file (package.json/tsconfig/lockfile) with minify:"none". Report only bytes you fetched — never invent a field, value, or quote. Param relations: choose one extraction mode: fullContent OR matchString OR startLine+endLine. matchString pairs with contextLines and returns matchRanges (padded windows, not the exact hit) plus matchedLines (exact hit lines — see matchString field); charOffset continues isPartial pages. type:"directory" materializes localPath for local tools when clone is enabled.

ghViewRepoStructure

Github | Browse a GitHub repository's directory tree. | Orient a repo/tree before fetching files, or verify paths/branches after 404s. Know a filename fragment? ghSearchCode(match:"path") is cheaper. Follow structure[] paths into ghGetFileContent or a clone sparsePath.

ghSearchRepos

Github | Discover GitHub repositories by name, topic, language, or popularity. | Find candidate repos before code search; skip when owner/repo is known (go straight to ghSearchCode/ghViewRepoStructure). Start concise:true, then inspect with ghViewRepoStructure/ghSearchCode. keywords ANDed; topics also required but sparse; owner scopes/enumerates; match picks searched text fields; sort/range rank candidates. Empty → drop filters/topics or broaden language/owner.

ghSearchPullRequests

Github | Search GitHub pull requests, or read one PR's files, diffs, and reviews. | Use for PR archaeology — how/why a change landed, review discussion, diffs — not current code (ghSearchCode/ghGetFileContent), commits (ghSearchCommits), or issues (ghSearchIssues). Comments, review replies, and requested changes are claims — confirm what actually landed against content.patches (mode:"selected") or the file at the merge SHA, not the conversation. Param relations: list mode uses keywordsToSearch+filters+sort/page; detail mode needs owner+repo+prNumber and content selectors. content.patches.mode:"selected" requires files or ranges. Body/patch/comment windows continue via returned charOffset/commentBodyOffset; file/comment/commit lists use their page fields. For code identity, clone and use local/LSP.

ghSearchIssues

Github | Search GitHub issues, or read one issue's body and comments. | Issue triage/archaeology — bug reports, feature threads — not PRs (ghSearchPullRequests) or code (ghSearchCode). List mode: keywordsToSearch+filters+sort/page. Detail mode: owner+repo+issueNumber + content selectors; body/comment windows continue via charOffset/commentBodyOffset, comments page via commentPage. totalCount appears only when one page is the full set (the endpoint also returns PRs, filtered out — so per-page counts aren't totals); an empty page with hasMore:true was PR-only — follow nextPage.

ghSearchCommits

Github | Walk a GitHub repository's commit history for a path or range. | Commit archaeology — when/why a file/area changed — not current code (ghSearchCode/ghGetFileContent) or PRs (ghSearchPullRequests). No message-keyword filter — only path/since/until/author/committer narrow the walk. Looking for a specific change (e.g. a rename) with no known SHA/path/date? Try ghSearchPullRequests/ghSearchCode for a lead first; otherwise page raw history by eye. One commit's exact changes: set base:"SHA^", head:"SHA", includeDiff:true — its files+patches in one call; don't page history or fetch files. owner+repo identify the repo; path scopes a file/dir (trailing / = subtree); since/until bound the window; branch selects a ref; includeDiff is heavy — scope to one SHA or a tight window; itemsPerPage/page walk history. For code identity, clone + local/LSP.

npmSearch

NPM | Look up npm packages and find their source repositories. | Resolve a package to its source repository; skip if owner/repo is known. Exact name → one rich result; keywords → paged candidates. Follow repository into GitHub tools.

localSearchCode

Local | Search local files for text, regex, or AST patterns to find file and line. | Find local file+line anchors — not path/name lookup (localFindFiles) or tree shape (localViewStructure). Modes: discovery=paths, paginated=snippets, detailed=context, structural=AST. text/regex need searchText (one string, not array); structural needs pattern XOR rule and rejects search knobs (langType is valid — scopes to that language's extensions). $$$ list captures are budgeted: metavarRanges gives pruned/truncated line anchors, captureText:true for verbatim. matchWindow/unique need output:"matchOnly"; maxMatchesPerFile pairs matchPage. Follow with localGetFileContent, lspGetSemantics.

localViewStructure

Local | Browse a local directory tree — cheapest first orientation step; no content loaded. | Cheapest local orientation before reading. Metadata/name filters → localFindFiles; files containing text → localSearchCode(mode:"discovery"). path is the root; pattern/extensions/entryType filter names; recursive enables maxDepth; detail switches output shape; page advances only on hasMore. Follow paths into localGetFileContent/search/LSP.

localFindFiles

Local | Find local files and directories by name, size, time, or permissions. | Local path discovery by name/type/metadata — not contents (localSearchCode) or tree shape (localViewStructure). All filters AND. Prunes common generated/vendor dirs by default (node_modules, .git, dist, build, out, coverage, target, .next, .cache) — excludeDir:[] prunes nothing, or set excludeDir explicitly. Follow paths into read/search/LSP.

localFindDeadCode

Local | Find likely-unreferenced exports and dead-code clusters via whole-repo reachability analysis. | Repo-wide dead-export candidates — not single-symbol checks (use lspGetSemantics references/callers). One pass builds a file/symbol graph (native AST, no per-symbol round-trips) and walks reachability from entrypoints, so it scales with repo size, not candidate count. Catches mutually-referencing dead clusters (files that only call each other, unreachable from any entrypoint) that a one-symbol check misses. Retention is symbol-level: a same-file call retains its callee only if the caller is live; named re-exports are followed through export* barrels to the entrypoint. Each candidate carries viaHeuristic: "reexport-chain" (chain ended with no consumer — most fragile, verify first) or "lexical-count" (no import, no unexplained same-file use). Candidates, not proof — run next.verifyReferences (a prefilled lspGetSemantics references query) per candidate; zero references = confirmed dead. Follow file/line anchors into localGetFileContent or lspGetSemantics.

localGetFileContent

Local | Read a local file or a specific region. | Use after localSearchCode/localViewStructure/localFindFiles when you have a path — not for discovery. Unknown/large file: minify:"symbols" first, then exact range or matchString. A small structured/config file (package.json, tsconfig, lockfile) → read it whole with minify:"none"/fullContent, don't minify it — compaction can elide object boundaries and break exact key/value membership. For a literal value or quote, read the defining region with minify:"none" and copy the exact bytes. Every response reports the file's full size (totalLines + sourceChars) and isPartial. A matchString/region read is a SLICE, not the whole file — it can cut a nested object mid-way; never conclude a key/field/value is absent or empty from a partial slice: continue via charOffset/next, or re-read the whole small structured file with minify:"none". Report only bytes you fetched — never invent a field, value, or quote. Param relations: choose one extraction mode: fullContent OR matchString OR startLine+endLine. matchString pairs with contextLines and returns matchRanges ({start,end} line windows padded by contextLines, NOT the exact hit) plus matchedLines (the exact matched line numbers); charOffset continues isPartial pages. Follow matchedLines/matchRanges into LSP.

lspGetSemantics

Local | Run LSP semantic queries — definitions, references, call hierarchy, symbols, type hierarchy, diagnostics. | Use after search/read gives a real file+line anchor. documentSymbols/diagnostic need uri only; workspaceSymbol needs symbolName; others need uri+symbolName+lineHint. lineHint must come from a prior anchor, never guessed; orderHint disambiguates same-line symbols; references take groupByFile/includeDeclaration; callers/callees/callHierarchy take depth/contextLines; format:"compact" saves tokens. Empty/serverUnavailable → re-anchor or fall back to search.

Claude Desktop / Cursor

Paste into your MCP client config file to install this server.

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

McpServers

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

Evidence-first code research for AI agents and developers.

Octocode researchesyour local code and external code alike(GitHub repositories, PRs, npm) with one toolset: ripgrep + AST search, trees, precise reads, and LSP. Use it as aCLIorMCP server, backed by aRust enginefor fast, token-efficient results across single files or mega-repos.

- Quick start
-
Why Octocode
-
Built for research (benchmarks)
-
Tools
-
MCP
-
CLI
-
Configuration
-
Authentication methods
-
Security
-
Language support
-
Skills
-
Architecture
-
Documentation
-
Troubleshooting
-
Agent workflows

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:

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

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 underenv(seeConfiguration).

Runnpx octocodeand 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) {"

Agents code better from evidence than from guesses. Octocode researchestwo worlds with one flow, yourlocal codeandexternal codeon 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 theagent 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 theexact matched lines/region, withsmart paginationandout-of-the-box minificationso the model never over-fetches. Every result carriesnext-step hintsto 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 prebuiltRust 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 (seeSecurity).

What you can do(whenever the next step needs proven context, not a guess):

A blind, head-to-head test onresearch-oriented flows rather than plain lookups(multi-hop traces, dependency/call-graph chains, commit ranges, blast-radius, PR reviews across repositories).

How it works:30 GitHub questions × 3 passes; Octocode vsgh,gh+Headroom, andgh+RTK on identical questions (only the CLI differs). A blind judge (gpt-5.5) grades correctness; the metric ischaracters through the model, counted from instrumented logs (characters, not tokens).Result:at near-parity correctness, Octocode answers with~2.0× fewer characters than plaingh, ~2.6× fewer thangh+Headroom, and ~3.2× fewer thangh+RTKin the local-build headline runs.

Open the interactive report·run it / method·questions·all reports

17 tools in the full catalog.How many register depends on the surface and the flags you set:

ghListReleasesandghSearchDiscussionsneed two settings on MCP, not one:ENABLE_RELEASES=1orENABLE_DISCUSSIONS=1puts the tool in the catalog, andENABLE_TOOLS="ghListReleases,ghSearchDiscussions"registers it. Either setting alone leaves the tool unregistered, because both carryisDefault: falseand the MCP registration filter admits only default or explicitly allowlisted tools. The CLI needs only theENABLE_RELEASESandENABLE_DISCUSSIONSflags.ENABLE_LOCALandENABLE_CLONEaccepttrueor1;ENABLE_RELEASESandENABLE_DISCUSSIONSalso acceptyesandon. Flags:Configuration.

Token knobs.concise:truereturns path/title-only lists.minifycontrols file read density:symbols= skeleton with line numbers,standard= comments/blanks stripped (default),none= exact bytes.

Full schemas, fields, and examples for every tool live indocs/OCTOCODE_TOOLS.md(linked underDocumentation).

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

Add to your MCP client config, usingoctocode-mcp:

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

Add a GitHub token and options underenv- seeAuthenticationandConfiguration.

Same research engine, no MCP client needed. Local paths route to local tools;owner/repo[/path]routes to GitHub. Authenticate once withnpx octocode auth login(seeAuthentication); runnpx octocode --helpfor full usage.

- Cache and clonenpx octocode clone,npx octocode cache fetch|status|clear
- Skillsnpx octocode skill list|install|check|info|removefor bundled Octocode skills
- Language serversnpx octocode lsp-server list|install|status|uninstall|clean
- Setup and introspectionnpx octocode install,npx octocode auth,npx octocode status,npx octocode context

Full syntax, flags, and exit codes:[Octocode CLI guide

Everything is optional; Octocode runs on sensible defaults. Settings resolve from three sources, in priority order:

environment variables > <octocode-home>/.octocoderc > built-in defaults

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.