Octocode MCP
The Perfect AI Code Assistant - Advanced Search & Discovery Across GitHub & NPM
What is Octocode? ๐
The perfect code assistant that can help understand anything. Octocode was built to understand connections between repositories and NPM packages under any privilege level you have. With AI-powered advanced search, heuristic discovery, and smart fallbacks, it makes GitHub's vast repository of knowledge truly searchable and analyzable.
Instead of manually browsing repositories, you can ask questions like:
- "How did React implement concurrent rendering?"
- "Show me authentication patterns in Next.js applications"
- "Find examples of how to use this specific API"
- "What's the architecture of this library?"
- "How do I use this MCP tool effectively?"
Recommended Use Cases
Use Octocode when you need to:
- ๐ Understand implementations - See how features work across different repositories
- ๐ Find real code examples - Discover patterns and best practices from production code
- ๐๏ธ Analyze architecture - Explore how systems are designed and structured
- ๐ฌ Research approaches - Compare different implementation strategies
- ๐ก Learn from code - Deep-dive into technical details and understand "how does this work?"
Unique Value Proposition
The most advanced AI-powered code assistant for understanding connections across the entire GitHub & NPM ecosystem. While other GitHub MCPs focus on project management or basic operations, Octocode provides unparalleled depth for code discovery and technical research.
๐ Out-of-the-Box Advanced Search (Powered by AI):
- ๐ง Heuristic Search - Intelligent pattern recognition that finds relevant code even with vague queries
- ๐ Smart Fallbacks - Automatic retry with alternative search strategies when initial searches fail
- ๐ฏ Smart Discovery - AI-guided exploration that uncovers hidden connections and patterns
- ๐ Connection Intelligence - Understands relationships between repositories, packages, and dependencies
- ๐ Multi-dimensional Analysis - Combines code, commits, issues, discussions, and package data
Key Differentiators:
- ๐ง Advanced AI Search - Heuristic algorithms that understand code context and connections
- ๐ Secure & Simple - No personal access tokens needed, uses GitHub CLI authentication
- ๐ Connected Discovery - Maps NPM packages to repositories, traces dependencies, finds related code
- ๐ Cross-Ecosystem Understanding - Works across any privilege level you have (public, private, organization)
It's the tool you reach for when you need to understand "how does this work?" rather than "how do I manage this project?"
Quick Start ๐
1. Install Prerequisites
# Install Node.js 18.12+
brew install node # macOS
# or download from https://nodejs.org/
# Install GitHub CLI
brew install gh # macOS
# or see: https://github.com/cli/cli#installation
2. Authenticate
# Login to GitHub (opens browser)
gh auth login
# Login to NPM (for package research)
npm login
๐ GitHub Authentication via CLI:
- โ No personal access tokens needed - Uses GitHub CLI behind the scenes
- โ Secure OAuth flow - Browser-based authentication, no tokens to store
- โ Enterprise ready - Works with SSO, 2FA, and organization access
- โ Private repository access - Automatically detects your organizations and accesses private repos
- โ
Zero configuration - Uses your existing
ghCLI permissions
3. Add to MCP Configuration
{
"octocode-mcp": {
"command": "npx",
"args": ["octocode-mcp"]
}
}
That's it! No personal access tokens, no config files, no complex setup. Octocode leverages GitHub CLI authentication behind the scenes and automatically works with your organization's private repositories.
How Octocode Works ๐
Smart Discovery Flow:
- ๐ Query Analysis โ AI determines the best search strategy based on your question
- โก Multi-Tool Orchestration โ Combines GitHub + NPM searches intelligently
- ๐ Smart Fallbacks โ Automatically retries with different approaches if initial search fails
- ๐ Cross-Reference Discovery โ Links packages to repositories, finds related implementations
- ๐ฏ Context Synthesis โ Provides comprehensive understanding across multiple sources
Example Flows
Example 1: LangGraph Node.js Implementation Tutorial
Query: "Show implementations of langgraph in node js. Make a tutorial for how to implement a simple agent using OpenAI API."
Example 2: Zustand React State Management
Query: "Show me how to add zustand to react application. Show examples and best practices"
Example 3: React vs Vue.js Rendering Comparison
Query: "How did React implement their concurrent rendering flows? How is it different from Vue.js rendering mechanism? Which is better?"
Core Features ๐ ๏ธ
๐ง AI-Powered Advanced Search
- Heuristic Pattern Recognition - Finds relevant code even with vague or incomplete queries
- Smart Fallback Strategies - Automatically tries alternative approaches when searches fail with actionable suggestions
- Boolean Search Intelligence - Automatic query optimization with smart boolean operators (3-5x performance improvement)
- Context-Aware Discovery - Understands code relationships and suggests related implementations
- Multi-Strategy Search - Combines semantic, syntactic, and dependency-based search methods
- Graceful Error Recovery - Comprehensive error handling with intelligent retry mechanisms
๐ Connection Intelligence
- Repository-Package Mapping - Automatically links NPM packages to their GitHub repositories
- Dependency Tracing - Follows dependency chains across the entire ecosystem
- Cross-Reference Analysis - Finds how different projects implement similar patterns
- Ecosystem Understanding - Maps relationships between libraries, frameworks, and tools
๐ Universal Access & Discovery
- Cross-Privilege Search - Works with any access level you have (public, private, organization)
- Organization-Aware - Automatically detects and uses your GitHub organization memberships
- Smart Repository Discovery - Finds relevant repositories even when you don't know they exist
- Progressive Refinement - AI-guided search that gets more precise with each iteration
๐ Multi-Dimensional Analysis
- Code + Context - Combines source code with commits, issues, discussions, and documentation
- Historical Understanding - Tracks how implementations evolved over time
- Community Insights - Discovers patterns from real-world usage and discussions
- Quality Signals - Uses NPM publication and GitHub activity as quality indicators
Privacy & Security ๐ก๏ธ
- ๐ 100% Local - Runs entirely on your machine
- ๐ซ Zero Data Collection - No telemetry, logging, or data transmission
- ๐ No Token Management - Uses GitHub CLI authentication, no personal access tokens needed
- ๐ก๏ธ Privacy by Design - All API calls use your existing
ghCLI permissions directly
Command Execution Security ๐
Robust protection against prompt injections and malicious command execution:
- โช Allowlisted Commands Only - Only pre-approved, safe NPM and GitHub CLI commands are executable
- NPM:
view,search,ping,config,whoami - GitHub CLI:
search,api,auth,org
- NPM:
- ๐ก๏ธ Argument Sanitization - All command arguments are properly escaped to prevent shell injection attacks
- โ Pre-execution Validation - Every command is validated against allowed lists before execution
- ๐ง Controlled Environment - Commands run in a secure, cross-platform shell environment with controlled variables
- Cross-platform shells: Uses
/bin/shon Unix/macOS,cmd.exeorpowershell.exeon Windows - minimal, standard shells - PowerShell support: Modern Windows environments can optionally use PowerShell with enhanced security
- Why minimal shells are safe: Avoids user's potentially customized shells with aliases, functions, plugins, or advanced features
- Controlled variables: Only essential environment variables (
PATH,SHELL) are passed, preventing environment-based attacks - Platform-specific escaping: Uses appropriate argument escaping for each platform (single quotes on Unix, double quotes for CMD, single quotes for PowerShell)
- Cross-platform shells: Uses
- ๐ซ No Arbitrary Execution - System cannot execute arbitrary shell commands or scripts
- โฑ๏ธ Timeout Protection - All commands have execution timeouts to prevent resource exhaustion
Best Practices ๐ก
AI-Powered Search Tips:
- Let AI guide you - Start with natural language questions, the heuristic search will find relevant code
- Trust the smart fallbacks - If initial search doesn't work, AI automatically tries alternative strategies
- Explore connections - Ask about relationships between packages, libraries, and implementations
- Use any privilege level - Works seamlessly across public repos, private repos, and organization repositories
- Keep research along the MCP - Build upon previous searches and maintain context across multiple queries for deeper exploration
Effective Questions:
- Vague is OK - "How does authentication work?" โ AI finds relevant patterns across repositories
- Ask for connections - "What libraries use this pattern?" โ Discovers related implementations
- Cross-ecosystem queries - "NPM packages that implement X" โ Links packages to their repositories
- Evolution questions - "How has this approach changed?" โ Traces implementation history
Advanced Search Features:
- Automatic fallbacks - No need to retry failed searches, AI handles it automatically
- Smart discovery - Finds repositories and packages you didn't know existed
- Connection mapping - Understands relationships between different codebases
- Context preservation - Maintains search context across multiple queries
Troubleshooting ๐ง
Authentication Issues:
# Check GitHub CLI status
gh auth status
# Re-authenticate if needed
gh auth logout && gh auth login
# Check NPM access
npm whoami
Common Solutions:
- No results? Try broader search terms
- Private repos not found? Check organization membership with
gh auth status - NPX issues? Clear cache:
rm -rf ~/.npm/_npx
๐ข Organization & Private Repository Access:
- Automatic detection - Octocode automatically discovers your GitHub organizations
- No additional setup - If you have access to private repos through your organization, they work immediately
- Verify access - Run
gh auth statusto see your organization memberships
๐ป Windows PowerShell Support:
- Modern shell support - Optionally use PowerShell instead of cmd.exe on Windows
- Enhanced security - PowerShell provides better argument escaping and modern features
- Automatic detection - The system automatically detects Windows and applies appropriate shell configurations
- Zero configuration - Works seamlessly with existing setups, no additional configuration needed
Why GitHub CLI Authentication?
- โ No token creation - GitHub CLI handles OAuth flow automatically
- โ Enterprise compatible - Works with SSO, SAML, and 2FA out of the box
- โ Organization auto-detection - Automatically discovers your GitHub organizations and private repo access
- โ Works out of the box - If you work for an organization, private repositories are immediately accessible
- โ vs Personal Access Tokens - No manual creation, rotation, or security risks
Background ๐ญ
This project started as a personal tool while working at Wix, born from the challenge of navigating large codebases and keeping up with rapidly evolving technology landscapes. What began as a side project to solve daily development challenges evolved into the perfect code assistant that can help understand anything.
The goal was simple: make code exploration as intelligent as having a senior developer guide you through any codebase. Built specifically to understand connections between many repositories and NPM packages under any privilege the user has, with AI-powered heuristic search, smart fallbacks, and intelligent discovery.
License ๐
MIT License - See LICENSE for details.


