MCP server for multi-language code graph intelligence and analysis across 25+ programming languages
Project description
Code Graph MCP Server
Model Context Protocol server providing comprehensive code analysis, navigation, and quality assessment capabilities across 25+ programming languages.
Features
🌍 Multi-Language Support
- 25+ Programming Languages: JavaScript, TypeScript, Python, Java, C#, C++, C, Rust, Go, Kotlin, Scala, Swift, Dart, Ruby, PHP, Elixir, Elm, Lua, HTML, CSS, SQL, YAML, JSON, XML, Markdown, Haskell, OCaml, F#
- Intelligent Language Detection: Extension-based, MIME type, shebang, and content signature analysis
- Framework Recognition: React, Angular, Vue, Django, Flask, Spring, and 15+ more
- Universal AST Abstraction: Language-agnostic code analysis and graph structures
🔍 Advanced Code Analysis
- Complete codebase structure analysis with metrics across all languages
- Universal AST parsing with ast-grep backend and intelligent caching
- Cyclomatic complexity calculation with language-specific patterns
- Project health scoring and maintainability indexing
- Code smell detection: long functions, complex logic, duplicate patterns
- Cross-language similarity analysis and pattern matching
🧭 Navigation & Search
- Symbol definition lookup across mixed-language codebases
- Reference tracking across files and languages
- Function caller/callee analysis with cross-language calls
- Dependency mapping and circular dependency detection
- Call graph generation across entire project
⚡ Performance Optimized
- Multi-language AST caching with mtime invalidation
- Intelligent file discovery with language-aware filtering
- Memory-efficient universal graph building
- Parallel processing for multi-language projects
- Comprehensive cache statistics and monitoring
🏢 Enterprise Ready
- Production-quality error handling across all languages
- Comprehensive logging and monitoring with language context
- UV package management with ast-grep integration
- 10.00/10 pylint score with comprehensive test coverage
Installation
Method 1: Install from PyPI (Recommended)
- Install the package with multi-language support:
pip install code-graph-mcp ast-grep-py
- Add to Claude Code using CLI:
claude mcp add --scope project code-graph-mcp code-graph-mcp
- Verify installation:
claude mcp list
code-graph-mcp --help
Method 2: Install from Source
- Clone and setup the project:
git clone <repository-url>
cd code-graph-mcp
uv sync # Install dependencies including ast-grep-py
- Add to your Claude Code configuration:
For local project configuration (recommended):
# This creates/updates .mcp.json in your current project
claude mcp add --scope project code-graph-mcp uv run code-graph-mcp
For user-wide configuration:
# This configures across all your projects
claude mcp add --scope user code-graph-mcp uv run code-graph-mcp
- Restart Claude Code
Method 3: Development Installation
For contributing to the project:
git clone <repository-url>
cd code-graph-mcp
uv sync --dev
uv build # Creates wheel and source distribution
Available Tools
The MCP server provides 8 comprehensive analysis tools that work across all 25+ supported languages:
| Tool | Description | Multi-Language Features |
|---|---|---|
analyze_codebase |
Complete project analysis with structure metrics and complexity assessment | Language detection, framework identification, cross-language dependency mapping |
find_definition |
Locate symbol definitions with detailed metadata and documentation | Universal AST traversal, language-agnostic symbol resolution |
find_references |
Find all references to symbols throughout the codebase | Cross-file and cross-language reference tracking |
find_callers |
Identify all functions that call a specified function | Multi-language call graph analysis |
find_callees |
List all functions called by a specified function | Universal function call detection across languages |
complexity_analysis |
Analyze code complexity with refactoring recommendations | Language-specific complexity patterns, universal metrics |
dependency_analysis |
Generate module dependency graphs and import relationships | Cross-language dependency detection, circular dependency analysis |
project_statistics |
Comprehensive project health metrics and statistics | Multi-language project profiling, maintainability indexing |
Usage Examples
Once installed, you can use the tools directly in Claude Code for multi-language projects:
Analyze this React/TypeScript frontend with Python backend - show me the overall structure and complexity metrics
Find all references to the function "authenticate" across both the Java services and JavaScript frontend
Show me functions with complexity higher than 15 across all languages that need refactoring
Generate a dependency graph showing how the Python API connects to the React components
Detect code smells and duplicate patterns across the entire multi-language codebase
Configuration Options
The server accepts these command-line arguments:
--project-root: Project directory to analyze (defaults to current directory)--verbose: Enable detailed logging for debugging
Development
Requirements
- Python 3.12+
- UV package manager
- MCP SDK
- ast-grep-py (for multi-language support)
Running locally
# Install dependencies
uv sync
# Run the server directly
uv run code-graph-mcp --project-root /path/to/your/project --verbose
# Test with help
uv run code-graph-mcp --help
Performance Features
- Multi-Language AST Caching: 50-90% faster repeated analysis with
@lru_cache(maxsize=256)across all 25+ languages - Intelligent File Discovery: Language-aware file discovery with framework detection and .gitignore support
- Universal Graph Building: Memory-efficient incremental graph construction for mixed-language codebases
- Parallel Processing: Concurrent analysis of multiple languages with intelligent routing
- Statistics: Comprehensive cache hit/miss monitoring with language-specific breakdowns
Supported Languages
| Category | Languages | Count |
|---|---|---|
| Web & Frontend | JavaScript, TypeScript, HTML, CSS | 4 |
| Backend & Systems | Python, Java, C#, C++, C, Rust, Go | 7 |
| JVM Languages | Java, Kotlin, Scala | 3 |
| Functional | Elixir, Elm | 2 |
| Mobile | Swift, Dart | 2 |
| Scripting | Ruby, PHP, Lua | 3 |
| Data & Config | SQL, YAML, JSON, TOML | 4 |
| Markup & Docs | XML, Markdown | 2 |
| Additional | Haskell, OCaml, F# | 3 |
| Total | 25+ |
Status
✅ Multi-Language Support - 25+ programming languages with ast-grep backend
✅ MCP SDK integrated - Full protocol compliance across all languages
✅ Universal Architecture - Language-agnostic graph structures and analysis
✅ Server architecture complete - Enterprise-grade multi-language structure
✅ Core tools implemented - 8 comprehensive analysis tools working across all languages
✅ Performance optimized - Multi-language AST caching with intelligent routing
✅ Production ready - 10.00/10 pylint score, comprehensive error handling, defensive security
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file code_graph_mcp-1.0.5.tar.gz.
File metadata
- Download URL: code_graph_mcp-1.0.5.tar.gz
- Upload date:
- Size: 27.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c10d0d18a81683e2d1b941e7086261552747d3d4fa6a0e539be77f00a745dec6
|
|
| MD5 |
d6e3232b702254e60c42a27510e076c2
|
|
| BLAKE2b-256 |
0b06abe5a170b8d0d878e75816a830b58b666007682d59b067205a2020fa7b43
|
File details
Details for the file code_graph_mcp-1.0.5-py3-none-any.whl.
File metadata
- Download URL: code_graph_mcp-1.0.5-py3-none-any.whl
- Upload date:
- Size: 30.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
94d72be02b8e199901d351af709fc6531ba2c011c7ee028055a9fbad51af3b06
|
|
| MD5 |
576251c8b191fcd144398e50013ae884
|
|
| BLAKE2b-256 |
b3aab254e2eecd8516d5973b075b836eb5b135456266126190b66104b68daed3
|