Prior oncology clinical trial infrastructure has been fragmented, site-specific, and inefficient across the critical dimensions of interoperability, auditability, privacy, and deployment. Each trial site has historically operated its own isolated systems for electronic health records, imaging archives, and audit logging, resulting in inconsistent data formats, duplicated regulatory effort, and limited cross-site collaboration.
This page presents a demonstration of the National MCP Physical AI Oncology Trials system, a proposed end-to-end architecture comprising five Model Context Protocol (MCP) servers that address these gaps through standardized, federated, and safety-governed capabilities. The five servers (Authorization, FHIR Clinical Data, DICOM Imaging, Audit Ledger, and Provenance) expose 23 tools across five hierarchical conformance levels, validated by 668 test functions.
Paper: 10.5281/zenodo.18916731 | Repository: kevinkawchak/national-mcp-pai-oncology-trials (DOI: 10.5281/zenodo.18894758)
Five domain-specific MCP servers form the protocol surface for Physical AI oncology trials
NATIONAL MCP FIVE-SERVER DEPLOYMENT +---------------------------------------------------+ | SITE DEPLOYMENT | | | | +-----------+ +-----------+ +-----------+ | | | trialmcp | | trialmcp | | trialmcp | | | | authz | | fhir | | dicom | | | | (5 tools) | | (4 tools) | | (4 tools) | | | | RBAC, | | FHIR R4, | | DICOMweb, | | | | Tokens | | HIPAA | | RECIST | | | +-----+-----+ +-----+-----+ +-----+-----+ | | | | | | | +------+-------+------+-------+ | | | | | | +------v------+ +-----v-------+ | | | trialmcp | | trialmcp | | | | ledger | | provenance | | | | (5 tools) | | (5 tools) | | | | SHA-256 | | DAG, W3C | | | | 21 CFR 11 | | PROV | | | +-------------+ +-------------+ | | | | 23 tools total across 5 servers | +---------------------------------------------------+
Deny-by-default RBAC, SHA-256 token lifecycle, policy evaluation
authz_evaluate | authz_issue_token | authz_validate_tokenauthz_revoke_token | authz_list_policiesFHIR R4 clinical data with HIPAA Safe Harbor de-identification
fhir_read | fhir_search | fhir_patient_lookup | fhir_study_statusDICOM imaging queries, RECIST 1.1 measurements
dicom_query | dicom_retrieve_pointer | dicom_study_metadata | dicom_recist_measurementsHash-chained 21 CFR Part 11 audit trail
ledger_append | ledger_verify | ledger_queryledger_replay | ledger_exportDAG-based data lineage, SHA-256 fingerprinting
provenance_record | provenance_query_forward | provenance_query_backwardprovenance_fingerprint | provenance_lineageservers/trialmcp_ledger/chain.py)GENESIS_HASH = "0" * 64
def canonical_json(record: dict[str, Any]) -> str:
filtered = {k: v for k, v in sorted(record.items())
if k != "hash"}
return json.dumps(filtered, sort_keys=True,
ensure_ascii=True)
def compute_audit_hash(record, prev_hash: str) -> str:
canonical = canonical_json(record)
payload = prev_hash + canonical
return hashlib.sha256(
payload.encode("utf-8")).hexdigest()
Each section corresponds to a process diagram from docs/mcp-process/
docs/mcp-process/01-robot-procedure-lifecycle.mdThe robot procedure lifecycle defines the complete state machine for robot-assisted clinical procedures. Each state transition requires specific MCP server interactions and safety validations, with timing constraints enforcing clinical safety protocols.
State Transitions and MCP Server Interactions:
SCHEDULED --(pre-check triggers)--> PRE_CHECK
Servers: trialmcp-authz (token validation)
trialmcp-fhir (patient eligibility)
trialmcp-dicom (imaging availability)
PRE_CHECK --(all checks pass)--> GATES_EVAL
Servers: safety/gate_service (5 gates evaluated)
GATES_EVAL --(all gates pass)--> HUMAN_APPROVAL
Servers: safety/approval_checkpoint (clinician review)
Timeout: 300 seconds
HUMAN_APPROVAL --(approved)--> IN_PROGRESS
Servers: trialmcp-ledger (audit record)
safety/procedure_state (state transition)
IN_PROGRESS --(procedure complete)--> COMPLETED
Servers: trialmcp-provenance (lineage record)
trialmcp-ledger (final audit)
Any State --(e-stop triggered)--> ABORTED
Servers: safety/estop (signal propagation)
trialmcp-ledger (abort audit record)
docs/mcp-process/02-cross-site-mcp-communication.mdThe cross-site communication model connects hospital sites, cancer centers, sponsors, and CROs through a federated coordination layer. Each site operates its own five-server deployment while participating in cross-site audit chain synchronization and token exchange protocols.
MULTI-SITE MCP TOPOLOGY
+------------------+ +------------------+ +------------------+
| SITE ALPHA | | SITE BETA | | SITE GAMMA |
| (Hospital) | | (Cancer Center) | | (Hospital) |
| +------+ +-----+ | | +------+ +-----+ | | +------+ +-----+ |
| |authz | |fhir | | | |authz | |fhir | | | |authz | |fhir | |
| +------+ +-----+ | | +------+ +-----+ | | +------+ +-----+ |
| +------+ +-----+ | | +------+ +-----+ | | +------+ +-----+ |
| |dicom | |ledger|| | |dicom | |ledger|| | |dicom | |ledger||
| +------+ +-----+ | | +------+ +-----+ | | +------+ +-----+ |
| +----------+ | | +----------+ | | +----------+ |
| |provenance| | | |provenance| | | |provenance| |
| +----------+ | | +----------+ | | +----------+ |
+--------+---------+ +--------+---------+ +--------+---------+
| | |
+----------+-------------+-------------+----------+
| |
+------v--------+ +------v--------+
| SPONSOR | | CRO |
| MCP Client | | MCP Client |
+---------------+ +---------------+
Cross-site token exchange enables authorized actors to access resources across sites without requiring site-specific credentials. The token exchange protocol uses scoped, time-limited tokens issued by each site's authorization server, with cross-site audit chain synchronization ensuring a unified compliance record.
docs/mcp-process/03-clinical-system-integration.mdThe integration adapter architecture connects MCP servers to real hospital infrastructure through 34 adapters organized across six categories in the integrations/ directory.
integrations/fhir/smart_on_fhir.py)integrations/fhir/hapi_fhir.py)integrations/fhir/deid_adapter.pyintegrations/fhir/terminology_adapter.pyintegrations/dicom/dcm4chee_adapter.pyintegrations/dicom/orthanc_adapter.pyintegrations/dicom/dicomweb_adapter.pyintegrations/identity/oidc_adapter.pyintegrations/identity/mtls_adapter.pyintegrations/identity/kms_adapter.py| Category | Count | Key Adapters |
|---|---|---|
| FHIR | 9 | HAPI FHIR, SMART on FHIR, de-identification, terminology |
| DICOM | 9 | dcm4chee, Orthanc, DICOMweb, RECIST, modality filter |
| Clinical | 3 | Scheduling, e-consent, provenance export |
| Federation | 4 | Coordinator, policy enforcement, secure aggregation |
| Identity | 5 | OIDC, mTLS, KMS, policy engine |
| Privacy | 4 | De-identification pipeline, privacy budget, data residency |
| Total | 34 |
docs/mcp-process/04-safety-gate-evaluation.mdFive mandatory pre-procedure safety gates must pass sequentially before any robotic procedure can proceed. Each gate has a 300-second timeout. If any gate fails, the procedure transitions to ABORTED and a full audit record is created.
The gate evaluation animation above demonstrates the sequential pass/fail workflow. In production, the gate service (safety/gate_service.py) integrates with all five MCP servers to validate each condition.
docs/mcp-process/05-federated-learning-coordination.mdMulti-site federated learning enables collaborative model training without centralizing patient data. The system supports three aggregation strategies with differential privacy budget tracking per site.
integrations/privacy/privacy_budget.pyFederation adapters are implemented in integrations/federation/, including the coordinator (coordinator.py), policy enforcement (policy_enforcer.py), secure aggregation (secure_aggregation.py), and site harmonization (site_harmonization.py) modules.
docs/mcp-process/06-audit-provenance-chain.mdThe audit ledger maintains a hash-chained sequence of records using SHA-256 with canonical JSON serialization. Every MCP tool invocation produces an audit record linked to the prior record, creating a tamper-evident chain satisfying 21 CFR Part 11 requirements.
PROVENANCE DAG (Directed Acyclic Graph)
[FHIR Read: Patient/P-001]
|
v
[DICOM Query: CT Studies]---->[RECIST Measurement]
| |
v v
[Robot Procedure]------------>[Audit Record]
| |
v v
[Provenance Node] [Chain Block #N]
|
v
[Forward Lineage Query]
Source types: fhir, dicom, computed, external, federated
Action types: read, transform, aggregate, transfer, derive
docs/mcp-process/07-privacy-deidentification.mdThe HIPAA Safe Harbor 18-identifier pipeline removes protected health information (PHI) across three stages before clinical data leaves the server boundary. HMAC-SHA256 pseudonymization preserves referential integrity across de-identified records.
Data residency enforcement ensures compliance with federal, California (CCPA/CMIA), and New York state privacy regulations through the data residency adapter (integrations/privacy/data_residency.py). Access control combines RBAC and ABAC checks across four data classification levels.
Three-tier architecture: National Governance, Regional Layers, 750+ Sites
NATIONAL GOVERNANCE LAYER
+-----------------------------------------------------+
| Standards Body | Conformance Registry |
| Extension Mgmt | Version Compatibility Policy |
| Schema Registry | Validation Services |
+--------+---------+---------+--------+--------+------+
| | |
+--------v------+ +---------v-----+ +--------v-----+
| REGION 1 | | REGION 2 | | REGION N |
| (East) | | (Central) | | (West) |
| 200+ Sites | | 300+ Sites | | 250+ Sites |
| 5 Svrs/Site | | 5 Svrs/Site | | 5 Svrs/Site |
+-------+-------+ +-------+-------+ +-------+------+
| | |
+------------------+------------------+
|
+--------v-----------+
| FEDERATED LAYER |
| Aggregation |
| Differential Priv. |
| Audit Merge |
+--------------------+
Run deterministic simulations of national deployment, robot procedure workflows, and audit chain verification. All data is synthetic and modeled.
Five hierarchical levels enabling incremental adoption (click to expand)
Eight conformance profiles are defined in profiles/, including five hierarchical profiles and three regulatory overlays (country-us-fda.md, state-us-ca.md, state-us-ny.md).
Eight safety modules designed for Physical AI systems in clinical environments
E-stop signal propagation, abort workflow, post-abort evidence capture, recovery with re-authorization.
State machine enforcement with valid transition validation across 6 states.
Robot registration, capability validation, firmware version tracking. Capability declaration is required before any procedure.
Task order validation against safety constraints and robot capabilities using schemas/task-order.schema.json.
5 mandatory gates with sequential evaluation: Patient Consent, Site Capability, Robot Capability, Protocol Compliance, Human Approval. 300-second timeout per gate.
Multi-party approval requiring concurrent authorization from clinician, system, and regulatory parties before critical procedure transitions.
Site capability verification against conformance requirements and infrastructure readiness checks.
Execution boundary enforcement: spatial boundary validation, force limit enforcement, temporal constraint checking.
safety/estop.py)class EStopStatus(Enum):
IDLE = "IDLE"
TRIGGERED = "TRIGGERED"
ACKNOWLEDGED = "ACKNOWLEDGED"
RECOVERING = "RECOVERING"
class EStopController:
def trigger_estop(self, procedure_id, reason,
triggered_by, current_state=None):
if self._status == EStopStatus.TRIGGERED:
raise RuntimeError("E-stop already active")
signal = EStopSignal(
signal_id=str(uuid.uuid4()),
procedure_id=procedure_id,
reason=reason,
triggered_by=triggered_by,
affected_servers=list(self._active_servers),
preserved_state=current_state or {})
self._active_signal = signal
self._status = EStopStatus.TRIGGERED
return signal
Quantitative summary of the national repository at v1.2.0
| Category | Count |
|---|---|
| MCP servers | 5 |
| Tools (total) | 23 |
| JSON schemas | 13 |
| Conformance profiles | 8 |
| Test functions | 668 |
| Integration adapters | 34 |
| Specification docs | 9 |
| ADRs | 7 |
| Total files | 381+ |
| Lines of code (approx.) | 69,800+ |
| Category | Count |
|---|---|
| Safety modules | 8 |
| Benchmark modules | 5 |
| Certification tools | 4 |
| Deployment modes | 6 |
| Interop scenarios | 8 |
| Actor personas | 6 |
| Stakeholder guides | 5 |
| Operational docs | 5 |
| Total directories | 88 |
| Regulatory overlays | 7 |
| Category | Tests | Validates |
|---|---|---|
| Unit (integrations) | 205 | All 34 integration adapters |
| Unit (safety) | 88 | All 8 safety modules |
| Unit (core server) | 32 | 5 MCP server implementations |
| Unit (infrastructure) | 12 | Conformance harness, schema validator |
| Positive conformance | 69 | Correct behavior at Levels 1-3 |
| Adversarial | 57 | AuthZ bypass, chain tampering, PHI leakage |
| Blackbox | 63 | Per-server external conformance |
| Security | 39 | SSRF prevention, token lifecycle, chain integrity |
| Interoperability | 32 | Cross-server trace, schema validation |
| Negative | 26 | Invalid input rejection, unauthorized access |
| Integration | 13 | Multi-server integration scenarios |
| Total | 668 |
The repository maintains quality through a GitHub Actions CI pipeline defined in .github/workflows/ci.yml:
lint-and-format: Ruff linting and formatting (Python 3.10, 3.11, 3.12)integration-tests: Multi-server integration validationadversarial-tests: Security attack resistanceschema-validation: JSON Schema Draft 2020-12 validationschema-compatibility: Schema metadata and field consistencycontract-consistency: Generated model alignment with schemasbenchmark-smoke: Performance benchmark verificationsdk-python: Python SDK import verificationsdk-typescript: TypeScript SDK compilationcli-smoke: CLI command validationcodegen-consistency: Code generation pipeline verificationsecurity-scan: Dependency audit and secret detectiontypescript-build: Reference TypeScript compilationdocs-lint: Documentation completeness and link integrityStakeholder-specific pathways for implementing the national standard
Begin with Level 1 (Core) deployment for centralized audit trail access. Progress to Level 2 for de-identified clinical data queries. Guide: docs/guides/sponsor-cro.md
Deploy five-server stack using Docker Compose (deploy/docker-compose.yml). Integrate with existing EHR via FHIR adapters and PACS via DICOM adapters. Guide: docs/guides/hospital-it.md
Review conformance profiles and regulatory overlays (profiles/). Evaluate audit chain integrity using ledger_verify. Guide: docs/guides/regulator-irb.md
Implement MCP client interface against the 23-tool contract. Register robots via safety/robot_registry.py. Run conformance tests at Level 5. Guide: docs/guides/robot-vendor.md
Review the 9 normative specifications in spec/, 7 ADRs in docs/adr/, and governance framework. Guide: docs/guides/standards-community.md
ROBOT AGENT MCP SERVERS CLINICAL SYSTEMS
----------- ----------- ----------------
+--------+
| START |
+---+----+
| 1. Request Token
v
+--------+ +--------------+
| AuthZ |--------| trialmcp- | Issue scoped token
| Phase |--------| authz | (role + expiry)
+---+----+ +--------------+
| 2. Query Patient Data
v
+--------+ +--------------+ +-----------+
| FHIR |--------| trialmcp- |-------| EHR |
| Phase |--------| fhir |-------| (FHIR R4) |
+---+----+ +--------------+ +-----------+
| 3. Retrieve Imaging
v
+--------+ +--------------+ +-----------+
| DICOM |--------| trialmcp- |-------| PACS |
| Phase |--------| dicom |-------| (DICOM) |
+---+----+ +--------------+ +-----------+
| 4. Execute Procedure
v
+--------+
| ROBOT | Physical AI task
| ACTION | under safety rules
+---+----+
| 5. Record Audit
v
+--------+ +--------------+
| Audit |--------| trialmcp- | Hash-chained record
| Phase |--------| ledger | (21 CFR Part 11)
+---+----+ +--------------+
| 6. Record Provenance
v
+--------+ +--------------+
| Prov. |--------| trialmcp- | DAG lineage entry
| Phase |--------| provenance | (SHA-256)
+---+----+ +--------------+
v
+--------+
| DONE |
+--------+
A reference architecture demonstration and interactive simulation of the proposed National MCP-PAI Oncology Trials Standard. It serves as an educational and stakeholder communication tool that visualizes the system described in the paper using deterministic simulations with pre-configured data.
This is a proposed reference standard with a complete reference implementation (381 files, approximately 69,800 lines) that has not yet been deployed in clinical settings. The repository (v1.2.0) includes the complete specification, reference implementations in Python and TypeScript, a 668-function test suite, and a 20-page peer-reviewed paper.
Kawchak K. National MCP Servers for Physical AI Oncology Clinical Trial Systems. Zenodo. 2026; 10.5281/zenodo.18916731.
| Repository | DOI | Focus |
|---|---|---|
| national-mcp-pai-oncology-trials | 10.5281/zenodo.18894758 | National standard, SDKs, governance (current) |
| mcp-pai-oncology-trials | 10.5281/zenodo.18869776 | MCP server proof of concept, 5-server architecture |
| pai-oncology-trial-fl | 10.5281/zenodo.18840880 | Federated learning, privacy modules |
| physical-ai-oncology-trials | 10.5281/zenodo.18445179 | USL scoring, single-site Physical AI framework |
This demonstration was generated by Anthropic Claude Code Opus 4.6 and OpenAI ChatGPT 5.4 Thinking under the direction of Kevin Kawchak.
This project is distributed under the MIT License. The paper is distributed under CC BY 4.0.