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.0.8.tar.gz (39.8 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.0.8-py3-none-any.whl (44.2 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for code_graph_mcp-1.0.8.tar.gz
Algorithm Hash digest
SHA256 4d69c46b5f6cbe3f6885ee450c64ebdaa5b8b73a886567d5c28f09dd9fda7c21
MD5 b5f8618c3fda0fba92e239c3acf356d4
BLAKE2b-256 b03555218e88494a072d647ed5f185d250d1490e8743f4192d52bb74f3505cac

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for code_graph_mcp-1.0.8-py3-none-any.whl
Algorithm Hash digest
SHA256 337e5b471f0474a412c96b7b310ad59c88fd5e665855d53114b5ff559d3daae2
MD5 9f1ca02d75cec82b01d5dc4d52f61c42
BLAKE2b-256 66f39a222af5472aed9bbe12f894b0b9ad8ed57c8103975616bf3c354612f4d6

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