Skip to main content

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

  • Aggressive LRU caching with 50-90% speed improvements on repeated operations
  • Cache sizes optimized for 500+ file codebases (up to 300K entries)
  • Sub-microsecond response times on cache hits
  • Memory-efficient universal graph building
  • Comprehensive performance benchmarks 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

Installation

Method 1: Install from PyPI (Recommended)

  1. Install the package with multi-language support:
pip install code-graph-mcp ast-grep-py rustworkx
  1. Add to Claude Code using CLI:
claude mcp add --scope project code-graph-mcp code-graph-mcp
  1. Verify installation:
claude mcp list
code-graph-mcp --help

Method 2: Install from Source

  1. Clone and setup the project:
git clone <repository-url>
cd code-graph-mcp
uv sync  # Install dependencies including ast-grep-py
  1. 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
  1. 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

Development

Requirements

  • Python 3.12+
  • UV package manager
  • MCP SDK
  • ast-grep-py (for multi-language support)
  • rustworkx (for high-performance graph operations)

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

  • LRU Caching: 50-90% speed improvements with cache sizes up to 300K entries for large codebases
  • High-Performance Analytics: PageRank at 4.9M nodes/second, Betweenness Centrality at 104K nodes/second
  • Sub-microsecond Response: Cache hits deliver sub-microsecond response times for repeated operations
  • Memory Optimized: Cache configurations optimized for 500+ file codebases with 500MB memory allocation
  • Comprehensive Benchmarks: Performance monitoring with detailed cache effectiveness metrics

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 - comprehensive error handling, defensive security

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

code_graph_mcp-1.1.0.tar.gz (44.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

code_graph_mcp-1.1.0-py3-none-any.whl (48.7 kB view details)

Uploaded Python 3

File details

Details for the file code_graph_mcp-1.1.0.tar.gz.

File metadata

  • Download URL: code_graph_mcp-1.1.0.tar.gz
  • Upload date:
  • Size: 44.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.11

File hashes

Hashes for code_graph_mcp-1.1.0.tar.gz
Algorithm Hash digest
SHA256 21db5eeafbe152cbfa402bb23acd3de4bf0b22a12ab322200af2ead10edd7704
MD5 d9cdc7aa62d75f9f16a23f8d4cce285f
BLAKE2b-256 1e326e0480e744d37b84b81e1d37d5c714eff34403795a49d989cc4a939580a7

See more details on using hashes here.

File details

Details for the file code_graph_mcp-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: code_graph_mcp-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 48.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.11

File hashes

Hashes for code_graph_mcp-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d8799b4103b8b1516079ed8e9240bf12390695b1a251bfd39155110094955dc6
MD5 bcee8b33c53e045f4062d4d35beaa4cc
BLAKE2b-256 f4637a73be6554fb35b85e7ed2e6fa3eaa46b0867528e385916f947b7b8bb2f3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page