Skip to main content
Glama
josh747jr

Doctor Appointment MCP Server

by josh747jr

Doctor Appointment MCP サーバー

外部の予約 REST API を通じて医師の予約を管理するための、Python ベースの Model Context Protocol (MCP) サーバーです。

このサーバーは、予約管理の操作を MCP ツールとして公開するため、MCP 互換の AI エージェントやクライアントが予約の作成、検索、取得、キャンセル、再スケジュールを行うことができます。

機能

サーバーは 5 つの MCP ツールを提供します:

ツール

説明

create_appointment

新しい医師の予約を作成します。

find_appointments

患者名、医師名、予約日で予約を検索します。

check_appointment_status

予約 ID で予約の詳細とステータスを取得します。

cancel_appointment

予約のステータスを cancelled に変更してキャンセルします。

reschedule_appointment

既存の予約の日時を変更します。

サーバーには以下も含まれます:

  • /mcp のストリーミング HTTP MCP エンドポイント

  • //health のヘルスチェックエンドポイント

  • オプションのカスタム HTTP ヘッダー認証

  • APPOINTMENTS_API で設定される外部 REST API バックエンド

  • httpx を使用した非同期 HTTP リクエスト

Related MCP server: MCP Appointment Booking Server

アーキテクチャ

AI Agent / MCP Client
          |
          | Model Context Protocol
          v
      /mcp endpoint
          |
          v
       Uvicorn
          |
          v
      Starlette
          |
          v
       FastMCP
          |
   +------+------+------+------+------+
   |      |      |      |      |
   v      v      v      v      v
 Create  Find   Check  Cancel Reschedule
   |      |      |      |      |
   +------+------+------+------+------+
                 |
                 v
            HTTPX Client
                 |
                 | REST API
                 v
        Appointment Backend
         (MockAPI by default)

プロジェクト構造

doctor-appointment-mcp/
├── server.py
├── requirements.txt
├── start.sh
├── run.sh
├── README.md
├── .gitignore
└── .gitattributes

要件

  • Python 3.11 以降を推奨

  • pip

  • 予約 REST API エンドポイント

Python の依存関係は requirements.txt で定義されています:

fastmcp>=3.0
uvicorn[standard]>=0.30
httpx>=0.27

ローカルセットアップ

1. リポジトリのクローン

git clone https://github.com/josh747jr/doctor-appointment-mcp.git
cd doctor-appointment-mcp

2. 仮想環境の作成

Windows PowerShell:

python -m venv .venv
.\.venv\Scripts\Activate.ps1

Linux/macOS/WSL:

python3 -m venv .venv
source .venv/bin/activate

3. 依存関係のインストール

pip install -r requirements.txt

4. 予約 API の設定

予約レコードを保存する REST エンドポイントに APPOINTMENTS_API を設定します。

Windows PowerShell:

$env:APPOINTMENTS_API="https://YOUR-API-ENDPOINT/appointments"

Linux/macOS/WSL:

export APPOINTMENTS_API="https://YOUR-API-ENDPOINT/appointments"

APPOINTMENTS_API が設定されていない場合、現在の server.py は設定済みの MockAPI エンドポイントを使用します。

API キー、認証情報、その他のシークレットをリポジトリにコミットしないでください。

サーバーをローカルで実行

Uvicorn を起動:

python -m uvicorn server:app --host 127.0.0.1 --port 8000

MCP エンドポイントは次のようになります:

http://127.0.0.1:8000/mcp

ヘルスチェックエンドポイントは次のようになります:

http://127.0.0.1:8000/health

ヘルスチェックが成功すると、次の応答が返されます:

ok

MCP ツール

1. create_appointment

新しい医師の予約を作成します。

入力:

  • patient_name

  • doctor_name

  • appointment_date

  • appointment_time

  • reason — オプション

ツール引数の例:

{
  "patient_name": "John Doe",
  "doctor_name": "Dr. Mike",
  "appointment_date": "2026-09-18",
  "appointment_time": "2:00 PM",
  "reason": "Annual physical"
}

新しい予約は scheduled のステータスで保存されます。

ユーザーリクエストの例:

Schedule an appointment for John Doe with Dr. Mike on September 18, 2026
at 2:00 PM for an annual physical.

2. find_appointments

予約 ID が不明な場合に、既存の 1 つ以上の予約を検索します。

検索入力:

  • patient_name — オプション

  • doctor_name — オプション

  • appointment_date — オプション

  • include_cancelled — オプションのブール値、デフォルトは false

patient_namedoctor_nameappointment_date のうち少なくとも 1 つを指定する必要があります。

患者の予約を検索:

{
  "patient_name": "John Doe"
}

患者と医師の予約を検索:

{
  "patient_name": "John Doe",
  "doctor_name": "Dr. Mike"
}

特定の日付の予約を検索:

{
  "appointment_date": "2026-09-18"
}

このツールは、指定された検索フィールドをクエリパラメータとして予約 REST API に送信し、一致する予約レコードを返します。

成功した結果には以下が含まれます:

{
  "success": true,
  "message": "Found 1 matching appointment(s).",
  "count": 1,
  "appointments": [
    {
      "id": "12",
      "patientName": "John Doe",
      "doctorName": "Dr. Mike",
      "appointmentDate": "2026-09-18",
      "appointmentTime": "2:00 PM",
      "reason": "Annual physical",
      "status": "scheduled"
    }
  ]
}

一致するレコードがない場合、ツールは count0 に設定され、appointments 配列が空の成功応答を返します。

ユーザーリクエストの例:

Find my appointment with Dr. Mike.
What appointments does John Doe have?
Find John Doe's appointment on September 18, 2026.

3. check_appointment_status

ID で予約を取得します。

入力:

  • appointment_id

例:

{
  "appointment_id": "12"
}

成功した応答には、患者、医師、予約日、予約時間、理由、ステータスが含まれます。

ユーザーリクエストの例:

What is the status of appointment 12?

4. cancel_appointment

既存の予約をキャンセルします。

入力:

  • appointment_id

例:

{
  "appointment_id": "12"
}

キャンセルしても予約レコードは削除されません。サーバーはそのステータスを次のように変更します:

cancelled

レコードを保持することで、予約履歴が保存されます。

ユーザーリクエストの例:

Cancel appointment 12.

5. reschedule_appointment

既存の予約の日時を変更します。

入力:

  • appointment_id

  • new_appointment_date

  • new_appointment_time

例:

{
  "appointment_id": "12",
  "new_appointment_date": "2026-09-21",
  "new_appointment_time": "10:00 AM"
}

現在の実装では、キャンセルされた予約は再スケジュールできません。

ユーザーリクエストの例:

Move appointment 12 to September 21, 2026 at 10:00 AM.

予約データモデル

REST バックエンドは、次のようなレコードを保存することが想定されています:

{
  "id": "12",
  "patientName": "John Doe",
  "doctorName": "Dr. Mike",
  "appointmentDate": "2026-09-18",
  "appointmentTime": "2:00 PM",
  "reason": "Annual physical",
  "status": "scheduled"
}

サーバーは、次のような REST 操作を使用します:

POST /appointments
GET  /appointments
GET  /appointments/{id}
PUT  /appointments/{id}

find_appointments は、次のようなクエリパラメータで GET /appointments を使用します:

patientName
doctorName
appointmentDate

エージェントワークフローの例

ユーザーは最初に次のように尋ねる場合があります:

Find my appointment with Dr. Mike.

MCP クライアントは次を呼び出すことができます:

find_appointments(patient_name="John Doe", doctor_name="Dr. Mike")

一致するレコードと予約 ID が見つかった後、ユーザーは次のように言うことができます:

Move that appointment to September 21 at 10 AM.

MCP クライアントは次に次を呼び出すことができます:

reschedule_appointment(
    appointment_id="12",
    new_appointment_date="2026-09-21",
    new_appointment_time="10:00 AM"
)

これにより、AI エージェントはユーザーが予約 ID を知らなくても、まず予約を特定できます。

オプションの MCP ヘッダー認証

サーバーは、MCP_REQUEST_HEADERS 環境変数によるオプションのカスタムヘッダー認証をサポートしています。

変数が設定されていない場合、カスタムヘッダー認証は無効になります。

単純なヘッダー

Windows PowerShell:

$env:MCP_REQUEST_HEADERS="my-secret"

Linux/macOS/WSL:

export MCP_REQUEST_HEADERS="my-secret"

この設定では、MCP リクエストに次の名前のヘッダーが含まれることが想定されます:

MCP_REQUEST_HEADERS

設定された値とともに。

カスタムヘッダー名

変数には JSON を含めることもできます:

export MCP_REQUEST_HEADERS='{"X-API-Key":"my-secret"}'

MCP クライアントは次に次を送信する必要があります:

X-API-Key: my-secret

//health のエンドポイントは、このカスタム認証なしでも引き続き利用できます。

セキュリティに関する注意: このプロジェクトはデモンストレーション/学習用の実装です。実際の医療アプリケーションでは、実際の患者情報を保存する前に、はるかに強力な認証、認可、プライバシー管理、監査ログ、シークレット管理、データ保護、規制レビューが必要です。

デプロイメント

リポジトリには以下が含まれています:

start.sh
run.sh

これらのスクリプトは Linux ベースのデプロイメントに使用できます。

start.sh は、必要な Python パッケージをデプロイメントの依存関係ディレクトリにインストールします。

run.sh は Uvicorn でアプリケーションを起動し、PORT 環境変数で待ち受けます。デフォルトはポート 8080 です。

必要なデプロイメント環境変数:

APPOINTMENTS_API=https://YOUR-API-ENDPOINT/appointments

オプションの認証:

MCP_REQUEST_HEADERS=your-secret

デプロイメント後、MCP エンドポイントは通常次のようになります:

https://YOUR-SERVER/mcp

ヘルスチェックエンドポイントは次のようになります:

https://YOUR-SERVER/health

サーバーのテスト

アプリケーションを起動:

python -m uvicorn server:app --host 127.0.0.1 --port 8000

ヘルスチェックエンドポイントをテスト:

curl http://127.0.0.1:8000/health

期待される応答:

ok

次に、MCP 互換クライアントを次の場所に接続するよう設定します:

http://127.0.0.1:8000/mcp

クライアントは次の 5 つのツールを検出するはずです:

create_appointment
find_appointments
check_appointment_status
cancel_appointment
reschedule_appointment

計画中の改善

有用な次のステップには以下が含まれます:

  • 医師の空き状況と時間枠の検索を追加

  • 競合する予約や二重予約を防止

  • より強力な日付と時刻の検証を追加

  • 本番データベースを追加

  • OAuth またはその他の本番グレードの認証メカニズムを追加

  • 自動テストを追加

  • 構造化された監査ログを追加

  • 実際のカレンダーまたはスケジューリングプロバイダーと統合

  • 本番グレードの患者 ID と認可制御を追加

開発ステータス

このプロジェクトは MCP の開発および学習プロジェクトとして意図されています。現在の予約バックエンドは、MCP 向けのツールインターフェースを維持したまま、後で本番のスケジューリングサービスやデータベースに置き換えることができます。

セキュリティと医療データ

保護されていないデモバックエンドで、実際の患者情報や保護対象医療情報 (PHI) を使用しないでください。

本番の医療アプリケーションには、米国では HIPAA などのプライバシー、セキュリティ、コンプライアンス、データ保持に関する要件が適用される場合があります。

リポジトリ

https://github.com/josh747jr/doctor-appointment-mcp

ライセンス

このリポジトリにはまだライセンスが指定されていません。特定のライセンス条件でプロジェクトを配布または再利用する前に、LICENSE ファイルを追加してください。

F
license - not found
Not graded
quality - not tested
B
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
    An MCP server that enables interaction with OnSched's consumer-facing appointment scheduling API through natural language, allowing users to manage bookings, appointments, and scheduling operations.
  • A
    license
    Not graded
    quality
    D
    maintenance
    An MCP server that enables users to book, cancel, reschedule, and list appointments through natural language interactions. It uses YAML configurations for agent behavior and function logic to manage appointment data and availability.
    MIT
  • A
    license
    Not graded
    quality
    D
    maintenance
    Enables users to manage medical appointments by searching for doctors, checking availability, and booking sessions through a natural language interface. It serves as a reference implementation for advanced MCP features like symptom-based specialist recommendations and multi-step scheduling workflows.
    15
    MIT
  • F
    license
    Not graded
    quality
    C
    maintenance
    Simulates a third-party appointment booking agent, enabling your AI platform to check availability and book appointments via MCP interoperability.

View all related MCP servers

Related MCP Connectors

  • Hosted Google Calendar MCP server for AI agents. No self-hosting or Google Cloud setup.

  • Self-hosted MCP gateway: turn any API, database or MCP server into AI connectors — no code.

  • 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/josh747jr/doctor-appointment-mcp'

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