sharp-on-fhir-mcp
sharp-fhir-mcp
Ein Clean-Room SHARP-on-MCP-konformer FHIR R4 MCP-Server mit interaktiven MCP-UI-Klinik-Dashboards.
Entwickelt für den Prompt Opinion "Build the Future of Healthcare AI" Hackathon — ein herstellerneutraler MCP-Server, in den sich jede SMART-on-FHIR-App, jeder Agent oder LLM-Host ohne serverseitiges OAuth, API-Schlüssel oder proprietäre Auth-Flows einklinken kann.
Warum SHARP?
Die SHARP (Standardised Healthcare Agent Remote Protocol)-Spezifikation beschreibt ein Header-basiertes Kontextmodell für MCP- Server im Gesundheitswesen:
Header | Zweck |
| Basis-URL des FHIR R4-Endpunkts des Patienten |
| Vom Agent-Host bereits erstelltes Bearer-Token |
| Optionale Standard- |
Gemäß SHARP §3.2 führt der MCP-Server selbst niemals einen OAuth-Vorgang durch. Der Agent- Host (z. B. ein SMART-on-FHIR-Launch-Container) erhält das Token und leitet es bei jedem Aufruf weiter. Das bedeutet, dass eine einzige Bereitstellung dieses Servers mit Epic, Cerner, MEDITECH, athenahealth, eClinicalWorks, ConnectEHR, HAPI oder jedem anderen FHIR R4-Endpunkt funktioniert — es gibt nichts herstellerspezifisches.
Der Server kündigt capabilities.experimental.fhir_context_required = true
bei jeder Initialisierungsantwort an, damit SHARP-fähige Clients wissen, dass sie diese
Header automatisch weiterleiten müssen.
Was ist enthalten
🩺 Klinische FHIR-Tools
fhir_get_capability_statement— den verbundenen FHIR-Server entdeckenfhir_get_patient,fhir_search,fhir_read,fhir_patient_everything— generischer R4-Zugriffclinical_search_patients,clinical_get_patient_summaryclinical_get_appointments,clinical_get_encountersclinical_get_problems,clinical_get_medications,clinical_get_allergies,clinical_get_immunizationsclinical_get_health_record— konsolidierte Datensatz-Abfrageclinical_get_context— vollständiger Besuchskontext (Demografie + Allergien + Medikamente + Probleme + Labor + Vitalwerte + Begegnungen + Warnungen) parallel
🔬 Labor, Vitalwerte & Bildgebung
lab_get_results,lab_get_vital_signs,lab_get_diagnostic_reportsimaging_get_documents— DocumentReference-Suche
🧠 Optionaler persistenter Speicher (SimpleMem)
Wenn SIMPLEMEM_API_URL und SIMPLEMEM_ACCESS_TOKEN gesetzt sind:
memory_store_encounter— eine Besuchszusammenfassung speichernmemory_store_alert— klinische Bedenken für den nächsten Besuch markierenmemory_search_history— semantische Suche über vergangene Begegnungenmemory_get_patient_history— alle gespeicherten Erinnerungen für den aktuellen Patienten auflisten
📊 MCP-UI-Visualisierungen
visualize_lab_trend— Chart.js-Liniendiagramm eines Laborwerts über die Zeitvisualize_vitals— Multi-Chart-Vitalwerte-Dashboardvisualize_patient_dashboard— vollständige HTML-Klinikseite (Demografie, Warnungen, Allergien, Medikamente, Probleme, Labor, Begegnungen, Impfungen + Chart.js-Trends)
Alle visuellen Tools geben MCP-UI ui://-Ressourcen zurück, die der Host in seinem Inspector-Bereich rendert.
Schnellstart
1. Installation
git clone https://github.com/your-org/sharp-fhir-mcp.git
cd sharp-fhir-mcp
pip install -e .2. Server starten
sharp-fhir-mcp # streamable-http on 0.0.0.0:8000
sharp-fhir-mcp --port 9000 # custom port
sharp-fhir-mcp --strict-context # 403 on non-handshake without FHIR headersDer MCP-Endpunkt ist http://localhost:8000/mcp.
Hinweis:
localhostbezieht sich hier auf den lokalen Host der Maschine, auf der Sie den Server ausführen. Um remote darauf zuzugreifen, stellen Sie den Server bereit (siehe unten) oder leiten Sie den Port auf Ihre lokale Instanz weiter.
3. Verbindung von einem SHARP-fähigen MCP-Client
Senden Sie diese Header bei jeder JSON-RPC-Anfrage:
X-FHIR-Server-URL: https://hapi.fhir.org/baseR4
X-FHIR-Access-Token: <bearer token from your SMART launch>
X-Patient-ID: 12345 # optional4. Eine öffentliche Sandbox ausprobieren, ohne eine SMART-App zu schreiben
Die HAPI öffentliche FHIR R4-Sandbox ist schreibgeschützt und erfordert keine Authentifizierung — nützlich zum Ausprobieren:
curl -X POST http://localhost:8000/mcp \
-H 'Content-Type: application/json' \
-H 'Accept: application/json, text/event-stream' \
-H 'X-FHIR-Server-URL: https://hapi.fhir.org/baseR4' \
-H 'X-FHIR-Access-Token: anonymous' \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}'Bereitstellung
Vercel (Python serverless)
Dieser Server läuft als zustandsloser Streamable-HTTP-Endpunkt, der auf Vercel sofort einsatzbereit ist. Sie können ein bestehendes Next.js MCP-Gerüst wiederverwenden, indem Sie entweder:
Den Python ASGI-Handler hinzufügen — fügen Sie die
appStarlette-Instanz inapi/index.pyein:# api/index.py from sharp_fhir_mcp.server import app # noqa: F401plus eine minimale
vercel.json:{ "builds": [{"src": "api/index.py", "use": "@vercel/python"}], "routes": [{"src": "/(.*)", "dest": "api/index.py"}] }Oder ihn als Sidecar hinter Ihrem bestehenden Vercel-Frontend ausführen und
/mcpper Reverse-Proxy an einen langlebigeren Host (Fly.io, Railway, Render) weiterleiten.
Der Server respektiert die von Vercel injizierte PORT-Umgebungsvariable.
Lokale Entwicklung
cp .env.example .env # set FHIR_SERVER_URL etc. for fallbacks
sharp-fhir-mcp # http://localhost:8000/mcpDocker (optional)
FROM python:3.12-slim
WORKDIR /app
COPY . .
RUN pip install -e .
EXPOSE 8000
CMD ["sharp-fhir-mcp", "--host", "0.0.0.0", "--port", "8000"]Architektur
┌─────────────────────────────────────────────────────────────┐
│ MCP Client / Agent / LLM host (Claude, Cursor, custom) │
│ • Knows the patient's FHIR endpoint + access token │
│ • Sends X-FHIR-Server-URL, X-FHIR-Access-Token headers │
└────────────────────────┬────────────────────────────────────┘
│ Streamable HTTP (SHARP-on-MCP)
POST /mcp + JSON-RPC + SHARP headers
▼
┌─────────────────────────────────────────────────────────────┐
│ sharp-fhir-mcp │
│ │
│ ┌────────────────────────────────────────────────────────┐ │
│ │ SharpContextMiddleware │ │
│ │ • Parses X-FHIR-Server-URL / X-FHIR-Access-Token │ │
│ │ • Stores in ContextVar for the request scope │ │
│ └─────────────────────────┬──────────────────────────────┘ │
│ ▼ │
│ ┌────────────────────────────────────────────────────────┐ │
│ │ FastMCP tool registry │ │
│ │ ├─ fhir_* (generic R4 search/read) │ │
│ │ ├─ clinical_* (patient/encounter/medication/…) │ │
│ │ ├─ lab_* / imaging_*(observations, reports, docs) │ │
│ │ ├─ memory_* (optional SimpleMem) │ │
│ │ └─ visualize_* (MCP-UI Chart.js dashboards) │ │
│ └─────────────────────────┬──────────────────────────────┘ │
│ ▼ │
│ ┌────────────────────────────────────────────────────────┐ │
│ │ Vendor-neutral FHIR R4 client (httpx, async) │ │
│ └─────────────────────────┬──────────────────────────────┘ │
└────────────────────────────┼────────────────────────────────┘
▼
FHIR R4 server (Epic / Cerner / HAPI / …)Siehe CLAUDE.md für detaillierte modulweise Notizen und die
SHARP-Compliance-Checkliste.
SHARP-Compliance-Checkliste
Anforderung | Status |
Streamable-HTTP-Transport (stdio nicht im Umfang) | ✅ |
FHIR-Endpunkt aus | ✅ |
Bearer-Token aus | ✅ |
Optionaler | ✅ |
| ✅ |
Kein serverseitiges OAuth / keine Tokenspeicherung | ✅ |
Herstellerneutraler FHIR R4-Client | ✅ |
Strukturierte | ✅ |
Optionale strikte 403-Durchsetzung ( | ✅ |
Lizenz
MIT — siehe LICENSE.
This server cannot be installed
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Connectors
Hosted MCP server exposing US hospital procedure cost data to AI assistants
MCP server for secureFlows: token-free URL builders and integration-linting tools for AI agents.
MCP Hub: AI service discovery, per-user OAuth, and multi-service workflow orchestration
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/TerminallyLazy/featherless-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server