Ast Grep MCP enables AI assistants to perform structural code search and analysis using Abstract Syntax Tree pattern matching through the ast-grep tool, allowing syntax-based pattern discovery rather than simple text matching. The server provides tools for finding specific programming constructs (functions, classes, imports), writing complex YAML search rules, and debugging AST structures for pattern development. It integrates with MCP-compatible clients like Cursor and Claude Desktop to give AI assistants powerful codebase analysis capabilities beyond traditional text search.
claude mcp add --transport stdio ast-grep-ast-grep-mcp uvx ast-grep-mcp