Ast Grep MCP Server

An experimental [Model Context Protocol (MCP)](https://modelcontextprotocol.io/) server that provides AI assistants with powerful structural code

Local serverstdioPython

What is the Ast Grep MCP Server?

An experimental Model Context Protocol (MCP) server that provides AI assistants with powerful structural code search capabilities using ast-grep.

What Ast Grep MCP does

This MCP server enables AI assistants (like Cursor, Claude Desktop, etc.) to search and analyze codebases using Abstract Syntax Tree (AST) pattern matching rather than simple text-based search. By leveraging ast-grep's structural search capabilities, AI can:

Requirements

  1. Install ast-grep: Follow ast-grep installation guide 2. Install uv: Python package manager 3. MCP-compatible client: Such as Cursor, Claude Desktop, or other MCP clients

Practical notes

  • Maintained by ast-grep, written in Python.

More MCP options

Compare MCP servers by category, or browse hosted MCP servers if you prefer an endpoint over a local process.

Maintainer setup documentation.

How to install the Ast Grep MCP Server

{
  "mcpServers": {
    "ast-grep": {
      "command": "uv",
      "args": [
        "--directory",
        "/absolute/path/to/ast-grep-mcp",
        "run",
        "main.py"
      ],
      "env": {}
    }
  }
}

From the project documentation. Replace placeholders and example paths before connecting.

Configuration

  1. Install ast-grep: Follow ast-grep installation guide 2. Install uv: Python package manager 3. MCP-compatible client: Such as Cursor, Claude Desktop, or other MCP clients

Frequently asked questions

An experimental [Model Context Protocol (MCP)](https://modelcontextprotocol.io/) server that provides AI assistants with powerful structural code search Confirm the tools offered by your installed version in the connected client. Tool availability and permissions depend on the server and account configuration.