Patient Data MCP Server
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Patient Data MCP Server Find patients with asthma"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
π₯ Patient Data MCP Server
Welcome to the Patient Data MCP (Model Context Protocol) Server project! π
This is a beginner-friendly project showing how to connect Claude Desktop to your own local Python data sources. It lets you chat with a synthetic patient dataset containing 200 health records. π§ββοΈπ
If you are a student or developer wanting to learn how to bridge LLMs with real-world databases, this is a perfect starting point! π‘
π οΈ Features
This server currently provides 6 powerful tools to Claude:
π
get_patient_by_idβ Look up a specific patient record.π
list_patients_above_ageβ Find older patients based on an age threshold.π¦
find_patients_by_diseaseβ Search for patients by their diagnosis (e.g., Asthma, Diabetes).π
list_all_diseasesβ See all unique diseases present in the dataset.π€
search_patients_by_nameβ Quickly find someone by their partial or full name.π
get_patient_statisticsβ Receive a beautiful statistical breakdown of the dataset.
Related MCP server: SQLite MCP Server
π₯οΈ Getting Started
1οΈβ£ Prerequisites
You will need a few things installed on your machine:
Python 3.10+ (π)
uv (β‘ A blazing fast Python package runner). Install it via terminal:
macOS/Linux:
curl -LsSf https://astral.sh/uv/install.sh | shWindows:
irm https://astral.sh/uv/install.ps1 | iex
Claude Desktop App (π€)
2οΈβ£ Clone the Repository
Download the code to your computer:
git clone https://github.com/asanm11611622ubca006/First-MCP-server.git
cd First-MCP-server(Optional) Run python generate_dataset.py if you ever want to regenerate the randomized patients.csv file!
3οΈβ£ Connect to Claude Desktop! π
You don't need to run the server in your terminal. Claude will automatically run it in the background!
Open your Claude Desktop config file:
Windows:
%APPDATA%\Claude\claude_desktop_config.jsonmacOS:
~/Library/Application Support/Claude/claude_desktop_config.json
Add the following JSON configuration. Make sure to update the
--directorypath to where you saved the code on your computer!
{
"mcpServers": {
"patient-data-server": {
"command": "uv",
"args": [
"--directory",
"YOUR_FULL_PATH_HERE\\First_MCP_server",
"run",
"patient_server.py"
]
}
}
}(β οΈ Windows users: Remember to use double backslashes \\ in path names!)
4οΈβ£ Start Chatting! π¬
Restart Claude Desktop (fully quit from the system tray and reopen).
Look for the little π¨ (Hammer) icon in the chat bar. You should see the
patient-data-serverfeatures loaded!Try asking:
"What are the most common diseases in the patient database?"
"Can you find patients with Hypertension?"
"Get patient by ID 42"
π± Learning & Contributing
This project is an awesome way to learn how the Model Context Protocol works. You can easily open patient_server.py and modify it.
Try adding a new tool to find patients by gender, or swap out the CSV parsing for an SQL database! π©βπ»π¨βπ»
Happy coding! π
Available Tools
6 toolsfind_patients_by_diseaseA
Find all patients diagnosed with a specific disease. The search is case-insensitive.
Args: disease: The disease name to search for (e.g. "Diabetes", "asthma").
Returns: A formatted list of matching patients.
Inputs: disease (required).
get_patient_by_idA
Look up a single patient by their unique patient ID.
Args: patient_id: The numeric ID of the patient (e.g. 1, 42, 200).
Returns: The patient record, or a "not found" message.
Inputs: patient_id (required).
get_patient_statisticsA
Get summary statistics for the entire patient dataset. Includes total count, age statistics, gender breakdown, and disease distribution.
Returns: A formatted statistical summary.
Inputs: no named parameters.
list_all_diseasesA
List all unique diseases present in the patient dataset. Useful for discovering what diseases can be queried.
Returns: A sorted list of disease names.
Inputs: no named parameters.
list_patients_above_ageA
List all patients whose age is strictly greater than the given value.
Args: age: The age threshold. Returns patients older than this number.
Returns: A formatted list of matching patients, or a message if none match.
Inputs: age (required).
search_patients_by_nameA
Search for patients whose name contains the given text. The search is case-insensitive and supports partial matches.
Args: name: Full or partial patient name to search for (e.g. "john", "Smith").
Returns: A formatted list of matching patients.
Inputs: name (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelogβ¦
TDQS
Scored across 6 tools
Each tool targets a distinct query: by ID, by age, by disease, by name, list diseases, and overall statistics. There is no overlap in their purposes, even though several search patients in different ways.
Tool names use a mix of verbs: get, list, find, search. While all are snake_case and readable, the pattern is not consistent across the set (e.g., 'get_patient_by_id' vs 'find_patients_by_disease').
With 6 tools, the server is well-scoped for a read-only patient data querying purpose. Each tool covers a distinct and necessary operation without unnecessary bloat.
The set covers all obvious read-only query needs: lookup by ID, filtering by age, disease, name, listing available diseases, and summary statistics. Missing write operations (create/update/delete) may be out of scope, but a generic 'list all patients' could be a minor gap.
Maintenance
Related MCP Connectors
Telehealth support for Claude, Codex and Cursor: investigate cases and connect your tools.
Your lab results and health record in Claude: trends, retests, meds, conditions and symptoms.
Connect AI clients to biomedical data and tools.
Connect your team's living knowledge base β docs, data, issues, CRM β to Claude and ChatGPT.
Related MCP Servers
- AlicenseNot gradedqualityBmaintenanceConnects Claude Desktop directly to databases, allowing it to explore database structures, write SQL queries, analyze datasets, and create reports through an API layer with tools for table exploration and query execution.3,714 PyPI422Mozilla Public 2.0
- AlicenseNot gradedqualityDmaintenanceEnables natural language interaction with local SQLite databases through Claude Desktop, translating plain English queries into SQL for data analysis and exploration.3MIT
- FlicenseNot gradedqualityDmaintenanceConnects Claude Desktop to a healthcare claims database for natural-language analysis of CPT codes, reimbursement rates, payer performance, and denial patterns.-
- FlicenseAqualityDmaintenanceExposes a clinic's knowledge base and structured records to Claude Desktop as callable tools, with read tools grounded with citations and write tools gated behind approval.4-