MCP Hub
Back to servers

MCP Medical Appointments Demo

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.

glama
Updated
Mar 31, 2026

MCP Medical Appointments Demo

A working reference for the Model Context Protocol — tools, resources, prompts, elicitation, sampling, and completion — built around a medical appointment scheduling domain.

Built with TypeScript, Hono, MCP SDK, and Zod.

Table of Contents

Features

MCP Server Primitives

PrimitiveNameDescription
Toolsearch_doctorsSearch doctors by name or specialty
Toolget_available_slotsGet available time slots for a doctor on a date
Toolbook_appointmentBook an appointment (uses elicitation for confirmation)
Toolcancel_appointmentCancel an appointment (uses elicitation for confirmation)
Toollist_appointmentsList appointments with filters
Toolrecommend_specialistSymptom-based specialist recommendation (uses sampling)
Resourcespecialties://listStatic list of all medical specialties
Resourcedoctor://{doctorId}/profileDynamic doctor profile with template
Resourcepatient://{patientId}/summaryPatient info + appointment history
Resourceappointment://{appointmentId}Full appointment details
Promptschedule-appointmentGuided appointment scheduling workflow (with completion)
Promptpatient-historyPatient history review (with completion)
Prompttriage-symptomsSymptom triage and specialist recommendation

MCP Client Features

FeatureHow It's Used
Elicitationbook_appointment and cancel_appointment ask the user to confirm before proceeding
Samplingrecommend_specialist uses LLM sampling to match symptoms to specialties
RootsServer registers a root for the medical appointments workspace
CompletionPrompts use completable() for auto-completing specialty names and patient IDs

Quick Start

Prerequisites

  • Node.js >= 22.0.0
  • VS Code with GitHub Copilot (for MCP integration)

1. Install and start the REST API

npm install
npm run dev:service

You should see:

Bootstrapped: 8 specialties, 12 doctors, 5 patients
Medical Appointment Service running on http://localhost:3000

2. Connect the MCP Server in VS Code

The .vscode/mcp.json file is already configured. VS Code will automatically detect and offer to start the MCP server. Alternatively, run it manually:

npm run dev:mcp

3. Try it out

In VS Code's Copilot Chat (Agent mode), try:

  • "Search for cardiologists"
  • "What slots does Dr. Sarah Chen have available next Monday?"
  • "Book an appointment with doc-3 for patient pat-1"
  • "Show me Alice Johnson's appointment history"
  • "I've been having severe headaches and dizziness — what specialist should I see?"

Or use the prompts from the prompt picker:

  • Schedule Appointment — guided scheduling workflow
  • Patient History — review a patient's visits
  • Triage Symptoms — symptom-based specialist matching

Architecture

┌─────────────────┐     stdio      ┌───────────────────┐     HTTP      ┌──────────────────┐
│   VS Code /     │◄──────────────►│   MCP Server      │─────────────►│  Hono REST API   │
│   MCP Client    │                │   (TypeScript)    │  localhost    │  (localhost:3000) │
└─────────────────┘                └───────────────────┘              └──────────────────┘
                                     Tools, Resources,                  In-memory store
                                     Prompts                            + JSON bootstrap

The project uses a two-process design:

  1. Hono REST API — HTTP service with an in-memory data store, bootstrapped from JSON seed files in data/.
  2. MCP Server — Connects via stdio and exposes the REST API through MCP primitives (tools, resources, prompts).

The MCP server never touches the data store directly — it calls the REST API through an HTTP client, keeping the two layers cleanly separated.

REST API Endpoints

MethodEndpointDescription
GET/api/specialtiesList all specialties
GET/api/specialties/:idGet specialty by ID
GET/api/doctorsList doctors (filters: ?specialtyId=, ?name=)
GET/api/doctors/:idGet doctor by ID
GET/api/doctors/:id/slots?date=YYYY-MM-DDGet available slots
GET/api/patientsList all patients
GET/api/patients/:idGet patient by ID
POST/api/patientsCreate a patient
GET/api/appointmentsList appointments (filters: ?patientId=, ?doctorId=, ?status=, ?date=)
GET/api/appointments/:idGet appointment by ID
POST/api/appointmentsBook an appointment
PATCH/api/appointments/:id/cancelCancel an appointment
PATCH/api/appointments/:id/completeComplete an appointment

Project Structure

mcp-demo/
├── data/
│   ├── specialties.json      # 8 medical specialties
│   ├── doctors.json           # 12 doctors across specialties
│   └── patients.json          # 5 sample patients
├── src/
│   ├── types.ts               # Shared domain types
│   ├── service/
│   │   ├── store.ts           # In-memory data store
│   │   ├── app.ts             # Hono app composition
│   │   ├── main.ts            # Service entry point
│   │   └── routes/            # REST route handlers
│   └── mcp/
│       ├── api-client.ts      # HTTP client for the REST API
│       ├── tools.ts           # MCP tool registrations
│       ├── resources.ts       # MCP resource registrations
│       ├── prompts.ts         # MCP prompt registrations
│       └── server.ts          # MCP server entry point
├── .vscode/
│   └── mcp.json               # VS Code MCP server config
├── package.json
└── tsconfig.json

Scripts

CommandDescription
npm run dev:serviceStart the Hono REST API with hot reload
npm run dev:mcpStart MCP server in stdio mode
npm run buildCompile TypeScript to dist/
npm run typecheckType-check without emitting files

Domain Model

EntityDescription
SpecialtyMedical specialty (Cardiology, Dermatology, etc.)
DoctorHas a specialty, available days, working hours, and slot duration
PatientName, email, phone, date of birth
AppointmentLinks a patient to a doctor at a specific date/time with a reason and status
TimeSlotAvailable or booked time window for a doctor on a given day

Configuration

The REST API listens on port 3000 by default. The MCP server communicates with the API over http://localhost:3000 and connects to VS Code via stdio.

Seed data (specialties, doctors, patients) is loaded from the data/ directory on startup. Edit those JSON files to customize the demo dataset.

Contributing

Contributions are welcome. Fork the repo, create a feature branch, and open a pull request.

License

MIT

Reviews

No reviews yet

Sign in to write a review