Splice Weaver MCP
An MCP (Model Context Protocol) server that provides ast-grep functionality to language models with automatic binary bundling and dual support for both direct CLI access and guided workflows.
Features
Core Tools
- find_scope: Universal scope navigation using relational rules
- execute_rule: Rule-based operations (search, replace, scan)
Binary Bundling
- Automatic Download: ast-grep binary (v0.38.7) is automatically downloaded if not found
- Multi-Platform Support: Supports Linux (x86_64, aarch64), macOS (Intel, Apple Silicon), Windows
- System Binary Detection: Uses system-installed ast-grep if available, otherwise downloads bundled version
MCP Resources
- ast-grep://binary-path: Get the path to the ast-grep executable
- ast-grep://cli-reference: Complete CLI documentation with bundled binary path
- ast-grep://rule-examples: YAML rule configuration examples
- ast-grep://relational-patterns: Examples of relational rules for scope navigation
- ast-grep://node-kinds: Tree-sitter node types by language
MCP Prompts
- scope_navigation_rule: Generate YAML rules to find specific scope types
- transform_in_scope: Generate YAML rules to transform code within scopes
Prerequisites
- Rust toolchain
- No ast-grep installation required - the server bundles the binary automatically
Installation
# From GitHub
cargo install --git https://github.com/micahscopes/splice-weaver-mcp
Usage
As MCP Server
Add to your MCP client configuration:
{
"mcp": {
"servers": {
"ast-grep": {
"command": "splice-weaver-mcp",
"args": []
}
}
}
}
Direct Usage
# If installed via cargo install
splice-weaver-mcp
# If built manually
./target/release/splice-weaver-mcp
Binary Management
The server automatically manages the ast-grep binary:
- System Check: First checks if ast-grep is installed on the system
- Auto-Download: If not found, downloads the appropriate binary for your platform
- Bundled Storage: Stores the binary in
./bundled_binaries/
relative to the executable
Supported platforms:
- Linux x86_64 (
x86_64-unknown-linux-gnu
) - Linux ARM64 (
aarch64-unknown-linux-gnu
) - macOS Intel (
x86_64-apple-darwin
) - macOS Apple Silicon (
aarch64-apple-darwin
) - Windows x64 (
x86_64-pc-windows-msvc
) - Windows x86 (
i686-pc-windows-msvc
)
Design Philosophy
This server implements a dual approach to ast-grep access:
- Direct Access: Full CLI power for experienced users and large LLMs
- Guided Workflows: Structured templates and examples for small LLMs
For complete ast-grep documentation, visit: https://ast-grep.github.io/
Documentation
Comprehensive project documentation is available in the notes-log/
directory:
- Project Evolution Summary - Complete overview and goals
- Design Decisions - Architecture and research-driven design
- Interface Summary - Technical implementation details
- Testing Guide - Comprehensive testing approach
- Full Documentation Index - Complete navigation guide
License
MIT