mirthcraft 0.1.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (129) hide show
  1. mirthcraft-0.1.1/.cursor/rules/mirthcraft.mdc +18 -0
  2. mirthcraft-0.1.1/.dockerignore +24 -0
  3. mirthcraft-0.1.1/.env.example +22 -0
  4. mirthcraft-0.1.1/.github/ISSUE_TEMPLATE/bug_report.md +25 -0
  5. mirthcraft-0.1.1/.github/PULL_REQUEST_TEMPLATE.md +13 -0
  6. mirthcraft-0.1.1/.github/dependabot.yml +16 -0
  7. mirthcraft-0.1.1/.github/workflows/ci.yml +28 -0
  8. mirthcraft-0.1.1/.github/workflows/publish.yml +28 -0
  9. mirthcraft-0.1.1/.gitignore +43 -0
  10. mirthcraft-0.1.1/AGENTS.md +40 -0
  11. mirthcraft-0.1.1/LICENSE +201 -0
  12. mirthcraft-0.1.1/Makefile +45 -0
  13. mirthcraft-0.1.1/NOTICE +7 -0
  14. mirthcraft-0.1.1/PKG-INFO +141 -0
  15. mirthcraft-0.1.1/README.md +100 -0
  16. mirthcraft-0.1.1/config/coding_standards.yaml +28 -0
  17. mirthcraft-0.1.1/config/environments.yaml +68 -0
  18. mirthcraft-0.1.1/config/redaction_rules.yaml +69 -0
  19. mirthcraft-0.1.1/docker/Dockerfile +34 -0
  20. mirthcraft-0.1.1/docker-compose.yml +66 -0
  21. mirthcraft-0.1.1/docs/AI_ORCHESTRATION.md +79 -0
  22. mirthcraft-0.1.1/docs/ARCHITECTURE.md +74 -0
  23. mirthcraft-0.1.1/docs/BACKLOG.md +95 -0
  24. mirthcraft-0.1.1/docs/CHANGELOG.md +167 -0
  25. mirthcraft-0.1.1/docs/CONTRIBUTING.md +38 -0
  26. mirthcraft-0.1.1/docs/DECISIONS.md +20 -0
  27. mirthcraft-0.1.1/docs/PUBLISH_CHECKLIST.md +75 -0
  28. mirthcraft-0.1.1/docs/PYPI.md +53 -0
  29. mirthcraft-0.1.1/docs/README.md +55 -0
  30. mirthcraft-0.1.1/docs/ROADMAP.md +38 -0
  31. mirthcraft-0.1.1/docs/SPEC.md +154 -0
  32. mirthcraft-0.1.1/docs/STATUS.md +45 -0
  33. mirthcraft-0.1.1/docs/adr/0001-python-fastmcp-stack.md +23 -0
  34. mirthcraft-0.1.1/docs/adr/0002-apache-license.md +22 -0
  35. mirthcraft-0.1.1/docs/adr/0003-sibling-oielab.md +23 -0
  36. mirthcraft-0.1.1/docs/adr/0004-multi-ai-orchestration.md +22 -0
  37. mirthcraft-0.1.1/docs/adr/0005-patch-xml-engine.md +22 -0
  38. mirthcraft-0.1.1/docs/adr/0006-mcp-sdk-v2.md +22 -0
  39. mirthcraft-0.1.1/docs/adr/0007-phase1-gate-and-formats.md +30 -0
  40. mirthcraft-0.1.1/docs/adr/0008-phase2-audit-decisions.md +27 -0
  41. mirthcraft-0.1.1/docs/adr/0009-mirth-oss-lab.md +30 -0
  42. mirthcraft-0.1.1/docs/agents/ANTIGRAVITY.md +40 -0
  43. mirthcraft-0.1.1/docs/agents/CURSOR.md +72 -0
  44. mirthcraft-0.1.1/docs/agents/OPENHANDS.md +41 -0
  45. mirthcraft-0.1.1/docs/db-mcp.md +87 -0
  46. mirthcraft-0.1.1/docs/lab/MIRTH_OSS.md +83 -0
  47. mirthcraft-0.1.1/docs/lab/OIELAB.md +67 -0
  48. mirthcraft-0.1.1/docs/lab/PASSWORD_WIRING.md +37 -0
  49. mirthcraft-0.1.1/docs/releases/v0.1.0.md +37 -0
  50. mirthcraft-0.1.1/docs/releases/v0.1.1.md +29 -0
  51. mirthcraft-0.1.1/docs/reviews/2026-12-05-phase1-audit.md +271 -0
  52. mirthcraft-0.1.1/docs/reviews/2026-12-05-phase2-audit.md +206 -0
  53. mirthcraft-0.1.1/docs/templates/adr.md +15 -0
  54. mirthcraft-0.1.1/docs/templates/session-note.md +24 -0
  55. mirthcraft-0.1.1/labs/mirthoss/.gitignore +4 -0
  56. mirthcraft-0.1.1/labs/mirthoss/README.md +11 -0
  57. mirthcraft-0.1.1/labs/mirthoss/docker-compose.yml +32 -0
  58. mirthcraft-0.1.1/pyproject.toml +81 -0
  59. mirthcraft-0.1.1/scripts/e2e_mirthoss_mllp.py +60 -0
  60. mirthcraft-0.1.1/scripts/e2e_mirthoss_pull.py +84 -0
  61. mirthcraft-0.1.1/scripts/e2e_phase2_oielab.py +146 -0
  62. mirthcraft-0.1.1/scripts/seed_mirthoss.py +86 -0
  63. mirthcraft-0.1.1/scripts/seed_mirthoss_mllp.py +117 -0
  64. mirthcraft-0.1.1/scripts/smoke_mirth_oss.py +77 -0
  65. mirthcraft-0.1.1/scripts/smoke_oielab.py +75 -0
  66. mirthcraft-0.1.1/src/mirthcraft/__init__.py +4 -0
  67. mirthcraft-0.1.1/src/mirthcraft/cli.py +506 -0
  68. mirthcraft-0.1.1/src/mirthcraft/client/__init__.py +0 -0
  69. mirthcraft-0.1.1/src/mirthcraft/client/endpoints.py +67 -0
  70. mirthcraft-0.1.1/src/mirthcraft/client/mirth_api.py +552 -0
  71. mirthcraft-0.1.1/src/mirthcraft/config.py +278 -0
  72. mirthcraft-0.1.1/src/mirthcraft/core/__init__.py +0 -0
  73. mirthcraft-0.1.1/src/mirthcraft/core/audit.py +43 -0
  74. mirthcraft-0.1.1/src/mirthcraft/core/js_syntax.py +43 -0
  75. mirthcraft-0.1.1/src/mirthcraft/core/linter.py +312 -0
  76. mirthcraft-0.1.1/src/mirthcraft/core/mllp.py +84 -0
  77. mirthcraft-0.1.1/src/mirthcraft/core/paths.py +88 -0
  78. mirthcraft-0.1.1/src/mirthcraft/core/redactor.py +366 -0
  79. mirthcraft-0.1.1/src/mirthcraft/core/topology.py +206 -0
  80. mirthcraft-0.1.1/src/mirthcraft/core/xml_engine.py +492 -0
  81. mirthcraft-0.1.1/src/mirthcraft/core/xml_safe.py +28 -0
  82. mirthcraft-0.1.1/src/mirthcraft/data/coding_standards.yaml +28 -0
  83. mirthcraft-0.1.1/src/mirthcraft/data/environments.yaml +68 -0
  84. mirthcraft-0.1.1/src/mirthcraft/data/redaction_rules.yaml +69 -0
  85. mirthcraft-0.1.1/src/mirthcraft/prompts/__init__.py +112 -0
  86. mirthcraft-0.1.1/src/mirthcraft/resources/__init__.py +0 -0
  87. mirthcraft-0.1.1/src/mirthcraft/server.py +518 -0
  88. mirthcraft-0.1.1/src/mirthcraft/tools/__init__.py +0 -0
  89. mirthcraft-0.1.1/src/mirthcraft/tools/authoring.py +685 -0
  90. mirthcraft-0.1.1/src/mirthcraft/tools/db_bridge.py +65 -0
  91. mirthcraft-0.1.1/src/mirthcraft/tools/diagnostics.py +38 -0
  92. mirthcraft-0.1.1/src/mirthcraft/tools/discovery.py +105 -0
  93. mirthcraft-0.1.1/src/mirthcraft/tools/lifecycle.py +156 -0
  94. mirthcraft-0.1.1/src/mirthcraft/tools/release.py +323 -0
  95. mirthcraft-0.1.1/src/mirthcraft/tools/testing.py +237 -0
  96. mirthcraft-0.1.1/src/mirthcraft/tools/workspace.py +186 -0
  97. mirthcraft-0.1.1/tests/__init__.py +0 -0
  98. mirthcraft-0.1.1/tests/conftest.py +28 -0
  99. mirthcraft-0.1.1/tests/fixtures/mirthoss-hl7-adt-mllp.xml +423 -0
  100. mirthcraft-0.1.1/tests/fixtures/oie_message_trace.json +49 -0
  101. mirthcraft-0.1.1/tests/fixtures/oielab-hl7-adt-mllp.xml +423 -0
  102. mirthcraft-0.1.1/tests/fixtures/oielab_adt_a01.hl7 +4 -0
  103. mirthcraft-0.1.1/tests/fixtures/sample_adt.hl7 +5 -0
  104. mirthcraft-0.1.1/tests/fixtures/sample_channel.xml +74 -0
  105. mirthcraft-0.1.1/tests/settings_util.py +23 -0
  106. mirthcraft-0.1.1/tests/test_audit.py +35 -0
  107. mirthcraft-0.1.1/tests/test_authoring.py +154 -0
  108. mirthcraft-0.1.1/tests/test_cli.py +19 -0
  109. mirthcraft-0.1.1/tests/test_config_security.py +110 -0
  110. mirthcraft-0.1.1/tests/test_db_bridge.py +69 -0
  111. mirthcraft-0.1.1/tests/test_diagnostics_redaction.py +50 -0
  112. mirthcraft-0.1.1/tests/test_diff_channel.py +85 -0
  113. mirthcraft-0.1.1/tests/test_http_transport.py +27 -0
  114. mirthcraft-0.1.1/tests/test_lifecycle.py +96 -0
  115. mirthcraft-0.1.1/tests/test_linter.py +130 -0
  116. mirthcraft-0.1.1/tests/test_mirth_api.py +137 -0
  117. mirthcraft-0.1.1/tests/test_mllp_scenario.py +117 -0
  118. mirthcraft-0.1.1/tests/test_phase2_security.py +76 -0
  119. mirthcraft-0.1.1/tests/test_policy_gate.py +33 -0
  120. mirthcraft-0.1.1/tests/test_prepare_prod_release.py +137 -0
  121. mirthcraft-0.1.1/tests/test_prompts.py +48 -0
  122. mirthcraft-0.1.1/tests/test_redactor.py +76 -0
  123. mirthcraft-0.1.1/tests/test_server_policy_registration.py +71 -0
  124. mirthcraft-0.1.1/tests/test_smoke_mirth_oss.py +24 -0
  125. mirthcraft-0.1.1/tests/test_topology.py +17 -0
  126. mirthcraft-0.1.1/tests/test_workspace_backup.py +64 -0
  127. mirthcraft-0.1.1/tests/test_xml_compile.py +53 -0
  128. mirthcraft-0.1.1/tests/test_xml_oielab_fixture.py +33 -0
  129. mirthcraft-0.1.1/tests/test_xml_roundtrip.py +31 -0
@@ -0,0 +1,18 @@
1
+ ---
2
+ description: MirthCraft core engineering and multi-AI governance rules
3
+ alwaysApply: true
4
+ ---
5
+
6
+ # MirthCraft rules
7
+
8
+ - Source of truth: `docs/SPEC.md`, `AGENTS.md`, `docs/BACKLOG.md`.
9
+ - Committed artifacts are English. Stamp doc updates with UTC ISO-8601 + AI name.
10
+ - After finishing a backlog item: update BACKLOG + CHANGELOG, run `pytest`.
11
+ - Policy: forbidden tools must be unregistered for the active profile, not only raise at call time.
12
+ - Redaction: any tool returning message content must use `Redactor`.
13
+ - XML: preserve `.mirth_base.xml`; patch-based compile only; no invented XStream graphs.
14
+ - Secrets/PHI: never commit; fixtures stay synthetic.
15
+ - Autonomy: implement without per-step human approval; ask only for public push, destructive sibling-lab resets, or committing credentials.
16
+ - Sibling lab: `../OpenIntegration` (oielab) via env URL — do not vendor or submodule it.
17
+ - Stack: Python 3.12+, mcp≥2.3 MCPServer, httpx, lxml, Pydantic v2, pytest.
18
+ - Phase 2 (`MC-020+`) blocked until Phase 1 gate in ADR-0007 is closed.
@@ -0,0 +1,24 @@
1
+ .venv
2
+ venv
3
+ .git
4
+ .github
5
+ .pytest_cache
6
+ .mypy_cache
7
+ .ruff_cache
8
+ __pycache__
9
+ *.pyc
10
+ .coverage
11
+ htmlcov
12
+ workspace
13
+ audit
14
+ scratch
15
+ .env
16
+ .env.*
17
+ secrets
18
+ docker-data
19
+ *.egg-info
20
+ dist
21
+ build
22
+ .cursor
23
+ docs/reviews
24
+ agent-transcripts
@@ -0,0 +1,22 @@
1
+ # Copy to .env for local development. Never commit real secrets.
2
+ # Prefer MIRTHCRAFT_TARGET. If MIRTHCRAFT_ENV is set, it MUST equal TARGET.
3
+ MIRTHCRAFT_TARGET=dev
4
+ # MIRTHCRAFT_ENV=dev
5
+
6
+ MIRTHCRAFT_CONFIG=config/environments.yaml
7
+ MIRTHCRAFT_WORKSPACE=./workspace
8
+ MIRTHCRAFT_AUDIT_DIR=./audit
9
+
10
+ # --- oielab (default DEV target) ---
11
+ # Preferred: password file (no shell substitution in .env)
12
+ # MIRTHCRAFT_PASSWORD_FILE=/absolute/path/to/OpenIntegration/secrets/admin_password
13
+ # Or set the password literally (not via $(cat ...)):
14
+ # MIRTHCRAFT_PASSWORD=
15
+
16
+ # --- mirthoss (second DEV lab; ADR-0009) ---
17
+ # MIRTHCRAFT_TARGET=mirth_oss
18
+ # MIRTHCRAFT_MIRTH_PASSWORD_FILE=/absolute/path/to/MirthCraft/labs/mirthoss/secrets/admin_password
19
+ # MIRTHCRAFT_MIRTH_PASSWORD=
20
+
21
+ # Do not set MIRTHCRAFT_VERIFY_SSL=false for PROD. Lab profiles use YAML verify_ssl: false.
22
+ # MIRTHCRAFT_VERIFY_SSL=false
@@ -0,0 +1,25 @@
1
+ ---
2
+ name: Bug report
3
+ about: Report a MirthCraft defect
4
+ title: ''
5
+ labels: bug
6
+ assignees: ''
7
+ ---
8
+
9
+ ## Summary
10
+
11
+ ## Environment
12
+
13
+ - MirthCraft version / commit:
14
+ - Target profile (`dev` / `test` / `prod` / `mirth_oss`):
15
+ - Engine (OIE / Mirth Connect) + version:
16
+
17
+ ## Steps to reproduce
18
+
19
+ ## Expected
20
+
21
+ ## Actual
22
+
23
+ ## Notes
24
+
25
+ Do **not** paste real PHI, passwords, or production payloads.
@@ -0,0 +1,13 @@
1
+ ## Summary
2
+
3
+ -
4
+
5
+ ## Test plan
6
+
7
+ - [ ] `make check`
8
+ - [ ] Policy gate still green (`tests/test_policy_gate.py`)
9
+ - [ ] No secrets / PHI in the diff
10
+
11
+ ## Notes for reviewers
12
+
13
+ -
@@ -0,0 +1,16 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: pip
4
+ directory: /
5
+ schedule:
6
+ interval: weekly
7
+ open-pull-requests-limit: 5
8
+ labels:
9
+ - dependencies
10
+ - package-ecosystem: github-actions
11
+ directory: /
12
+ schedule:
13
+ interval: weekly
14
+ open-pull-requests-limit: 5
15
+ labels:
16
+ - dependencies
@@ -0,0 +1,28 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+
8
+ jobs:
9
+ test:
10
+ runs-on: ubuntu-latest
11
+ strategy:
12
+ matrix:
13
+ python-version: ["3.12", "3.13"]
14
+ steps:
15
+ - uses: actions/checkout@v5
16
+ - uses: actions/setup-python@v6
17
+ with:
18
+ python-version: ${{ matrix.python-version }}
19
+ - name: Install
20
+ run: |
21
+ python -m pip install -U pip
22
+ pip install -e ".[dev]"
23
+ - name: Ruff
24
+ run: ruff check src tests scripts
25
+ - name: Mypy
26
+ run: mypy
27
+ - name: Pytest
28
+ run: pytest -q
@@ -0,0 +1,28 @@
1
+ name: Publish
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+ workflow_dispatch:
7
+
8
+ permissions:
9
+ contents: read
10
+ id-token: write
11
+
12
+ jobs:
13
+ pypi:
14
+ runs-on: ubuntu-latest
15
+ environment: pypi
16
+ steps:
17
+ - uses: actions/checkout@v5
18
+ - uses: actions/setup-python@v6
19
+ with:
20
+ python-version: "3.12"
21
+ - name: Build
22
+ run: |
23
+ python -m pip install -U pip build
24
+ python -m build
25
+ - name: Publish to PyPI
26
+ uses: pypa/gh-action-pypi-publish@release/v1
27
+ with:
28
+ packages-dir: dist/
@@ -0,0 +1,43 @@
1
+ # Python
2
+ .venv/
3
+ venv/
4
+ __pycache__/
5
+ *.py[cod]
6
+ *$py.class
7
+ *.egg-info/
8
+ .eggs/
9
+ dist/
10
+ build/
11
+ .pytest_cache/
12
+ .mypy_cache/
13
+ .ruff_cache/
14
+ .coverage
15
+ htmlcov/
16
+ .tox/
17
+ *.cover
18
+
19
+ # Environment and secrets
20
+ .env
21
+ .env.local
22
+ secrets/
23
+ *.pem
24
+ *.key
25
+
26
+ # IDE / OS
27
+ .idea/
28
+ .vscode/
29
+ *.swp
30
+ .DS_Store
31
+ Thumbs.db
32
+
33
+ # Runtime / workspace
34
+ workspace/
35
+ audit/
36
+ *.jsonl
37
+ .mirthcraft/
38
+
39
+ # Docker
40
+ docker-data/
41
+
42
+ # Local lab notes (keep English docs; ignore private scratch)
43
+ scratch/
@@ -0,0 +1,40 @@
1
+ # AGENTS.md — MirthCraft
2
+
3
+ Entry point for **Cursor**, **Antigravity**, and **OpenHands**.
4
+
5
+ ## Mission
6
+
7
+ Build a production-grade MCP bridge for Mirth Connect / OIE with safe XML authoring, PHI redaction, and environment policy gates. Public-repo standards. English records.
8
+
9
+ ## Non-negotiables
10
+
11
+ 1. **English** for all committed docs, commits, PRs, backlog, ADRs.
12
+ 2. After every completed work unit: update docs + backlog + CHANGELOG with **UTC ISO-8601** and **acting AI name**.
13
+ 3. Run **pytest** before claiming done; fix failures you caused.
14
+ 4. **PROD** must not register write/deploy/test-inject tools (`tests/test_policy_gate.py`).
15
+ 5. Never return unredacted message payloads; never commit real PHI or secrets.
16
+ 6. Patch XML via `.mirth_base.xml` — do not synthesize Mirth XStream XML from scratch.
17
+ 7. Prefer autonomous progress; ask the human only for push/publish, destructive lab resets, or secret materialization into git.
18
+ 8. Labs: sibling oielab + `labs/mirthoss` (no submodule).
19
+
20
+ ## Read next
21
+
22
+ 1. [docs/SPEC.md](docs/SPEC.md)
23
+ 2. [docs/AI_ORCHESTRATION.md](docs/AI_ORCHESTRATION.md)
24
+ 3. [docs/BACKLOG.md](docs/BACKLOG.md)
25
+ 4. Agent-specific: [docs/agents/CURSOR.md](docs/agents/CURSOR.md) · [docs/agents/ANTIGRAVITY.md](docs/agents/ANTIGRAVITY.md) · [docs/agents/OPENHANDS.md](docs/agents/OPENHANDS.md)
26
+
27
+ ## Quick commands
28
+
29
+ ```bash
30
+ source .venv/bin/activate
31
+ pip install -e ".[dev]"
32
+ make check
33
+ mirthcraft info
34
+ make smoke-labs # optional live labs
35
+ ```
36
+
37
+ ---
38
+ Updated: 2026-12-05T16:49:06Z
39
+ AI: Composer (Cursor)
40
+ Change: Quick commands → make check; dual labs noted.
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other Contributors to the Work a copy of
95
+ this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2026 Gus Martin
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,45 @@
1
+ .PHONY: install test lint info docker-build smoke-oielab smoke-mirthoss smoke-labs e2e-phase2 e2e-mirthoss e2e-mirthoss-mllp seed-mirthoss seed-mirthoss-mllp check
2
+
3
+ install:
4
+ python3 -m venv .venv
5
+ .venv/bin/pip install -U pip
6
+ .venv/bin/pip install -e ".[dev]"
7
+
8
+ test:
9
+ .venv/bin/pytest
10
+
11
+ lint:
12
+ .venv/bin/ruff check src tests scripts
13
+ .venv/bin/mypy
14
+
15
+ info:
16
+ .venv/bin/mirthcraft info
17
+
18
+ docker-build:
19
+ docker compose build
20
+
21
+ smoke-oielab:
22
+ .venv/bin/python scripts/smoke_oielab.py
23
+
24
+ smoke-mirthoss:
25
+ .venv/bin/python scripts/smoke_mirth_oss.py
26
+
27
+ smoke-labs: smoke-oielab smoke-mirthoss
28
+
29
+ e2e-phase2:
30
+ .venv/bin/python scripts/e2e_phase2_oielab.py --strict
31
+
32
+ e2e-mirthoss:
33
+ .venv/bin/python scripts/seed_mirthoss.py --strict
34
+ .venv/bin/python scripts/e2e_mirthoss_pull.py --strict
35
+
36
+ e2e-mirthoss-mllp:
37
+ .venv/bin/python scripts/e2e_mirthoss_mllp.py --strict
38
+
39
+ seed-mirthoss:
40
+ .venv/bin/python scripts/seed_mirthoss.py
41
+
42
+ seed-mirthoss-mllp:
43
+ .venv/bin/python scripts/seed_mirthoss_mllp.py
44
+
45
+ check: lint test
@@ -0,0 +1,7 @@
1
+ MirthCraft
2
+ Copyright 2026 Gus Martin
3
+
4
+ This product includes software developed for integration with
5
+ Mirth Connect and Open Integration Engine ecosystems.
6
+
7
+ Licensed under the Apache License, Version 2.0.
@@ -0,0 +1,141 @@
1
+ Metadata-Version: 2.5
2
+ Name: mirthcraft
3
+ Version: 0.1.1
4
+ Summary: MCP bridge for Mirth Connect and Open Integration Engine with safe XML authoring, PHI redaction, and environment policy gates.
5
+ Project-URL: Homepage, https://github.com/gusmartinuk/mirthcraft
6
+ Project-URL: Documentation, https://github.com/gusmartinuk/mirthcraft/tree/main/docs
7
+ Project-URL: Issues, https://github.com/gusmartinuk/mirthcraft/issues
8
+ Author: Gus Martin
9
+ License-Expression: Apache-2.0
10
+ License-File: LICENSE
11
+ License-File: NOTICE
12
+ Keywords: healthcare,hl7,integration,mcp,mirth,oie
13
+ Classifier: Development Status :: 3 - Alpha
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: License :: OSI Approved :: Apache Software License
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Programming Language :: Python :: 3.13
19
+ Classifier: Topic :: Software Development :: Libraries
20
+ Requires-Python: >=3.12
21
+ Requires-Dist: httpx>=0.28.0
22
+ Requires-Dist: lxml>=5.3.0
23
+ Requires-Dist: mcp>=2.3.0
24
+ Requires-Dist: pydantic-settings>=2.7.0
25
+ Requires-Dist: pydantic>=2.10.0
26
+ Requires-Dist: pyyaml>=6.0.2
27
+ Requires-Dist: tree-sitter-javascript>=0.23.0
28
+ Requires-Dist: tree-sitter>=0.23.0
29
+ Provides-Extra: dev
30
+ Requires-Dist: mypy>=1.14.0; extra == 'dev'
31
+ Requires-Dist: pytest-asyncio>=0.25.0; extra == 'dev'
32
+ Requires-Dist: pytest>=8.3.0; extra == 'dev'
33
+ Requires-Dist: respx>=0.22.0; extra == 'dev'
34
+ Requires-Dist: ruff>=0.9.0; extra == 'dev'
35
+ Requires-Dist: types-lxml>=2024.12.13; extra == 'dev'
36
+ Requires-Dist: types-pyyaml>=6.0.12; extra == 'dev'
37
+ Provides-Extra: http
38
+ Requires-Dist: fastapi>=0.115.0; extra == 'http'
39
+ Requires-Dist: uvicorn[standard]>=0.34.0; extra == 'http'
40
+ Description-Content-Type: text/markdown
41
+
42
+ # MirthCraft
43
+
44
+ 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.
45
+
46
+ **License:** Apache-2.0
47
+ **Status:** Alpha — Phases 1–4 complete; backlog cleared; public publish optional
48
+ **Python:** 3.12+
49
+
50
+ ## Why MirthCraft
51
+
52
+ This is not a 1:1 REST wrapper. Design principles:
53
+
54
+ 1. **Token economy + deterministic XML** — LLMs edit `.js` / `.json`; MirthCraft patches `.mirth_base.xml`.
55
+ 2. **Zero-trust by environment** — `PROD` never registers write/deploy tools.
56
+ 3. **Privacy by design** — message content is redacted before it reaches the model.
57
+ 4. **Git-friendly workspace** — develop locally; MCP syncs, validates, and prepares releases.
58
+
59
+ ## Quick start
60
+
61
+ ```bash
62
+ # Clone
63
+ git clone https://github.com/gusmartinuk/mirthcraft.git
64
+ cd mirthcraft
65
+
66
+ python3 -m venv .venv
67
+ source .venv/bin/activate
68
+ pip install -e ".[dev]"
69
+ # Or released tag: pip install "git+https://github.com/gusmartinuk/mirthcraft.git@v0.1.0"
70
+ # PyPI: pip install mirthcraft==0.1.0 (after Trusted Publisher is linked — docs/PYPI.md)
71
+
72
+ cp .env.example .env
73
+ # Prefer MIRTHCRAFT_PASSWORD_FILE for oielab (see docs/lab/PASSWORD_WIRING.md)
74
+
75
+ make check # ruff + mypy + pytest
76
+ mirthcraft info
77
+ ```
78
+
79
+ ### MCP (stdio) for IDEs
80
+
81
+ ```bash
82
+ mirthcraft serve --transport stdio
83
+ ```
84
+
85
+ Streamable HTTP (loopback):
86
+
87
+ ```bash
88
+ mirthcraft serve --transport http --host 127.0.0.1 --port 8080
89
+ # or: docker compose --profile http up mirthcraft-http
90
+ ```
91
+
92
+ Point Cursor / Antigravity / OpenHands at the `mirthcraft` CLI. See [docs/AI_ORCHESTRATION.md](docs/AI_ORCHESTRATION.md).
93
+
94
+ ### Docker
95
+
96
+ ```bash
97
+ docker compose build
98
+ docker compose run --rm mirthcraft info --json
99
+ ```
100
+
101
+ ## Local labs
102
+
103
+ | Lab | Role | Docs |
104
+ | --- | --- | --- |
105
+ | Sibling **OpenIntegration** (`oielab`) | Primary DEV (`dev`) — OIE 4.7.0 | [docs/lab/OIELAB.md](docs/lab/OIELAB.md) |
106
+ | **mirthoss** (`labs/mirthoss`) | Second DEV (`mirth_oss`) — Connect 4.5.2 | [docs/lab/MIRTH_OSS.md](docs/lab/MIRTH_OSS.md) |
107
+
108
+ ```bash
109
+ make smoke-labs # skip-friendly if a lab is down
110
+ make e2e-phase2 # oielab pull→lint→diff→dry-run→MLLP
111
+ ```
112
+
113
+ ## Documentation
114
+
115
+ 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.
116
+
117
+ | Doc | Purpose |
118
+ | --- | --- |
119
+ | [docs/SPEC.md](docs/SPEC.md) | Normative product/technical specification |
120
+ | [docs/BACKLOG.md](docs/BACKLOG.md) | Prioritized work items |
121
+ | [docs/DECISIONS.md](docs/DECISIONS.md) | Architecture Decision Records index |
122
+ | [docs/PUBLISH_CHECKLIST.md](docs/PUBLISH_CHECKLIST.md) | Pre-public GitHub gate |
123
+ | [docs/AI_ORCHESTRATION.md](docs/AI_ORCHESTRATION.md) | Multi-AI workflow |
124
+ | [docs/CHANGELOG.md](docs/CHANGELOG.md) | Release / session change log |
125
+
126
+ ## Naming
127
+
128
+ | Component | Value |
129
+ | --- | --- |
130
+ | Repo / product | `mirthcraft` |
131
+ | Python package | `mirthcraft` |
132
+ | MCP server name | `mirthcraft` |
133
+ | CLI | `mirthcraft` |
134
+ | Resource URI scheme | `mirthcraft://…` |
135
+ | Env prefix | `MIRTHCRAFT_` |
136
+
137
+ ## Safety
138
+
139
+ - Never commit real PHI, passwords, or production URLs.
140
+ - Fixtures must be synthetic.
141
+ - `PROD` policy is read-only by construction (see `tests/test_policy_gate.py`).