DM

doctorcare/mcp-fhir

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

1 stars 11 forks 质量 65 趋势 5MIT

A Model Context Protocol implementation for FHIR

概览

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

README

以下为原文 README 节选,完整内容请查看原文。

@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

Appointment Management

  • Find available appointment slots based on practitioner availability and constraints
  • Schedule new appointments with required patient, practitioner, and timing information
  • Support for different appointment types and durations
  • Integration with FHIR Schedule and Appointment resources

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
  • find_available_slots - Find available appointment slots
    • Takes practitionerId, appointmentType, duration, startDate, and endDate as parameters
    • Returns list of available time slots
  • schedule_appointment - Schedule a new appointment
    • Takes patientId, practitionerId, appointmentType, startTime, endTime, and optional notes
    • Returns the created FHIR Appointment resource
  • cancel_appointments_by_date - Cancel all appointments for a specified date
    • Takes date (YYYY-MM-DD format) and optional reason for cancellation
    • Returns a list of canceled appointment IDs
  • update_fhir - Update a FHIR resource
    • Takes uri and resource as parameters
    • Returns the updated FHIR resource

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_ACCESS_TOKEN": ""
    }
  }
}

Debugging

在 GitHub 查看完整 README

安装

This server does not publish a one-line install command.

Open the repository installation guide 新手?先看 mcpskill.org 教程 →

配置

{ "mcpServers": { "fhir": { "command": "/path/to/@flexpa/mcp-fhir/build/index.js" }, "env": { "FHIR_BASE_URL": "<FHIR_BASE_URL>", "FHIR_ACCESS_TOKEN": "<FHIR_ACCESS_TOKEN>" } } }