Codex skill and Python tool server for operating Mirth Connect through controlled REST API tools, XML backup/restore, audit logs, rollback support, MCP, and CLI fallback.
Designed for agent-assisted Mirth operations: inspect, export, update, deploy, start/stop channels, read statistics and messages, with structured user prompts when credentials, permissions, endpoints, or safety gates block an action.
Mirth Connect is a healthcare integration engine. Treat this repository as operational tooling: use a dedicated Mirth account, keep audit logs, and avoid returning raw PHI unless explicitly required.
- Codex skill for Mirth Connect operator workflows.
- Python package with REST-first Mirth client and local CLI.
- MCP server with ToolAnnotations (readOnlyHint/destructiveHint) and full docstrings for LLM agent discovery.
- XML-first channel export/import/update for version compatibility.
- Backup-before-write and rollback helpers for all write operations.
- Audit trail (JSONL) for write and destructive actions.
- PHI redaction for HL7 PID segments, email, phone, SSN, MRN, DOB.
- Safety gates for full access, destructive actions, production writes, and approval tokens.
- Plan/Execute two-phase workflow for safe operation planning.
- CLI fallback with command allowlist when REST API is unavailable.
- Local test suite with mock Mirth REST API and sandbox installer checks.
- Node.js 18 or newer.
- Python 3.10 or newer.
- Mirth Connect reachable over REST API, usually at
https://localhost:8443. - A dedicated Mirth user with permissions for the operations the agent performs.
Full Mirth operator install:
npx github:DinhLucent/mirth-connect-skills fullThis installs:
- Codex skill into
.agents/skills/mirth-connect-operator - Python tool server into
.mirth/mirth-agent-tools - Python dependencies with optional MCP extra
- Local
.envfrom.env.example .mirth/.gitignoreto protect credentials, backups, and logs
Then configure and verify:
cd .mirth/mirth-agent-tools
# Edit .env with your Mirth URL and credentials
mirth-agent-tools health_checkUsing the shared Skills CLI (mattpocock/skills compatible):
npx skills@latest add DinhLucent/mirth-connect-skillsNon-interactive Codex install:
npx skills@latest add DinhLucent/mirth-connect-skills --agent codex --skill mirth-connect-operator -y --copyThis installs skill instructions only (no Python tools, MCP, or .env). Use the full installer for operational access.
# Minimal: skill + tool files only
npx github:DinhLucent/mirth-connect-skills init
# Full: skill + tools + pip install + MCP + .env
npx github:DinhLucent/mirth-connect-skills init --install-python --install-mcp --create-env
# Under hidden project folder
npx github:DinhLucent/mirth-connect-skills init --mirth-dir .mirth --install-python --install-mcp --create-env
# Global user install
npx github:DinhLucent/mirth-connect-skills init --global
# Admin install
npx github:DinhLucent/mirth-connect-skills init --adminGlobal npm install:
npm install -g github:DinhLucent/mirth-connect-skills
mirth-connect-skills init --global| Scope | Skill Path | Tool Path |
|---|---|---|
| Project | .agents/skills/mirth-connect-operator |
mirth-agent-tools or .mirth/mirth-agent-tools |
| User/Global | ~/.agents/skills/mirth-connect-operator |
~/.agents/tools/mirth-agent-tools |
| Admin | /etc/codex/skills/mirth-connect-operator |
-- |
| Legacy Codex | .codex/skills/mirth-connect-operator |
-- |
The MCP server exposes 34 tools with proper ToolAnnotations for client-side safety classification:
python -m pip install -e ".[mcp]"
mirth-agent-mcpTools are categorized by safety tier:
| Tier | Annotation | Examples |
|---|---|---|
| Read-only | readOnlyHint=true |
health_check, list_channels, get_messages, plan_operation |
| Write | readOnlyHint=false |
deploy_channel, update_channel, import_channel |
| Destructive | destructiveHint=true |
delete_channel, redeploy_all, remove_messages |
Every tool includes a comprehensive docstring describing purpose, parameters, safety requirements, and audit behavior.
Write operations are gated by environment flags:
MIRTH_FULL_ACCESS=trueenables write-capable tools.MIRTH_ALLOW_DESTRUCTIVE=trueenables delete, clear, remove, and redeploy-all.MIRTH_ALLOW_PROD_WRITE=truerequired whenMIRTH_ENV=prod.MIRTH_REQUIRE_APPROVAL=true+MIRTH_APPROVAL_TOKENfor approval-gated workflows.MIRTH_DRY_RUN=truelogs the action without executing.MIRTH_REDACT_PHI=trueredacts PHI from message content.MIRTH_ALLOWED_HOSTSrestricts allowed Mirth API hosts.
When blocked, tools return needs_user_input=true with a specific user_question for the operator.
mirth-connect-skills init [options]
mirth-connect-skills full [options]
Options:
--target <dir> Install into specific project directory
--global Install into user's Codex skill/tool locations
--admin Install into /etc/codex/skills
--legacy-codex Also install into older .codex/skills location
--force Overwrite existing destination folders
--skip-tools Install only the Codex skill
--install-python Run pip install inside tool server
--install-mcp Add MCP extra to pip install
--create-env Copy .env.example to .env
--mirth-dir <dir> Install tools under <dir>/mirth-agent-tools
--dot-mirth Alias for --mirth-dir .mirth
mirth-connect-skills/
bin/ npx installer
mirth-connect-operator/ Codex skill instructions and agent metadata
mirth-agent-tools/ Python REST/MCP/CLI tool server
src/mirth_agent_tools/
client.py Mirth REST API client
mcp_server.py MCP server with ToolAnnotations
tools.py Tool functions with safety gates
safety.py Layered access control
audit.py JSONL audit trail
redaction.py PHI redaction (HL7, email, phone, SSN)
config.py Environment-based configuration
discovery.py API endpoint auto-discovery
cli_fallback.py mccommand CLI fallback
xml_utils.py Channel XML parsing and diff
tests/ Unit tests
scripts/ Local audit and check runners
tests/ Tool effectiveness evaluation suite
npm run check # Full local check suite
npm run eval:tools # Tool effectiveness against mock Mirth API
npm run sandbox:test # Installer sandbox checksMIT License. See LICENSE.
This project is not affiliated with, endorsed by, or sponsored by NextGen Healthcare. Mirth and Mirth Connect are trademarks of their respective owners.