Skip to main content
Glama
Patient Data MCP Server

Patient Data MCP Server

πŸ₯ 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:

  1. πŸ” get_patient_by_id β€” Look up a specific patient record.

  2. πŸŽ‚ list_patients_above_age β€” Find older patients based on an age threshold.

  3. 🦠 find_patients_by_disease β€” Search for patients by their diagnosis (e.g., Asthma, Diabetes).

  4. πŸ“‹ list_all_diseases β€” See all unique diseases present in the dataset.

  5. πŸ‘€ search_patients_by_name β€” Quickly find someone by their partial or full name.

  6. πŸ“ˆ 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 | sh

    • Windows: 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!

  1. Open your Claude Desktop config file:

    • Windows: %APPDATA%\Claude\claude_desktop_config.json

    • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json

  2. Add the following JSON configuration. Make sure to update the --directory path 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! πŸ’¬

  1. Restart Claude Desktop (fully quit from the system tray and reopen).

  2. Look for the little πŸ”¨ (Hammer) icon in the chat bar. You should see the patient-data-server features loaded!

  3. 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 tools
find_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

    A4.3/5.0

    Scored across 6 tools

    Disambiguation5/5

    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.

    Naming Consistency3/5

    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').

    Tool Count5/5

    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.

    Completeness4/5

    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

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      B
      maintenance
      Connects 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 PyPI
      422
      Mozilla Public 2.0
    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables natural language interaction with local SQLite databases through Claude Desktop, translating plain English queries into SQL for data analysis and exploration.
      3
      MIT
    • F
      license
      A
      quality
      D
      maintenance
      Exposes 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
      -