Why-Be-So-Septic/mcp-server
If you are the rightful owner of mcp-server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to dayong@mcphub.com.
This repository implements a Model Context Protocol (MCP) server for predicting clinical outcomes for ICU/sepsis patients.
MCP Server — Sepsis Outcome Prediction
Overview This repository implements a Model Context Protocol (MCP) server exposing a tool that predicts clinical outcomes for ICU/sepsis patients based on their longitudinal lab results and metadata. The tool hides implementation details (like HTTP requests) from the LLM and provides a clean interface: supply patient records, receive per-day outcome predictions.
Key Features
- MCP tool: predict_sepsis_outcome
- MCP tool: compute_lab_score
- Input schema validated with Zod; all fields optional and nullable with default null
- Gender normalization for backend ("male"/"female" → "M"/"F")
- FastAPI backend integration at http://localhost:8000/predict with required checkpoint_path
- Text-based tool output (JSON stringified) to comply with MCP response types
Tool: predict_sepsis_outcome Description Analyzes medical data for a patient with sepsis and predicts their clinical outcome across time.
Input The tool expects an object with key data containing an array of patient records. Each record represents a measurement day for a patient and accepts the following fields:
- id: string | number | null
- StartDate: string (YYYY-MM-DD) | null
- EndDate: string (YYYY-MM-DD) | null
- Aging: number | null
- Gender: "male" | "female" | null
- data: string (measurement date, YYYY-MM-DD) | null
- Optional numeric labs (all number | null): ALT, APTT, AST, Amilasa, CRP, Conj_bilirubin, Creatinin, D_dimer, Ferritin, Fibrinogen, Glucose, Hemoglobin, LDG, Lymphocytes, Monocytes, Neutrophils, Platelets, Potassium, Procalcitonin, Sodium, Total_protein, Urea, WBC
Important
- The tool does not accept Outcome or DaysBfOutcome in the request payload. These fields are intentionally excluded from the schema and will be rejected.
- Missing fields are allowed and default to null.
Output interpretation For each day t in a patient’s timeline the model predicts one of:
- 0 = no event within ≤7 days (patient remains hospitalized)
- 1 = discharge within ≤7 days
- 2 = death within ≤7 days
Backend Integration
- Endpoint: POST http://localhost:8000/predict
- Required body shape: { "checkpoint_path": "tsformer_best.pt", "patients": [ ...normalized records... ] }
- Gender values are mapped automatically by the tool: "male" → "M", "female" → "F". Null stays null.
- The backend should sanitize any NaN/Infinity values in responses (replace with null) to avoid JSON serialization errors.
Example request to the MCP tool { "data": [ { "id": "12345", "StartDate": "2025-01-10", "EndDate": "2025-01-20", "Aging": 67, "Gender": "male", "data": "2025-01-12", "ALT": 35.0, "APTT": 28.5, "AST": 22.0, "CRP": 8.7, "Creatinin": 1.1, "WBC": 7.8 } ] }
Example tool output (text) Patient analysis complete. Sepsis outcome predictions available. { "predictions": [ { "id": "12345", "date": "2025-01-12", "y_hat": 0 } ], "meta": { "model": "tsformer_best.pt" } }
Getting started Prerequisites
- Node.js 20+
- pnpm 9+ (recommended)
- Running FastAPI backend at http://localhost:8000 with /predict endpoint
Install dependencies pnpm install
Run in development pnpm dev
Build pnpm build
Type check pnpm typecheck
Notes
- The MCP server is implemented in src/index.ts. The tool description includes a detailed schema and example.
- The server returns MCP-compliant text content; JSON is stringified before returning.
- If you change the backend path or checkpoint file, update src/index.ts accordingly.
License Proprietary / Internal (update as appropriate).