Medical Calc MCP
π₯ MCP Server with 121 validated medical calculators for AI agents. DDD architecture, evidence-based formulas with PMID citations. Supports Claude, GPT, and other LLM integrations.
Install / Use
/learn @u9401066/Medical Calc MCPQuality Score
Category
Development & EngineeringSupported Platforms
README
Medical Calculator MCP Server π₯
A DDD-architected medical calculator service providing clinical scoring tools for AI Agent integration via MCP (Model Context Protocol).
ηΉι«δΈζη (Traditional Chinese)
π Table of Contents
- Features
- Why This Project?
- Research Framework
- Architecture
- Quick Start
- OpenClaw Compatibility
- OpenClaw Registry Guide
- Deployment Modes
- Agent Integration
- Docker Deployment
- HTTPS Deployment
- REST API
- Security
- Tool Discovery
- Available Tools
- Usage Examples
- References
- Development
- Deployment Guide
- Clinical Guidelines Review
- Roadmap
π― Features
- π MCP Native Integration: Built with FastMCP SDK for seamless AI agent integration
- π Intelligent Tool Discovery: Two-level key system + Tool Relation Graph (Hypergraph) for smart tool selection
- π‘οΈ Smart Parameter Matching: Alias support, fuzzy matching, and typo tolerance
- β οΈ Boundary Validation: Literature-backed clinical range checking with automatic warnings
- ποΈ Clean DDD Architecture: Onion architecture with clear separation of concerns
- π Evidence-Based: All 121 calculators cite peer-reviewed research (100% coverage, Vancouver style)
- π Type Safe: Full Python type hints with dataclass entities
- π Bilingual: Chinese/English documentation and tool descriptions
π€ Why This Project?
The Problem
When AI agents (like Claude, GPT) need to perform medical calculations, they face challenges:
- Hallucination Risk: LLMs may generate incorrect formulas or values
- Version Confusion: Multiple versions of same calculator (e.g., MELD vs MELD-Na vs MELD 3.0)
- No Discovery Mechanism: How does an agent know which tool to use for "cardiac risk assessment"?
The Solution
This project provides:
| Feature | Description | |---------|-------------| | Validated Calculators | Peer-reviewed, tested formulas | | Tool Discovery | AI can search by specialty, condition, or clinical question | | MCP Protocol | Standard protocol for AI-tool communication | | Paper References | Every calculator cites original research |
π§ͺ Development Methodology
We employ a human-in-the-loop, AI-augmented workflow to ensure clinical accuracy:
- Domain Specification: Human experts define the target medical specialty or clinical domain.
- AI-Driven Search: AI agents perform comprehensive searches for the latest clinical guidelines and consensus.
- Guideline Extraction: Systematically identify recommended scoring systems and calculations mentioned in those guidelines.
- Source Validation: Trace back to original peer-reviewed primary papers to verify exact formulas and coefficients.
- Implementation: Develop validated calculation tools with precise parameters and evidence-based interpretations.
π¬ Research Framework
This project implements a Neuro-Symbolic Framework for reliable medical calculation, combining LLM understanding with validated symbolic computation.
Academic Positioning
| Challenge | Traditional LLM | Our Solution | | --------- | --------------- | ------------ | | Calculation Accuracy | ~50% (MedCalc-Bench) | >95% via validated formulas | | Parameter Extraction | Vocabulary mismatch | ParamMatcher (60+ aliases) | | Safety Guardrails | No clinical constraints | BoundaryValidator (PMID-backed) | | Tool Discovery | Keyword/RAG only | Two-Level Key + Hypergraph |
Three-Module Architecture
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β NEURO-SYMBOLIC MEDICAL REASONING β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β β
β βββββββββββββββββββββ βββββββββββββββββββββ βββββββββββββββββββββ β
β β Discovery Engine β β β Reasoning Interfaceβ β β Safety Layer β β
β β (Tool Selection) β β (Param Matching) β β (Validation) β β
β β β β β β β β
β β β’ High/Low Keys β β β’ Alias Matching β β β’ Range Check β β
β β β’ Hypergraph β β β’ Fuzzy Match β β β’ PMID Citation β β
β β β’ Context-Aware β β β’ Multi-lingual β β β’ Error Messages β β
β βββββββββββββββββββββ βββββββββββββββββββββ βββββββββββββββββββββ β
β β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Core Contributions
-
Semantic Parameter Mapping (ParamMatcher): Resolves vocabulary mismatch between clinical text and calculator parameters through alias tables, fuzzy matching, and suffix normalization.
-
Literature-Based Guardrails (BoundaryValidator): Validates input values against clinically impossible ranges derived from peer-reviewed literature (17+ parameters with PMID citations).
-
Context-Aware Tool Discovery: Two-level key system + Clinical Knowledge Graph for intelligent tool recommendation based on clinical context.
π Levels of Academic Value
| Level | Contribution | Scholarly Focus | | ----- | ------------ | --------------- | | L1 | Validated Symbolic Engine | Extends LLM with deterministic precision | | L2 | Hierarchical Tool Discovery | Solves RAG precision in high-stakes domains | | L3 | Robust Semantic Extraction | Resolves the "Vocabulary Mismatch" problem | | L4 | Knowledge-Gated Safety Layer | Unique: Literature-derived constraint verification | | L5 | Clinical Hypergraph Agent | Cross-specialty workflow reasoning |
π For detailed research roadmap and benchmark strategy, see ROADMAP.md
ποΈ Architecture
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β infrastructure/mcp/ β
β (MCP Server, Handlers, Resources) β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β MedicalCalculatorServer β β
β β βββ handlers/DiscoveryHandler (discover, list...) β β
β β βββ handlers/CalculatorHandler (calculate_*) β β
β β βββ resources/CalculatorResourceHandler β β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
ββββββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββββ
β uses
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β application/ β
β (Use Cases, DTOs, Validation) β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β DiscoveryUseCase, CalculateUseCase β β
β β DiscoveryRequest/Response, CalculateRequest/Responseβ β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
ββββββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββββ
β depends on
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β domain/ β
β (Entities, Services, Value Objects) β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β BaseCalculator, ToolMetadata, ScoreResult β β
β β LowLevelKey, HighLevelKey, ToolRegistry β β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β γCore, Zero Dependenciesγ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Key Design Decisions
| Decision | Rationale | |----------|-----------| | DDD Onion | Domain logic isolated from infrastructure | | FastMCP | Native Python MCP SDK, simple decorator-b
