Monday, 2 June 2025

MCP + FHIR - Example MCP Server integrated with FHIR

In the ever-evolving landscape of healthcare data, interoperability is paramount. FHIR has emerged as a leading standard for exchanging healthcare information, but raw FHIR interactions can sometimes feel a bit… bare specially when working with AI Apps that use LLMs extensively. What if we could add a layer of context, logic, and user-friendly abstractions on top of FHIR? This is precisely where an MCP (Model Context Protocol) server comes into play.

In this post, we'll explore the implementation of an MCP server, built with TypeScript, that seamlessly integrates with a FHIR server (specifically tested with Aidbox). This server will empower applications to not only create FHIR resources with contextual understanding but also to read and interpret specific FHIR resources with ease.

The source code for this quick and dirty implementation of MCP + FHIR integration is available on my github: https://github.com/j4jayant/mcp-fhir-server

This implementation is inspired by Aidbox article: https://www.health-samurai.io/articles/mcp-fhir-server and the related articles of Dr. Pawan Jindal on LinkedIn.

I thought of implementing the same as was able to achieve the similar results. 

This MCP server has couple of tools:

1. create-fhir-resource

    This tool takes a couple of parameters

  • ResourceType (string like Patient, Appointment etc.)
  • ResourceBody (string with raw JSON of the resource)

    Sample Request and Output in Claude Desktop

    


        

2. read-fhir-resource

This tool takes a couple of parameters

  • ResourceType (string like Patient, Appointment etc.)
  • ResourceID (string with ID of the resource)

    

        Sample Request and Output in Claude Desktop






The MCP server receives the requests from LLMs and sends the request to FHIR server. 

This implementation is tested with Claude Desktop and Aidbox FHIR server.

The Claude configurations to run this server locally can be copied from the Aidbox article.


MCP + FHIR - Example MCP Server integrated with FHIR

In the ever-evolving landscape of healthcare data, interoperability is paramount. FHIR has emerged as a leading standard for exchanging heal...