AST MCP

v1.0.0Developer Toolsstable

Provides advanced code structure and semantic analysis through Abstract Syntax Trees (AST) and Abstract Semantic Graphs (ASG) across multiple programming languages. It enables tasks like incremental parsing, complexity analysis, and AST diffing to he

asgastclaudecodingmcp-server
Share:
35
Stars
0
Downloads
0
Weekly
0/5

What is AST MCP?

AST MCP is a Model Context Protocol (MCP) server that allows AI assistants like Claude, Cursor, and VS Code to provides advanced code structure and semantic analysis through abstract syntax trees (ast) and abstract semantic graphs (asg) across multiple programming languages. it enables tasks like incremental p...

Provides advanced code structure and semantic analysis through Abstract Syntax Trees (AST) and Abstract Semantic Graphs (ASG) across multiple programming languages. It enables tasks like incremental parsing, complexity analysis, and AST diffing to he

This server falls under the Developer Tools and Coding Agents categories on MCPgee, the world's largest MCP server directory with 33,000+ servers.

Features

  • Provides advanced code structure and semantic analysis throu

Use Cases

Analyze code structure using Abstract Syntax Trees across languages.
Perform incremental parsing and complexity analysis.
Detect code changes and differences via AST diffing.
angrysky56

Maintainer

LicenseMIT License
Languagepython
Versionv1.0.0
UpdatedApr 21, 2026
Statushealthy
Maintenanceactive

Works with

ClaudeOpenAIwindowsmacoslinux

Installation

Manual Installation

npx ast-mcp-server

Configuration

Configuration Details

Config File

claude_desktop_config.json

Performance

Response Metrics

Response Time< 200ms
ThroughputMedium

Resource Usage

Memory UsageLow
CPU UsageLow

How to Set Up and Use AST MCP

The AST MCP Server provides AI assistants with deep code structure analysis by parsing source code into Abstract Syntax Trees (AST) and Abstract Semantic Graphs (ASG) across eight programming languages including Python, JavaScript, TypeScript, Go, Rust, C, C++, and Java. It enables structural queries, incremental parsing, complexity analysis, AST diffing, and node-level position lookup — turning code review and refactoring tasks from text scanning into structured graph traversal. This makes it especially valuable for large codebases where understanding dependencies and complexity is critical.

Prerequisites

  • Python 3.10 or later installed
  • uv package manager installed (recommended) or pip
  • Git to clone the repository
  • An MCP client such as Claude Desktop
1

Clone the repository

Clone the ast-mcp-server repository from GitHub to your local machine.

git clone https://github.com/angrysky56/ast-mcp-server.git
cd ast-mcp-server
2

Install dependencies

Use uv to install dependencies and sync the environment. uv is the recommended approach as it manages the virtual environment automatically.

uv sync
3

Build the tree-sitter parsers

Run the build-parsers step to compile the native tree-sitter grammar libraries for all supported languages. This is required before first use.

uv run build-parsers
4

Add the server to your MCP client config

Add the AstAnalyzer entry to your Claude Desktop claude_desktop_config.json, pointing to the directory where you cloned the repo.

{
  "mcpServers": {
    "AstAnalyzer": {
      "command": "uv",
      "args": ["--directory", "/path/to/ast-mcp-server", "run", "server.py"]
    }
  }
}
5

Restart Claude Desktop and test

Restart Claude Desktop to load the new server. Verify by asking Claude to parse a source file and describe its structure.

AST MCP Examples

Client configuration

Claude Desktop JSON config for the AST MCP Server — update the directory path to match your clone location.

{
  "mcpServers": {
    "AstAnalyzer": {
      "command": "uv",
      "args": ["--directory", "/Users/yourname/ast-mcp-server", "run", "server.py"]
    }
  }
}

Prompts to try

Example prompts that leverage AST and ASG analysis capabilities.

- "Parse this Python file and show me its Abstract Syntax Tree"
- "Generate an Abstract Semantic Graph for the main.ts file and identify all function dependencies"
- "What is the cyclomatic complexity of the checkout.py module?"
- "Show me the diff between the AST of the old and new versions of this file"
- "Find the node at line 42, column 8 in utils.go"
- "Which languages does this server support for AST parsing?"

Troubleshooting AST MCP

build-parsers step fails with missing compiler or linker errors

Install the system build tools required by tree-sitter: on macOS run xcode-select --install, on Ubuntu/Debian run sudo apt install build-essential, on Windows install Visual Studio Build Tools.

Server fails to start with 'module not found' error

Ensure you ran uv sync from inside the ast-mcp-server directory and that the --directory argument in your MCP config points to the correct absolute path of the cloned repository.

Language not supported or parser missing for a file type

Run uv run build-parsers again to ensure all grammars compiled successfully. The supported languages are Python, JavaScript, TypeScript, Go, Rust, C, C++, and Java — other languages are not currently supported.

Frequently Asked Questions about AST MCP

What is AST MCP?

AST MCP is a Model Context Protocol (MCP) server that provides advanced code structure and semantic analysis through abstract syntax trees (ast) and abstract semantic graphs (asg) across multiple programming languages. it enables tasks like incremental parsing, complexity analysis, and ast diffing to he It connects AI assistants to external tools and data sources through a standardized interface.

How do I install AST MCP?

Follow the installation instructions on the AST MCP GitHub repository. Clone the repo, install dependencies, and add the server config to your AI client.

Which AI clients work with AST MCP?

AST MCP works with all major MCP-compatible AI clients including Claude Desktop, Claude Code, Cursor, VS Code (GitHub Copilot), Windsurf, and Cline.

Is AST MCP free to use?

Yes, AST MCP is open source and available under the MIT License license. You can use it freely in both personal and commercial projects.

Browse More Developer Tools MCP Servers

Explore all developer tools servers available in the MCPgee directory. Each server includes setup guides for Claude, Cursor, and VS Code.

Quick Config Preview

{ "mcpServers": { "ast-mcp-server": { "command": "npx", "args": ["-y", "ast-mcp-server"] } } }

Add this to your claude_desktop_config.json or .cursor/mcp.json

Read the full setup guide →

Ready to use AST MCP?

Browse our complete directory of 33,000+ MCP servers, read setup guides for your editor, and start building with the Model Context Protocol.

33,000+ ServersFree & Open SourceStep-by-Step Guides