Skip to main content
Glama
asanm11611622ubca006

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.

ParametersJSON Schema
NameRequiredDescriptionDefault
diseaseYes

TDQS

A4.3/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the burden of behavioral disclosure. It does disclose that search is case-insensitive and that the return is a formatted list of matching patients. But it does not clarify behavior for no results, pagination, or required permissions. For a simple search tool this is adequate but not thorough.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is concise, front-loaded with the main purpose, and organized into summary, note, Args, and Returns sections. Every sentence adds useful information without unnecessary fluff.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a single-parameter search tool with no output schema, the description covers the essentials: purpose, parameter explanation, and return type. It could mention edge cases like empty results or error behavior, but the provided information is sufficient for basic usage.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema only provides the parameter name and type, with no description. The tool's description compensates fully with an Args section explaining the disease parameter and giving concrete examples ("Diabetes", "asthma"). This adds clear meaning beyond the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool finds all patients diagnosed with a specific disease, using a specific verb and resource. It distinguishes from sibling tools like search_patients_by_name (who search by name) and list_patients_above_age (age-based), making the purpose unambiguous.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description gives clear context: use this when you need patients by disease name. It notes case-insensitivity, which is a practical usage detail. However, it does not explicitly mention when not to use it or name alternatives, so it stops short of full exclusion guidance.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

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.

ParametersJSON Schema
NameRequiredDescriptionDefault
patient_idYes

TDQS

A4.2/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries full burden for behavioral traits. It mentions the 'not found' return, which is useful, but it does not describe the exact structure of the patient record or any potential errors. For a simple lookup, the disclosure is adequate but minimal.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is compact and front-loaded with the purpose, followed by clearly separated Args and Returns sections. Every sentence adds information, and there is no filler or redundancy.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a single-parameter lookup tool with no output schema, the description provides enough to select and invoke correctly: purpose, parameter type/examples, and what to expect back (record or not-found). It could be more explicit about the shape of the return record, but the tool's simplicity keeps the gap small.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema only specifies an integer type, but the description adds meaning by labeling it 'the numeric ID' and giving examples ('e.g. 1, 42, 200'). This compensates for the 0% schema coverage, though it does not provide additional constraints like value ranges.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description uses a specific verb 'look up' and resource 'a single patient by their unique patient ID,' clearly distinguishing this tool from siblings like list_patients_above_age or find_patients_by_disease. The scope (single record, unique ID) is unambiguous.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The context of when to use this tool is clearβ€”when you have a numeric patient IDβ€”but it does not explicitly mention when not to use it or name alternatives. The sibling tools imply alternatives, but the description does not explicitly say 'use search_patients_by_name if you don't know the ID.'

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

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.

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

TDQS

A4.2/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the burden. It discloses the scope ('entire patient dataset') and output contents, adding some behavioral context. Yet it omits potential performance implications, data freshness, or any side effects, leaving partial transparency.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise: two sentences of purpose and contents, plus a simple return note. Every sentence earns its place with no redundancy, making it easy to scan.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a zero-parameter, read-only statistics tool with no output schema, the description covers the essential what and includes the main contents. It could add detail about formatting or calculation specifics, but the absence is not critical given the tool's simplicity.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool has zero parameters, and the schema is empty (100% coverage). The description correctly avoids inventing parameter details, and the baseline for 0 params is 4, as there is nothing to explain.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's function: 'Get summary statistics for the entire patient dataset' with specific contents (count, age, gender, disease distribution). This distinguishes it from sibling tools that focus on individual records or filtered lists.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description clearly implies use for dataset-level overview, contrasting with sibling tools that retrieve specific patients or diseases. However, it does not explicitly mention alternatives or exclusions, though the context from sibling names is helpful.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

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.

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

TDQS

A4.5/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

The description discloses that the result is 'a sorted list of disease names' and that diseases are 'unique' and 'present in the dataset,' adding behavioral detail beyond the tool's name. With no annotations, this gives the agent useful expectations about output.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is compact and well-structured: a clear purpose sentence, a usage hint, and a return format line. Every sentence earns its place with no redundancy.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a parameterless, simple listing tool, the description is complete: it explains what it lists, why it's useful, and what the return value looks like. There are no missing details that would prevent an agent from correctly using it.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool has zero parameters and the schema is empty (100% coverage), so there is nothing to document. The description naturally adds no param semantics, but the baseline of 4 applies because no parameter information is needed.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's function: 'List all unique diseases present in the patient dataset.' This specific verb and resource distinguish it from siblings like find_patients_by_disease, which queries patients, not diseases.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The phrase 'Useful for discovering what diseases can be queried' provides clear context for when to use the tool. It does not explicitly name alternatives or exclusions, but the guidance is sufficient for a simple discovery tool.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

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.

ParametersJSON Schema
NameRequiredDescriptionDefault
ageYes

TDQS

A4.6/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations present, the description carries the full burden. It discloses that the operation is a read-only 'list', clarifies the strict greater-than semantics, and describes the return behavior including the empty case. It stops short of mentioning potential details like ordering or pagination, but these are not necessary for such a simple tool.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is compact and well-structured: a one-sentence purpose, an Args section for the parameter, and a Returns section. Every sentence earns its place with no redundancy or fluff.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Despite having no output schema, the description covers the essential behavior: what the tool does, what the parameter means, and what is returned. The tool's simplicity means no further context is needed, and the sibling list does not introduce missing requirements.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema descriptions coverage is 0%, so the description must compensate. It does so thoroughly by explaining the 'age' parameter as 'the age threshold' and explicitly stating that it returns patients older than this number. This adds meaningful semantic context beyond the raw schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description starts with a specific verb ('List') and a resource ('patients') with a clear filtering condition ('age is strictly greater than the given value'). This directly distinguishes it from sibling tools like get_patient_by_id or find_patients_by_disease, which target different criteria.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description clearly implies the use case: when you need to retrieve patients above a certain age threshold. It provides context without explicitly naming alternatives, but the unique filtering criterion makes the intended usage obvious. It does not include any exclusions, hence a 4 rather than a 5.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

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.

ParametersJSON Schema
NameRequiredDescriptionDefault
nameYes

TDQS

A4.3/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden. It discloses case-insensitivity and partial matching, which are key behavioral traits. However, it does not mention other potentially relevant behaviors like read-only nature, result limits, or ordering. The return description is vague ('a formatted list'), leaving some uncertainty.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is concise and well-structured, with a front-loaded purpose sentence followed by clearly labeled Args and Returns sections. It is appropriately sized, containing no fluff or repetitive information.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple search tool with one parameter and no output schema, the description covers purpose, parameter semantics, and return format adequately. It could provide more detail on the exact fields returned or any result limits, but the current level is sufficient for an agent to invoke it correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema only provides the parameter name and type. The description's Args section explains that 'name' accepts full or partial names and gives examples, adding significant meaning beyond the schema. This fully compensates for the 0% schema description coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose with a specific verb ('Search') and resource ('patients'), specifying the search criterion (name containing given text). It distinguishes from sibling tools like get_patient_by_id (exact ID) and find_patients_by_disease (by disease).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides clear context for use: when you have a full or partial patient name to search. It does not explicitly mention alternatives or exclusions, but its specific purpose makes the usage obvious. The sibling tools cover different search keys, so the context is sufficient.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. 6 tool updatesv1.0.0
    • First observedfind_patients_by_disease
    • First observedget_patient_by_id
    • First observedget_patient_statistics
    • First observedlist_all_diseases
    • First observedlist_patients_above_age
    • First observedsearch_patients_by_name

TDQS

A4.3/5.0
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 issues

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

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.
    419
    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
    C
    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
    -

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/asanm11611622ubca006/First-MCP-server'

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