ast-grep-mcp

MCP.Pizza Chef: ast-grep

Plain text search matches anything that merely looks similar. This understands the shape of code instead, so your assistant can find every call written a particular way, or every async function that really uses await, across a whole project. It covers JavaScript, TypeScript, Python, Rust, Go, Java, C, C++, C# and more, and works in Cursor, Claude Desktop, and similar tools. You install the free ast-grep command first. Updated in July 2026 and still labelled experimental.

Coding

Use This MCP server To

Find every place a function is called this way Locate all console.log statements left in the project Search for async functions that actually use await Test a search rule before running it everywhere Understand why my search pattern is not matching

README

ast-grep MCP Server

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

Overview

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:

  • Find code patterns based on syntax structure, not just text matching
  • Search for specific programming constructs (functions, classes, imports, etc.)
  • Write and test complex search rules using YAML configuration
  • Debug and visualize AST structures for better pattern development

Prerequisites

  1. Install ast-grep: Follow ast-grep installation guide

    # macOS
    brew install ast-grep
    nix-shell -p ast-grep
    cargo install ast-grep --locked
  2. Install uv: Python package manager

    curl -LsSf https://astral.sh/uv/install.sh | sh
  3. MCP-compatible client: Such as Cursor, Claude Desktop, or other MCP clients

Installation

  1. Clone this repository:

    git clone https://github.com/ast-grep/ast-grep-mcp.git
    cd ast-grep-mcp
  2. Install dependencies:

    uv sync
  3. Verify ast-grep installation:

    ast-grep --version

Running with uvx

You can run the server directly from GitHub using uvx:

uvx --from git+https://github.com/ast-grep/ast-grep-mcp ast-grep-server

This is useful for quickly trying out the server without cloning the repository.

ast-grep-mcp FAQ

Is this still maintained?
Yes, with updates as recently as July 2026, though the authors still describe it as experimental.
Which apps does it work in?
Cursor and Claude Desktop are documented, and other tools that support MCP servers work as well.
Do I need a paid key?
No. Everything here is free and runs on your own machine against your own files.
Can I use this to find leftover debug statements?
Yes. Asking for every console.log in a project is one of the most common requests.
How hard is setup?
Install ast-grep and the uv tool, then paste a small block into your app's settings file.
Which languages does it cover?
JavaScript, TypeScript, Python, Rust, Go, Java, C, C++, C#, and many more, plus custom ones you configure.