fhir-patient-consent-mcp-server
Enables natural-language queries about a patient, their insulin pump or other devices, and consent to share their data, with answers retrieved in real time from a FHIR R4 endpoint.
README
fhir-patient-consent-mcp-server
An MCP server that lets a model ask questions about a patient, their insulin pump, and who's consented to see that data - all sourced live from a FHIR (R4) store. No data lives in this server; every answer is a real-time FHIR REST query.
It's a companion to
fhir-consent-service (a Spring Boot API for
writing Patient/Device/Consent to FHIR), but has no code dependency on
it - this server only depends on the FHIR wire format, so it works against
any FHIR R4 endpoint.
Tools
| Tool | Purpose |
|---|---|
find_patient |
Look up a patient by MRN and/or family name |
get_patient |
Fetch one patient's demographics by FHIR id |
get_patient_devices |
List a patient's devices (flags insulin pumps via SNOMED CT 469756000) |
get_patient_consents |
List a patient's data-sharing consents (partner, purpose, data categories, period) |
check_partner_consent |
Authorization check: does partner X currently have active consent for patient Y? |
Resource
fhir-chart://{patientId} - a consolidated JSON "chart" (demographics +
devices + active consents) for a patient, meant to be attached directly
into context by a host application rather than assembled by the model
across several tool calls. See docs/architecture.md
for why this is a resource rather than a sixth tool.
Setup
npm install
npm run build
Point it at a FHIR server
export FHIR_BASE_URL=http://localhost:8081/fhir # default shown
export FHIR_AUTH_TOKEN=... # optional bearer token
The easiest way to get data to query: run
fhir-consent-service's docker compose up -d
(starts a local HAPI FHIR JPA server on :8081) and create a patient,
device, and consent through its REST API, then query the same store here.
Run it directly (for testing with stdio)
npm run dev
Register it with an MCP client
For Claude Desktop / Claude Code, add to your MCP config:
{
"mcpServers": {
"fhir-patient-consent": {
"command": "node",
"args": ["/absolute/path/to/fhir-patient-consent-mcp-server/dist/index.js"],
"env": {
"FHIR_BASE_URL": "http://localhost:8081/fhir"
}
}
}
}
Run npm run build first so dist/index.js exists.
Example questions once connected
- "Look up the patient with MRN MRN-778001."
- "What insulin pump does patient 123 have, and what's its serial number?"
- "Has GlucoVue Remote Monitoring been given consent to see patient 123's device data?"
- "Show me patient 123's full chart." (exercises the
fhir-chart://resource)
Testing
npm test
Unit tests cover the mapper layer (src/mappers/*.ts), including the
consent-authorization logic in isConsentActiveForPartner - specifically
its handling of revoked consents, not-yet-started/expired periods, and
open-ended (end absent) periods, since those are the cases most likely to
be gotten subtly wrong.
There's no integration test against a live FHIR server in this repo (unlike
fhir-consent-service, which uses Testcontainers) because this server has
no write path to seed data with - it would need to depend on that repo (or
duplicate its resource-creation logic) purely to set up test fixtures. If
this repository grows a seeding script, add one then.
Note: written in a sandboxed environment without npm registry access, so
npm install/npm run build/npm testhave not actually been executed here. The code targets@modelcontextprotocol/sdk@^1.12; if the SDK'sserver.tool(...)/server.resource(...)signatures have moved toregisterTool/registerResourceby the version you install, the fix is mechanical - check the SDK's own README/CHANGELOG.
Project layout
src/
├── index.ts Server entry point, registers all tools/resources
├── fhirClient.ts Thin fetch-based FHIR REST client
├── tools/ One file per MCP tool
├── resources/ One file per MCP resource
├── mappers/ FHIR JSON -> summary objects + consent auth logic
└── util/results.ts Shared tool-result formatting helpers
Security note
This server performs no PHI redaction and passes through whatever the FHIR
server returns. If deploying against real patient data, put access control
in front of the FHIR server itself (this server forwards FHIR_AUTH_TOKEN
as a bearer token, but does not manage token acquisition/refresh) and
consider what should and shouldn't be exposed to an MCP client at all.
License
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。