fhir-mcp-server
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@fhir-mcp-serverfind patients with hypertension"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
fhir-mcp-server
FHIR R4 サーバー(JP-Core 準拠の fhir-server や HAPI FHIR 等)に接続する MCP(Model Context Protocol)サーバーです。Claude Desktop / Claude Code などの MCP クライアントから、FHIR データを自然言語で検索・参照・(オプトインで)書き込みできます。
fhir-server とはリポジトリ分離(接点は HTTP + Bearer トークンのみ)
SMART Backend Services(OAuth2
client_credentials+system/*スコープ)のクライアントとして動作FHIR_BASE_URLとクレデンシャルの差し替えで任意の FHIR R4 サーバーに接続可能
クイックスタート
Node.js 20+ が必要です。
npm install
npm run build
# Claude Code に登録(認証なしの fhir-server が localhost:3000 で動いている場合)
claude mcp add fhir -e FHIR_BASE_URL=http://localhost:3000 -- node /path/to/fhir-mcp-server/dist/index.js認証ありの FHIR サーバーには
FHIR_CLIENT_ID/FHIR_CLIENT_SECRETを渡します(両方未設定なら無認証モード)。書き込みツールは
FHIR_MCP_ALLOW_WRITES=trueのときだけ登録されます。Node.js を入れずに Docker で動かす方法と Claude Desktop の設定は docs/setup.md を参照してください。
Related MCP server: medplum-mcp
ドキュメント
ドキュメント | 内容 |
セットアップ、Docker / docker compose、Claude Code・Desktop への接続、環境変数、SMART Backend Services 認証 | |
Web版(リモート HTTP MCP)の起動、Auth0 の要点、Cloud Run・Render へのデプロイ、スマホ Claude アプリへの登録 | |
Web版の OAuth を Auth0 に委譲するための詳細手順 | |
ツール一覧(参照系・書き込み系)とトークン消費を抑えるコツ | |
開発コマンド、integration テスト、ソース構成 | |
設計方針とその背景 |
Available Tools
6 toolsget_capabilitiesGet FHIR server capabilitiesARead-only
Fetch the FHIR server's CapabilityStatement (GET /metadata) and return a compact summary: supported resource types, interactions, search parameters, and operations. Call this first to discover what the server supports.
| Name | Required | Description | Default |
|---|---|---|---|
No parameters | |||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Annotations declare readOnlyHint=true, and description adds that it returns a compact summary of resource types, interactions, search parameters, and operations. No contradictions. Slightly enhanced beyond annotations.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Two concise sentences, front-loaded with action ('Fetch'), no wasted words. Perfectly structured.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given no parameters, annotations, and no output schema, the description sufficiently explains the return value (compact summary of capabilities). Complete enough for a simple read-only discovery tool.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
No parameters exist, so no need for parameter explanation. Schema coverage is 100%. Baseline score of 4 is appropriate.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
Description clearly states it fetches the CapabilityStatement and returns a compact summary of capabilities. Specifies verb 'Fetch' and resource 'FHIR server's CapabilityStatement'. Differentiates from sibling tools like search_fhir, read_fhir etc.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Explicitly says 'Call this first to discover what the server supports', providing clear usage context. Lacks explicit when-not or alternative tools but is adequate for a discovery tool.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
get_historyGet resource historyARead-only
Fetch version history. With resourceType and id: history of one resource (GET /{type}/{id}/_history). With only resourceType: history across that type. With neither: system-wide history.
| Name | Required | Description | Default |
|---|---|---|---|
| id | No | Logical id (requires resourceType) | |
| count | No | Entries per page (default 20, capped at 50) | |
| since | No | Only versions created after this instant (ISO 8601) | |
| resourceType | No | FHIR resource type (omit for system-level history) |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Description adds implementation details (endpoint patterns) beyond the readOnlyHint annotation, but does not explain what the history response contains (e.g., version entries, ordering) or pagination behavior beyond the count parameter.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Three concise sentences, front-loaded with the primary purpose, no redundancy or unnecessary detail.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Description is mostly complete for a read operation with readOnlyHint, but lacks details about the return format (no output schema) and does not mention that the response is typically a Bundle of history entries, which would aid an agent in processing the result.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 100% with descriptive parameter descriptions, but the tool description adds meaningful context by explaining the three usage modes and how parameters relate (e.g., id requires resourceType), which goes beyond the schema's individual field descriptions.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
Description clearly states it fetches version history and specifies three distinct modes based on parameter combinations (with id+resourceType, only resourceType, neither). This distinguishes it from siblings like search_fhir and read_fhir, which serve different purposes.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Description provides explicit context for when to use each combination of parameters, but does not indicate when NOT to use the tool or mention alternative tools for similar tasks.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
patient_everythingFetch a patient's full recordARead-only
Fetch all resources in a patient's compartment (GET /Patient/{id}/$everything): conditions, observations, encounters, medications, etc. Use types to limit resource types and since to limit to recently-updated resources — both are recommended to keep responses manageable.
| Name | Required | Description | Default |
|---|---|---|---|
| count | No | Results per page (default 20, capped at 50) | |
| since | No | Only resources updated after this instant (ISO 8601, e.g. 2026-01-01T00:00:00Z) | |
| types | No | Restrict to these resource types, e.g. ["Observation", "Condition"] | |
| patientId | Yes | Logical id of the Patient |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Annotations already declare readOnlyHint=true. The description adds the behavioral context that it fetches a large bundle of resources, but does not detail pagination or performance implications. Since annotations cover the safety profile, a 3 is appropriate.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is two sentences with no filler. The first sentence defines purpose and endpoint; the second gives actionable parameter guidance. It is front-loaded and every word earns its place.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a tool that returns a large bundle of resources, the description covers the key points: what is returned, optional filters, and the endpoint. Without an output schema, it could mention pagination or response format, but it is sufficient for a read-only operation.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 100% so baseline is 3. The description adds value by explaining that `types` and `since` are recommended for limiting response size, providing context beyond the schema descriptions. This justifies a 4.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states 'Fetch all resources in a patient's compartment' with specific examples (conditions, observations, etc.) and the FHIR endpoint. It distinguishes from sibling tools like read_fhir (single resource) and search_fhir (query-based).
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description recommends using `types` and `since` to keep responses manageable, providing explicit guidance for efficient use. It implies this is for comprehensive patient data retrieval but does not explicitly contrast with siblings for when to use alternatives.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
read_fhirRead a FHIR resourceARead-only
Read a single resource by type and id (GET /{resourceType}/{id}).
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | Logical id of the resource | |
| resourceType | Yes | FHIR resource type, e.g. Patient |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Annotations already declare readOnlyHint=true. The description adds the HTTP method and URL pattern (GET /{resourceType}/{id}), providing additional behavioral context beyond annotations.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single, front-loaded sentence that efficiently conveys the tool's purpose without any wasted words.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool's simplicity (read by type and ID), the description is complete. It covers the purpose, HTTP method, and URL pattern. Output schema is not needed for such a tool.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 100% with both parameters having descriptions. The description reiterates 'by type and id' but does not add new meaning beyond the schema. Baseline 3 is appropriate.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states 'Read a single resource by type and id', with a specific verb and resource. It distinguishes from sibling tools like search_fhir and patient_everything which serve different purposes.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies when to use (to read a single resource) by specifying 'Read a single resource by type and id'. It does not explicitly list alternatives but is clear in context of siblings.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
search_fhirSearch FHIR resourcesARead-only
Search resources of a given type (GET /{resourceType}?...). Search parameters are passed through to the server as-is, so chained parameters, _has, _include, _revinclude, _sort, _total etc. all work. To keep responses small, prefer _elements (comma-separated field list) or _summary=true, and page with _count plus the returned hasNextPage flag (use params like _count/_offset or the server's paging links).
| Name | Required | Description | Default |
|---|---|---|---|
| count | No | Results per page (default 20, capped at 50) | |
| params | No | Search parameters as key-value pairs, e.g. {"name": "山田", "_elements": "id,name,birthDate"}. Repeat-style OR values can be comma-separated per FHIR search rules. | |
| resourceType | Yes | FHIR resource type to search, e.g. Patient, Observation, Condition |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Annotations already indicate readOnlyHint=true, so the tool is safe for reads. The description adds valuable behavioral context: HTTP GET method, parameter passthrough, pagination behavior, and response size control. No contradictions.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Two sentences with zero waste. The first sentence states the core action and HTTP method, the second provides crucial usage tips. Information is front-loaded and every sentence adds value.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
No output schema, but description explains the pagination response (hasNextPage flag). For a search tool with moderate complexity, it covers essential aspects: parameters, pagination, response size. Could mention more about return format but is sufficient.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema covers all 3 parameters with descriptions. The description adds extra meaning: params can include FHIR chaining, _include, _revinclude, and mentions _elements, _summary, _count which are not in schema but are related. Adds value beyond schema.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states it searches resources of a given type via GET, and the title 'Search FHIR resources' reinforces this. It distinguishes from siblings like read_fhir (single resource retrieval) and patient_everything (specific patient bundle).
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides explicit guidance on when to use and how: pass parameters as-is, use _elements/_summary for small responses, paginate with _count and hasNextPage flag. It doesn't explicitly state when not to use but siblings imply alternatives.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
validate_fhirValidate a FHIR resourceARead-only
Validate a resource against the server's profiles without saving it (POST /{resourceType}/$validate). Use this before create_fhir/update_fhir to catch structural or terminology errors early. The resource JSON must include resourceType.
| Name | Required | Description | Default |
|---|---|---|---|
| resource | Yes | The FHIR resource to validate (JSON object including resourceType) |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Description confirms the operation is read-only (no save), aligning with readOnlyHint annotation. It adds behavioral context about the endpoint and required structure (resourceType), surpassing annotation detail.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Two concise sentences, front-loaded with purpose and endpoint. No redundant or filler content.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Lacks description of the return value (e.g., OperationOutcome). While sufficient given no output schema, adding expected response type would improve completeness.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
With 100% schema coverage, schema already defines the param. Description adds critical constraint that resource must include resourceType, which is not in schema description, enhancing clarity.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool validates a FHIR resource against server profiles without saving, using a specific HTTP method and endpoint. It distinguishes from sibling tools like search or read by focusing on validation.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Explicitly advises using this tool before create_fhir or update_fhir to catch errors early, providing clear context for when to use it over alternatives.
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.
6 tool updates
v0.1.0- First observed
get_capabilities - First observed
get_history - First observed
patient_everything - First observed
read_fhir - First observed
search_fhir - First observed
validate_fhir
TDQS
Scored across 6 tools
Each tool targets a distinct FHIR operation: server metadata, searching, reading, patient compartment, history, and validation. No overlaps are apparent.
Most tool names follow a verb_noun pattern (e.g., get_capabilities, search_fhir), except patient_everything which uses a noun_verb form. The inconsistency is minor and does not hinder understanding.
Six tools is appropriate for a FHIR MCP server covering essential interactions: discovery, search, read, patient compartment, history, and validation. The scope is well-balanced.
The toolset lacks create, update, and delete operations, which are core to resource lifecycle management. The validate_fhir tool even references create_fhir/update_fhir as prerequisites, but they are missing.
Maintenance
Related MCP Connectors
- mcpOAuthcom.medplum
Securely access and manage FHIR healthcare data stored in Medplum.
Hosted MCP server for the Healthie EHR & telehealth API: patients, appointments, charting, tasks.
Hosted MCP server for Cliniko — patients, appointments, availability, and invoices for AI agents.
Hosted MCP server exposing US hospital procedure cost data to AI assistants
Related MCP Servers
- AlicenseNot gradedqualityNot gradedmaintenanceEnables seamless integration with FHIR APIs for healthcare applications, allowing users to search, retrieve, create, update, and analyze clinical information through natural language interactions. Supports SMART-on-FHIR authentication and works with various healthcare systems like EPIC and HAPI FHIR servers.Apache 2.0
- FlicenseNot gradedqualityDmaintenanceProvides access to Medplum FHIR healthcare data, enabling Claude and other MCP clients to read, search, and query FHIR resources from one or more Medplum environments.8 npm-
- FlicenseNot gradedqualityAmaintenanceEnables LLM-based agents and MCP-compatible clients to query and manipulate FHIR resources through full CRUD tools, with document ingestion, semantic search, LOINC terminology lookup, and OAuth2-authenticated FHIR API integration.-
- FlicenseNot gradedqualityAmaintenanceEnables LLM-based agents and MCP-compatible clients such as Claude Desktop to query and manipulate clinical data through natural-language prompts, supporting full CRUD operations on FHIR resources, OAuth2-secured FHIR API access, AI-powered document ingestion, and semantic search over embedded documents via Pinecone. It also provides LOINC terminology lookup and validation, plus RAG-ready context retrieval for clinical data workflows.-