cms-mcp
Click on "Install 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., "@cms-mcpShow me the top DRGs for hospital CCN 050046 in 2024"
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.
cms-mcp
A read-only MCP server over the DuckDB star schema built by cms-inpatient-warehouse. It gives an agent seven typed tools for Medicare inpatient DRG data, plus one guarded SQL tool for anything the typed tools do not cover.
Read this first: the data covers 71.7% of national volume
CMS suppresses any hospital-DRG cell with fewer than 11 discharges, so the fact table does not sum to the published provider-level totals. For data year 2024, CMS published 6,904,504 discharges nationally; the mart holds 4,952,481, about 71.7%. Every number this server returns is an estimate over published cells. Small hospitals and rare DRGs are underrepresented, and no reweighting fixes this, because the suppressed values are not published at any grain.
Related MCP server: mcp-server-duckdb
Setup
Build the warehouse:
git clone https://github.com/abhaymettu/cms-inpatient-warehouse
cd cms-inpatient-warehouse
./run_all.shThis produces warehouse.duckdb. Per its README, the run takes about 7 seconds after an
84 MB one-time download.
Install this server with uv:
uv venv
uv pip install -e .or, without cloning this repo:
uv pip install git+https://github.com/abhaymettu/cms-mcpRun it, pointed at the warehouse file:
CMS_MCP_DB=/path/to/warehouse.duckdb cms-mcpThis speaks MCP over stdio. python -m cms_mcp is equivalent to the cms-mcp binary.
Client configuration
Claude Desktop, Cursor, or any generic stdio client (claude_desktop_config.json):
{
"mcpServers": {
"cms-mcp": {
"command": "/path/to/cms-mcp/.venv/bin/cms-mcp",
"env": {
"CMS_MCP_DB": "/path/to/warehouse.duckdb"
}
}
}
}Claude Code:
claude mcp add cms-mcp -e CMS_MCP_DB=/path/to/warehouse.duckdb -- /path/to/.venv/bin/cms-mcpMCP Inspector, to list tools without a client:
npx @modelcontextprotocol/inspector --cli .venv/bin/cms-mcp -e CMS_MCP_DB=/path/to/warehouse.duckdb --method tools/listSee docs/client-configs.md for these plus a tools/call example, and docs/smoke-test.md for a
captured Inspector session against the real warehouse: every tool called once, plus the
rejection cases.
Tools
Tool | Arguments | Returns | Purpose |
| none | list of table summaries | List the four exposed marts tables with grain and role |
|
| columns, row count, notes, sample rows | Show a table's schema and how to use it correctly |
|
| columns, rows, truncated flag, elapsed time | Run a single guarded SELECT against the marts schema |
|
| list of hospitals | Find hospitals by name, location, or CCN |
|
| list of DRGs | Find MS-DRGs by description or code |
|
| totals and top DRGs for one hospital | Summarize one hospital's discharges, payments, and case mix |
|
| national or state totals and top hospitals for one DRG | Summarize one DRG nationally or in one state |
Schema
Table | Grain |
| one row per (CCN, DRG code, data year) |
| one row per hospital per version (Type 2 SCD) |
| one row per MS-DRG code |
| one row per state, ZIP, RUCA combination |
Two rules an agent must follow:
Join facts to
dim_provideronprovider_sk, notccn.dim_provideris a Type 2 dimension, so accncan match more than one row.avg_*columns are per discharge and not additive. Sumext_*(extended amount, already multiplied by discharges), then divide, rather than averagingavg_*across rows.
Guardrails
Guardrail | Mechanism | Env var |
Read-only file handle | DuckDB connection opened with | none |
No external access |
| none |
Single-statement SELECT only | Parsed with DuckDB's own | none |
Row cap | Result wrapped in an outer |
|
Per-statement timeout | A timer thread calls |
|
Rate limit | Token bucket shared across all tools, per server process |
|
SQL length cap | Query text rejected past this length |
|
Memory and CPU ceiling |
| none |
Warehouse file path | required to start the server |
|
Failure modes
Suppression bias. Covered above. It affects every tool, not just
query.A timed-out query returns an error, but the process keeps running. Narrow a slow analytic join rather than retrying it as-is.
The rate limit is per server process, not per client. Two clients sharing one process share the same token bucket.
stdio only, no auth. This is a local tool for one trusted process to talk to, not a network service.
If the warehouse file is rebuilt while the server holds it open, the server keeps serving the old file until restarted.
Summing
avg_*columns silently gives wrong rollups. They are per discharge, not additive. Useext_*for anything that needs to be summed.Joining
dim_provideronccnfans out facts by version count, becausedim_provideris Type 2. Join onprovider_skinstead.A query that hits the 1GB memory limit fails with a DuckDB out-of-memory message.
PRAGMAstatements do not work inside the row-cap wrapper, because the wrapper selects from the query as a subquery.The real-data tests are skipped in CI, because the warehouse file is not committed. CI proves the guardrails and tool contracts against a small fixture, not the actual numbers.
describe_tableandquerycannot see thestagingorintermediateschemas, by design. Onlymartsis exposed.
Development
uv pip install -e ".[dev]"
pytest -q
ruff check .tests/test_real_warehouse.py runs only when CMS_MCP_DB points at a real warehouse file;
otherwise it is skipped. CI runs on the small fixture built in tests/conftest.py.
Licence
MIT.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.
No tool schema history has been recorded yet.
This server cannot be installed
Maintenance
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
Query, join, profile, clean and convert CSV/JSON/Parquet with server-side DuckDB over MCP.
Governed data discovery, exact queries, decisions, simulations, and runtime utilities over MCP.
Read-only U.S. healthcare dataset metadata, schemas, immutable downloads, and checksums.
Query your org's data in natural language — read-only MCP access to SQL, NoSQL, files & warehouses.
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceEnables querying MIMIC-IV medical data using natural language through MCP clients, with support for local DuckDB and cloud BigQuery backends.77MIT
- AlicenseAqualityCmaintenanceEnables DuckDB database interaction through MCP, supporting SQL queries, table creation, and schema inspection with optional read-only mode.1MIT
- FlicenseNot gradedqualityCmaintenanceProvides MCP tools to interact with Databricks SQL warehouses, enabling metadata discovery, table reading, and DDL operations.-
- AlicenseBqualityCmaintenanceEnables SQL querying over CSV and Excel files using DuckDB, providing tools to load files, inspect schemas, and run read-only queries via MCP.5MIT
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
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/abhaymettu/cms-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server