Skip to main content
Glama
scollard001

fhir-patient-consent-mcp-server

by scollard001

fhir-patient-consent-mcp-server

MCP サーバーです。モデルが患者、その患者のインスリンポンプ、そしてそのデータの閲覧に同意した人について質問できるようにし、すべての情報を FHIR (R4) ストアからリアルタイムに取得します。このサーバーにはデータは一切保存されません。すべての回答はリアルタイムの FHIR REST クエリです。

これは fhir-consent-service のコンパニオンです (FHIR への Patient / Device / Consent を書き込むための Spring Boot API)。ただし、コード上の依存関係はありません。このサーバーは FHIR のワイヤーフォーマットにのみ依存するため、任意の FHIR R4 エンドポイントに対して動作します。

Tools

ツール

目的

find_patient

MRN または姓 (family name) で患者を検索する

get_patient

FHIR ID で患者のデモグラフィック情報を取得する

get_patient_devices

患者のデバイスを一覧表示する (SNOMED CT 469756000 でインスリンポンプを識別)

get_patient_consents

患者のデータ共有同意を一覧表示する (パートナー、目的、データカテゴリ、期間)

check_partner_consent

認可チェック: パートナー X は患者 Y に対する有効な同意を現在持っているか?

Related MCP server: FHIR MCP Server

Resource

fhir-chart://{patientId} - 患者の統合 JSON「チャート」(デモグラフィック情報 + デバイス + 有効な同意) です。モデルが複数のツール呼び出しにまたがって組み立てるのではなく、ホストアプリケーションがコンテキストに直接添付することを想定しています。これがツールではなくリソースである理由は docs/architecture.md を参照してください。

セットアップ

npm install
npm run build

FHIR サーバーを指定する

export FHIR_BASE_URL=http://localhost:8081/fhir   # default shown
export FHIR_AUTH_TOKEN=...                         # optional bearer token

クエリ用のデータを取得する最も簡単な方法は、fhir-consent-servicedocker compose up -d を実行することです (:8081 でローカルの HAPI FHIR JPA サーバーとが起動します)。その後、その REST API で patient、device、consent を作成し、ここで同じストアをクエリします。

直接実行する (stdio でのテスト用)

npm run dev

MCP クライアントに登録する

Claude Desktop / Claude Code の場合は、MCP 設定に追加してください:

{
  "mcpServers": {
    "fhir-patient-consent": {
      "command": "node",
      "args": ["/absolute/path/to/fhir-patient-consent-mcp-server/dist/index.js"],
      "env": {
        "FHIR_BASE_URL": "http://localhost:8081/fhir"
      }
    }
  }
}

先に npm run build を実行し、dist/index.js が存在するようにしてください。

接続後の質問例

  • 「MRN が MRN-778001 の患者を検索してください。」

  • 「患者 123 のインスリンポンプは何で、そのシリアル番号は何ですか?」

  • 「GlucoVue Remote Monitoring は、患者 123 のデバイスデータを閲覧する同意を与えられていますか?」

  • 「患者 123 の完全なチャートを表示してください。」 (fhir-chart:// リソースを使う例)

テスト

npm test

ユニットテストはマッパーレイヤー (src/mappers/*.ts) をカバーしており、isConsentActiveForPartner の同意認可ロジックも含みます。具体的には、撤回されたコンセント、未開始/期限切れの期間、そしてオープンエンド (end なし) 期間の扱いです。これらは、特にアンド细微に間違っていることが多いケースだからです。

このリポジトリには、実際の FHIR サーバーに対する統合テストはありません (fhir-consent-service は Testcontainers を使用していますが、それとは異なります)。これは、このサーバーにはデータをシードするための書き込みパスがないためです。テストフィクスチャを設定するためにのみ、そのリポジトリに依存する (またはそのリソース作成ロジックを複製する) 必要があります。もしこのリポジトリにシードスクリプトが追加されれば、そのときに追加してください。

注記: npm レジストリにアクセスできないサンドボックス環境で作成されたため、npm install / npm run build / npm test は実際にはここでは実行されていません。コードは @modelcontextprotocol/sdk@^1.12 を対象としています。インストールした SDK のバージョンで server.tool(...) / server.resource(...) のシグネチャが registerTool / registerResource に移っている場合、修正は機械的です - SDK 自身の README/CHANGELOG を確認してください。

プロジェクト構成

src/
├── index.ts              Server entry point, registers all tools/resources
├── fhirClient.ts          Thin fetch-based FHIR REST client
├── tools/                 One file per MCP tool
├── resources/             One file per MCP resource
├── mappers/                FHIR JSON -> summary objects + consent auth logic
└── util/results.ts        Shared tool-result formatting helpers

セキュリティに関する注意

このサーバーは PHI のリダクションを行わず、FHIR サーバーが返す内容をそのままパススルーします。実際の患者データに対してデプロイする場合は、FHIR サーバー自体の前段にアクセス制御を置いてください (このサーバーは FHIR_AUTH_TOKEN をベアラートークンとして転送しますが、トンの取得/更新は管理しません)。また、そもそも MCP クライアントに対して何を公開すべきで、何を公開すべきでないかを検討してください。

ライセンス

MIT

A
license - permissive license
Not graded
quality - not tested
C
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

  • F
    license
    Not graded
    quality
    D
    maintenance
    A 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.
    1
  • A
    license
    A
    quality
    D
    maintenance
    Enables LLM-based agents to interact with FHIR healthcare data through natural language prompts, providing full CRUD operations on FHIR resources, document processing, and semantic search capabilities.
    13
    97
    MIT
  • -
    license
    Not graded
    quality
    Not graded
    maintenance
    Enables seamless integration with FHIR APIs for healthcare applications, allowing users to search, retrieve, create, update, and analyze clinical information through natural language interactions. Supports SMART-on-FHIR authentication and works with various healthcare systems like EPIC and HAPI FHIR servers.

View all related MCP servers

Related MCP Connectors

  • Securely access and manage FHIR healthcare data stored in Medplum.

  • Hosted MCP server exposing US hospital procedure cost data to AI assistants

  • An AI concierge that turns static forms into adaptive AI conversations. From any MCP client.

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/scollard001/fhir-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server