Get the FREE Ultimate OpenClaw Setup Guide →

ast2llm-go

Powerful MCP-server that parses Go source code into AST and converts it into a clean, LLM-friendly format.

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio ast2llm-ast2llm-go ast2llm-go

How to use

AST2LLM for Go provides a dedicated tool, parse-go, that analyzes a Go project structure and identifies external type declarations to package context for LLM prompts. This enables quicker, more accurate context injection when you query the model about code entities such as structs, interfaces, and variables. You can integrate the server with common MCP clients (Cursor, Claude Desktop, VS Code, etc.) by pointing them at the ast2llm-go executable, which will expose the parse-go capability to your editor or IDE workflow. Typical usage involves running the server as a local process and using the provided tool to generate context from your Go codebase, which the LLM can then reference in prompts.

To use the tools, install ast2llm-go on your system, ensure it’s reachable in your PATH, and configure your MCP client with the server name (for example go-ast). The parse-go tool will analyze the project, extract relevant type information, and return a structured snippet of context such as struct definitions and their fields, which you can embed into prompts to guide the model’s understanding of your codebase.

How to install

Prerequisites:

  • A working shell with curl and sh available
  • Internet access to download the installation script
  • Optional: an installation directory in PATH if you don’t want to install globally
  1. Install ast2llm-go (latest release) via the official installer script:
curl -LsSf https://raw.githubusercontent.com/ast2llm/ast2llm-go/main/install.sh | sh
  1. (Optional) Install to a custom directory and add to PATH:
curl -LsSf https://raw.githubusercontent.com/ast2llm/ast2llm-go/main/install.sh | sh -s -- --install-dir /usr/local/bin
  1. Verify installation:
which ast2llm-go
ast2llm-go --help
  1. Self-update: re-run the installer script to fetch the latest version:
curl -LsSf https://raw.githubusercontent.com/ast2llm/ast2llm-go/main/install.sh | sh
  1. Uninstall (if needed):
curl -LsSf https://raw.githubusercontent.com/ast2llm/ast2llm-go/main/uninstall.sh | sh

Notes:

  • The install script automatically detects your OS/architecture and installs the appropriate binary.
  • If you configured a custom install directory, ensure it is added to your PATH so you can run ast2llm-go from anywhere.

Additional notes

Tips and considerations:

  • The project is under active development, so you may encounter parsing edge cases or limited type support in some Go codebases. Check the GitHub issues for known issues and fixes.
  • If you’re integrating with MCP clients, ensure the client configuration points to the go-ast server name (e.g., go-ast) and references the ast2llm-go executable.
  • The parse-go tool focuses on extracting relevant code structure to facilitate prompt construction; for large codebases, cross-file dependency resolution is supported, but multi-file analysis may be improved in future releases.
  • If you run into PATH issues after installation, verify the directory containing ast2llm-go is in your PATH and reopen your terminal or IDE.

Related MCP Servers

Sponsor this space

Reach thousands of developers