MCP ExplorerExplorer

Mcp Fhir

@flexpaon 10 months ago
35 MIT
FreeCommunity
AI Systems
#fhir#model-context-protocol#mpc
A Model Context Protocol implementation for FHIR

Overview

What is Mcp Fhir

mcp-fhir is an experimental Model Context Protocol implementation designed to interact with FHIR resources. It serves as a bridge between clients and FHIR servers, enabling access and manipulation of healthcare-related data.

Use cases

Use cases for mcp-fhir include retrieving patient records, searching for specific healthcare resources, and integrating FHIR data into machine learning models for enhanced healthcare analytics.

How to use

To use mcp-fhir, set up the environment by defining the FHIR_BASE_URL and FHIR_ACCESS_TOKEN. Install dependencies with ‘npm install’, build the server using ‘npm run build’, and configure it for use with compatible applications like Claude Desktop.

Key features

Key features include the ability to access FHIR resources via URIs, search for FHIR resources, and return data in FHIR JSON format. It supports all resource types as defined in the FHIR server’s CapabilityStatement.

Where to use

mcp-fhir can be used in healthcare applications that require interaction with FHIR-compliant data, such as electronic health records, health information exchanges, and clinical decision support systems.

Content

@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.

Tools

No tools

Comments

Recommend MCP Servers

View All MCP Servers