Deep Codebase Intelligence for Claude Desktop
Claude CodeGraph is a Model Context Protocol (MCP) server that provides Claude Desktop with deep, multi-layered understanding of your codebase. Unlike simple file readers, CodeGraph builds a living knowledge graph of your code, understanding not just syntax but relationships, patterns, and impact.
CodeGraph introduces Progressive Codebase Intelligence - a 5-phase indexing system that gradually builds deeper understanding:
- Syntax Understanding β Parse and understand code structure
- Relationship Mapping β Build a graph of how code connects
- Semantic Intelligence β Understand meaning and similarity
- Temporal Awareness β Track evolution and patterns over time
- Query Intelligence β Smart routing and context building
This progressive approach means Claude can start helping immediately while building deeper insights in the background.
When working with large codebases, AI assistants often lack the context to provide meaningful help. They can read individual files but miss the bigger picture - how components connect, what impacts what, and where the important patterns are.
CodeGraph gives Claude a "mental model" of your entire codebase:
- Instant Navigation: Find implementations across thousands of files in seconds
- Impact Analysis: Understand what breaks when you change something
- Architecture Understanding: See the big picture of how your system fits together
- Smart Search: Find code by meaning, not just text matching
- Change Intelligence: Know what's frequently modified and needs attention
"Find where user authentication is implemented"
"Show me all API endpoints"
"Where is the database connection configured?"
"What functions call processPayment?"
"Show me the dependency chain for UserService"
"What would be affected if I change this interface?"
"Explain the architecture of this codebase"
"What are the main modules and how do they interact?"
"Identify architectural patterns used in this project"
"What's the impact of changing the User model?"
"Show me the critical paths in the codebase"
"What are the most coupled components?"
"What are the code hotspots?"
"Which files change together frequently?"
"Where is technical debt accumulating?"
- Multi-language AST parsing (JavaScript, TypeScript, Python, Go, Rust, Java)
- Function, class, and variable extraction
- Import/export dependency tracking
- Comprehensive code structure understanding
- SQLite-powered relationship database
- Directed graph of code dependencies
- Bidirectional relationship tracking
- Weighted connections based on usage
- Local transformer models for embeddings
- Semantic similarity search
- Context-aware code matching
- Fallback to intelligent text matching
- Git history integration
- Change pattern detection
- Co-modification analysis
- Refactoring detection
- Intent classification
- Multi-strategy search
- Progressive context building
- Result ranking and filtering
CodeGraph doesn't make you wait. It provides value immediately and gets smarter over time:
Phase 1 (0-10s): Basic syntax analysis available
Phase 2 (10-30s): Relationship graph ready
Phase 3 (30-60s): Semantic search online
Phase 4 (1-2min): Git history analyzed
Phase 5 (2min+): Full intelligence available
| Tool | Description | Capability Required |
|---|---|---|
get_indexing_status |
Real-time indexing progress | Always available |
get_capabilities |
Check available features | Always available |
wait_for_indexing |
Wait for analysis completion | Always available |
analyze_codebase |
Full codebase analysis | Syntax analysis |
find_implementation |
Semantic code search | Syntax analysis |
trace_execution |
Execution path tracing | Graph relationships |
impact_analysis |
Change impact assessment | Graph relationships |
explain_architecture |
Architecture explanation | Graph relationships |
| Resource | Description | Updates |
|---|---|---|
codegraph://architecture |
High-level architecture view | On file change |
codegraph://dependencies |
Dependency visualization | On package change |
codegraph://hotspots |
Frequently changed code | On git commit |
codegraph://status |
Current indexing status | Real-time |
codegraph://metrics |
Code quality metrics | On indexing complete |
- Clone the repository:
git clone https://github.com/chatcbdai/claude-codegraph-mcp.git
cd claude-codegraph-mcp- Install and build:
npm install
npm run build- Add to Claude Desktop configuration:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"codegraph": {
"command": "node",
"args": ["/absolute/path/to/claude-codegraph-mcp/dist/index.js"]
}
}
}- Restart Claude Desktop
See detailed installation guide for IDE integration and advanced configuration.
Get started quickly with our comprehensive guides:
Complete setup instructions for Claude Desktop, IDE integration, and troubleshooting.
Leverage CodeGraph's full power directly from VS Code's integrated terminal with automatic workspace detection.
Master CodeGraph from the command line with project navigation, advanced workflows, and Mac-specific tips.
Once installed, CodeGraph automatically activates when you open Claude Code in a project directory. No manual activation needed!
Understanding Code:
"Explain how the authentication system works"
"What's the data flow for processing orders?"
"How is caching implemented in this project?"
Finding Code:
"Where is the email validation logic?"
"Find all database queries related to users"
"Show me the API rate limiting implementation"
Analyzing Impact:
"What happens if I change the Product schema?"
"Which components depend on the Redis client?"
"What's the blast radius of refactoring UserService?"
Architecture Review:
"Identify architectural anti-patterns"
"What are the most complex parts of the codebase?"
"Show me the service boundaries"
| Codebase Size | Initial Index | Incremental Update | Memory Usage |
|---|---|---|---|
| Small (< 1K files) | 5-10s | < 1s | ~100MB |
| Medium (1K-10K) | 30-60s | 1-2s | ~500MB |
| Large (10K-50K) | 2-5min | 2-5s | ~2GB |
CodeGraph includes several optimizations:
- Incremental indexing for file changes
- Parallel processing for multi-core systems
- Smart caching of embeddings and relationships
- Lazy loading of analysis modules
- Project-specific databases for isolation
| Variable | Description | Default |
|---|---|---|
CODEGRAPH_MAX_FILES |
Maximum files to index | 10000 |
CODEGRAPH_INDEX_DEPTH |
Directory traversal depth | 10 |
CODEGRAPH_ENABLE_GIT |
Enable git analysis | true |
CODEGRAPH_IGNORE_PATTERNS |
Additional ignore patterns | none |
By default, CodeGraph ignores:
node_modules/.git/dist/,build/- Binary files
- Files over 1MB
βββββββββββββββββββββββββββββββββββββββββββββββββββ
β Claude Desktop β
ββββββββββββββββββββββ¬βββββββββββββββββββββββββββββ
β MCP Protocol
ββββββββββββββββββββββΌβββββββββββββββββββββββββββββ
β CodeGraph MCP Server β
ββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β ββββββββββββββββ ββββββββββββββββ β
β β Handlers β β Auto-Indexer β β
β ββββββββ¬ββββββββ ββββββββ¬ββββββββ β
β β β β
β ββββββββΌβββββββββββββββββββΌβββββββ β
β β Core Indexer β β
β ββββββββ¬βββββββββββββββββββββββββββ β
β β β
β ββββββββΌββββββββ¬βββββββββ¬βββββββββββ β
β β Parser β Graph β Embeddingsβ β
β ββββββββββββββββ΄βββββββββ΄βββββββββββ β
β β
β ββββββββββββββββββββββββββββββββββββββ β
β β Intelligence Modules β β
β β ββββββββββ ββββββββββ ββββββββββ β β
β β βSemanticβ βTemporalβ β Query β β β
β β ββββββββββ ββββββββββ ββββββββββ β β
β ββββββββββββββββββββββββββββββββββββββ β
ββββββββββββββββββββββββββββββββββββββββββββββββββββ
- File System β Parser β AST Extraction
- AST β Graph Builder β Relationships
- Code Content β Embeddings β Semantic Index
- Git History β Temporal Analyzer β Patterns
- All Indexes β Query Router β Results
- β
JavaScript/TypeScript (
.js,.jsx,.ts,.tsx) - β
Python (
.py) - β
Go (
.go) - β
Rust (
.rs) - β
Java (
.java)
β οΈ C/C++ (basic parsing)β οΈ Ruby (basic parsing)β οΈ PHP (basic parsing)
- π C# / .NET
- π Swift
- π Kotlin
We welcome contributions! Please submit issues and pull requests on GitHub.
# Clone the repository
git clone https://github.com/chatcbdai/claude-codegraph-mcp.git
cd claude-codegraph-mcp
# Install dependencies
npm install
# Run in development mode
npm run dev
# Run tests
npm test
# Type checking
npm run typecheck- C# and .NET support
- WebAssembly module for browser-based indexing
- Real-time collaborative indexing
- Custom query language
- Machine learning-based pattern detection
- Automated refactoring suggestions
- Cross-repository intelligence
- IDE plugins for real-time sync
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Documentation: How-To Guides
MIT License - see LICENSE file for details.
Built with:
- Model Context Protocol by Anthropic
- Tree-sitter for parsing
- Transformers.js for embeddings
- Better-SQLite3 for graph storage
Made with β€οΈ for the Claude Desktop community