AST

Provides code structure and semantic analysis via ASTs and ASGs across Python, JavaScript, Go, Rust, and more.
  • python

26

GitHub Stars

python

Language

5 months ago

First Indexed

2 months ago

Catalog Refreshed

Documentation & install

Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.

Installation

Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "angrysky56-ast-mcp-server": {
      "command": "uv",
      "args": [
        "--directory",
        "/home/ty/Repositories/ai_workspace/ast-mcp-server/ast_mcp_server",
        "run",
        "server.py"
      ]
    }
  }
}

AST MCP Server enables local, plug-in style code analysis by parsing source code into Abstract Syntax Trees (ASTs) and producing Abstract Semantic Graphs (ASGs). It supports multiple languages and provides fast, incremental parsing with local caching, making it practical to analyze code efficiently within MCP-enabled clients like Claude Desktop.

How to use

You use the AST MCP Server by connecting an MCP client to run the local analysis tools. The server exposes functions to parse code into ASTs, generate ASGs, and analyze structure and complexity across supported languages. You configure your MCP client to start the server locally and then call the available tools to analyze code you share in chats or documents.

How to install

Prerequisites you need before installation include Python 3.9 or higher and the uv package manager (recommended) for managing MCP services.

Using uv (Recommended) start here:

# Clone the project
git clone https://github.com/angrysky56/ast-mcp-server.git
cd ast-mcp-server

# Install the project in development mode with all dependencies
uv sync

# Optional extras for development
uv sync --extra dev
uv sync --extra testing
uv sync --extra docs

# Build the tree-sitter parsers
uv run build-parsers

Additional setup for Claude Desktop integration

To connect Claude Desktop to the local AST MCP Server, configure Claude Desktop to load the server as an MCP endpoint. Provide the following configuration path placeholders and a local command that starts the server.

{
  "mcpServers": {
    "AstAnalyzer": {
      "command": "uv",
      "args": [
        "--directory",
        "/home/ty/Repositories/ai_workspace/ast-mcp-server/ast_mcp_server",
        "run",
        "server.py"
      ]
    }
  }
}

Starting and using the server

Start Claude Desktop after your MCP endpoint is configured. The server runs locally, parses code, and returns results to Claude Desktop for display and assistance. Use the client to share code snippets or files, and invoke the available analysis tools to view ASTs, ASGs, and code structure metrics.

Troubleshooting and notes

Common issues include parser-related errors or connection problems with Claude Desktop. If you encounter issues, rebuild parsers, verify the paths in your Claude Desktop configuration, ensure the MCP runner (uv) is accessible from your system PATH, and restart Claude Desktop after making changes.

For development, you can run tests and quality checks locally to ensure stability before using the server in production. Follow the development steps to install with development dependencies, run tests, and check code quality.

Available tools

parse_to_ast

Parse code into an Abstract Syntax Tree (AST) to reveal the code’s structural tree.

generate_asg

Create an Abstract Semantic Graph (ASG) from code to relate semantic entities and usages.

analyze_code

Analyze code structure and complexity to identify hotspots and relationships.

supported_languages

Return the list of programming languages supported by the server.

parse_and_cache

Parse code into an AST and cache it locally for fast resource access.

generate_and_cache_asg

Generate an ASG from code and cache it for quick reuse.

analyze_and_cache

Analyze code and cache results for repeated, efficient access.

parse_to_ast_incremental

Parse code with incremental parsing for faster processing of large files.

generate_enhanced_asg

Generate an enhanced ASG with improved scope handling.

diff_ast

Compute differences between two versions of code by comparing their ASTs.

find_node_at_position

Locate a specific AST node at a given line and column.

parse_and_cache_incremental

Parse code incrementally and cache the results.

generate_and_cache_enhanced_asg

Generate an enhanced ASG and cache the results for resource access.

ast_diff_and_cache

Generate an AST diff and cache it for fast retrieval.

Built by
VeilStrat
AI signals for GTM teams
© 2026 VeilStrat. All rights reserved.All systems operational
AST MCP Server - angrysky56/ast-mcp-server | VeilStrat