Skip to main content
Glama

smart-fhir

一个不会凭空捏造患者的连接器。

MCP v1 transport stdio FHIR R4 4.0.1 SMART 2.2.0 writes off

tools 4 sandbox public synthetic empty search stays empty unknown id 404 PHI none

安装 · 工具 · 工作原理 · 限制


安装

仅支持 stdio。TypeScript 构建完成后,添加一个本地连接器:

name: smart-fhir
command: node
args: dist/index.js
npm install
npm run build

为它添加以下环境变量(默认值,非机密信息):

FHIR_ISS = https://launch.smarthealthit.org/v/r4/fhir
FHIR_VERSION = R4
FHIR_AUTH_MODE = open
FHIR_WRITE = off
FHIR_AUDIT_PATH = ./audit/audit.jsonl

不要把机密值放进仓库。不要开放公共 HTTP 端口。不要绑定 TCP。

晨间快捷方式(相同环境变量)

npx -y tsx src/index.ts

参见 package.json 脚本:install、build、test、prove。

Related MCP server: smart-mcp-server

工具

四个工具。没有 create / update / delete。

工具

行为

smart_discover

{iss}/.well-informed/smart-configuration 执行 GET。返回解析后的 JSON,或明确的错误。不会凭空编造端点。

fhir_auth_status

返回 { mode, iss, fhir_version: "R4", write: "off", token_present, discovery_ok, last_error? }。绝不打印 token 或 PEM。

fhir_search

{iss}/{resourceType}?... 执行 GET。_count 默认 10,最大 50。只返回一页。空 Bundle 原样返回。

fhir_read

{iss}/{resourceType}/{id} 执行 GET。404 就是未找到,而不是虚构出来的资源。

resourceType 允许列表: Patient | Observation | Condition | MedicationRequest | Encounter。任何其他值 → { ok: false, error: "resourceType not in v1 allowlist" }

工作原理

FHIR_VERSION 必须是 R4。其他任何值都会拒绝启动。

内容

URL

说明

FHIR 索引(发布页面是 R5 5.0.0

http://hl7.org/fhir/

仅限官方索引。未实现。

FHIR R4(v1)

https://hl7.org/fhir/R4/

FHIR Release 4,4.0.1。资源模型。

SMART App Launch 2.2.0(STU 2.2)

https://hl7.org/fhir/smart-app-launch/

当前已发布的 SMART IG。基于 FHIR R4。

APP 启动 + 授权

https://hl7.org/fhir/smart-app-launch/app-launch.html

发现、standalone/EHR 启动、PKCE、token。App Launch(code+PKCE)不在 v1 范围内。

Backend Services

https://hl7.org/fhir/smart-app-launch/backend-services.html

client_credentials + 私钥 JWT。已实现;除非设置了环境变量,否则不用。

ISS 允许列表(去掉尾部斜杠,其他一律拒绝):

  • https://launic.smartfirhealthit.org/v/r4/smartivor(默认)

  • https://r4.smarthealthit.org

  • https://hapi.fhir.org/baseR4

FHIR_ISS 设为允许列表中另一个 base,即可指向其他 ISS。新 ISS 需要先评审。没有评审且没有真实 client_id,不要指向生产环境的 EHR。

FHIR_AUTH_MODE

行为

open(默认)

先 discovery,然后不带 Authorization 执行 FHIR GET。在 open 模式中 discovery 返回 404 不是致命的(记日志;继续)。FHIR 返回 401/403 → { ok: false, http_status, ... }

bearer

同样的 discovery。FHIR GET 携带 Authorization Bearer token。

backend_jwt

仅当 FHIR_CLIENT_ID(或 SMART_CLIENT_ID)和 FHIR_PRIVATE_KEY_PEM 同时存在时使用。SMART Backend Services JWT。缺少环境变量 → 拒绝启动。不会凭空编造凭证。

App Launch(code+PKCE)不在范围内FHIR_REDIRECT_URI 已保留但未使用。

认证失败返回:{ ok: false, http_status, issue?, error? }。绝不会出现人为制造的 Patient。

FHIR_WRITE 默认为 off。即使有人把它设为 on,v1 也没有写入工具。写入永远不会向 FHIR POST AuditEvent。

名称

默认值

说明

FHIR_ISS\t

默认启动器 R4

必须在允许列表内

FHIR_VERSION

R4

拒绝其他任何值

FHIR_AUTH_MODE

open

open / bearer / backend_jwt

FHIR_WRITE

off

v1 中写入保持关闭

FHIR_AUDIT_PATH

/workspace/smart-fhir-mcp/audit/audit.jsonl

只增不改的 JSONL;本地设为 ./audit/audit.jsonl

FHIR_ACCESS_TOKEN

未设置

仅用于 Bearer

FHIR_CLIENT_ID

未设置

Backend Services

SMART_CLIENT_ID

未设置

FHIR_CLIENT_ID 的别名

FHIR_PRIVATE_KEY_PEM

未设置

Backend Services JWT

FHIR_JWKS_URL

未设置

预留,供需要 JWKS 的 EHR 使用

FHIR_SCOPE

五个 system/*.rs 类型

JWT 模式覆盖

FHIR_REDIRECT_URI

未设置

为后续 App Launch 预留

审计行:ts、tool、iss、mode、resourceType、id?、http_status、entry_count?。不记录资源正文、token、PEM,也不记录姓名/MRN 查询值。

限制

  • R5 / R4B 作为默认。额外资源类型。CRUD。Bulk。App Launch 浏览器/PKCE。

  • 真实 EHR / 真实 PHI。生产部署。公网绑定或 Streamable HTTP。

  • momentum / fhirhydrant / Atrium / Pinecone / Medplum。

  • 不是医疗产品。不诊断、不治疗、不存取 PHI。


无 PHI。不连接一个 LiveEHR。

Install Server
F
license - not found
A
quality
C
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

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

View all related MCP servers

Related MCP Connectors

  • Securely access and manage FHIR healthcare data stored in Medplum.

  • Hosted MCP endpoint with realistic fake data for prototyping agents. 12 tools, no setup.

  • Guardrailed FHIR access for AI agents: PHI redaction, audit trail, step-up auth, tenant isolation

View all MCP Connectors

Latest Blog Posts

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/swami8791/smart-fhir-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server