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: Healthpoint 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。

Available Tools

4 tools
fhir_auth_statusFHIR auth statusA

Report mode, ISS, R4 lock, write=off, token_present, discovery_ok. Never prints token or PEM.

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

TDQS

A3.5/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

The description adds the behavioral note 'Never prints token or PEM', which is a valuable safety disclosure not available in annotations (since none are provided). It also lists exactly what will be reported. However, it does not state whether the operation is read-only, whether it can fail (e.g., if discovery hasn't been run), or what the response format will be. Given zero annotations, the description carries the burden but provides only partial behavioral transparency.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, tightly written sentence that front-loads the verb 'Report' and then enumerates the status fields. It ends with a concise safety disclaimer. There is no fluff or repetition; every word earns its place. This is an exemplary model of conciseness.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a zero-parameter tool with no output schema, the description lists all the status values it reports and adds a safety constraint. It lacks details on the exact output structure (e.g., JSON keys vs. plain text) and does not specify whether the tool requires prior setup (like discovery), but these are minor given the tool's simplicity. Overall, it provides enough context for an agent to call and interpret the results reasonably.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool has zero parameters (schema is an empty object), so the baseline for parameter semantics is 4 according to the rubric. The description correctly mentions the fields that will be reported, which are effectively the tool's 'output' rather than input parameters. Since there are no parameters to document, the description adds what little meaning is needed.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description uses the verb 'Report' and lists specific status fields (mode, ISS, R4 lock, etc.), making the tool's purpose clear: to report FHIR authentication status. It is distinguishable from siblings like fhir_search and fhir_read by focusing on auth state rather than data operations, and from smart_discover by being a status check. However, it does not explicitly differentiate itself from siblings in the text.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus the sibling tools. It doesn't mention scenarios like 'before calling fhir_search' or 'when you need to verify authentication state'. The purpose is implicit from the name and list of status fields, but no explicit usage context is given, and no exclusions or alternatives are referenced.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

fhir_readFHIR readB

GET {iss}/{resourceType}/{id} as FHIR R4. 404 is not found, not a made-up resource. Same resourceType allowlist as search.

ParametersJSON Schema
NameRequiredDescriptionDefault
idYes
issNo
resourceTypeYes

TDQS

B3.3/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden. It does disclose that a 404 means genuinely not found, which is valuable error semantics. It also indicates the response is FHIR R4 format. However, it does not mention authentication requirements, rate limits, or what happens on other errors (e.g., 401, 500). For a read-only GET operation, this is above minimum but not rich.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is two sentences with no wasted words. The URL template is front-loaded, followed by a critical error-handling note and a cross-reference to search. Every sentence earns its place, making it highly efficient.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple single-resource read, the description covers the URL construction, 404 semantics, and resource type allowlist. It does not explicitly state the tool's overall purpose (fetching one resource) or mention authentication, which might be assumed from a prior auth step. Given no output schema, it could also clarify the response shape, though 'FHIR R4' implies a FHIR resource. Slight gaps remain in purpose clarity and auth context.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must compensate. The URL template '{iss}/{resourceType}/{id}' gives meaning and ordering to the three parameters, and the allowlist note constrains resourceType. However, it does not explain what iss represents (likely the server base URL) or any format expectations for id or resourceType beyond being strings. This is partial compensation for the lack of schema documentation.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states 'GET {iss}/{resourceType}/{id} as FHIR R4', which clearly indicates a read operation targeting a specific FHIR resource. It also clarifies the 404 semantics, which helps distinguish it from a search that might return empty results. However, it does not explicitly say 'retrieve a single resource by ID', relying on the URL pattern to imply it, and it does not contrast with fhir_search directly beyond the allowlist note.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no explicit guidance on when to use this tool versus fhir_search or other siblings. It only mentions 'Same resourceType allowlist as search', which hints at shared constraints but does not explain the core difference (single resource lookup vs query). A clear statement like 'Use this to fetch one resource by ID; use fhir_search for queries' is missing.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

smart_discoverSMART discoverA

GET {iss}/.well-known/smart-configuration (SMART App Launch 2.2.0). Optional iss must be v1-allowlisted. Does not invent endpoints.

ParametersJSON Schema
NameRequiredDescriptionDefault
issNo

TDQS

A3.8/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the full burden of behavioral disclosure. It includes one genuinely useful behavioral note ('Does not invent endpoints'), signaling the tool only returns what the server actually advertises. However, it omits other relevant behavior such as error handling when iss is not allowlisted, whether authentication is needed, or any required scopes, leaving the behavioral profile only partially disclosed.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Three terse, information-dense sentences with no filler. The endpoint is front-loaded, followed by the spec version, the parameter constraint, and the single most important behavioral caveat. Every sentence earns its place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple one-optional-parameter discovery tool with no output schema, the description covers the endpoint, the constraint, and the key behavior. Return format is not described, but SMART discovery responses are standardized by the cited spec, reducing the need. Only edge-case behavior (unallowlisted iss handling) is left unspecified, which is minor for this tool's simplicity.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 0%, so the description must compensate. It does add meaning by substituting iss into the URL path and by stating the v1-allowlist constraint. However, it never explicitly defines iss as the FHIR server base URL or describes the valid format/value domain beyond the allowlist, leaving some semantic burden on inference from the '{iss}' placeholder.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb (GET) plus a concrete resource (.well-known/smart-configuration) with a spec version (SMART App Launch 2.2.0). The '{iss}' prefix clarifies it targets a specific FHIR server's discovery document, and it is clearly distinct from the sibling tools (fhir_auth_status, fhir_search, fhir_read) which handle auth status and searches/reads rather than capability discovery.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Provides a useful precondition (iss must be v1-allowlisted) and clarifies the call is optional-parameter. However, it gives no explicit guidance on when to prefer smart_discover versus sibling tools like fhir_auth_status, nor any exclusion criteria. The 'when to use vs alternatives' context is implied by its distinct purpose but never stated.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 4 tool updatesv1.0.0
    • First observedfhir_auth_status
    • First observedfhir_read
    • First observedfhir_search
    • First observedsmart_discover

TDQS

A3.6/5.0

Scored across 4 tools

Disambiguation5/5

Each tool targets a distinct function: smart_discover retrieves server metadata, fhir_auth_status reports client-side authentication state, fhir_search performs list queries, and fhir_read fetches individual resources. There is no overlap or ambiguity between the four operations.

Naming Consistency4/5

Tools use a consistent prefix pattern (smart_ for auth/discovery, fhir_ for data operations) and each suffix clearly indicates the action (discover, auth_status, search, read). While the prefixes differ by domain, the overall structure is predictable and not chaotic.

Tool Count4/5

Four tools is on the lower end but appropriate for a narrowly scoped read-only FHIR access server focused on discovery and basic querying. It avoids bloat while covering the primary use cases.

Completeness3/5

The server covers read and search for a limited set of resources, but lacks pagination (only one page), search parameters beyond resource type, and a capability statement. Given the explicit read-only nature, core operations are present but notable gaps exist in search depth and server metadata.

Maintenance

ActivityMaintained
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers