Logo di 结合 MCP 和 FHIR 的电子健康记录工具

结合 MCP 和 FHIR 的电子健康记录工具

Community
jmandel

Connect to an EHR and make clinical data available via MCP

Pubblicato dajmandel
Repositoryhealth-record-mcp
LinguaTypeScript
Fork
36
Stelle
87
Strumenti disponibili
0
Tipo di trasportostdio, streamable-http
Categorie
LicenzaMIT
Link
  • Collega gli strumenti ai flussi di lavoro IA

    结合 MCP 和 FHIR 的电子健康记录工具 mette a disposizione funzionalità MCP utilizzabili da client e agenti IA compatibili.

  • Strumenti disponibili: 0

    Esplora le azioni richiamabili qui sotto, con nomi e descrizioni se il server li fornisce.

  • Configurazione pronta da copiare

    Usa gli esempi di installazione per configurare questo server nel tuo client MCP preferito.

  • Indicatori di interesse della comunità open source

    Stelle: 87; fork: 36 (repository collegato).

EHR Tools with MCP and FHIR

EHR Tools Overview

https://youtu.be/K0t6MRyIqZU?si=Mz4d65DcAD3i2YbO

This project acts as a specialized server providing tools for Large Language Models (LLMs) and other AI agents to interact with Electronic Health Records (EHRs). It leverages the SMART on FHIR standard for secure data access and the Model Context Protocol (MCP) to expose the tools.

Think of it as a secure gateway and toolkit enabling AI to safely access and analyze patient data from diverse EHR systems.

The Core Idea

The system works in three main stages:

  1. SMART on FHIR Client (Implemented within this project): Connects securely to an EHR using the standard SMART App Launch framework. It extracts a wide range of patient information, including both structured data (like conditions, medications, labs) and unstructured clinical notes or attachments.
  2. MCP Server (This Project): Takes the extracted EHR data and makes it available through a set of powerful tools accessible via the Model Context Protocol. These tools allow external systems (like AI models) to query and analyze the data without needing direct access to the EHR itself.
  3. AI / LLM Interface (External Consumer): An AI agent or Large Language Model connects to the MCP Server and uses the provided tools to "ask questions" about the patient's record, perform searches, or run custom analyses.

Available Tools

The MCP Server offers several tools for interacting with the loaded EHR data:

  • grep_record: Performs text or regular expression searches across all parts of the fetched record (structured FHIR data + text from notes/attachments). Ideal for finding keywords or specific mentions (e.g., "diabetes", "aspirin").
  • query_record: Executes read-only SQL SELECT queries directly against the structured FHIR data. Useful for precise lookups based on known FHIR resource structures (e.g., finding specific lab results by LOINC code).
  • eval_record: Executes custom JavaScript code directly on the fetched data (FHIR resources + attachments). Offers maximum flexibility for complex calculations, combining data from multiple sources, or custom formatting.

This setup allows AI tools to leverage comprehensive EHR data through a standardized and secure interface.

(Developer setup and usage details can be found within the codebase and specific module documentation.)


Components & Usage

This project offers different ways to fetch EHR data and expose it via MCP tools:

1. Standalone SMART on FHIR Web Client

This project includes a self-contained web application that allows users to connect to their EHR via SMART on FHIR and fetch their data.

  • Hosted Version: You can use a publicly hosted version at:
    https://mcp.fhir.me/ehr-connect#deliver-to-opener:$origin
    (Replace $origin with the actual origin of the window that opens this link).
  • Filtering Brands (?brandTags): You can filter the list of EHR providers shown on the connection page by adding the brandTags query parameter to the URL. Provide a comma-separated list of tags. Only brands matching all provided tags (from their configuration in brandFiles) will be displayed. It supports both OR (comma-separated) and AND (caret ^ separated) logic, with AND taking precedence.
    • ?brandTags=epic,sandbox: Shows brands tagged with epic OR sandbox.
    • ?brandTags=epic^dev: Shows brands tagged with both epic AND dev.
    • ?brandTags=epic^dev,sandbox^prod: Shows brands tagged with (epic AND dev) OR (sandbox AND prod).
    • If the parameter is omitted, it defaults to showing brands tagged with prod.
    • Example: .../ehr-connect?brandTags=hospital^us: Shows brands tagged with hospital AND us.
  • How it Works: When opened, this page prompts the user to select their EHR provider. It then initiates the standard SMART App Launch flow, redirecting the user to their EHR's login page. After successful authentication and authorization, the client fetches a comprehensive set of FHIR resources (Patient, Conditions, Observations, Medications, Documents, etc.) and attempts to extract plaintext from any associated attachments (like PDFs, RTF, HTML found in DocumentReference).
  • Data Output (ClientFullEHR): Once fetching is complete, the client gathers all the data into a ClientFullEHR JSON object. This object contains:
    • fhir: A dictionary where keys are FHIR resource types (e.g., "Patient") and values are arrays of the corresponding FHIR resources.
    • attachments: An array of processed attachment objects, each including metadata (source resource, path, content type) and the content itself (contentBase64 for raw data, contentPlaintext for extracted text).
  • Data Delivery: If opened with the #deliver-to-opener:$origin hash, the client will prompt the user for confirmation and then send the ClientFullEHR object back to the window that opened it using window.opener.postMessage(data, targetOrigin).

2. Local MCP Server via Stdio (src/cli.ts)

This mode is ideal for running the MCP server locally, often used with tools like Cursor or other command-line AI clients.

  • Two-Step Process:
    1. Fetch Data to Database: First, run the command-line interface with the --create-db and --db flags. This starts a temporary web server and uses the same SMART on FHIR web client logic described above to fetch data. Instead of sending the data via postMessage, it saves the ClientFullEHR data into a local SQLite database file.
      bash
      # Example: Fetch data and save to data/my_record.sqlite
      bun run src/cli.ts --create-db --db ./data/my_record.sqlite
      Follow the prompts (opening a link in your browser) to connect to your EHR.
    2. Run MCP Server: Once the database file is created, run the CLI again, pointing only to the database file. This loads the data into memory and starts the MCP server, listening for commands on standard input/output.
      bash
      # Example: Start the MCP server using the saved data
      bun run src/cli.ts --db ./data/my_record.sqlite
    • Configuration (config.*.json): This process relies on a configuration file (e.g., config.epicsandbox.json) which defines available EHR brands/endpoints in a brandFiles array. Each entry in this array specifies the brand's details, including:
      • url: Path/URL to the brand definition file (like static/brands/epic-sandbox.json).
      • tags: An array of strings (e.g., ["epic", "sandbox"]) used for categorization or filtering.
      • vendorConfig: Contains SMART on FHIR client details (clientId, scopes).
  • Client Configuration (e.g., Cursor): Configure your MCP client to execute this command. Crucially, use absolute paths for both src/cli.ts and the database file.
    json
    {
      "mcpServers": {
        "local-ehr": {
          "name": "Local EHR Search",
          "command": "bun", // Or the absolute path to bun
          "args": [
              "/home/user/projects/smart-mcp/src/cli.ts", // Absolute path to cli.ts
              "--db",
              "/home/user/projects/smart-mcp/data/my_record.sqlite" // Absolute path to DB file
            ]
        }
      }
    }

3. Full MCP Server via SSE (src/sse.ts / index.ts)

This mode runs a persistent server suitable for scenarios where multiple clients might connect over the network. It uses Server-Sent Events (SSE) for the MCP communication channel.

  • Authentication: Client authentication relies on OAuth 2.1, as specified by the Model Context Protocol. The server provides standard endpoints (/authorize, /token, /register, etc.).
  • Data Fetch: When a client initiates an OAuth connection, the server handles the SMART on FHIR flow itself, fetches the ClientFullEHR data during the authorization process, and keeps it in memory (or a persisted session) for the duration of the client's connection.
  • Status: While functional, the MCP specification for OAuth 2.1 client interaction is still evolving. Client support for this authentication method is extremely limited at present, making it difficult to test this mode with standard clients outside of specialized developer or debugging tools. This SSE mode should be considered experimental.

Installazione

TypingMind
Prerequisiti:

Node.js 18+

{
  "mcpServers": {
    "jmandel-health-record-mcp": {
      "command": "",
      "args": []
    }
  }
}

Usa 结合 MCP 和 FHIR 的电子健康记录工具 MCP con più modelli AI

TypingMind collega gli strumenti MCP a livello di area di lavoro: una volta connesso 结合 MCP 和 FHIR 的电子健康记录工具, puoi usarlo con diversi modelli IA in TypingMind, senza configurarlo separatamente per ogni modello. Puoi eseguire MCP localmente sul tuo dispositivo o connetterti all'URL di un server MCP remoto.

Opzione 1: usa il connettore locale

Usa questo metodo quando il server MCP deve accedere a file locali, app o risorse private sul tuo computer.

1

Apri le impostazioni MCP

In TypingMind, vai su Impostazioni, Impostazioni avanzate, poi su Model Context Protocol e scegli Configura connettore.

  1. Apri TypingMind nel tuo browser.
  2. Fai clic sull'icona Impostazioni.
  3. Vai a Impostazioni avanzate.
  4. Apri la sezione Model Context Protocol.
  5. Fai clic su Configura connettore e scegli Questo dispositivo.
Schermata di configurazione del connettore MCP di TypingMind con l’opzione «Questo dispositivo» selezionata
2

Esegui il comando del connettore

Scegli Questo dispositivo, copia il comando da TypingMind ed eseguilo nel terminale. Lascia il processo in esecuzione mentre usi MCP.

  1. Copia il comando di configurazione mostrato da TypingMind.
  2. Apri Terminale su macOS o Windows Terminal su Windows.
  3. Incolla ed esegui il comando.
  4. Conferma l'installazione del pacchetto se il terminale ti chiede di procedere.
  5. Tieni aperta la finestra del terminale con il processo in esecuzione mentre usi gli strumenti MCP.
3

Aggiungi 结合 MCP 和 FHIR 的电子健康记录工具 come server

Quando lo stato del connettore è Pronto, fai clic su Modifica server e incolla la configurazione del server MCP.

  1. Attendi che lo stato del connettore sia Pronto.
  2. Fai clic su Modifica server.
  3. Incolla la configurazione del server MCP di 结合 MCP 和 FHIR 的电子健康记录工具.
  4. Salva l'elenco dei server.
  5. Se vuoi verificare che il connettore sia ancora pronto, aggiorna la pagina.
Impostazioni MCP di TypingMind con un server attivo e il pulsante Modifica server
{
  "mcpServers": {
    "jmandel-health-record-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "@jmandel/ehr-mcp"
      ]
    }
  }
}
4

Usa la connessione con diversi modelli

Salva l'elenco dei server, apri Plugin, abilita gli strumenti MCP di 结合 MCP 和 FHIR 的电子健康记录工具, poi seleziona un modello IA supportato in TypingMind e usa gli strumenti in chat o assegnali a un agente IA.

  1. Apri la pagina Plugin in TypingMind.
  2. Abilita gli strumenti MCP di 结合 MCP 和 FHIR 的电子健康记录工具.
  3. Avvia una chat e scegli il modello IA che vuoi usare.
  4. Usa gli strumenti MCP in chat o assegnali a un agente IA.
  5. Passa a un altro modello IA quando serve, senza riconnettere MCP.
Chat di TypingMind che usa gli strumenti MCP abilitati con un modello IA selezionato
Puoi usare 结合 MCP 和 FHIR 的电子健康记录工具 per aiutarmi con questa attività?
结合 MCP 和 FHIR 的电子健康记录工具
Certo. L’ho letto.
Ecco cosa ho trovato con 结合 MCP 和 FHIR 的电子健康记录工具.

Opzione 2: aggiungi l'URL di un server MCP

Usa questo metodo se 结合 MCP 和 FHIR 的电子健康记录工具 è già ospitato in remoto o se il tuo team vuole un unico connettore condiviso accessibile a più utenti.

1

Apri Connettori MCP

In TypingMind, vai su Plugin, apri Connettori MCP e scegli Aggiungi URL.

  1. Apri TypingMind nel tuo browser.
  2. Vai a Plugin.
  3. Apri Connettori MCP.
  4. Fai clic su Aggiungi URL.
Modulo di TypingMind per aggiungere l'URL di un server MCP personalizzato
2

Incolla l'URL del server

Inserisci URL del tuo server nel campo URL del server. Aggiungi un nome per la connessione, una descrizione, un'icona, header HTTP personalizzati o le impostazioni del client OAuth se richiesti dal server.

  1. Incolla URL del tuo server nel campo URL del server.
  2. Inserisci un nome per la connessione a 结合 MCP 和 FHIR 的电子健康记录工具.
  3. Se vuoi riconoscere più facilmente la connessione, aggiungi una descrizione e un’icona.
  4. Aggiungi header HTTP personalizzati o i dati del client OAuth se il server richiede l'autenticazione.
3

Crea la connessione

Fai clic su Crea connessione, poi torna all'elenco dei plugin e verifica che la nuova connessione MCP sia attiva.

  1. Fai clic su Crea connessione.
  2. Torna all'elenco dei connettori MCP.
  3. Verifica che la connessione 结合 MCP 和 FHIR 的电子健康记录工具 risulti attiva.
  4. Aggiorna l'elenco dei plugin se la connessione non appare subito.
4

Cambia modello senza dover ristabilire la connessione MCP

Avvia una chat con il tuo modello preferito, abilita gli strumenti di 结合 MCP 和 FHIR 的电子健康记录工具 dalla sezione Plugin e passa a un altro modello quando serve. La connessione MCP rimane disponibile nell'area di lavoro di TypingMind.

  1. Avvia una nuova chat in TypingMind.
  2. Seleziona il modello IA che vuoi usare.
  3. Abilita gli strumenti di 结合 MCP 和 FHIR 的电子健康记录工具 dalla sezione Plugin.
  4. Chiedi al modello di usare lo strumento quando serve.
  5. Passa a un altro modello IA e riutilizza la stessa connessione MCP.
Chat di TypingMind che usa gli strumenti MCP abilitati con un modello IA selezionato
Puoi usare 结合 MCP 和 FHIR 的电子健康记录工具 per aiutarmi con questa attività?
结合 MCP 和 FHIR 的电子健康记录工具
Certo. L’ho letto.
Ecco cosa ho trovato con 结合 MCP 和 FHIR 的电子健康记录工具.

Domande frequenti

A cosa serve il server MCP 结合 MCP 和 FHIR 的电子健康记录工具?

结合 MCP 和 FHIR 的电子健康记录工具 è un server MCP che consente ai client IA compatibili di accedere a strumenti e informazioni di contesto esterni. In TypingMind puoi aggiungere questo server MCP una sola volta e rendere disponibili i suoi strumenti nella tua area di lavoro IA.

Posso usare il server MCP 结合 MCP 和 FHIR 的电子健康记录工具 con più modelli IA in TypingMind?

Sì. TypingMind collega gli strumenti MCP a livello di area di lavoro, quindi puoi usare 结合 MCP 和 FHIR 的电子健康记录工具 con diversi modelli IA come Claude, ChatGPT, Gemini o altri modelli che hai configurato in TypingMind, senza dover configurare il server MCP separatamente per ogni modello.

Perché usare il connettore MCP 结合 MCP 和 FHIR 的电子健康记录工具 con TypingMind?

TypingMind è una delle migliori interfacce per chattare con gli LLM perché riunisce più modelli IA, prompt, plugin, agenti IA, chiavi API e strumenti MCP in un'unica area di lavoro. Collegando 结合 MCP 和 FHIR 的电子健康记录工具, puoi usare i suoi strumenti MCP con i tuoi modelli preferiti e mantenere organizzato il tuo flusso di lavoro in chat su TypingMind.

Come collego il server MCP 结合 MCP 和 FHIR 的电子健康记录工具 a TypingMind?

Puoi collegare 结合 MCP 和 FHIR 的电子健康记录工具 a TypingMind con il connettore MCP locale oppure aggiungendo l'URL di un server MCP remoto. Usa il connettore locale quando il server deve accedere a file, app o risorse private sul tuo dispositivo; usa invece l'URL del server quando il server MCP è ospitato in remoto.

Quali strumenti offre il server MCP 结合 MCP 和 FHIR 的电子健康记录工具 in TypingMind?

结合 MCP 和 FHIR 的电子健康记录工具 mette a disposizione funzionalità MCP che puoi attivare dalla pagina Plugin di TypingMind e usare in chat o assegnare agli agenti IA.

Devo condividere le mie chiavi API con TypingMind per usare il server MCP 结合 MCP 和 FHIR 的电子健康记录工具?

No. TypingMind privilegia il funzionamento in locale e ti permette di mantenere il controllo su fornitori di modelli, chiavi API, prompt e configurazione MCP. Se 结合 MCP 和 FHIR 的电子健康记录工具 richiede l'autenticazione, aggiungi le intestazioni, le impostazioni OAuth o la configurazione locale necessarie per quel server MCP quando crei la connessione.

Server MCP correlati

Elenco completo

Crea subito il tuo spazio di lavoro AI

Iscriviti alla nostra newsletter per ricevere aggiornamenti sulle nuove funzionalità e sulle prossime iniziative a premi 👇