Get the FREE Ultimate OpenClaw Setup Guide →

mcp-fhir

A Model Context Protocol implementation for FHIR

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio flexpa-mcp-fhir node build/index.js \
  --env FHIR_BASE_URL="<FHIR_BASE_URL>" \
  --env FHIR_ACCESS_TOKEN="<FHIR_ACCESS_TOKEN>"

How to use

This MCP server (@flexpa/mcp-fhir) exposes MCP functionality to interact with a FHIR server. It provides two main tools: read_fhir and search_fhir. read_fhir takes a single parameter, uri, and returns the FHIR resource located at that URI in JSON format. search_fhir accepts resourceType and searchParams to query the FHIR server for resources matching the given criteria, returning FHIR-compliant search results. Resources are exposed as MCP Resources and can be read or used as context for LLM interactions via the MCP protocol. To use these tools, ensure the server is running with access to a configured FHIR_BASE_URL and a valid FHIR_ACCESS_TOKEN, then invoke read_fhir or search_fhir with the appropriate arguments.

How to install

Prerequisites:

  • Node.js (14.x or newer) and npm installed on your machine
  • Access to a FHIR server and a valid SMART on FHIR access token

Installation steps:

  1. Clone or install the package npm install @flexpa/mcp-fhir

  2. Build the server (TypeScript -> JavaScript) npm run build

  3. (Optional) Run in development mode with auto-rebuild npm run watch

  4. Run the server (example) node build/index.js

  5. Configure your Claude Desktop or MCP client with the server details from the Installation section of the README (see mcp_config below).

Additional notes

Tips and notes:

  • The server requires two environment variables: FHIR_BASE_URL and FHIR_ACCESS_TOKEN. Provide placeholders in configuration if you have not yet obtained a token.
  • Since MCP servers communicate over stdio, debugging can be tricky. Use the MCP Inspector tool for debugging when available.
  • The server exposes two tools: read_fhir (reads a single resource by URI) and search_fhir (performs searches by resourceType and searchParams). Ensure you pass appropriate arguments according to the tool signatures.
  • The README example shows mapping the server into Claude Desktop's config; adapt the path to your build output and ensure environment variables are set in the same config object.
  • If your FHIR server requires specific authentication flows, ensure the FHIR_ACCESS_TOKEN is refreshed and kept valid; consider automating token management if possible.

Related MCP Servers

Sponsor this space

Reach thousands of developers