FHIR Healthcare MCP server

Integrates with FHIR healthcare systems and medical document repositories to provide natural language access to electronic health records, clinical observations, patient data management, and medical literature search through OAuth2-authenticated FHIR servers and vector-based document analysis.
Back to servers
Setup instructions
Provider
Momentum
Release date
Jul 16, 2025
Stats
22 stars

The FHIR MCP Server implements the Model Context Protocol to connect LLM-based agents with FHIR-compliant healthcare backends. It enables natural language interactions with clinical data through Claude Desktop and other MCP-compatible clients, providing a comprehensive suite of tools for FHIR resource management.

Getting Started

Prerequisites

  • Docker (recommended) or uv for dependency management
  • FHIR Server Account (e.g., Medplum)
  • Pinecone API key for document search capabilities
  • LOINC Account (optional) for terminology resolution

Installation

  1. Clone the repository:

    git clone https://github.com/the-momentum/fhir-mcp-server
    cd fhir-mcp-server
    
  2. Set up environment variables:

    cp config/.env.example config/.env
    
  3. Install Dependencies:

    For Docker-based execution:

    make build
    

    For uv-based execution:

    make uv
    
  4. Update MCP Client configuration:

    For Docker setup (in Claude Desktop's claude_desktop_config.json):

    {
       "mcpServers": {
          "docker-mcp-server": {
             "command": "docker",
             "args": [
                "run",
                "-i",
                "--rm",
                "--init",
                "--name",
                "fhir-mcp-server",
                "--mount",
                "type=bind,source=<your-project-path>/app,target=/root_project/app",
                "--mount",
                "type=bind,source=<your-project-path>/config/.env,target=/root_project/config/.env",
                "-e", "TRANSPORT_MODE=stdio",
                "mcp-server:latest"
             ]
          }
       }
    }
    

    For uv setup, first get uv path from terminal, then update config:

    {
       "mcpServers": {
          "uv-mcp-server": {
             "command": "uv",
             "args": [
                "run",
                "--frozen",
                "--directory",
                "<your-project-path>",
                "start"
             ],
             "env": {
                "PATH": "<uv-bin-folder-path>"
             }
          }
       }
    }
    
  5. Restart MCP Client to apply changes

Configuration

Security & Encryption

The server includes built-in encryption for sensitive configuration values. You can set up encryption using the automated script:

# uv method
uv run scripts/cryptography/setup_encryption.py

# docker method
docker exec fhir-mcp-server uv run scripts/cryptography/setup_encryption.py

Key Environment Variables

Variable Description Example Value
MASTER_KEY Master encryption key gAAAAABl...
FHIR_SERVER_HOST FHIR API host URL https://api.medplum.com
FHIR_BASE_URL FHIR base path /fhir/R4
FHIR_SERVER_CLIENT_ID OAuth2 client ID 019720e7...
FHIR_SERVER_CLIENT_SECRET OAuth2 client secret gAAAAABl...
LOINC_USERNAME LOINC account username loinc-user
LOINC_PASSWORD LOINC account password gAAAAABl...
PINECONE_API_KEY Pinecone API key gAAAAABl...
EMBEDDING_MODEL HuggingFace embedding model NeuML/pubmedbert-base-embeddings

Available MCP Tools

FHIR Resource Tools

Tool Resource Type Description
request_patient_resource Patient Manage patient demographics
request_observation_resource Observation Handle clinical measurements
request_condition_resource Condition Manage diagnoses
request_medication_resource Medication Handle medication information
request_immunization_resource Immunization Manage vaccination records
request_encounter_resource Encounter Handle patient visits
request_allergy_intolerance_resource AllergyIntolerance Manage allergies
request_family_member_history_resource FamilyMemberHistory Handle family health history
request_generic_resource Any FHIR Resource Operate on any other FHIR resource

Document Management Tools

Tool Description
request_document_reference_resource Manage FHIR DocumentReference resources
add_document_to_pinecone Ingest documents into vector database
search_pinecone Perform semantic search across indexed documents

LOINC Terminology Tools

Tool Description
get_loinc_codes Retrieve standardized LOINC codes

All tools support full CRUD operations with proper error handling and data validation.

How to install this MCP server

For Claude Code

To add this MCP server to Claude Code, run this command in your terminal:

claude mcp add-json "fhir-mcp-server" '{"command":"docker","args":["run","-i","--rm","--init","--mount","type=bind,source=${projectPath}/app,target=/root_project/app","--mount","type=bind,source=${projectPath}/config/.env,target=/root_project/config/.env","mcp-server:latest"]}'

See the official Claude Code MCP documentation for more details.

For Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "fhir-mcp-server": {
            "command": "docker",
            "args": [
                "run",
                "-i",
                "--rm",
                "--init",
                "--mount",
                "type=bind,source=${projectPath}/app,target=/root_project/app",
                "--mount",
                "type=bind,source=${projectPath}/config/.env,target=/root_project/config/.env",
                "mcp-server:latest"
            ]
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.

For Claude Desktop

To add this MCP server to Claude Desktop:

1. Find your configuration file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json

2. Add this to your configuration file:

{
    "mcpServers": {
        "fhir-mcp-server": {
            "command": "docker",
            "args": [
                "run",
                "-i",
                "--rm",
                "--init",
                "--mount",
                "type=bind,source=${projectPath}/app,target=/root_project/app",
                "--mount",
                "type=bind,source=${projectPath}/config/.env,target=/root_project/config/.env",
                "mcp-server:latest"
            ]
        }
    }
}

3. Restart Claude Desktop for the changes to take effect

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later