Repository avatar
Version Control
v7.0.9
active

octocode-mcp

io.github.bgauryy/octocode-mcp

AI code research platform. Search, analyze, and extract insights from any GitHub repository.

Documentation

Octocode Logo

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.

MCP Community Server Ask DeepWiki Trust Score

npm version npm downloads License

Website YouTube Channel



Install in Cursor


✨ Featured On

MCP Official Servers Awesome MCP Servers


Table of Contents


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

Install in Cursor Install in VS Code

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

CapabilityImplementationBenefit
Code DiscoveryMulti-dimensional search across repositories, code, and pull requestsFind relevant implementations in seconds
Context ExtractionSmart content retrieval with pattern matching and line-range targetingGet exactly the context you need
Token OptimizationAdvanced minification strategies (50+ language support)30-70% reduction in token consumption
SecurityAutomatic secrets detection and content sanitizationEnterprise-grade data protection
Progressive ResearchWorkflow-driven exploration (Discover β†’ Explore β†’ Analyze)Deep understanding of complex systems
Access ControlGitHub permission-based access to public and private repositoriesOrganization-wide code research

Packages

PackagenpmDescription
octocode-mcpnpmCore MCP server: GitHub API, local filesystem tools, LSP code intelligence
octocode-clinpmInteractive CLI for IDE setup, skills marketplace, MCP management
octocode-vscodeVS Code MarketplaceVS Code extension for OAuth and multi-editor sync
octocode-sharedInternalShared utilities for credentials and session management

GitHub Tools

Five specialized tools for comprehensive GitHub code research:

πŸ” githubSearchCode

Find code implementations across repositories

FeatureDescription
Content SearchFind code inside files by keywords (AND logic)
Path SearchDiscover files/directories by name (25x faster)
Smart FilteringScope by repository, path, file extension, or popularity
Context-Rich ResultsReturns 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

FeatureDescription
Topic-Based DiscoverySearch by exact GitHub topics (most precise)
Keyword SearchFind repos by name, description, or README content
Quality FiltersFilter 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

FeatureDescription
Directory TreeVisual representation of folder structure
Depth ControlExplore 1 level (overview) or 2 levels (detailed)
Path TargetingNavigate directly to specific directories
β€’ "Show me the structure of facebook/react"
β€’ "Explore src/ directory in a monorepo"

πŸ“„ githubGetFileContent

Read file contents with smart extraction

FeatureDescription
Pattern MatchingExtract sections matching specific patterns with context
Line Range ReadingRead specific line ranges for efficiency
Content MinificationAutomatic 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

FeatureDescription
PR DiscoverySearch by state, author, labels, dates
Direct AccessFetch specific PR by number (10x faster)
Code DiffsInclude full diff content to see what changed
DiscussionsAccess 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.

Install in Cursor

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

Filesystem Tools

ToolDescriptionExample
πŸ“ localViewStructureExplore directory structure with depth control"Show src/ with depth 2"
πŸ” localSearchCodeFast pattern search (ripgrep-powered)"Search for 'useAuth' in TypeScript files"
πŸ“‚ localFindFilesFind files by metadata (name, time, size)"Find files modified in the last 7 days"
πŸ“„ localGetFileContentRead files with smart extraction"Show the validateUser function"

LSP Tools (Code Intelligence)

ToolDescriptionExample
🎯 lspGotoDefinitionNavigate to symbol definitions"Go to the definition of handleSubmit"
πŸ”— lspFindReferencesFind all usages of a symbol"Find all references to validateToken"
🌳 lspCallHierarchyTrace 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 /research and /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.

Octocode CLI

npx octocode-cli@latest
FeatureDescription
Multi-IDE SupportCursor, VS Code, Claude Desktop, Windsurf, and more
Skills Marketplace7+ community sources with 170+ skills
MCP Registry50+ curated MCP servers ready to install
GitHub AuthBrowser-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

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

  1. Create a token at github.com/settings/tokens
  2. Select scopes: repo, read:user, read:org
  3. 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

One-click: Install in 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

One-click: Install in 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

One-click: Install in Goose

Manual: Go to Advanced settings β†’ Extensions β†’ Add custom extension. Use type STDIO, command npx octocode-mcp@latest.

LM Studio

One-click: Add MCP Server octocode to LM Studio

Manual: Go to Program β†’ Install β†’ Edit mcp.json. Use the standard config.

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

  1. Restart your MCP client completely
  2. 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
  3. Test: Search GitHub for React hooks implementations

Documentation

ResourceDescription
Configuration GuideEnvironment variables and server configuration
Authentication GuideSetup instructions and troubleshooting
GitHub Tools ReferenceFull GitHub tools documentation
Local Tools ReferenceFull local tools documentation
LSP ToolsCode intelligence features

Examples

ThreeJS Implementation Quality Comparison

Interactive Demo

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:

  1. Repository discovery (React source)
  2. Structure exploration (hooks implementation)
  3. Code analysis (internal mechanisms)
  4. Comprehensive explanation with code references

Community

Get Support

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.