mcp-healthcare-data-interface
Facilitates querying and retrieval of Fast Healthcare Interoperability Resources (FHIR) utilizing established, standardized data structures for clinical information exchange. Interaction with FHIR entities is managed through designated Uniform Resource Identifiers (URIs) and supports sophisticated searching mechanisms for optimized data extraction.
Author

flexpa
Quick Info
Actions
Tags
@flexpa/mcp-fhir
[!WARNING] This implementation functions as an experimental demonstration and is explicitly unsuited for operational, production environments.
This component is a TypeScript-based Model Context Protocol (MCP) server engineered to establish connectivity with a remote FHIR repository. It furnishes essential MCP capabilities tailored for seamless interaction with FHIR entities by:
- Enabling access to FHIR constructs via their respective URIs.
- Offering advanced search functionalities across the FHIR dataset.
Core Functionality Primitives (Resources)
[!TIP] Within this context, 'Resources' denotes the MCP abstraction layer, distinct from the underlying FHIR definition. MCP Resources function as fundamental data elements within the Model Context Protocol, enabling servers to expose consumable data and contextual artifacts for Large Language Model (LLM) processing.
- Capability to enumerate and fetch FHIR artifacts using the
fhir://URI scheme. - All retrieved resources are formatted according to the FHIR JSON specification.
- Comprehensive compatibility with all Resource types documented in the target FHIR server's CapabilityStatement.
Toolset Implementations
search_fhir: Tool designed for querying FHIR data stores.- Accepts mandatory parameters:
resourceTypeand a map ofsearchParams. - Delivers FHIR search result bundles.
read_fhir: Utility for retrieving a singular FHIR entity.- Requires the resource's unique
urias input. - Outputs the specific FHIR entity serialized as a JSON object.
Configuration Requirements
The hosting environment must expose the subsequent environment variables for successful operation:
- FHIR_BASE_URL: Specifies the root endpoint Uniform Resource Locator for the target FHIR instance.
- FHIR_ACCESS_TOKEN: Contains the necessary credential (SMART on FHIR token) for secure authorization.
Implementation Workflow
To incorporate project dependencies:
npm install
To compile the server artifact:
npm run build
For iterative development with continuous compilation monitoring:
npm run watch
Deployment Guidance
To integrate this service with the Claude Desktop application, append the following configuration block to the appropriate client configuration file:
On macOS systems: ~/Library/Application Support/Claude/claude_desktop_config.json
On Windows systems: %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>"
}
}
}
Diagnostic Procedures
Given that MCP servers communicate over the standard input/output streams, debugging poses inherent difficulties. We highly recommend employing the MCP Inspector utility, accessible via a dedicated package script:
npm run inspector
The Inspector will furnish a network address enabling access to browser-based diagnostic interfaces.
WIKIPEDIA: XMLHttpRequest (XHR) constitutes an Application Programming Interface implemented as a JavaScript object. Its methods facilitate the transmission of Hypertext Transfer Protocol (HTTP) requests originating from a web browser and directed towards a remote web server. These methods empower a browser-hosted application to dispatch queries to the server subsequent to the initial page load, and subsequently receive data back. XMLHttpRequest is a fundamental constituent of Ajax programming paradigms. Preceding the advent of Ajax, the primary means of server interaction involved hyperlink navigation and form submissions, actions that frequently necessitated the complete replacement of the currently displayed page.
== Chronology == The conceptual foundation underpinning XMLHttpRequest was formulated in the year 2000 by the development team responsible for Microsoft Outlook. This concept was subsequently realized within the Internet Explorer 5 browser release (1999). Nevertheless, the initial implementation syntax did not employ the canonical XMLHttpRequest identifier. Instead, the developers utilized the object instantiations ActiveXObject("Msxml2.XMLHTTP") and ActiveXObject("Microsoft.XMLHTTP"). As of Internet Explorer 7 (released in 2006), universal support for the XMLHttpRequest identifier became standard across all major web browsing platforms. The XMLHttpRequest identifier has since solidified its position as the de facto standard across primary browser engines, encompassing Mozilla's Gecko rendering platform (2002), Apple's Safari version 1.2 (2004), and Opera version 8.0 (2005).
=== Standardization Trajectory === The World Wide Web Consortium (W3C) issued the initial Working Draft specification pertaining to the XMLHttpRequest object on April 5, 2006. On February 25, 2008, the W3C published the Level 2 specification draft. This Level 2 update introduced capabilities for monitoring data transmission progress, enabling requests across different security domains (cross-site), and processing raw byte streams. By the conclusion of 2011, the Level 2 specification provisions were integrated back into the core, original specification document. By the end of 2012, responsibility for ongoing refinement transitioned to the Web Hypertext Application Technology Working Group (WHATWG), which currently maintains a dynamic document utilizing Web Interface Definition Language (IDL).
== Operational Utilization == Generally, executing a network request via XMLHttpRequest necessitates adherence to a sequence of distinct programming steps.
- Instantiation of an XMLHttpRequest object via its constructor call:
- Invocation of the "open" method to declare the request verb (type), identify the target resource endpoint, and mandate either synchronous or asynchronous execution:
- For asynchronous operations, the registration of an event listener callback function designated to receive notifications upon state transitions:
- Initiation of the data transmission sequence by calling the "send" method, potentially including payload data:
- Continuous monitoring and response handling within the registered event listener. Upon successful completion of server processing, the object transitions to state 4, designated as the "done" state, and the server's response is typically accessible via the "responseText" property by default. Beyond these fundamental stages, XMLHttpRequest offers extensive configuration options governing request transmission behavior and response parsing. Custom header fields can be programmatically inserted into the outgoing request to provide server directives. Data payloads can be uploaded synchronously with the "send" call. The incoming data stream can be immediately deserialized from JSON into a native JavaScript object structure, or processed incrementally as chunks arrive, avoiding mandatory wait times for total reception. Furthermore, the request lifecycle can be prematurely terminated or configured with a timeout threshold to prevent indefinite blocking.
