
octocode-mcp
io.github.bgauryy/octocode-mcp
AI code research platform. Search, analyze, and extract insights from any GitHub repository.
Documentation
A Model Context Protocol (MCP) server enabling AI assistants to search, analyze, and extract insights from millions of GitHub repositories with enterprise-grade security and token efficiency.
Table of Contents
- Quick Start
- Overview
- GitHub Tools
- Local Tools
- Commands
- Octocode CLI
- Installation Guide
- Documentation
- Examples
- Community
- License
Quick Start
Option 1: Octocode CLI (Recommended)
npx octocode-cli
β Interactive menu for GitHub auth, MCP installation, and AI skills
Option 2: One-Click Install
Option 3: Manual Configuration
{
"mcpServers": {
"octocode": {
"command": "npx",
"args": ["octocode-mcp@latest"]
}
}
}
Overview
Octocode is an agentic code research platform that bridges the gap between AI assistants and real-world code implementations. By providing structured access to GitHub's vast repository ecosystem, it enables AI systems to learn from production codebases rather than relying solely on training data.
Core Capabilities
| Capability | Implementation | Benefit |
|---|---|---|
| Code Discovery | Multi-dimensional search across repositories, code, and pull requests | Find relevant implementations in seconds |
| Context Extraction | Smart content retrieval with pattern matching and line-range targeting | Get exactly the context you need |
| Token Optimization | Advanced minification strategies (50+ language support) | 30-70% reduction in token consumption |
| Security | Automatic secrets detection and content sanitization | Enterprise-grade data protection |
| Progressive Research | Workflow-driven exploration (Discover β Explore β Analyze) | Deep understanding of complex systems |
| Access Control | GitHub permission-based access to public and private repositories | Organization-wide code research |
Packages
| Package | npm | Description |
|---|---|---|
| octocode-mcp | Core MCP server: GitHub API, local filesystem tools, LSP code intelligence | |
| octocode-cli | Interactive CLI for IDE setup, skills marketplace, MCP management | |
| octocode-vscode | VS Code Marketplace | VS Code extension for OAuth and multi-editor sync |
| octocode-shared | Internal | Shared utilities for credentials and session management |
GitHub Tools
Five specialized tools for comprehensive GitHub code research:
π githubSearchCode
Find code implementations across repositories
| Feature | Description |
|---|---|
| Content Search | Find code inside files by keywords (AND logic) |
| Path Search | Discover files/directories by name (25x faster) |
| Smart Filtering | Scope by repository, path, file extension, or popularity |
| Context-Rich Results | Returns code snippets with surrounding context |
β’ "How do popular repos implement OAuth?"
β’ "Search for React custom hooks in vercel repos"
β’ "Find error handling patterns in Express apps"
π githubSearchRepositories
Discover repositories by topics and keywords
| Feature | Description |
|---|---|
| Topic-Based Discovery | Search by exact GitHub topics (most precise) |
| Keyword Search | Find repos by name, description, or README content |
| Quality Filters | Filter by stars, language, size, activity |
β’ "Discover TypeScript CLI tools with >1000 stars"
β’ "Find all React state management libraries"
β’ "List all repos from microsoft with topic 'ai'"
ποΈ githubViewRepoStructure
Explore repository directory structure
| Feature | Description |
|---|---|
| Directory Tree | Visual representation of folder structure |
| Depth Control | Explore 1 level (overview) or 2 levels (detailed) |
| Path Targeting | Navigate directly to specific directories |
β’ "Show me the structure of facebook/react"
β’ "Explore src/ directory in a monorepo"
π githubGetFileContent
Read file contents with smart extraction
| Feature | Description |
|---|---|
| Pattern Matching | Extract sections matching specific patterns with context |
| Line Range Reading | Read specific line ranges for efficiency |
| Content Minification | Automatic optimization for token efficiency |
β’ "Get the validateUser function from auth.ts"
β’ "Read lines 100-150 from the API handler"
π githubSearchPullRequests
Analyze pull requests, changes, and discussions
| Feature | Description |
|---|---|
| PR Discovery | Search by state, author, labels, dates |
| Direct Access | Fetch specific PR by number (10x faster) |
| Code Diffs | Include full diff content to see what changed |
| Discussions | Access comment threads and review discussions |
β’ "Show recent merged PRs about authentication"
β’ "Find PRs discussing the API redesign with comments"
Local Tools
Octocode Local provides local filesystem research with LSP-powered code intelligence.
{
"mcpServers": {
"octocode-local": {
"command": "npx",
"args": ["octocode-mcp-local@latest"]
}
}
}
Filesystem Tools
| Tool | Description | Example |
|---|---|---|
| π localViewStructure | Explore directory structure with depth control | "Show src/ with depth 2" |
| π localSearchCode | Fast pattern search (ripgrep-powered) | "Search for 'useAuth' in TypeScript files" |
| π localFindFiles | Find files by metadata (name, time, size) | "Find files modified in the last 7 days" |
| π localGetFileContent | Read files with smart extraction | "Show the validateUser function" |
LSP Tools (Code Intelligence)
| Tool | Description | Example |
|---|---|---|
| π― lspGotoDefinition | Navigate to symbol definitions | "Go to the definition of handleSubmit" |
| π lspFindReferences | Find all usages of a symbol | "Find all references to validateToken" |
| π³ lspCallHierarchy | Trace function call relationships | "Who calls the authenticate function?" |
Research Workflows
Discovery: localViewStructure β localSearchCode β localGetFileContent
Semantic: localSearchCode β lspGotoDefinition β lspFindReferences
Flow Analysis: localSearchCode β lspCallHierarchy(incoming) β lspCallHierarchy(outgoing)
π Full LSP Documentation β
Commands
Intelligent prompt commands that enhance your research workflow:
/research - Expert Code & Product Research
Deep code discovery, documentation analysis, pattern identification, and bug investigation.
When to use:
- Understanding repository workflows and technical implementations
- Cross-repository flow analysis and microservices tracing
- Bug investigation and root cause analysis
- Pattern discovery across multiple repos
/research How does React's useState hook work internally?
/research Compare state management approaches: Redux vs Zustand vs Jotai
/research Why is the payment webhook failing? Trace the error through payment-service
/plan - Research, Plan & Implement Complex Tasks
Your AI architect for complex development work. Breaks down tasks, researches patterns, guides execution.
When to use:
- Building new features with research-backed architecture
- Complex refactoring with migration planning
- Learning new technologies incrementally
/plan Build a real-time chat application with WebSocket support
/plan Migrate our authentication from JWT to OAuth2
/plan Implement a plugin system for our CLI tool
/review_pull_request - Comprehensive PR Review
Args: prUrl (required) - GitHub Pull Request URL
Expert-level PR review with Defects-First mindset. Analyzes:
- Defects & Bugs: Logic errors, edge cases, race conditions
- Security Issues: Injection vulnerabilities, auth bypasses
- Performance: N+1 queries, memory leaks
- Code Quality: Complexity, maintainability, test coverage
/review_pull_request prUrl: https://github.com/facebook/react/pull/12345
/review_security - Security Audit
Args: repoUrl (required) - GitHub repository URL
Comprehensive security analysis. Analyzes:
- Authentication & Authorization: Auth flows, session management
- Input Validation: Injection points, sanitization
- Secrets Management: Hardcoded credentials, API keys
- Dependencies: Known vulnerabilities, supply chain risks
/review_security repoUrl: https://github.com/your-org/your-repo
π‘ Pro Tip: Combine
/researchand/planβ research existing patterns first, then plan your implementation.
Octocode CLI
One-command setup for Octocode, MCP servers, and AI skills across all your IDEs.
npx octocode-cli@latest
| Feature | Description |
|---|---|
| Multi-IDE Support | Cursor, VS Code, Claude Desktop, Windsurf, and more |
| Skills Marketplace | 7+ community sources with 170+ skills |
| MCP Registry | 50+ curated MCP servers ready to install |
| GitHub Auth | Browser-based OAuth or GitHub CLI integration |
π Octocode MCP - Install/sync Octocode across IDEs
π§ Manage System Skills - Browse marketplace, install & manage skills
β‘ Manage System MCP - Add popular MCP servers to your setup
Learn More: CLI Documentation | What are Skills?
Installation Guide
Prerequisites
- Node.js >= 18.12.0 (or use standalone binary)
- GitHub Authentication: GitHub CLI (recommended) or Personal Access Token
Authentication Methods
GitHub CLI (Recommended)
Advantages: Automatic token management, works with 2FA, supports SSO
# macOS
brew install gh
# Windows
winget install --id GitHub.cli
# Linux - See https://github.com/cli/cli/blob/trunk/docs/install_linux.md
# Authenticate
gh auth login
Then use the standard configuration (no GITHUB_TOKEN needed).
Personal Access Token
When to use: CI/CD environments, automation, or if GitHub CLI isn't available
- Create a token at github.com/settings/tokens
- Select scopes:
repo,read:user,read:org - Add to your MCP configuration:
{
"mcpServers": {
"octocode": {
"command": "npx",
"args": ["octocode-mcp@latest"],
"env": {
"GITHUB_TOKEN": "ghp_your_token_here"
}
}
}
}
Security Tip: Never commit tokens to version control.
GitHub Enterprise
Add the GITHUB_API_URL environment variable:
{
"mcpServers": {
"octocode": {
"command": "npx",
"args": ["octocode-mcp@latest"],
"env": {
"GITHUB_TOKEN": "your_token",
"GITHUB_API_URL": "https://github.company.com/api/v3"
}
}
}
}
IDE-Specific Setup
Cursor
Manual: Go to Cursor Settings β MCP β Add new MCP Server. Use command npx octocode-mcp@latest.
Project-specific: Create .cursor/mcp.json in your project root with the standard config.
VS Code
CLI:
code --add-mcp '{"name":"octocode","command":"npx","args":["octocode-mcp@latest"]}'
Claude Desktop / Claude Code
Claude Code CLI:
claude mcp add octocode npx octocode-mcp@latest
Claude Desktop: Follow the MCP install guide, use the standard config.
Amp
VS Code settings.json:
"amp.mcpServers": {
"octocode": {
"command": "npx",
"args": ["octocode-mcp@latest"]
}
}
Amp CLI:
amp mcp add octocode -- npx octocode-mcp@latest
Codex
CLI:
codex mcp add octocode npx "octocode-mcp@latest"
Config file (~/.codex/config.toml):
[mcp_servers.octocode]
command = "npx"
args = ["octocode-mcp@latest"]
Goose
Manual: Go to Advanced settings β Extensions β Add custom extension. Use type STDIO, command npx octocode-mcp@latest.
Other IDEs (Cline, Gemini CLI, Kiro, opencode, Qodo Gen, Warp, Windsurf, Zed)
All use the standard configuration:
{
"mcpServers": {
"octocode": {
"command": "npx",
"args": ["octocode-mcp@latest"]
}
}
}
See each IDE's MCP documentation for the specific config file location.
Verify Installation
- Restart your MCP client completely
- Check connection status:
- Cursor: Green dot in Settings β Tools & Integrations β MCP Tools
- Claude Desktop: Check for "octocode" in available tools
- VS Code: Verify in GitHub Copilot settings
- Test:
Search GitHub for React hooks implementations
Documentation
| Resource | Description |
|---|---|
| Configuration Guide | Environment variables and server configuration |
| Authentication Guide | Setup instructions and troubleshooting |
| GitHub Tools Reference | Full GitHub tools documentation |
| Local Tools Reference | Full local tools documentation |
| LSP Tools | Code intelligence features |
Examples
ThreeJS Implementation Quality Comparison
Side-by-side comparison showing Generic AI vs Octocode-Enhanced AI implementation quality:
- Performance optimizations from high-performance projects
- Proper resource management patterns
- Industry-standard error handling
Deep Technical Research
YouTube: React Hooks Internals
Progressive research workflow demonstration:
- Repository discovery (React source)
- Structure exploration (hooks implementation)
- Code analysis (internal mechanisms)
- Comprehensive explanation with code references
Community
Get Support
- GitHub Discussions: Ask questions, share ideas
- GitHub Issues: Report bugs, request features
Show Your Support
If Octocode helps your AI development workflow:
- β Star the repository on GitHub
- π£ Share on social media with #OctocodeMCP
License
MIT - See LICENSE for details.
octocode-mcpnpm install octocode-mcpRelated Servers
ai.smithery/Hint-Services-obsidian-github-mcp
Connect AI assistants to your GitHub-hosted Obsidian vault to seamlessly access, search, and analyβ¦
ai.smithery/anirbanbasu-pymcp
Primarily to be used as a template repository for developing MCP servers with FastMCP in Python, Pβ¦
ai.smithery/neverinfamous-memory-journal-mcp
A MCP server built for developers enabling Git based project management with project and personalβ¦