MCP Server Integration¶
Overview¶
Snapper includes an MCP (Model Context Protocol) server that exposes formatting tools to AI assistants like Claude Desktop and Claude Code.
Start it with:
snapper mcp
This launches the server on stdin/stdout using the MCP protocol.
The MCP feature must be enabled at build time:
cargo install snapper-fmt --features mcp
Configuration¶
Claude Desktop / Claude Code¶
Add to your MCP configuration:
{
"mcpServers": {
"snapper": {
"command": "snapper",
"args": ["mcp"]
}
}
}
Or with the npm wrapper:
{
"mcpServers": {
"snapper": {
"command": "npx",
"args": ["@turtletech/snapper-mcp"]
}
}
}
Tools¶
formattext¶
Format text with semantic line breaks.
Parameters:
text(string, required): Text to formatformat(string): Document format („org“, „latex“, „markdown“, „rst“, „plaintext“; default: „plaintext“)max_width(integer): Maximum line width (default: 0, unlimited)extra_abbreviations(array of strings): Additional abbreviations
Returns the formatted text.
detectformat¶
Detect document format from text content using heuristics.
Parameters:
text(string, required): Text to analyze
Returns the detected format string.
checkformatting¶
Check text for semantic line break violations.
Parameters:
text(string, required): Text to checkformat(string): Document format (default: „plaintext“)
Returns line numbers with violations and a pass/fail status.
splitsentences¶
Split text into individual sentences using Unicode-aware boundary detection.
Parameters:
text(string, required): Text to split
Returns an array of sentence strings.