Used for managing environment variables that store Medplum server connection details and authentication credentials.
Provides linting for the MCP server codebase to ensure code quality.
Used for integration testing against a live Medplum instance to verify FHIR resource operations.
Serves as the runtime environment for the MCP server that interfaces with Medplum.
Used during development to automatically restart the server on code changes.
Used for package management and running scripts within the MCP server project.
Integrated with the test harness to process natural language queries into FHIR operations on the Medplum server.
Handles code formatting for the MCP server codebase.
Used as the implementation language for the MCP server's tools and configurations.
Medplum MCP Server
🚀 Project Description
This project implements a complete Model Context Protocol (MCP) server designed to seamlessly interact with a Medplum FHIR server. The MCP server provides a standardized interface, enabling Large Language Models (LLMs) to perform Create, Read, Update, and Search (CRUDS) operations on various FHIR resources through a comprehensive suite of tools. This empowers users to manage healthcare data stored in Medplum using natural language commands through any MCP-compatible client (Claude Desktop, VS Code MCP extensions, etc.).
The server implements the full MCP protocol specification, providing 33 comprehensive FHIR resource management tools that can be discovered and executed by any MCP client. Users can intuitively manage patient information, practitioners, organizations, encounters, observations, and more by conversing with an LLM that leverages the MCP tools to execute requests against the FHIR server.
✨ Current Status
🎉 MCP Server Implementation Complete! 🎉
What's Implemented:
- ✅ Core FHIR resource management tools (Patient, Practitioner, Organization, Encounter, Observation, Medication, etc.)
- ✅ MCP Server Protocol Implementation - Full Model Context Protocol server with stdio transport
- ✅ Comprehensive tool schemas for LLM interaction (33 FHIR tools)
- ✅ Interactive Chat Harness - Full MCP client with natural language interface
- ✅ Jest integration tests for all tools
- ✅ Medplum FHIR server connectivity and authentication
- ✅ MCP Inspector testing and validation
- ✅ Claude Desktop integration configuration
Ready for Use:
- 🔄 The MCP server is fully functional and ready for integration with MCP clients
- ✅ All 33 FHIR tools are properly registered and working
- 🔄 Server successfully authenticates with Medplum and executes FHIR operations
- 🔄 Interactive chat harness available - Test all tools with natural language
- 🔄 Tested with MCP Inspector - all tools discoverable and executable
- 🔄 Claude Desktop configuration provided for immediate use
Current Capabilities:
- Full CRUD operations on FHIR resources through natural language
- Interactive chat interface for testing and development
- Seamless integration with any MCP-compatible client (Claude Desktop, VS Code MCP extensions, etc.)
- Comprehensive error handling and logging
- Production-ready MCP protocol implementation
🌟 Features Implemented
The MCP server currently supports a comprehensive set of 33 tools for managing various FHIR resources:
👥 Patient Management (4 tools) - src/tools/patientUtils.ts
createPatient
: Create new patient records with demographics, identifiers, and contact information.getPatientById
: Retrieve complete patient details by their unique ID.updatePatient
: Modify existing patient information including demographics and contact details.searchPatients
: Find patients based on name, birthdate, identifier, or other criteria.
👩⚕️ Practitioner Management (5 tools) - src/tools/practitionerUtils.ts
createPractitioner
: Register new healthcare practitioners with their professional details.getPractitionerById
: Fetch complete practitioner details by their unique ID.updatePractitioner
: Update practitioner information including qualifications and contact details.searchPractitionersByName
: Search for practitioners using their first or last name.searchPractitioners
: Conduct advanced searches for practitioners based on multiple criteria.
🏥 Organization Management (4 tools) - src/tools/organizationUtils.ts
createOrganization
: Add new healthcare organizations (hospitals, clinics, departments).getOrganizationById
: Retrieve complete organization details by their unique ID.updateOrganization
: Update organization information including contact details and addresses.searchOrganizations
: Search for organizations by name, type, or other attributes.
🏥 Encounter Management (4 tools) - src/tools/encounterUtils.ts
createEncounter
: Create new patient encounters (visits, appointments, hospital stays).getEncounterById
: Retrieve complete encounter details by their unique ID.updateEncounter
: Update encounter information including status, class, and participants.searchEncounters
: Search for encounters by patient, practitioner, date, status, or class.
🔬 Observation Management (4 tools) - src/tools/observationUtils.ts
createObservation
: Record new observations (lab results, vital signs, diagnostic findings).getObservationById
: Retrieve complete observation details by their unique ID.updateObservation
: Modify existing observations including values, status, and interpretations.searchObservations
: Search for observations by patient, code, date, or encounter.
💊 Medication Request Management (4 tools) - src/tools/medicationRequestUtils.ts
createMedicationRequest
: Create new medication requests (prescriptions) with dosage and instructions.getMedicationRequestById
: Retrieve complete medication request details by their unique ID.updateMedicationRequest
: Update prescription information including status, dosage, and instructions.searchMedicationRequests
: Search for medication requests by patient, medication, or prescriber.
💉 Medication Management (3 tools) - src/tools/medicationUtils.ts
createMedication
: Create new medication resources with codes, names, and formulations.getMedicationById
: Retrieve complete medication details by their unique ID.searchMedications
: Search for medications by code, name, or ingredient.
📋 Episode of Care Management (4 tools) - src/tools/episodeOfCareUtils.ts
createEpisodeOfCare
: Create new episodes of care for managing patient care over time.getEpisodeOfCareById
: Retrieve complete episode of care details by their unique ID.updateEpisodeOfCare
: Update episode information including status, period, and managing organization.searchEpisodesOfCare
: Search for episodes of care by patient, status, or managing organization.
🔍 General FHIR Operations (1 tool)
generalFhirSearch
: Generic FHIR search with custom parameters for any resource type, enabling advanced queries across all FHIR resources.
Each tool is exposed to the LLM via a well-defined JSON schema and is callable through a dedicated test harness (src/llm-test-harness.ts
), facilitating robust testing and integration.
🛠️ Technology Stack
- Runtime: Node.js
- Language: TypeScript
- FHIR Server Interaction:
@medplum/core
,@medplum/fhirtypes
- LLM Integration: OpenAI API (specifically
gpt-4o
in the test harness) - Testing: Jest (for integration tests), Manual E2E via test harness
- Linting & Formatting: ESLint, Prettier
- Environment Management:
dotenv
- HTTP Client (for Medplum SDK):
node-fetch
📁 Project Structure
⚙️ Setup and Configuration
- Prerequisites:
- Node.js (refer to
package.json
for engine specifics; LTS versions recommended) - A running Medplum server instance (e.g., local Dockerized instance at
http://localhost:8103/
) - Medplum client credentials (Client ID and Client Secret)
- Node.js (refer to
- Installation:
- Environment Variables:
Create a
.env
file in the project root with your specific Medplum server details and API keys:
🚀 Usage
💬 Interactive Chat Harness (Recommended)
The most user-friendly way to test your MCP server is through the interactive chat interface:
Features:
- 🗣️ Natural language interaction with all 33 FHIR tools
- 🔧 Automatic tool discovery and execution
- 📋 Built-in help and examples
- 🔄 Conversation context maintenance
- ⚡ Real-time tool execution and results
Example Session:
See CHAT_HARNESS_USAGE.md
for detailed usage instructions and IMPLEMENTATION_PLAN.md
for development details.
▶️ Running the MCP Server Directly
🧪 Alternative Testing Methods
✅ Testing
🔗 Integration Tests
Integration tests use Jest and interact with a live Medplum instance (configured via .env
).
To run all integration tests:
To run specific integration test files:
📄 License
This project is licensed under the MIT License - see the LICENSE file for details.
remote-capable server
The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.
Tools
A Model Context Protocol server that enables natural language commands to manage healthcare data stored in Medplum FHIR servers through standardized Create, Read, Update, and Search operations.
- 🚀 Project Description
- ✨ Current Status
- 🌟 Features Implemented
- 👥 Patient Management (4 tools) - src/tools/patientUtils.ts
- 👩⚕️ Practitioner Management (5 tools) - src/tools/practitionerUtils.ts
- 🏥 Organization Management (4 tools) - src/tools/organizationUtils.ts
- 🏥 Encounter Management (4 tools) - src/tools/encounterUtils.ts
- 🔬 Observation Management (4 tools) - src/tools/observationUtils.ts
- 💊 Medication Request Management (4 tools) - src/tools/medicationRequestUtils.ts
- 💉 Medication Management (3 tools) - src/tools/medicationUtils.ts
- 📋 Episode of Care Management (4 tools) - src/tools/episodeOfCareUtils.ts
- 🔍 General FHIR Operations (1 tool)
- 🛠️ Technology Stack
- 📁 Project Structure
- ⚙️ Setup and Configuration
- 🚀 Usage
- ✅ Testing
- 📄 License
Related MCP Servers
- -securityFlicense-qualityA Model Context Protocol server providing AI assistants with access to healthcare data tools, including FDA drug information, PubMed research, health topics, clinical trials, and medical terminology lookup.Last updated -10Python
- -securityFlicense-qualityA Model Context Protocol server that connects AI tools to Electronic Health Records using SMART on FHIR, allowing secure searching, querying, and analysis of patient data from compatible EHRs.Last updated -21TypeScript
- AsecurityAlicenseAqualityA Model Context Protocol server that enables standardized interaction with Azure Health Data Services FHIR servers, allowing healthcare data operations through MCP tools.Last updated -17PythonMIT License
- -security-license-qualityA Model Context Protocol server that enables querying FHIR healthcare data using natural language, allowing doctors to retrieve patient information, medications, observations, and other healthcare records.Last updated -Python