Skip to main content
Glama
brianbastian01

FHIR MCP Server

FHIR MCP Server

An MCP (Model Context Protocol) server that gives AI assistants safe, read-only access to healthcare data using the FHIR R4 standard — built on a public sandbox, so it's completely safe to run, share, and extend.

Instead of an AI assistant guessing at what a "patient," "observation," or "condition" looks like, this server lets it query real FHIR-shaped data through a small set of well-defined, guardrailed tools.

⚠️ Data note: This project connects to the SMART Health IT public sandbox (r4.smarthealthit.org), which serves synthetic, non-real test data for development purposes. No real patient data is used or stored anywhere in this project. This is a technical demonstration of AI-assisted healthcare data workflows — not a clinical or diagnostic tool.


Why this project exists

Healthcare data is one of the most valuable — and most sensitive — domains for AI to work in. Most public MCP examples connect AI to generic APIs (weather, GitHub, Slack). This one demonstrates something closer to real enterprise work: giving an AI assistant controlled, read-only access to structured clinical data, with the same instincts you'd want in a production system — least privilege, hard limits, and no write access at all.

It pairs naturally with an orchestrating agent: point an AI assistant (Claude, or any MCP-compatible client) at this server, and it can look up patients, pull their vitals, and summarize conditions in plain language — all through auditable, typed tool calls instead of free-form scraping.


Related MCP server: MCP FHIR Server

Tools

Tool

What it does

search_patients

Search the sandbox for patients by name

get_patient

Get demographic details for a patient by id

get_observations

Get recent vitals/lab observations for a patient

summarize_conditions

Get a plain-language summary of a patient's recorded conditions

All tools are read-only — there is no create, update, or delete capability anywhere in this server, by design.


Guardrails

This server is built with the same discipline you'd want in any production integration:

  • Read-only, always. No write, update, or delete operations exist in the codebase.

  • Result caps. Every query is capped (default 10, max 20 results) to prevent runaway responses.

  • Request timeouts. All outbound FHIR requests time out after 10 seconds.

  • Sandbox-only data source. Points exclusively at a public, synthetic FHIR test server — never a production or real clinical system.


Getting started

Prerequisites

  • Node.js 18+

  • An MCP-compatible client (e.g. Claude Desktop, or any client supporting the MCP stdio transport)

Install & build

git clone https://github.com/brianbastian01/fhir-mcp-server.git
cd fhir-mcp-server
npm install
npm run build

Run it

npm start

The server communicates over stdio, so in practice you'll point your MCP client at it rather than running it standalone. For example, in Claude Desktop's config:

{
  "mcpServers": {
    "fhir": {
      "command": "node",
      "args": ["/absolute/path/to/fhir-mcp-server/dist/index.js"]
    }
  }
}

Restart your MCP client, and the four tools above will be available for the AI to call.

Try it

Once connected, ask your AI assistant something like:

"Search the FHIR sandbox for patients named Smith, then summarize the conditions for the first result."

The assistant will call search_patients, then summarize_conditions, and give you a plain-language answer — all backed by real tool calls you can inspect.


Project structure

fhir-mcp-server/
├── src/
│   └── index.ts       # Server setup + all four tool definitions
├── dist/               # Compiled output (generated by `npm run build`)
├── package.json
├── tsconfig.json
├── LICENSE
└── README.md

Roadmap / ideas for extending this

  • Add a medications tool (FHIR MedicationRequest resource)

  • Add pagination support for large result sets

  • Add an in-memory cache to reduce repeated calls to the sandbox

  • Swap the sandbox URL for a real FHIR server behind proper auth (OAuth2/SMART on FHIR) for a production-grade version

  • Pair with a small orchestrating agent that chains these tools automatically


About

Built by Brian Bastian, Solution Architect with 14+ years in enterprise software, cloud architecture, and — more recently — AI-assisted engineering, agents, and MCP servers.

License

MIT — see LICENSE.

Available Tools

4 tools
get_observationsA

Get recent clinical observations (e.g. vitals, lab results) for a patient by id. Synthetic sandbox data only. Capped to protect against large or runaway responses.

ParametersJSON Schema
NameRequiredDescriptionDefault
limitNoMax results to return (1-20)
patientIdYesThe FHIR Patient resource id

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. It adds useful context: data is synthetic sandbox data, and responses are capped to protect against runaway responses. However, it does not explicitly state that the operation is read-only (though 'Get' implies it) or describe the output format.

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?

Two sentences, front-loaded with the purpose, then key limitations. Every word earns its place; no fluff or repetition.

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 tool with 2 params and no output schema, the description covers the essential purpose and limitations (synthetic data, cap). It could optionally mention ordering or time range, but the examples and constraint 'recent' give a reasonable picture. Overall, sufficiently complete.

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 100%, and both parameters have clear descriptions in the schema. The tool description adds context about 'recent' and 'capped,' but does not elaborate on parameter specifics. Baseline 3 is appropriate since the schema already documents the parameters well.

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?

The description clearly states the tool fetches recent clinical observations (vitals, lab results) for a patient by id. It uses a specific verb and resource, and the examples distinguish it from sibling tools like get_patient and summarize_conditions.

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?

The description implies usage: call this when you need a patient's recent observations. It does not explicitly state when to prefer this over siblings or mention any alternatives/exclusions, but the context of patientId and the tool name make the use case reasonably clear.

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

get_patientA

Get demographic details for a single patient by their FHIR id. Synthetic sandbox data only.

ParametersJSON Schema
NameRequiredDescriptionDefault
patientIdYesThe FHIR Patient resource id

TDQS

A4.1/5.0
Behavior4/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 discloses a key behavioral trait: 'Synthetic sandbox data only,' which informs the user about the non-production environment. The verb 'Get' also implies a read-only operation. It does not detail error behavior or return format, but for a simple get-by-id tool, the core behavior is sufficiently transparent.

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 concise sentences, front-loaded with the primary purpose and followed by the important environmental note. Every word earns its place, with no unnecessary detail or repetition.

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

Completeness5/5

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

For a tool with one parameter, no output schema, and no nested objects, the description is complete. It states what it returns (demographic details), the input required (FHIR id), and the environment (synthetic sandbox). No additional context is needed for an agent to select and invoke it correctly.

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 100%: the parameter patientId is described as 'The FHIR Patient resource id.' The description also mentions 'by their FHIR id,' which reinforces the same meaning but does not add new semantic details beyond the schema. The schema already handles the parameter semantics adequately.

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?

The description clearly states the tool 'Get demographic details for a single patient by their FHIR id.' The verb 'Get' is specific, the resource is 'patient', and the scope ('single patient', 'demographic details') distinguishes it from sibling tools like search_patients (which implies searching) and get_observations (which targets a different resource).

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?

The description implies usage: use this tool when you have a specific FHIR id and want demographic details for a single patient. However, it does not explicitly mention when not to use it or suggest alternatives like search_patients for searching without an id. The context is clear but lacks explicit exclusions or alternative references.

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

search_patientsA

Search for patients in the FHIR sandbox by name. Returns synthetic test data only — never real patient records. Use this first to find a patient's id before calling get_patient or get_observations.

ParametersJSON Schema
NameRequiredDescriptionDefault
nameYesFull or partial patient name to search for
limitNoMax results to return (1-20)

TDQS

A4.4/5.0
Behavior4/5

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

No annotations are provided, so the description carries the full burden. It discloses a key non-obvious behavior: returns synthetic test data only, never real patient records. However, it does not describe the return format or error behavior, but this is acceptable for a simple search tool.

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 three concise sentences, each providing distinct value: what it does, its synthetic data guarantee, and workflow guidance. It is front-loaded and free of redundancy.

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 search tool with no output schema, the description covers the core purpose, data safety, and usage sequence. It implies the return includes patient ids but does not explicitly state the return structure. Given the low complexity, this is adequate, though a bit more detail would make it completely self-sufficient.

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 100% for both parameters (name and limit), so the schema fully documents parameter semantics. The description adds no extra parameter details beyond what the schema already provides, earning the baseline score of 3.

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?

The description clearly states the tool searches for patients in the FHIR sandbox by name, specifying the resource (patients) and the action (search). It also explicitly distinguishes from siblings by saying to use it before get_patient or get_observations to find a patient's id.

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

Usage Guidelines5/5

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

Provides explicit guidance: 'Use this first to find a patient's id before calling get_patient or get_observations.' This clearly indicates when to use this tool and the order relative to alternatives, plus notes it returns synthetic data only.

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

summarize_conditionsA

Get a plain-language summary of a patient's recorded conditions (diagnoses). Synthetic sandbox data only — this is a data-retrieval tool, not a clinical or diagnostic tool.

ParametersJSON Schema
NameRequiredDescriptionDefault
patientIdYesThe FHIR Patient resource id

TDQS

A4.3/5.0
Behavior4/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 explicitly labels itself as a 'data-retrieval tool' (implying read-only) and adds the key disclaimer that it is not clinical or diagnostic, which discloses the tool's limitations. It does not detail return format or error handling, but these are less critical for a simple retrieval tool.

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, front-loaded with the core purpose, and every clause adds context (nature of data, non-clinical disclaimer). There is no redundant or vague language.

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

Completeness5/5

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

For a simple tool with one parameter and no output schema, the description covers the essential aspects: what it does, that it's a retrieval, the sandbox-only context, and a caution about clinical use. The absence of output schema details is acceptable because the description's 'plain-language summary' provides the expected return nature.

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?

The schema covers the single parameter patientId with a clear description ('The FHIR Patient resource id'). The tool description adds no additional parameter semantics beyond that, so the baseline score of 3 for 100% schema coverage applies.

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?

The description clearly states the verb 'Get' and the resource 'a patient's recorded conditions (diagnoses)', and specifies the output as a 'plain-language summary'. This distinguishes it from sibling tools like get_patient or get_observations, which focus on different resources and formats.

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

Usage Guidelines4/5

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

The description provides important usage context: 'Synthetic sandbox data only' and 'not a clinical or diagnostic tool', which tells the agent when and why to use it. However, it does not explicitly name sibling tools or provide comparisons for when to choose one over another, so it stops short of a 5.

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. Dates show when Glama detected each change.

  1. 4 tool updatesv1.0.0
    • First observedget_observations
    • First observedget_patient
    • First observedsearch_patients
    • First observedsummarize_conditions

TDQS

A4.2/5.0
Disambiguation5/5

Each tool targets a distinct operation: searching for patients, retrieving demographics, retrieving observations, and summarizing conditions. There is no overlap in purpose, and the descriptions reinforce clear boundaries.

Naming Consistency5/5

All tool names follow a clean verb_noun pattern in snake_case: search_patients, get_patient, get_observations, summarize_conditions. The verbs and nouns are consistent and predictable.

Tool Count5/5

Four tools is well-scoped for a read-only FHIR sandbox focused on patient data retrieval. Each tool earns its place, covering the core actions a user would need without unnecessary bloat.

Completeness4/5

The tool surface covers the main patient-centric workflows: find patient, view demographics, view observations, and summarize conditions. Minor gaps exist (e.g., no raw conditions list or medication history), but the core read-only purpose is well-served.

Maintenance

ActivityMaintained
ResponsivenessNo issues

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

  • -
    license
    Not graded
    quality
    Not graded
    maintenance
    Enables AI assistants to securely access Epic Healthcare Systems patient data through FHIR R4 API integration. Provides tools for searching patients, retrieving clinical summaries, vital signs, medications, and generating healthcare reports with HIPAA-compliant OAuth 2.0 authentication.
    -
  • F
    license
    A
    quality
    D
    maintenance
    Provides read/write access to any FHIR-compliant healthcare API with built-in validation, supporting resource management, search operations, and granular permissions through natural language.
    5
    1
    -
  • A
    license
    A
    quality
    C
    maintenance
    Provides seamless integration with FHIR APIs, enabling AI/LLM tools to search, retrieve, and analyze clinical healthcare data with support for SMART-on-FHIR authentication and multiple transport protocols.
    7
    134
    Apache 2.0

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/brianbastian01/fhir-mcp-server'

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