Back to Apps

ast-grep MCP Server
by integritystudio
Advanced structural code search, refactoring, and quality analysis powered by ast-grep.
0 stars
Works in:claude
Exposes:Tools
What it does
This MCP server provides a powerful interface for structural code search and manipulation using ast-grep. It allows AI assistants to perform pattern-based searches, safe code rewrites, complexity analysis, and automated deduplication across multi-language codebases.
Tools
find_code: Structural search using patterns or YAML rules.rewrite_code: Safe code transformations with backup and rollback.extract_function: Scope-aware function extraction with parameter detection.find_duplication: Detection of code duplicates using MinHash/LSH.analyze_complexity: Metrics for cyclomatic and cognitive complexity.detect_code_smells: Identification of common anti-patterns and smells.create_linting_rule: Define and apply custom linting templates.generate_docstrings: Automated documentation for functions and classes.
Installation
Add the following to your claude_desktop_config.json:
{
"mcpServers": {
"ast-grep": {
"command": "uv",
"args": ["--directory", "/absolute/path/to/ast-grep-mcp", "run", "main.py"]
}
}
}
Supported hosts
- Claude Desktop
Choose your AI client and follow the steps below.
Claude Desktop
{
"mcpServers": {
"ast-grep": {
"command": "uv",
"args": ["--directory", "/absolute/path/to/ast-grep-mcp", "run", "main.py"]
}
}
}





