ast-grep-mcp MCP Server

MCP server that exposes ast-grep (sg) as two tools for structural code search.

Local serverstdio

What is the ast-grep-mcp Server?

ast-grep-mcp is an MCP project maintained in the isco0819/ast-grep-mcp repository. The maintainer describes its purpose as “MCP server that exposes ast-grep (sg) as two tools for structural code search”. Read the project documentation for the complete scope.

Local setup

The project provides a local client configuration using node. Follow the repository’s build and installation steps before copying it, and replace example paths with the paths on your own computer.

Source

Project documentation · Repository · Discovery listing. This profile records the public documentation checked on 2026-10-08.

Recorded tools

Check the linked publisher documentation and your connected client's tool list. Names and availability can vary with the server version and account permissions.

ToolWhat it does
paramtype
langstring
patternstring
dirstring
async-no-catchawait expressions — check for missing try/catch
hooks-missing-depsuseEffect(..., []) — empty deps may hide missing dependencies
route-no-authExpress app.METHOD(path, handler) — routes that may lack auth middleware
sql-no-paramTemplate-literal SQL strings — potential injection risk
promise-no-returnnew Promise(...) bodies — check all paths resolve/reject
ast_search
ast_search_preset

How to install the ast-grep-mcp Server

{
  "mcpServers": {
    "ast-grep": {
      "command": "node",
      "args": [
        "/absolute/path/to/ast-grep-mcp/src/index.js"
      ]
    }
  }
}

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