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

  • 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)

  1. Install the package with multi-language support:
pip install code-graph-mcp ast-grep-py
  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

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


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.4.tar.gz (33.1 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.4-py3-none-any.whl (30.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: code_graph_mcp-1.0.4.tar.gz
  • Upload date:
  • Size: 33.1 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.4.tar.gz
Algorithm Hash digest
SHA256 0b7efc7e98ac32bbdcf07f4fc2fc8765783f11cd296fde22f6195919847a2122
MD5 9e2c040758346d346876059c07148729
BLAKE2b-256 9bb723e1f852256e32aff00680d4dd5121706680f546bdd7e61022a38dcb0293

See more details on using hashes here.

File details

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

File metadata

  • Download URL: code_graph_mcp-1.0.4-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

Hashes for code_graph_mcp-1.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 3ca7e7b6b39d86531ebb806d8fb17ca17aba27d72eca0b46de9c4d59c0796d9b
MD5 3834fdda9f8b6f9b640c27b4eb42c915
BLAKE2b-256 c2a86b10677f8d7a5e06f9e9599bba76d25d41aa470cbb3b4dd5dc09d63fdfc2

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