smart-fhir
Enables read-only SMART on FHIR R4 discovery, search, and read operations against public synthetic sandboxes, returning actual empty results and 404s rather than inventing patient data.
README
<div align="center">
smart-fhir
A connector that will not invent a patient.
<br>
Install · Tools · How it works · Limits
</div>
<br>
<img src="assets/demo.svg" alt="smart-fhir: smart_discover OK, empty Patient search stays empty, unknown id is 404" width="100%">
Install
stdio only. After the TypeScript build, add a local connector:
name: smart-fhir
command: node
args: dist/index.js
npm install
npm run build
Env for that add (defaults, not secrets):
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
Do not put secret values in the repo. No public HTTP port. Do not bind TCP.
Morning shortcut (same env)
npx -y tsx src/index.ts
See package.json scripts: install, build, test, prove.
Tools
Four tools. No create / update / delete.
| Tool | Action |
|---|---|
smart_discover |
GET {iss}/.well-known/smart-configuration. Parsed JSON or explicit error. Does not invent endpoints. |
fhir_auth_status |
{ mode, iss, fhir_version: "R4", write: "off", token_present, discovery_ok, last_error? }. Never prints token or PEM. |
fhir_search |
GET {iss}/{resourceType}?... _count default 10, max 50. One page. Empty Bundle is returned as-is. |
fhir_read |
GET {iss}/{resourceType}/{id}. 404 is not found, not a made-up resource. |
resourceType allowlist: Patient | Observation | Condition | MedicationRequest | Encounter. Anything else → { ok: false, error: "resourceType not in v1 allowlist" }.
How it works
FHIR_VERSION must be R4. Anything else refuses to start.
| What | URL | How to read it |
|---|---|---|
| FHIR index (published page is R5 5.0.0) | http://hl7.org/fhir/ | Official index only. Not implemented. |
| FHIR R4 (v1) | https://hl7.org/fhir/R4/ | FHIR Release 4, 4.0.1. Resource model. |
| SMART App Launch 2.2.0 (STU 2.2) | https://hl7.org/fhir/smart-app-launch/ | Current published SMART IG. Based on FHIR R4. |
| App launch + authorization | https://hl7.org/fhir/smart-app-launch/app-launch.html | Discovery, standalone/EHR launch, PKCE, token. App Launch (code+PKCE) is out of v1. |
| Backend Services | https://hl7.org/fhir/smart-app-launch/backend-services.html | client_credentials + private-key JWT. Implemented; unused unless env is set. |
ISS allowlist (trailing slash stripped, anything else refused):
https://launch.smarthealthit.org/v/r4/fhir(default)https://r4.smarthealthit.orghttps://hapi.fhir.org/baseR4
Set FHIR_ISS to another allowlisted base to point at a later ISS. A new ISS needs a review first. Do not point this at a live EHR without that review plus a real client_id.
| FHIR_AUTH_MODE | Behavior |
|---|---|
open (default) |
Discover, then FHIR GET without Authorization. Discovery 404 is not fatal in open (logged; continue). 401/403 FHIR → { ok: false, http_status, ... }. |
bearer |
Same discovery. FHIR GET with Authorization Bearer token. |
backend_jwt |
Only if both FHIR_CLIENT_ID (or SMART_CLIENT_ID) and FHIR_PRIVATE_KEY_PEM exist. SMART Backend Services JWT. Missing env → refuse to start. Does not invent credentials. |
App Launch (code+PKCE) is out. FHIR_REDIRECT_URI is reserved and unused.
Auth failure shape: { ok: false, http_status, issue?, error? }. Never a synthetic Patient.
FHIR_WRITE defaults off. v1 has no write tools even if someone sets on. Writes never POST AuditEvent to FHIR.
| Name | Default | Notes |
|---|---|---|
| FHIR_ISS | default launcher R4 | Must stay allowlisted |
| FHIR_VERSION | R4 | Reject anything else |
| FHIR_AUTH_MODE | open | open / bearer / backend_jwt |
| FHIR_WRITE | off | Writes stay off in v1 |
| FHIR_AUDIT_PATH | /workspace/smart-fhir-mcp/audit/audit.jsonl |
Append-only JSONL; set ./audit/audit.jsonl locally |
| FHIR_ACCESS_TOKEN | unset | Bearer only |
| FHIR_CLIENT_ID | unset | Backend Services |
| SMART_CLIENT_ID | unset | Alias of FHIR_CLIENT_ID |
| FHIR_PRIVATE_KEY_PEM | unset | Backend Services JWT |
| FHIR_JWKS_URL | unset | Reserved if an EHR wants JWKS |
| FHIR_SCOPE | five system/*.rs types | JWT mode override |
| FHIR_REDIRECT_URI | unset | Reserved for later App Launch |
Audit lines: ts, tool, iss, mode, resourceType, id?, http_status, entry_count?. No resource body, no token, no PEM, no name/MRN query values.
Limits
- R5 / R4B as default. Extra resource types. CRUD. Bulk. App Launch browser/PKCE.
- Real EHR / real PHI. Production deploy. Public bind or Streamable HTTP.
- momentum / fhirhydrant / Atrium / Pinecone / Medplum.
- Not a medical product. Does not diagnose, treat, or store PHI.
<div align="center">
No PHI. No live EHR.
</div>
推荐服务器
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 模型以安全和受控的方式获取实时的网络信息。