rootcause-mcp
The RootCause MCP server enables AI agents to conduct medical reasoning and structured root cause analysis (RCA). It provides:
Session Management — Start, retrieve, list, filter, and archive RCA sessions with case types such as death, complication, near miss, safety, and staffing.
Evidence Handling — Add, retrieve, and verify structured evidence with provenance and source metadata.
Differential Diagnosis — Propose, update, rank, and exclude hypotheses using Bayesian updates and likelihood ratios, and link evidence to hypotheses.
Cognitive Transparency — Record explicit reasoning, alternatives considered, uncertainty factors, and confidence rationales as auditable thinking steps.
Fishbone (Ishikawa) Analysis — Initialize 6M diagrams (Personnel, Equipment, Material, Process, Environment, Monitoring), add causes with sub-causes, evidence, and HFACS codes, inspect diagrams, and export in Mermaid, JSON, or Markdown.
5-Why / Why Tree Analysis — Iteratively drill down with Why questions up to 5 levels, branch from any node, mark root causes with confidence, and export trees in Mermaid, JSON, or Markdown.
Causal Relationship Mapping — Add directed or bidirectional causal links between Why nodes and classify them as contributes_to, feedback, escalates, or mitigates.
Causation Verification — Run counterfactual tests for temporality, necessity, mechanism, and sufficiency, with standard or comprehensive verification modes.
HFACS-MES Classification — Get AI-ranked HFACS-MES code suggestions, confirm classifications, browse the framework hierarchy, list learned rules, reload rules from YAML, and map 6M Fishbone categories to HFACS codes.
Reporting — Generate auditable CONTRACT reports in JSON or FHIR-compatible DiagnosticReport formats with content hashes for integrity.
Teaching Case Generation — Convert Why Trees into teaching cases with learning objectives, common pitfalls, discussion prompts, and reverse-causality questions, targeted to learner levels and exported in Markdown or JSON.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@rootcause-mcpPerform root cause analysis on a fall incident using fishbone diagram"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
RootCause MCP
Medical reasoning, differential diagnosis, and clinical RCA harness for any MCP-compatible AI agent.
English | 繁體中文
Mission
RootCause MCP enables general-purpose agents such as Claude Code, Codex, Cline, OpenCode, OpenClaw, and Z.ai agents to perform a specialized workflow:
Ingest clinical documents through the host agent.
Register source-grounded evidence and provenance.
Build and update differential diagnoses with likelihood ratios.
Record explicit rationales, alternatives, uncertainty, and possible bias.
Connect diagnostic reasoning to Fishbone, 5-Why, HFACS-MES, and causation checks.
Produce a machine-readable, auditable report.
The agent performs the reasoning. The MCP server does not inspect hidden model states or raw private chain-of-thought. It provides schemas, workflow constraints, persistence, calculations, and audit records for reasoning the agent explicitly chooses to externalize.
This project is not a medical device and must not autonomously diagnose or treat patients. Clinical use requires qualified human review, local governance, privacy controls, and independent verification of source documents.
Related MCP server: SafetyOps MCP Server
Architecture
graph TB
A[General-purpose AI Agent] -->|MCP SDK 2.0| T[36 typed tools]
D[Clinical documents] --> A
subgraph Harness
T --> S[ServerState / case aggregate]
S --> O[ClinicalReasoningOrchestrator]
O --> E[Evidence + provenance]
O --> H[Hypotheses + Bayesian updates]
O --> R[ReasoningChain]
S --> C[ThinkingChain: explicit rationale records]
end
E --> DB[(SQLite / SQLModel)]
H --> DB
R --> DB
C --> DB
S --> CR[CONTRACT report]
CR --> J[JSON]
CR --> F[FHIR-compatible DiagnosticReport]
T --> RCA[Fishbone / 5-Why / HFACS-MES / causation]The dependency direction follows DDD:
Interface -> Application -> Domain <- InfrastructureWhat Is Persisted
The SDK 2.0 server persists the medical reasoning aggregate in SQLite:
Structured Evidence and source metadata
Differential-diagnosis hypotheses and Bayesian update history
Explicit ThinkingStep records supplied by the agent
ReasoningStep audit records generated by the orchestrator
RCA sessions and Fishbone diagrams
Known limitation: the legacy Why Tree repository remains in memory and is not yet rehydrated after process restart. Authentication, encryption-at-rest, tenant isolation, database migrations, and regulated deployment controls must be supplied by the deployment environment before clinical production use.
Quick Start
# Install the locked environment
uv sync --all-extras
# Run the MCP SDK 2.0 stdio server
uv run rootcause-mcpVS Code .vscode/mcp.json:
{
"servers": {
"rootcause-mcp": {
"type": "stdio",
"command": "uv",
"args": ["run", "rootcause-mcp"],
"cwd": "${workspaceFolder}"
}
}
}Environment variables:
Variable | Purpose | Default |
| SQLite database and generated exports |
|
| Configuration root containing |
|
Agent Workflow
A compatible agent should follow the sequence below instead of jumping directly to a diagnosis:
rc_start_session
-> rc_add_evidence
-> rc_think_aloud / rc_identify_gaps / rc_challenge_assumption
-> rc_propose_hypothesis
-> rc_link_evidence_to_hypothesis
-> rc_get_differential_diagnosis
-> rc_get_reasoning_chain
-> rc_verify_causation
-> rc_generate_contract_reportrc_propose_hypothesis requires the agent to provide clinical rationale,
alternatives considered, supporting evidence, uncertainty factors, and confidence
rationale. These are explicit agent-authored records, not a dump of hidden model
reasoning.
See Agent Integration Guide for payload examples.
Tool Catalog
Category | Count | Purpose |
Cognitive transparency | 5 | Explicit rationale, reflection, gaps, assumptions, thinking-chain retrieval |
Evidence | 3 | Add, retrieve, and verify structured evidence |
Differential diagnosis | 4 | Propose, update, rank, and exclude hypotheses |
Reasoning chain | 2 | Retrieve and export the auditable action chain |
CONTRACT report | 1 | Generate finalized JSON or FHIR-compatible output |
HFACS-MES | 6 | Suggest, confirm, inspect, learn, reload, and map classifications |
Session | 4 | Start, retrieve, list, and archive RCA sessions |
Fishbone | 4 | Initialize, add causes, inspect, and export |
Why Tree | 6 | Ask why, inspect, cross-link, mark root causes, export, and teach |
Causation verification | 1 | Conservative counterfactual and mechanism checks |
Total | 36 |
All tools expose an MCP SDK 2.0 input_schema and a structured output envelope.
New medical-reasoning tools return structured domain data; legacy RCA tools retain
human-readable text and also expose it through structured content.
Evidence and Causation Safety
Evidence provenance records document, location, collector, and timestamps.
Evidence quality uses an Oxford CEBM-inspired strength/reliability model.
Likelihood ratios and their rationale are retained in hypothesis history.
A causal claim without explicit counterfactual or mechanism support is not marked fully verified.
Finalized reports include a SHA-256 content hash.
Generated paths are confined under
ROOTCAUSE_DATA_DIR/exports.
Quality Gates
Verified locally on Windows with Python 3.12:
uv run pytest
uv run ruff check src tests
uv run mypy --no-incremental src/rootcause_mcp
uv run bandit -r src/rootcause_mcp -ll -q
uv run vulture src/rootcause_mcp --min-confidence 80Current baseline:
48 tests passing
80% branch-aware coverage gate passing
Ruff passing
Strict mypy passing for 71 source files
Bandit medium/high-severity scan passing
No vulture findings at 80% confidence
Project Layout
src/rootcause_mcp/
├── domain/ # Entities, value objects, repository contracts, services
├── application/ # Case aggregate, orchestration, progress guidance
├── infrastructure/ # SQLModel repositories and safe export paths
├── interface/ # MCP tool schemas and handlers
└── server_v2.py # Sole MCP SDK 2.0 entry pointDocumentation
Research and Attribution
The design references publicly available work including MEDDxAgent, ClinClaw, HFACS-MES, Oxford CEBM concepts, FHIR conventions, and the MCP Python SDK. See the research survey for licenses and design notes.
License
Apache License 2.0. See LICENSE.
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- Alicense-qualityDmaintenanceProvides AI-powered medical image analysis tools for LLM agents, enabling tasks such as X-ray classification, interactive segmentation, and visual question answering. It supports multi-step diagnostic reasoning and clinical workflows through a suite of specialized medical AI models.MIT
- Alicense-qualityDmaintenanceEnables AI assistants to query workplace incident data using RAG, providing search, analysis, and corrective action plans.1MIT

vClinic MCP Serverofficial
Flicense-qualityCmaintenanceEnables AI agents to manage virtual clinic data including patients, visits, diagnoses, treatments, lab/radiology orders, and search medical literature and internal knowledge base.- Alicense-qualityBmaintenanceEnables privacy-first medical document analysis with multi-perspective AI review. Ingest documents, run consilium reviews, generate doctor letters, and search patient memory—all through natural language.Apache 2.0
Related MCP Connectors
Physician-reviewed medical opinions and prescriptions for AI agents.
Deterministic reasoning stack for AI agents: simulate, decide & compute, plus cross-domain tools.
Deterministic compliance and vertical knowledge bases for autonomous agents. Free 24hr trial.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/u9401066/rootcause-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server