VaclavSynacek/parinfer-mcp-server
If you are the rightful owner of parinfer-mcp-server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to dayong@mcphub.com.
An MCP server utilizing the parinfer-rust library to correct parentheses in Clojure code based on indentation.
Parinfer MCP Server
An MCP (Model Context Protocol) server that uses the parinfer-rust library to automatically fix parentheses and brackets in Clojure code based on indentation.
Purpose
This server is designed to help LLMs correct Clojure code when parentheses are mismatched or incorrectly nested. It takes Clojure code with correct indentation but potentially incorrect parentheses/brackets and outputs corrected code.
Building
make build
The binary will be available at target/release/parinfer-mcp-server.
Usage
The MCP server can be used with any MCP-compatible client (like Claude Desktop, Cline, etc.).
Configuration
Add to your MCP client configuration:
Claude Desktop (~/Library/Application Support/Claude/claude_desktop_config.json on macOS):
{
"mcpServers": {
"parinfer": {
"command": "/absolute/path/to/parinfer-mcp/target/release/parinfer-mcp-server"
}
}
}
For other platforms and clients, see .
Available Tools
The MCP server provides one tool:
- fix_parens: Fixes mismatched or missing closing parentheses in Clojure code based on indentation
- Input:
code(string) - Clojure code with correct indentation - Output: Corrected Clojure code with proper parentheses
- Input:
How It Works
The server uses parinfer's "indent mode" which:
- Preserves all indentation exactly as provided
- Infers correct closing parentheses/brackets based on indentation
- Fixes mismatched or missing closing delimiters
Testing
Run tests:
make test
Test with MCP Inspector:
npx @modelcontextprotocol/inspector ./target/release/parinfer-mcp-server
See for detailed testing instructions.
Example
Input with incorrect parentheses:
(defn nnbsp [n
(apply str (repeat n nbsp))
Output with corrected parentheses:
(defn nnbsp [n]
(apply str (repeat n nbsp)))