@easysolutions906/mirth-mcp
v1.1.5
Published
MCP server for Mirth Connect — parse channels, generate Rhino-compatible code, analyze HL7 transformations, debug errors
Downloads
89
Maintainers
Readme
Mirth Connect MCP Server
The first Model Context Protocol (MCP) server for Mirth Connect (NextGen Connect). Lets AI assistants (Claude, Cursor, etc.) parse Mirth channels, generate Rhino-compatible JavaScript, analyze HL7 transformations, and debug common errors.
Tools
| Tool | Description |
|------|-------------|
| mirth_parse_channel | Parse a Mirth channel XML export into structured JSON |
| mirth_analyze_channel | Lint a channel for hardcoded IPs, SQL injection, missing error handling, Rhino compat issues |
| mirth_explain_channel | Generate a plain-English description of what a channel does |
| mirth_generate_transformer | Generate a Mirth transformer step (Rhino-compatible JavaScript) |
| mirth_generate_filter | Generate a filter step (message type, field value, test patient exclusion) |
| mirth_generate_channel | Generate a complete importable Mirth channel XML |
| mirth_map_fields | Generate HL7 field mapping code (PID-5-1 -> patient_last_name) |
| mirth_generate_code_template | Generate a code template using the IIFE pattern |
| mirth_debug_error | Explain a Mirth error message and suggest fixes |
| mirth_validate_js | Validate JavaScript for Rhino compatibility |
Rhino Rules Enforced
All generated code follows Mirth Connect's Rhino (ES6-mode) constraints:
varat root level for public API bindings (required for global scope across code templates)constand arrow functions inside IIFEs and function bodies- No
letat root level, no template literals, no destructuring, noimport/export, noasync/await - No
for each...in(deprecated Rhino syntax) — usesforEachon arrays - Every code template uses the IIFE pattern: declare public
vars, wrap implementation in(() => { ... })()
Install
Claude Desktop
Add to ~/Library/Application Support/Claude/claude_desktop_config.json:
{
"mcpServers": {
"mirth-connect": {
"command": "node",
"args": ["/path/to/mirth-mcp/src/index.js"]
}
}
}Cursor
Add to .cursor/mcp.json in your project:
{
"mcpServers": {
"mirth-connect": {
"command": "node",
"args": ["/path/to/mirth-mcp/src/index.js"]
}
}
}Claude Code
claude mcp add mirth-connect node /path/to/mirth-mcp/src/index.jsHTTP Mode (Railway / Docker)
Set the PORT environment variable to run in HTTP mode with both REST API and MCP endpoints:
PORT=3000 node src/index.jsREST endpoints are available at http://localhost:3000/ and the MCP streamable HTTP endpoint at http://localhost:3000/mcp.
API Endpoints (HTTP Mode)
| Method | Path | Description |
|--------|------|-------------|
| GET | / | API info and tool list |
| GET | /health | Health check |
| POST | /parse | Parse channel XML |
| POST | /analyze | Analyze channel for issues |
| POST | /explain | Explain channel in English |
| POST | /generate/transformer | Generate transformer code |
| POST | /generate/filter | Generate filter code |
| POST | /generate/channel | Generate channel XML |
| POST | /generate/code-template | Generate code template |
| POST | /map-fields | Generate field mapping code |
| POST | /validate | Validate JS for Rhino |
| POST | /debug | Debug error message |
| POST | /mcp | MCP streamable HTTP |
Plans
| Plan | Calls/Day | Rate Limit | Price | |------|-----------|------------|-------| | Free | 20 | 5/min | $0 | | Starter | 500 | 20/min | $19.99/mo | | Pro | 5,000 | 60/min | $49.99/mo |
Examples
Parse a channel
curl -X POST http://localhost:3000/parse \
-H "Content-Type: application/json" \
-d '{"xml": "<channel version=\"4.5.0\"><name>Test</name>...</channel>"}'Generate a transformer
curl -X POST http://localhost:3000/generate/transformer \
-H "Content-Type: application/json" \
-d '{
"description": "Extract patient demographics from PID",
"messageType": "HL7",
"variables": [
{"name": "patientLastName", "path": "msg['\''PID'\'']['\''PID.5'\'']['\''PID.5.1'\''].toString()"},
{"name": "patientFirstName", "path": "msg['\''PID'\'']['\''PID.5'\'']['\''PID.5.2'\''].toString()"},
{"name": "mrn", "path": "msg['\''PID'\'']['\''PID.3'\'']['\''PID.3.1'\''].toString()"}
]
}'Validate Rhino compatibility
curl -X POST http://localhost:3000/validate \
-H "Content-Type: application/json" \
-d '{"code": "const x = `hello ${name}`; const {a, b} = obj;"}'Debug an error
curl -X POST http://localhost:3000/debug \
-H "Content-Type: application/json" \
-d '{"error": "ReferenceError: \"formatDate\" is not defined"}'Development
npm install
npm run devLicense
ISC
