TrialGuard GxP MCP Server
README.md
# TrialGuard GxP — Regulatory CAPA & 21 CFR Part 11 Studio
**TrialGuard GxP** is an Atlassian Forge, Rovo Agent, MCP, and Teamwork Graph compliance studio built for **Biotech, Clinical Trial, and Medical Device** teams operating on Jira and Confluence under **FDA 21 CFR Part 11**, **ISO 13485**, and **ICH Q9**.
Instead of relying on paid external LLM calls for compliance math, TrialGuard pairs a **deterministic TypeScript regulatory engine** with Atlassian's native **Rovo Agent**, **Rovo MCP Bridge**, and **Teamwork Graph** lineage model.
## Live Demo & Judge Resources
- **Interactive Custom UI Preview (GitHub Pages)**: [https://alphonshhhomenicmtu.github.io/trialguard-gxp-codegeist/](https://alphonshhhomenicmtu.github.io/trialguard-gxp-codegeist/)
- **8-Slide Architecture Deck (PDF)**: [https://alphonshhhomenicmtu.github.io/trialguard-gxp-codegeist/trialguard-deck.pdf](https://alphonshhhomenicmtu.github.io/trialguard-gxp-codegeist/trialguard-deck.pdf) (also in [`docs/trialguard-deck.pdf`](./docs/trialguard-deck.pdf))
- **MCP & Agent Tool Contract**: [`skill.md`](./skill.md)
- **3-Minute Atlassian Cloud Deployment**: [`DEPLOY_CHECKLIST.md`](./DEPLOY_CHECKLIST.md)

## Key Capabilities
1. **Tamper-Evident 21 CFR Part 11 Electronic-Signature Hash Chain (`src/compliance/hashChain.ts`)**
- Cryptographically chains every `Author`, `Clinical_Lead_Approval`, and `QA_Review` electronic signature using deterministic SHA-256 digests (`FDA 21 CFR Part 11 §11.10(e) & §11.50`).
- Instant detection of payload tampering, broken `previousHash` links, and sequence gaps—including a live **"Simulate Tamper"** toggle in the Custom UI.
2. **Deterministic ICH Q9 FMEA & SOP Compliance Engine (`src/compliance/capaEngine.ts`)**
- Computes `RPN = Severity × Occurrence × Detection`, assigns `Minor` (72h SLA), `Major` (24h SLA), or `Critical` (4h SLA) containment bands, and enforces patient-safety / batch-quarantine escalation rules.
- Scans Confluence-backed Controlled SOPs for upcoming expirations, overdue periodic reviews, and operator training-gap exposure.
3. **Teamwork Graph Regulatory Lineage (`src/graph/regulatoryGraph.ts`)**
- Maps `ClinicalProtocol -> ControlledSOP -> QualityDeviation -> CapaApprovalSignoff` relationships and flags orphan SOPs or unsigned CAPAs.
4. **Rovo QA Officer + 4 Typed MCP Tools (`src/rovo/regulatoryActions.ts`, `src/mcp/gxpTools.ts`)**
- Exposes `classifyDeviationSeverity`, `verifyAuditHashChain`, `auditSopExpirationRisk`, and `generate21CFRPart11Report` (producing both **Markdown** and **Atlassian Document Format (ADF)** inspection packs).
- Exposes 4 schema-validated MCP tools (`evaluate_fmea_risk`, `verify_part11_chain`, `scan_sop_compliance`, `export_inspection_dossier`) documented in [skill.md](./skill.md).
## Architecture
```
manifest.yml (nodejs24.x)
├── jira:issuePanel & confluence:contentBylineItem ──▶ static/panel/ (Vite + TS Custom UI)
├── rovo:agent ("TrialGuard Regulatory QA Officer") ──▶ src/rovo/regulatoryActions.ts
├── rovo:mcp ("TrialGuard GxP MCP Server") ──▶ src/mcp/gxpTools.ts
└── Teamwork Graph & Compliance Core ──▶ src/compliance/ & src/graph/
```
## Quick Start (Local Build & Verification)
```bash
npm install
npm --prefix static/panel install
npm test
npm run build
```
To preview the Custom UI standalone in any browser without an Atlassian tenant:
```bash
npm --prefix static/panel run dev
```
For 3-minute Atlassian Cloud deployment steps, see [DEPLOY_CHECKLIST.md](./DEPLOY_CHECKLIST.md).
## License
MIT — see [LICENSE](./LICENSE).
This server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessNo recent community issues