Skip to main content
Glama
medicaid-drug-rebate

medicaid-drug-rebate

by pipeworx-io
README.md
# @pipeworx/medicaid-drug-rebate

Medicaid Drug Rebate Program reference data from CMS: which drug products participate, which were newly reported this week, ACA Federal Upper Limits, whether manufacturers reported their Average Manufacturer Price, and the clotting-factor, exclusive-pediatric and first-time NADAC lists.

Part of [Pipeworx](https://pipeworx.io) — an MCP gateway connecting AI agents to 2018+ live data sources. This is an independent, unofficial integration — not affiliated with, endorsed by, or published by the upstream provider.

## Tools

- `mdrp_product_lookup(ndc?, name?, labeler?, active_only?, limit?, offset?)` — a product's current Medicaid Drug Rebate Program listing: labeler, FDA product name, drug category, approval and market dates, termination date, unit type, clotting-factor and pediatric flags. An NDC with no current listing returns the period it last appeared in; an unmatched name returns near matches.
- `mdrp_newly_reported_drugs(week_start?, from?, to?, labeler?, name?, ndc?, limit?)` — products manufacturers newly reported to CMS, weekly. Defaults to the latest week; a date with no release returns the weeks that exist.
- `aca_federal_upper_limit(ingredient?, ndc?, strength?, year?, month?, limit?)` — the ACA Federal Upper Limit per unit and the weighted average AMP it derives from, for multiple-source generics. Latest monthly file by default.
- `amp_reporting_status(ndc?, labeler?, frequency?, limit?)` — whether the required AMP was reported (R) or not (NR). By NDC: the last 12 periods. By labeler: reported and not-reported counts for the latest period plus the not-reported products.
- `mdrp_drug_designations(list, name?, labeler?, ndc?, limit?)` — the CMS clotting-factor and exclusive-pediatric product lists.
- `first_time_nadac_rates(name?, since?, limit?)` — products that just received their first NADAC rate. For ongoing NADAC prices use `nadac_price` and `nadac_history` in the drug-prices pack; for state utilization use medicaid-intelligence.

NDCs are always strings. Pass 11 digits (`00002120001`) or the dashed form (`00002-1200-01`); every tool normalises to what its dataset uses.

## Auth

Keyless.

## Data sources

- CMS, Medicaid open data catalog: Drug Products in the Medicaid Drug Rebate Program; Product Data for Newly Reported Drugs in the Medicaid Drug Rebate Program; ACA Federal Upper Limits; Drug AMP Reporting (monthly and quarterly); Clotting Factor Drug Report; Exclusive Pediatric Drugs; First Time NADAC Rates. US federal government data, public domain or government-works licence.

Every response names the dataset in `source` and carries `data_as_of`, the publisher's own last-modified timestamp for that dataset.

Served live, one filtered request per call; nothing is copied or stored. The upstream scans millions of rows without indexes, so a cold call can take several seconds (the latest-period lookup is the slow part and is remembered for an hour within a running instance).

Traps the next person would otherwise rediscover:

- Period columns are text, so a descending sort puts month "9" above "10". The latest period is found by asking for months 10-12 and 1-9 separately.
- The weekly newly-reported releases each have their own dataset id; they are resolved by title, never hardcoded, and CMS skips some weeks.
- The quarterly AMP file pads labeler names with spaces; they are trimmed.
- The monthly AMP file lacks some products the quarterly one has; `amp_reporting_status` falls back to quarterly when frequency is not given.

## Quick Start

Add to your MCP client (Claude Desktop, Cursor, Windsurf, etc.):

```json
{
  "mcpServers": {
    "medicaid-drug-rebate": {
      "url": "https://gateway.pipeworx.io/medicaid-drug-rebate/mcp"
    }
  }
}
```

### What this endpoint actually serves

`tools/list` at `https://gateway.pipeworx.io/medicaid-drug-rebate/mcp` returns the tools in the table
above **plus the shared Pipeworx meta-tools** — `ask_pipeworx`,
`discover_tools`, `search_within`, `remember`/`recall` and the rest of the
gateway-wide set. So the tool count you see is larger than this table: a
single-pack endpoint currently lists roughly 30 shared tools alongside the
pack's own. The connection's `initialize` response states its exact scope, and
is the authoritative answer for a given day.

This is deliberate, not multiplexing by accident. The meta-tools are what let a
scoped connection answer a question this pack does not cover — via
`ask_pipeworx`, which routes across the whole catalog — without you adding a
second MCP server. There is currently no way to mount a pack endpoint without
them; if the extra schemas cost you more context than the routing is worth,
connect to the full gateway once rather than to several pack endpoints.

Or connect to the full Pipeworx gateway to get every pack's tools listed
directly, instead of just this one's:

```json
{
  "mcpServers": {
    "pipeworx": {
      "url": "https://gateway.pipeworx.io/mcp"
    }
  }
}
```

Both URLs reach the same gateway and the same 2018+ data sources. The
only difference is which pack's tools are listed **directly**; `ask_pipeworx`
reaches all of them from either one.

## No MCP client? Call it over HTTP

```bash
curl -X POST https://gateway.pipeworx.io/v1/tools/mdrp_product_lookup \
  -H 'Content-Type: application/json' \
  -d '{"name":"OZEMPIC","limit":3}'
```

No account needed for the first calls. Inspect any tool: `GET https://gateway.pipeworx.io/v1/tools/mdrp_product_lookup`. Find one: `POST https://gateway.pipeworx.io/v1/tools/search_packs` with `{"query":"..."}`.

## Run it from npm

`@pipeworx/mcp-medicaid-drug-rebate` is a local stdio bridge to the Pipeworx gateway: your MCP client
starts it with `npx`, and it forwards every call to the same
`https://gateway.pipeworx.io/medicaid-drug-rebate/mcp` endpoint shown above. It needs network access;
there is no offline mode.

```json
{
  "mcpServers": {
    "medicaid-drug-rebate": {
      "command": "npx",
      "args": ["-y", "@pipeworx/mcp-medicaid-drug-rebate"]
    }
  }
}
```

Without a key it calls anonymously, capped at 50 calls a day. A free account
raises that to 200 a day: get a key at https://pipeworx.io/signup and add
`"env": { "PIPEWORX_API_KEY": "<your key>" }` to the server entry.
The key is sent as a Bearer token, the same way a hosted connection sends it,
so calls are metered and billed exactly as they are there.

It lists **only** this pack's tools by default. Set `PIPEWORX_META_TOOLS=1` to
also list `ask_pipeworx` and the other gateway-wide tools.

Behind an HTTPS proxy: Node's built-in `fetch` does not read `HTTPS_PROXY` by
default. Newer Node releases honour it when `NODE_USE_ENV_PROXY=1` is set; check
your Node version's documentation.

## Using with ask_pipeworx

Instead of calling tools directly, you can ask questions in plain English —
this works on the pack endpoint above as well as on the full gateway:

```
ask_pipeworx({ question: "your question about Medicaid Drug Rebate data" })
```

The gateway picks the right tool and fills the arguments automatically.

## More

- [Docs and guides](https://pipeworx.io/docs)
- [pipeworx.io](https://pipeworx.io)

## License

MIT