healthcare-mcp-demo
A healthcare MCP demo server exposing clinical resources, tools, and prompts over SSE with authentication, integrated with Pydantic AI and Gemini for natural language patient record updates.
README
Healthcare Model Context Protocol (MCP) Demo
A lightweight healthcare demo application showcasing the latest stateless Model Context Protocol (MCP) standard using FastMCP, Pydantic AI, and Google Gemini.
This repository demonstrates how to build a secure, server-side MCP infrastructure that exposes clinical read endpoints, state mutation tools, and workflow prompts, then orchestrates them via an AI Host layer.
Key Concepts & Architecture
- MCP Resources (Read Operations): Exposes passive context via custom URIs (e.g.,
healthcare://patients/{patient_id}/record). Used by the AI model to fetch factual data without side effects. - MCP Tools (Write/Mutation Operations): Exposes executable actions (e.g.,
update_patient_status). Converts Python type hints and docstrings into JSON Schemas for AI function calling. - MCP Prompts (Workflow Templates): Centralizes clinical prompt logic on the server (e.g.,
generate_discharge_summary_prompt), providing standardized instructions across all client environments. - Transports (HTTP/SSE): Runs as a stateless remote server over Server-Sent Events (SSE) on HTTP port
8000. - Authentication: Uses Bearer Token authorization to secure remote SSE server connections.
- AI Host Integration: Uses
pydantic-aiandgoogle-gla:gemini-2.5-flashto automatically inspect tools, make clinical decisions, and execute mutations via natural language queries.
Project Structure
healthcare-mcp-demo/
├── server.py # FastMCP Server (Resources, Tools, Prompts, SSE transport)
├── client.py # Deterministic host test script (Direct MCP protocol verification)
├── pydantic_llm_client.py # AI Host script (Pydantic AI + Gemini + MCPToolset + Auth)
├── pyproject.toml # Project dependencies managed by uv
├── uv.lock # Lockfile for precise dependency resolution
└── README.md # Documentation
----
Prerequisites
Python: 3.10 or higher
Package Manager: uv installed on your system
API Key: Google Gemini API key (GEMINI_API_KEY)
Installation & Setup
Clone or navigate to the repository:
PowerShell
cd healthcare-mcp-demo
Install Dependencies:
uv will automatically set up the virtual environment and install all necessary packages:
PowerShell
uv sync
Configure Environment Variables:
Set your Gemini API key in your terminal session:
PowerShell
# Windows PowerShell
$env:GEMINI_API_KEY="your-actual-gemini-api-key"
# Linux / macOS
export GEMINI_API_KEY="your-actual-gemini-api-key"
Running the Application
Running the demo requires two terminal windows:
Step 1: Start the Remote MCP Server (Terminal 1)
Run the server script using uv:
PowerShell
uv run .\server.py
The server will start listening on http://0.0.0.0:8000/sse.
Step 2: Run the AI Host Client (Terminal 2)
In a second terminal, execute the Pydantic AI client script:
PowerShell
uv run .\pydantic_llm_client.py
Expected Output Workflow
The client establishes an authenticated SSE connection using a Bearer Token (secure-healthcare-secret-token-123).
Pydantic AI sends the user query alongside the discovered MCP tools to Gemini.
Gemini determines that update_patient_status needs to be called.
The MCP Tool executes on server.py, updating the record for patient P-101.
Gemini synthesizes the execution feedback and returns a natural language response:
Plaintext
User Request: 'Please update patient P-101's status to 'Discharged' and set condition to 'Acute Bronchitis - Fully Recovered'.'
Executing request via Gemini + FastMCP...
=== GEMINI RESPONSE ===
The patient record for P-101 has been successfully updated.
* Status: Discharged
* Condition: Acute Bronchitis - Fully Recovered
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
Neon Database
MCP server for interacting with Neon Management API and databases
E2B
Using MCP to run code via e2b.
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.