Fire in da houseTop Tip:Paying $100+ per month for Perplexity, MidJourney, Runway, ChatGPT and other tools is crazy - get all your AI tools in one site starting at $15 per month with Galaxy AI Fire in da houseCheck it out free

mcp-fhir

MCP.Pizza Chef: flexpa

mcp-fhir is a TypeScript-based Model Context Protocol (MCP) server that integrates with FHIR servers to expose healthcare data as structured context for large language models (LLMs). It allows clients to list, access, and search FHIR resources using standardized fhir:// URIs, returning data in FHIR JSON format. The server supports all FHIR resource types declared in the connected FHIR server's CapabilityStatement. Key features include tools for searching and reading individual FHIR resources, enabling real-time, context-aware interactions with healthcare data. This experimental demo is designed for developers building AI workflows that require secure, standardized access to clinical data via MCP.

Use This MCP server To

Access FHIR healthcare data for AI-assisted clinical decision support Search and retrieve patient records via MCP for LLM context Integrate FHIR data into AI workflows for medical research Enable LLMs to query and read FHIR resources dynamically Provide structured healthcare data context to AI copilots Test and prototype MCP-FHIR integration in healthcare apps

README

@flexpa/mcp-fhir

Warning

This is an experimental demo not intended for production use.

This is a TypeScript-based MCP server that connects to a FHIR server. It provides core MCP functionality for interacting with FHIR resources by:

  • Accessing FHIR resources via URIs
  • Providing search capabilities for FHIR resources

Features

Resources

Tip

"Resources" here refers to the MCP definition not the FHIR one. MCP Resources are a core primitive in the Model Context Protocol (MCP) that allow servers to expose data and content that can be read by clients and used as context for LLM interactions.

  • List and access FHIR resources via fhir:// URIs
  • Resources are returned in FHIR JSON format
  • Supports all FHIR Resource types available in the FHIR server's CapabilityStatement

Tools

  • search_fhir - Search FHIR resources
    • Takes resourceType and searchParams as parameters
    • Returns FHIR search results
  • read_fhir - Read an individual FHIR resource
    • Takes uri as a parameter
    • Returns the FHIR resource in JSON format

Configuration

The server requires the following environment variables:

  • FHIR_BASE_URL: The base URL of your FHIR server
  • FHIR_ACCESS_TOKEN: A SMART on FHIR access token for authentication

Development

Install dependencies:

npm install

Build the server:

npm run build

For development with auto-rebuild:

npm run watch

Installation

To use with Claude Desktop, add the server config:

On MacOS: ~/Library/Application Support/Claude/claude_desktop_config.json On Windows: %APPDATA%/Claude/claude_desktop_config.json

{
  "mcpServers": {
    "fhir": {
      "command": "/path/to/@flexpa/mcp-fhir/build/index.js"
    },
    "env": {
      "FHIR_BASE_URL": "<FHIR_BASE_URL>",
      "FHIR_ACCESS_TOKEN": "<FHIR_ACCESS_TOKEN>"
    }
  }
}

Debugging

Since MCP servers communicate over stdio, debugging can be challenging. We recommend using the MCP Inspector, which is available as a package script:

npm run inspector

The Inspector will provide a URL to access debugging tools in your browser.

mcp-fhir FAQ

How do I connect mcp-fhir to my FHIR server?
Configure the mcp-fhir server with your FHIR server's base URL and ensure it supports the CapabilityStatement endpoint for resource discovery.
What FHIR resource types does mcp-fhir support?
It supports all resource types declared in the connected FHIR server's CapabilityStatement, enabling broad interoperability.
How does mcp-fhir expose FHIR data to LLMs?
It exposes FHIR resources as MCP Resources accessible via fhir:// URIs, returning data in standard FHIR JSON format for LLM consumption.
Can I perform searches on FHIR data using mcp-fhir?
Yes, mcp-fhir provides a search_fhir tool that accepts resourceType and searchParams to query FHIR resources dynamically.
Is mcp-fhir production-ready?
No, mcp-fhir is currently an experimental demo and not intended for production use.
What programming language is mcp-fhir implemented in?
mcp-fhir is implemented in TypeScript, facilitating integration with modern JavaScript/TypeScript environments.
How does mcp-fhir handle security and privacy?
Security depends on the underlying FHIR server configuration; mcp-fhir itself relies on secure connections and authentication managed externally.
Can mcp-fhir be used with different LLM providers?
Yes, it is provider-agnostic and can be used with OpenAI, Anthropic Claude, Google Gemini, and other LLMs supporting MCP.