# Octocode
Octocode Logo [![MCP Community Server](https://img.shields.io/badge/Model_Context_Protocol-Official_Community_Server-blue?style=flat-square)](https://github.com/modelcontextprotocol/servers) [![Glama score](https://glama.ai/mcp/servers/bgauryy/octocode/badges/score.svg)](https://glama.ai/mcp/servers/bgauryy/octocode) [![Website](https://img.shields.io/badge/Website-007ACC?style=for-the-badge&logo=link&logoColor=white)](https://octocode.ai) [![YouTube](https://img.shields.io/badge/YouTube-FF0000?style=for-the-badge&logo=youtube&logoColor=white)](https://www.youtube.com/@Octocode-ai)
Octocode helps you answer questions about code and show where the answer came from. Trace a caller to its source line, find the pull request behind a change, or check whether an advisory affects the version in your lockfile. Use the same tools in your coding agent over MCP or from the terminal. [Install](#install) · [Tools](#tools) · [Workflows](#how-an-agent-uses-octocode) · [Configuration](#configuration) · [Skills](#skills) ## Install One npm package, `octocode-mcp`, is both the MCP server and the CLI: an MCP client runs it bare, and `npx -y octocode-mcp ` runs a CLI command. It requires Node.js 24.15 or later. Prebuilt binaries cover macOS on Apple Silicon or Intel, Linux on x64 or ARM64 (glibc, or musl such as Alpine), and Windows on x64 or ARM64. [Native installation](packages/octocode-native/README.md#install) ### Connect your agent over MCP 1. Add Octocode to your client: run `npx -y octocode-mcp install --enable-local true` and choose a client, or name one, as in `npx -y octocode-mcp install --ide cursor --enable-local true`. Without `--enable-local true`, the server lists only the GitHub and package tools. To pick a whole tool set instead, add `--preset full` (every tool), `--preset local` (local tools only) or `--preset github` (GitHub tools only). [Tool presets](docs/CONFIGURATION.md#tool-presets) 2. Sign in to GitHub: `npx -y octocode-mcp auth login`. Without a token, GitHub tools run anonymously, with no code search or private repositories. [Sign-in steps](docs/AUTHENTICATION.md#oauth-device-login) · [Other ways to add a token](docs/CONFIGURATION.md#github-token-for-mcp) 3. Restart the client. In a project with a README, ask "Use Octocode to read the first line of README.md." The answer quotes that line. ### Run the CLI From a project with a README, run this command. The output includes the README's first line. ```bash npx -y octocode-mcp localFetch '{"queries":[{"path":"README.md","ranges":[{"startLine":1,"endLine":1}]}]}' ``` Run `npx -y octocode-mcp --help` for every command. GitHub code search and private repositories need a sign-in: `npx -y octocode-mcp auth login`; `npx -y octocode-mcp auth status` shows the account in use. [GitHub authentication](docs/AUTHENTICATION.md) ### One-click installs The IDE buttons (Cursor, VS Code, VS Code Insiders, Windsurf, Kiro) add the local tools with the GitHub and package tools: their server entry sets `OCTOCODE_ENABLE_LOCAL=true`. Goose and LM Studio are chat apps that open no project, so their buttons add the GitHub and package tools only; to add the local tools there, run `npx -y octocode-mcp config set local.enabled true`. After any button, sign in with `npx -y octocode-mcp auth login` and restart the client. [Install in Cursor](https://cursor.com/en/install-mcp?name=octocode&config=eyJjb21tYW5kIjoibnB4IiwidHlwZSI6InN0ZGlvIiwiYXJncyI6WyIteSIsIm9jdG9jb2RlLW1jcEBsYXRlc3QiXSwiZW52Ijp7Ik9DVE9DT0RFX0VOQUJMRV9MT0NBTCI6InRydWUifX0=) [Install in VS Code](https://insiders.vscode.dev/redirect/mcp/install?name=octocode&config=%7B%22command%22%3A%22npx%22%2C%22type%22%3A%22stdio%22%2C%22args%22%3A%5B%22-y%22%2C%22octocode-mcp%40latest%22%5D%2C%22env%22%3A%7B%22OCTOCODE_ENABLE_LOCAL%22%3A%22true%22%7D%7D)
More one-click installs [Install in VS Code Insiders](https://insiders.vscode.dev/redirect/mcp/install?name=octocode&config=%7B%22command%22%3A%22npx%22%2C%22type%22%3A%22stdio%22%2C%22args%22%3A%5B%22-y%22%2C%22octocode-mcp%40latest%22%5D%2C%22env%22%3A%7B%22OCTOCODE_ENABLE_LOCAL%22%3A%22true%22%7D%7D&quality=insiders) [Install in Windsurf](windsurf://mcp/install?name=octocode&config=%7B%22command%22%3A%22npx%22%2C%22type%22%3A%22stdio%22%2C%22args%22%3A%5B%22-y%22%2C%22octocode-mcp%40latest%22%5D%2C%22env%22%3A%7B%22OCTOCODE_ENABLE_LOCAL%22%3A%22true%22%7D%7D) [Install in Kiro](https://kiro.dev/launch/mcp/add?name=octocode&config=%7B%22command%22%3A%22npx%22%2C%22type%22%3A%22stdio%22%2C%22args%22%3A%5B%22-y%22%2C%22octocode-mcp%40latest%22%5D%2C%22env%22%3A%7B%22OCTOCODE_ENABLE_LOCAL%22%3A%22true%22%7D%7D) [Install in Goose](https://goose-docs.ai/extension?cmd=npx&arg=-y&arg=octocode-mcp%40latest&id=octocode&name=octocode&description=Evidence-first%20code%20research%20for%20AI%20agents) [Install in LM Studio](https://lmstudio.ai/install-mcp?name=octocode&config=eyJjb21tYW5kIjoibnB4IiwidHlwZSI6InN0ZGlvIiwiYXJncyI6WyIteSIsIm9jdG9jb2RlLW1jcEBsYXRlc3QiXX0=)
## Tools **17 tools.** With default settings you get 7 tools over MCP and 14 in the CLI. Set `OCTOCODE_ENABLE_LOCAL=true` in the MCP server entry to add the local tools, or choose a whole set with `OCTOCODE_TOOLS_PRESET` (`full`, `local`, `github`), which then overrides every other tool setting. [Tool presets](docs/CONFIGURATION.md#tool-presets) Both interfaces use the same tool names and JSON inputs. | Task | Tools | Availability | |---|---|---| | Find and read local code | `structureSearch` finds files, `localSearch` finds text, and `localFetch` reads the matching lines. | CLI default · MCP opt-in | | Follow a symbol | `astSearch` matches code by syntax. `lspSearch` finds definitions, references and callers. | CLI default · MCP opt-in | | Read GitHub code | `ghSearchRepo` finds repositories. `ghSearchCode` finds code on the default branch. `ghStructure` browses a tree at a ref, and `ghGetFileContent` reads a file there. | Default | | Trace a change | `ghSearchHistory` finds commits, pull requests and issues. `ghGetHistoryItem` opens their patches or discussions and compares revisions. | Default | | Look up a package | `artifactSearch` resolves a package version to registry metadata, dependencies and upstream source when available. | Default | | Explore dependencies | `graphBuild` creates a snapshot. `graphQuery` finds importers, cycles and files a change can affect. | Graph package CLI; its MCP server serves `build_graph` and `query_graph` | | Search a GitHub repository locally | `ghCloneRepo` returns a checkout path for local tools. Requires Git and persistent storage. | CLI default · MCP opt-in | | Check known vulnerabilities | `securityCheck` looks up advisories for a package version, repository or commit and reports affected ranges and known fixes. | CLI default · MCP opt-in | | Read by meaning | `clasify` answers questions about files, images and web pages, or filters search results by meaning. | Provider key on both | Run `npx -y octocode-mcp schema` to list the tools available in your CLI. For a tool's inputs and examples, try `npx -y octocode-mcp schema localFetch --view variants`. [Tool reference](docs/OCTOCODE_TOOLS.md) ## How an agent uses Octocode | Ask your agent | How it can check the answer | |---|---| | "Who calls this function?" | Find its declaration with `localSearch` or `astSearch`. Give the file, line and symbol to `lspSearch`, then use `localFetch` to read a returned call site. | | "What could break if we change this module?" | Run `graphBuild` on the project, then `graphQuery` on that snapshot for importers or impact. Read the affected code before deciding what to test. | | "Which change introduced this behavior in our dependency?" | Give `artifactSearch` the locked version. For GitHub source, browse the release ref with `ghStructure`, read the file at the returned commit with `ghGetFileContent`, then follow `ghSearchHistory` to the patch in `ghGetHistoryItem`. | | "Does this advisory affect the version we ship?" | Pass the package ecosystem, name and locked version to `securityCheck`. Check the advisory's affected range and any fixed version against the lockfile. | | "Which docs or screenshots explain retries?" | Give `clasify` a `localFetch` or `ghGetFileContent` source for a file or image, a URL for a web page, or a supported search query with a predicate. Follow `next.read` when offered to inspect the evidence. | For repeated searches across a remote repository, run `ghCloneRepo` once and give its returned path to local tools. For a paged result, follow the returned `next` call to reach the remaining evidence. [Graph examples](docs/OCTOCODE_GRAPH.md) · [Classification examples and request budgets](docs/OCTOCODE_CLASIFY.md) · [Reading paged results](docs/TOOL_DATA_CONTRACT.md#executable-continuations) ## Configuration Run `npx -y octocode-mcp config list` to see effective settings, defaults and sources. Octocode reads project settings from `.octocode/` in its launch directory. CLI and MCP share user settings in the Octocode home, normally `~/.octocode/`. Run `npx -y octocode-mcp config home` to see its location. | To enable | Do this once for your user | |---|---| | Local tools in MCP | `npx -y octocode-mcp config set local.enabled true` | | Graph tools in MCP | Add the [Octocode Graph](packages/octocode-graph/README.md) MCP server, with local tools on | | Repository cloning in MCP | `npx -y octocode-mcp config set tools.enableClone true`, with local tools on | | Advisory lookups in MCP | `npx -y octocode-mcp config set tools.enableSecurity true` | | Classification in CLI and MCP | `npx -y octocode-mcp config set OCTOCODE_TYPESAFE_KEY --stdin` | Restart MCP after a settings change. [Settings, scopes and workspace permissions](docs/CONFIGURATION.md) · [Which GitHub token wins](docs/AUTHENTICATION.md#github-token-resolution) ## Security Local tools enforce workspace path rules and redact recognized secrets from text. GitHub and registry lookups contact their respective services. Classification sends selected evidence, including supplied image pixels, to your configured provider. Fresh evaluations can incur charges. [Security and advisory requests](docs/SECURITY.md) · [Storage and caches](docs/STORAGE_AND_LIMITS.md) · [Privacy](PRIVACY.md) ## Skills Skills give your agent a workflow for a task. Run `npx -y octocode-mcp skill list` to see the bundled skills and their installation status. To add code research to a Codex project, run this from its root. ```bash npx -y octocode-mcp skill install octocode-research --platform codex --project-dir . ``` | What you want to do | Public skills | |---|---| | Get set up and investigate code | [octocode-get-started](skills/octocode-get-started/SKILL.md), [octocode-research](skills/octocode-research/SKILL.md), [octocode-debugging](skills/octocode-debugging/SKILL.md) | | Explore dependencies and visualize a repository | [octocode-graph](packages/octocode-graph/skills/octocode-graph/SKILL.md) | | Evaluate ideas and design changes | [octocode-brainstorming](skills/octocode-brainstorming/SKILL.md), [octocode-engineer](skills/octocode-engineer/SKILL.md), [octocode-rfc-generator](skills/octocode-rfc-generator/SKILL.md), [octocode-generate](skills/octocode-generate/SKILL.md) | | Review, test and document code | [octocode-pr-review](skills/octocode-pr-review/SKILL.md), [octocode-test-plan](skills/octocode-test-plan/SKILL.md), [octocode-roast](skills/octocode-roast/SKILL.md), [octocode-clean-agentic-code](skills/octocode-clean-agentic-code/SKILL.md), [octocode-documentation](skills/octocode-documentation/SKILL.md) | | Research the web or operate a browser | [octocode-scraping](skills/octocode-scraping/SKILL.md), [octocode-browser-tools](packages/octocode-browser-tools/skills/octocode-browser-tools/SKILL.md) | | Build agent workflows and coordinate work | [octocode-agentic](skills/octocode-agentic/SKILL.md), [octocode-skills](skills/octocode-skills/SKILL.md), [octocode-workflows](skills/octocode-workflows/SKILL.md), [octocode-orchestrator](skills/octocode-orchestrator/SKILL.md), [octocode-messages-proxy](skills/octocode-messages-proxy/SKILL.md) | [Skill descriptions and installation options](skills/README.md) ## Documentation [User guides and reference](docs/README.md) · [CLI](docs/OCTOCODE_CLI.md) · [MCP client setup](docs/OCTOCODE_MCP.md) · [Tool catalog](docs/OCTOCODE_TOOLS.md) · [Language support](packages/octocode-native/docs/engine/SUPPORTED_LANGUAGES_AND_FEATURES.md) [VS Code extension](packages/octocode-vscode/README.md) · [Claude Code plugin](packages/octocode-claude-plugin/README.md) · [Codex plugin](packages/octocode-codex-plugin/README.md) · [Benchmarks](packages/octocode-benchmark/README.md) · [Contributing](AGENTS.md) · [MIT license](LICENSE)