Skip to main content
Glama
README.md
# MirthCraft

MCP bridge for **Mirth Connect** and **Open Integration Engine (OIE)**. Safe discovery, diagnostics, workspace sync, and authoring — with environment policy gates and PHI/PII redaction.

**License:** Apache-2.0  
**Status:** Alpha — Phases 1–4 shipped; PyPI `mirthcraft` live  
**Python:** 3.12+

## Why MirthCraft

This is not a 1:1 REST wrapper. Design principles:

1. **Token economy + deterministic XML** — LLMs edit `.js` / `.json`; MirthCraft patches `.mirth_base.xml`.
2. **Zero-trust by environment** — `PROD` never registers write/deploy tools.
3. **Privacy by design** — message content is redacted before it reaches the model.
4. **Git-friendly workspace** — develop locally; MCP syncs, validates, and prepares releases.

## Install

```bash
pip install mirthcraft
# pin: pip install mirthcraft==0.1.2

mirthcraft --version
mirthcraft info
```

Point at a lab or server with env vars (or a custom `environments.yaml`):

```bash
export MIRTHCRAFT_TARGET=dev
export MIRTHCRAFT_BASE_URL=https://127.0.0.1:18443
export MIRTHCRAFT_PASSWORD_FILE=/path/to/password
# Optional: MIRTHCRAFT_CONFIG=/path/to/environments.yaml
# (redaction_rules.yaml / coding_standards.yaml fall back to packaged defaults)
```

## Develop from source

```bash
git clone https://github.com/gusmartinuk/mirthcraft.git
cd mirthcraft

python3 -m venv .venv
source .venv/bin/activate
pip install -e ".[dev]"

cp .env.example .env
# Prefer MIRTHCRAFT_PASSWORD_FILE for oielab (see docs/lab/PASSWORD_WIRING.md)

make check          # ruff + mypy + pytest
mirthcraft info
```

### MCP (stdio) for IDEs

```bash
mirthcraft serve --transport stdio
```

Streamable HTTP (loopback):

```bash
mirthcraft serve --transport http --host 127.0.0.1 --port 8080
# or: docker compose --profile http up mirthcraft-http
```

Point Cursor / Antigravity / OpenHands at the `mirthcraft` CLI. See [docs/AI_ORCHESTRATION.md](docs/AI_ORCHESTRATION.md) and [docs/agents/CURSOR.md](docs/agents/CURSOR.md).

### Docker

```bash
docker compose build
docker compose run --rm mirthcraft info --json
```

## Local labs

| Lab | Role | Docs |
| --- | --- | --- |
| Sibling **OpenIntegration** (`oielab`) | Primary DEV (`dev`) — OIE 4.7.0 | [docs/lab/OIELAB.md](docs/lab/OIELAB.md) |
| **mirthoss** (`labs/mirthoss`) | Second DEV (`mirth_oss`) — Connect 4.5.2 | [docs/lab/MIRTH_OSS.md](docs/lab/MIRTH_OSS.md) |

```bash
make smoke-labs                 # skip-friendly if a lab is down
make e2e-phase2                 # oielab pull→lint→diff→dry-run→MLLP
make e2e-mirthoss-mllp          # mirthoss ADT ACK
```

## Documentation

All project records live under [`docs/`](docs/README.md) and are written in **English** (public-repo ready). Local spoken/command language may be Turkish; committed artifacts stay English.

| Doc | Purpose |
| --- | --- |
| [docs/SPEC.md](docs/SPEC.md) | Normative product/technical specification |
| [docs/BACKLOG.md](docs/BACKLOG.md) | Prioritized work items |
| [docs/PYPI.md](docs/PYPI.md) | Trusted Publishing / install |
| [docs/DECISIONS.md](docs/DECISIONS.md) | Architecture Decision Records index |
| [docs/AI_ORCHESTRATION.md](docs/AI_ORCHESTRATION.md) | Multi-AI workflow |
| [docs/CHANGELOG.md](docs/CHANGELOG.md) | Release / session change log |

## Naming

| Component | Value |
| --- | --- |
| Repo / product | `mirthcraft` |
| Python package | `mirthcraft` |
| MCP server name | `mirthcraft` |
| CLI | `mirthcraft` |
| Resource URI scheme | `mirthcraft://…` |
| Env prefix | `MIRTHCRAFT_` |

## Safety

- Never commit real PHI, passwords, or production URLs.
- Fixtures must be synthetic.
- `PROD` policy is read-only by construction (see `tests/test_policy_gate.py`).