Get the FREE Ultimate OpenClaw Setup Guide →

ast

By transforming source code into a queryable Semantic Graph and a structured AST, this tool bridges the gap between "reading text" and "understanding structure." For an AI assistant, it provides the "spatial" awareness needed to navigate deep dependencies without getting lost in large files.

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio angrysky56-ast-mcp-server uv --directory /absolute/path/to/ast-mcp-server/ast_mcp_server run server.py

How to use

This MCP server provides code analysis capabilities based on Abstract Syntax Trees (AST) and Abstract Semantic Graphs (ASG). It supports multiple languages (Python, JavaScript/TypeScript, Go, Rust, C/C++, Java) and offers a suite of tools for parsing, analyzing, and caching results to speed up repeated work. You can access these tools through MCP-compatible clients such as Claude Desktop, which can query the server for tasks like parsing code into an AST, generating an ASG, performing structural analysis, and retrieving incremental or cached results. The server is designed to work locally, leveraging tree-sitter parsers and a robust caching layer to accelerate repetitive analyses on large codebases.

How to install

Prerequisites:\n- Python 3.9 or higher\n- uv package manager (recommended) or pip\n\nOption A: Using uv (Recommended)\n1) Clone the repository and enter the project directory:\n\nbash\ngit clone https://github.com/angrysky56/ast-mcp-server.git\ncd ast-mcp-server\n````\n2) Install the project in development mode with all dependencies:\n\nbash\nuv sync\n\n3) Build the tree-sitter parsers:\n\n```bash\nuv run build-parsers\n\n\nOption B: Using pip (Alternative)\n1) Create and activate a virtual environment:\n\nbash\npython -m venv .venv\nsource .venv/bin/activate # On Windows: .venv\Scripts\activate\n````\n2) Install dependencies in editable mode:\n\nbash\npip install -e .\n\n3) Build parsers:\n\n```bash\npython build_parsers.py\n

Additional notes

Tips and common considerations:\n- Ensure you have all required tree-sitter language packages installed when adding support for new languages: uv add tree-sitter-<language> (e.g., tree-sitter-python).\n- The server caches results to speed up repeated queries. You may need to clear or refresh caches if you modify parsers or language support.\n- If you encounter parser or language loading issues, rebuild parsers with uv run build-parsers and verify that the necessary tree-sitter language packages are available.\n- When configuring Claude Desktop or other MCP clients, specify the absolute path to the server working directory (the example uses the path in the repository).\n- Development and testing commands are provided under the Development section of the README; run tests with uv run pytest.\n- The server supports incremental parsing and enhanced ASG tools for more robust analysis across large codebases.

Related MCP Servers

Sponsor this space

Reach thousands of developers