MCP Server × PostgreSQL on MIMIC‑IV

by ambakick

224 downloads
Not rated
GitHub

Description

# MCP Server × PostgreSQL on MIMIC‑IV > **Project goal:** Evaluate whether a Model Context Protocol (MCP) Server layered on Azure Database for PostgreSQL can match—or outperform—direct SQL while reducing developer effort for large‑scale clinical analytics. --- ## 1. Problem…

About

# MCP Server × PostgreSQL on MIMIC‑IV > **Project goal:** Evaluate whether a Model Context Protocol (MCP) Server layered on Azure Database for PostgreSQL can match—or outperform—direct SQL while reducing developer effort for large‑scale clinical analytics. --- ## 1. Problem Statement Clinical datasets such as MIMIC‑IV…

Details

Author
ambakick
Downloads
224
Categories
Database

- MCP‑based abstraction over Azure Database for PostgreSQL.
- Designed for clinical dataset MIMIC‑IV (millions of rows, hundreds of attributes).
- Supports both password and Microsoft Entra authentication.
- Includes benchmark scripts to compare performance with direct SQL.
- Example benchmarks show up to 33% faster query execution for COUNT(*) on EMAR data.
- Reduces lines of code (LOC) by 66% compared to raw SQL for a sample workload.

Setting up with Highlight

This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:

  1. Download and install Highlight from highlightai.com/download
  2. Navigate to the plugins tab and select "Add Custom Plugin"
  3. Configure the plugin with the settings below
    Plugin Name MCP Server × PostgreSQL on MIMIC‑IV
    Command (node, npx, python, etc.)

    Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.

  4. Enable "Start Automatically" if you want the plugin to start when Highlight launches

From the repository

Install Python 3.10+ and required libraries (psycopg, mcp[cli], azure‑identity, etc.). Load MIMIC‑IV data into an Azure Database for PostgreSQL Flexible Server using the provided SQL scripts and bulk copy script. Start the MCP server by running python azure_postgresql_mcp.py with environment variables PGHOST, PGUSER, PGPASSWORD, PGDATABASE set (or use Microsoft Entra authentication by setting AZURE_USE_AAD=True). Benchmarks can be run with python benchmarks/run_sql.py --query <name> for direct SQL or python benchmarks/run_mcp.py --query <name> for the MCP server.

Claude Desktop / Cursor

Paste into your MCP client config file to install this server.

{
    "mcpServers": {
        "mcp server \u00d7 postgresql on mimic\u2011iv": {
            "mimic-mcp-server": {
                "command": "python",
                "args": [
                    "02_bulk_copy.py",
                    "--csv-root",
                    "/path/to/mimic-iv"
                ]
            }
        }
    }
}

McpServers

{
    "mimic-mcp-server": {
        "command": "python",
        "args": [
            "02_bulk_copy.py",
            "--csv-root",
            "/path/to/mimic-iv"
        ]
    }
}

MCP Server × PostgreSQL on MIMIC‑IV

> Project goal: Evaluate whether a Model Context Protocol (MCP) Server layered on Azure Database for PostgreSQL can match—or outperform—direct SQL while reducing developer effort for large‑scale clinical analytics.

---

1. Problem Statement

Clinical datasets such as MIMIC‑IV contain tens of millions of rows and hundreds of attributes. Writing and maintaining raw SQL against such breadth is error‑prone and slow. We ask:

_Can an MCP‑based abstraction simultaneously improve developer productivity and sustain (or enhance) runtime efficiency compared with traditional SQL‑only workflows?_

To answer this we compare direct SQL against an MCP Server → Postgres path on identical workloads—ranging from a simple COUNT(*) on mimiciv_hosp.emar_detail (≈ 87 M rows) to multi‑table note aggregations.

---

2. Repository Layout

.
├── mimic-postgres/          # Scripts to create schemas & ingest MIMIC‑IV CSVs
├── src/            # Fork of azure_postgresql_mcp with env configs
└── README.md              # This file

---

3. Prerequisites

- Python 3.10+
- Node 18+ (optional, for additional MCP tooling)
- Azure Database for PostgreSQL – Flexible Server (Standard_D4s v5 or larger)
- MIMIC‑IV credential & data download permission

```bash

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.