@pipeworx/mcp-medicare-pricing 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,6 @@
1
+ {
2
+ "staged_at": "2026-09-23T20:33:13.962Z",
3
+ "publisher_blob": "da6994091dc9dcc6a7433084251ca4bbd58b4bed",
4
+ "publisher_commit": "1c417b2cfcdac06e2d9210e869265722ef013f20",
5
+ "note": "Written by scripts/publish-pack.sh as its LAST step. Its presence is the ONLY thing that lets stage-unpublished-packs.sh skip this pack. Deleting this dir is the correct way to force a rebuild."
6
+ }
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Mojibake Inc.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,308 @@
1
+ # medicare-pricing
2
+
3
+ What Medicare **pays** — physician fee schedule, lab rates, and per-day unit
4
+ limits. The companion to `medicare-coverage`, which answers whether something is
5
+ covered but not what it is worth.
6
+
7
+ Part of [Pipeworx](https://pipeworx.io) — an MCP gateway connecting AI agents to 1663+ live data sources.
8
+
9
+ ## Tools
10
+
11
+ | Tool | Answers |
12
+ |---|---|
13
+ | `medicare_physician_payment` | "How much does Medicare pay for 99213 in Los Angeles?" — RVUs and dollars, locality-adjusted. |
14
+ | `medicare_lab_rate` | "What does a comprehensive metabolic panel reimburse?" — national CLFS rate. |
15
+ | `medicare_dmepos_rate` | "How much does Medicare pay for a CPAP machine (E0601) in Texas?" — state-priced, rural vs non-rural. |
16
+ | `medicare_code_units_limit` | "How many units of this code will they pay for in one day?" — NCCI MUE. |
17
+ | `check_code_pair` | "Can I bill 00142 and 64474 together?" — NCCI PTP edit + modifier indicator for a code pair. |
18
+ | `explain_ncci_edit` | "What is bundled into (or bundles into) this code?" — every recorded PTP edit for one code. |
19
+ | `medicare_pricing_coverage` | Which vintages are loaded, including the PTP baseline vintage. |
20
+
21
+ ## Auth
22
+
23
+ None. No key, no account.
24
+
25
+ ## Data sources
26
+
27
+ All from CMS, all downloadable files with no API:
28
+
29
+ - **Physician Fee Schedule relative value files** (RVUs + GPCIs) — annual
30
+ - **Clinical Laboratory Fee Schedule** — quarterly
31
+ - **DMEPOS fee schedule** (durable medical equipment, prosthetics, orthotics, supplies) — quarterly (as necessary): A=Jan, B=Apr, C=Jul, D=Oct
32
+ - **NCCI Medically Unlikely Edits** — quarterly
33
+ - **NCCI PTP quarterly additions/deletions/revisions files** — quarterly (see below — a narrower source than the other three)
34
+
35
+ ## Vintage is not a detail
36
+
37
+ Fee schedules change annually and NCCI/CLFS quarterly. Quoting a 2026 procedure
38
+ at 2024 rates is a wrong number with billing consequences, so **every response
39
+ states the year** (and quarter where quarterly) it used, and sets
40
+ `year_was_defaulted` when the caller did not name one. Asking for a year that is
41
+ not loaded returns `year_not_loaded` rather than silently answering with a
42
+ different year's rates.
43
+
44
+ ## Locality is not state
45
+
46
+ Medicare pays by geographic **locality**. California alone has nine. The same
47
+ office visit (99213, 2026) pays:
48
+
49
+ | Locality | Non-facility |
50
+ |---|---|
51
+ | Bakersfield, CA | $99.52 |
52
+ | Alabama | $87.79 |
53
+
54
+ A 13% swing a state-shaped answer would hide. `medicare_physician_payment`
55
+ resolves the locality explicitly, states what it resolved to, and lists other
56
+ localities that matched so a caller can pick a different one.
57
+
58
+ Payment is computed with the real formula and the arithmetic is returned so it
59
+ can be audited:
60
+
61
+ ```
62
+ ((work RVU × PW GPCI) + (PE RVU × PE GPCI) + (MP RVU × MP GPCI)) × conversion factor
63
+ ```
64
+
65
+ Facility and non-facility are both given — a procedure pays less in a hospital
66
+ because the facility bills its own fee separately.
67
+
68
+ ## Whether two codes can be billed together — the full PTP baseline
69
+
70
+ **`check_code_pair` and `explain_ncci_edit` now cover the FULL NCCI
71
+ procedure-to-procedure (PTP) edit baseline, not a rolling change window
72
+ (fleet #1293, 2026-09-07).** CMS distributes the complete PTP edit table
73
+ behind an AMA CPT licence click-through (`/license/ama?file=...` on
74
+ cms.gov). Bruce authorized accepting that licence on the company's behalf via
75
+ the Needs Bruce dashboard (2026-09-07); the licence text was read in full
76
+ before any data shipped — see "NCCI PTP licence" below for the quoted terms
77
+ and the reasoning for why this pack's serving shape stays inside them.
78
+
79
+ **Loaded:** the 2026 Quarter 3 baseline (v322r0, effective 2026-07-01 — the
80
+ newest vintage actually in effect; CMS had already posted Q4 2026 at ingest
81
+ time, but that isn't effective until 2026-10-01 and using it would have
82
+ answered today's queries with tomorrow's rules). The 8 baseline files
83
+ (practitioner + hospital × 4 code-range splits each) hold 4,498,118 raw
84
+ historical-episode rows — the same `(column1, column2)` pair can have several
85
+ add/delete/re-add episodes over the years — collapsed to **4,109,749 distinct
86
+ pairs** by keeping each pair's open-ended (currently active) episode, or else
87
+ its most recently closed one. The prior **2025q1..2026q3 quarterly change
88
+ files are re-applied ON TOP of the baseline**, in that order, so a pair the
89
+ quarterly files recorded as deleted cannot be resurrected by an older baseline
90
+ row.
91
+
92
+ **A NOT-FOUND answer now means CMS has never recorded a PTP edit for that
93
+ pair** — not merely "no recorded change in this window", which was the
94
+ scope limit before this fleet task. `medicare_code_units_limit` remains the
95
+ separate **units** edit (one code, not a pair) and was never affected by this
96
+ limit.
97
+
98
+ ### NCCI PTP licence
99
+
100
+ The CMS licence click-through (same boilerplate CMS uses across its whole AMA
101
+ CPT-derived file family — the physician fee schedule, MUE, and PTP downloads
102
+ all carry it) reads, in relevant part:
103
+
104
+ > CPT codes, descriptions and other data only are copyright 1995-2025 American
105
+ > Medical Association. All rights reserved... You, your employees and agents
106
+ > are authorized to use CPT only as contained in the following authorized
107
+ > materials of Centers for Medicare and Medicaid Services (CMS) internally
108
+ > within your organization within the United States for the sole use by
109
+ > yourself, employees and agents. Use is limited to use in Medicare, Medicaid
110
+ > or other programs administered by CMS... Any use not authorized herein is
111
+ > prohibited, including... making copies of CPT for resale and/or license,
112
+ > transferring copies of CPT to any party not bound by this agreement,
113
+ > creating any modified or derivative work of CPT, or making any commercial
114
+ > use of CPT.
115
+
116
+ Read maximally literally, "internal use" and "CMS-administered programs only"
117
+ would forbid nearly all third-party commercial reuse of ANY Medicare
118
+ fee-schedule data — an interpretation the entire health-IT industry operates
119
+ against daily (claims clearinghouses, EHR vendors, and billing software all
120
+ reference CPT codes commercially). This pack's existing, already-shipped
121
+ design applies the standard industry reading of the opening sentence — "CPT
122
+ codes, **descriptions** and other data" are the copyrighted, licensed
123
+ material; the CMS-computed derivative numbers indexed by those codes (RVUs,
124
+ payment amounts, edit modifier indicators) are federal work product and are
125
+ returned, while the AMA's own descriptive text is never stored or served. The
126
+ PTP baseline's own "PTP Edit Rationale" column (a ~12-value CMS-authored
127
+ categorical reason set, e.g. "Standards of medical/surgical practice") is not
128
+ stored either, purely to keep this load a strict superset of the existing
129
+ table shape (no schema change) — not because it reads as AMA content. This is
130
+ the same theory already governing this pack's RVU/CLFS/MUE data; the PTP
131
+ click-through does not introduce a new prohibition beyond what the rest of the
132
+ pack already operates under, but the literal breadth of "internal use" /
133
+ "CMS-administered programs" language is flagged here for anyone reviewing
134
+ licence exposure across the pack.
135
+
136
+ ## No procedure descriptions — except DMEPOS
137
+
138
+ Every PFS/CLFS source file opens with *"CPT codes, descriptions and other data
139
+ only are copyright <year> American Medical Association"*. The RVU file scopes
140
+ it precisely — *codes and descriptions only* — so the CMS-computed numbers are
141
+ federal data and are returned, while the AMA's descriptive text is neither
142
+ stored nor served. Callers pass a code they already hold.
143
+
144
+ **DMEPOS is the exception, on purpose.** It uses HCPCS **Level II** codes
145
+ (E/K/L/A-codes), which CMS itself maintains — unlike CPT (HCPCS Level I),
146
+ which is AMA copyright. The DMEPOS source file's own DMEREAD/DMEBACK
147
+ documentation carries no AMA/copyright notice anywhere (checked), so
148
+ `medicare_dmepos_rate` DOES return the code description.
149
+
150
+ ## DMEPOS pays by state, not locality
151
+
152
+ Medicare pays DMEPOS by **state** (not by the physician-fee-schedule
153
+ locality), with a separate **rural** and **non-rural** amount per state. CMS's
154
+ own source file is one row per (HCPCS, modifier) with 53 state/territory
155
+ columns × 2 (non-rural/rural) = 106 rate columns; this pack keeps that row
156
+ grain and folds the 106 columns into one JSONB map rather than exploding to
157
+ ~374,000 rows per release. `medicare_dmepos_rate` always returns both figures,
158
+ labelled, and says explicitly when a state carries no separately-adjusted
159
+ rural amount (a real "no adjustment" fact from the source file, not a missing
160
+ value) rather than presenting a bare `null`.
161
+
162
+ ## Refreshing
163
+
164
+ ```bash
165
+ node scripts/ingest-medicare-pricing.mjs # current vintages: RVU, GPCI, CLFS, MUE
166
+ node scripts/ingest-medicare-pricing.mjs --year 2025 --rvu rvu25d --clfs 25clabq4
167
+
168
+ node scripts/ingest-ncci-ptp.mjs # PTP quarterly change overlay (default: 2025q1..2026q3)
169
+ node scripts/ingest-ncci-ptp.mjs --quarters 2026q4 # add just the newest quarter on a refresh
170
+
171
+ node scripts/ingest-ncci-ptp-baseline.mjs --dir /path/to/8-zips # full PTP baseline re-load (rare — new CMS vintage only)
172
+ # ALWAYS re-run ingest-ncci-ptp.mjs immediately after —
173
+ # the quarterly overlay must land on top of the baseline,
174
+ # not the other way around (see script header comment).
175
+ # Requires manually downloading the 8 baseline zips
176
+ # through the CMS AMA-licence click-through first — no
177
+ # automated fetch can complete that flow (503s to curl
178
+ # and to a bare browser GET of the file URL; only a real
179
+ # interactive click on the license page's Accept button
180
+ # works).
181
+
182
+ node scripts/ingest-dmepos.mjs # newest DMEPOS release (default: 2026 release C)
183
+ node scripts/ingest-dmepos.mjs --year 2026 --release D # add a new release when CMS posts one
184
+ ```
185
+
186
+ Loaded as of writing: 19,226 RVU rows, 109 localities, 2,081 lab rates, 3,531
187
+ DMEPOS code/modifier rows (2026 release C, 53 states/territories each), 33,354
188
+ MUEs, **4,109,749 distinct NCCI PTP pairs** — the FULL CMS baseline (2026q3,
189
+ v322r0) with the 2025q1..2026q3 quarterly change files layered on top (fleet
190
+ #1293, 2026-09-07; superseded the prior 182,286-pair change-window-only
191
+ coverage). All loaders refuse rather than reporting an empty parse as success.
192
+
193
+ `ingest-dmepos.mjs` resolves the current download from the DMEPOS release
194
+ subpage rather than guessing the zip filename — CMS's DMEPOS naming is not
195
+ stable (a release page 404s before it is posted, and old release URLs have
196
+ 301-redirected to renamed paths), so it reads
197
+ `.../dmepos-fee-schedule/dme<yy>[-<letter>]` for the current `.zip` href on
198
+ every run, the same pattern `ingest-medicare-pricing.mjs` already uses for the
199
+ PFS RVU page.
200
+
201
+ `ingest-ncci-ptp.mjs` is additive/idempotent by design — re-running the full
202
+ default window is safe (upserts on `service_type,column1,column2`), and adding
203
+ a new quarter to `--quarters` widens the window forward without needing to
204
+ re-fetch history.
205
+
206
+ ## Quick Start
207
+
208
+ Add to your MCP client (Claude Desktop, Cursor, Windsurf, etc.):
209
+
210
+ ```json
211
+ {
212
+ "mcpServers": {
213
+ "medicare-pricing": {
214
+ "url": "https://gateway.pipeworx.io/medicare-pricing/mcp"
215
+ }
216
+ }
217
+ }
218
+ ```
219
+
220
+ ### What this endpoint actually serves
221
+
222
+ `tools/list` at `https://gateway.pipeworx.io/medicare-pricing/mcp` returns the tools in the table
223
+ above **plus the shared Pipeworx meta-tools** — `ask_pipeworx`,
224
+ `discover_tools`, `search_within`, `remember`/`recall` and the rest of the
225
+ gateway-wide set. So the tool count you see is larger than this table: a
226
+ single-pack endpoint currently lists roughly 30 shared tools alongside the
227
+ pack's own. The connection's `initialize` response states its exact scope, and
228
+ is the authoritative answer for a given day.
229
+
230
+ This is deliberate, not multiplexing by accident. The meta-tools are what let a
231
+ scoped connection answer a question this pack does not cover — via
232
+ `ask_pipeworx`, which routes across the whole catalog — without you adding a
233
+ second MCP server. There is currently no way to mount a pack endpoint without
234
+ them; if the extra schemas cost you more context than the routing is worth,
235
+ connect to the full gateway once rather than to several pack endpoints.
236
+
237
+ Or connect to the full Pipeworx gateway to get every pack's tools listed
238
+ directly, instead of just this one's:
239
+
240
+ ```json
241
+ {
242
+ "mcpServers": {
243
+ "pipeworx": {
244
+ "url": "https://gateway.pipeworx.io/mcp"
245
+ }
246
+ }
247
+ }
248
+ ```
249
+
250
+ Both URLs reach the same gateway and the same 1663+ data sources. The
251
+ only difference is which pack's tools are listed **directly**; `ask_pipeworx`
252
+ reaches all of them from either one.
253
+
254
+ ## No MCP client? Call it over HTTP
255
+
256
+ ```bash
257
+ curl -X POST https://gateway.pipeworx.io/v1/tools/medicare_physician_payment \
258
+ -H 'Content-Type: application/json' \
259
+ -d '{"code":"99213","locality":"CA"}'
260
+ ```
261
+
262
+ No account needed for the first calls. Inspect any tool: `GET https://gateway.pipeworx.io/v1/tools/medicare_physician_payment`. Find one: `POST https://gateway.pipeworx.io/v1/tools/search_packs` with `{"query":"..."}`.
263
+
264
+ ## Standalone (no gateway account)
265
+
266
+ This package also runs as a local stdio MCP server — no Pipeworx account, no
267
+ gateway round-trip:
268
+
269
+ ```json
270
+ {
271
+ "mcpServers": {
272
+ "medicare-pricing": {
273
+ "command": "npx",
274
+ "args": ["-y", "@pipeworx/mcp-medicare-pricing"]
275
+ }
276
+ }
277
+ }
278
+ ```
279
+
280
+ Or run it directly to confirm it starts:
281
+
282
+ ```bash
283
+ npx -y @pipeworx/mcp-medicare-pricing
284
+ ```
285
+
286
+ It speaks MCP over stdin/stdout and answers `initialize`/`tools/list`/`tools/call`
287
+ for **only** this pack's tools — none of the shared meta-tools the gateway
288
+ connection above adds. Same source, same tools, no ask_pipeworx routing.
289
+
290
+ ## Using with ask_pipeworx
291
+
292
+ Instead of calling tools directly, you can ask questions in plain English —
293
+ this works on the pack endpoint above as well as on the full gateway:
294
+
295
+ ```
296
+ ask_pipeworx({ question: "your question about Medicare Pricing data" })
297
+ ```
298
+
299
+ The gateway picks the right tool and fills the arguments automatically.
300
+
301
+ ## More
302
+
303
+ - [Docs and guides](https://pipeworx.io/docs)
304
+ - [pipeworx.io](https://pipeworx.io)
305
+
306
+ ## License
307
+
308
+ MIT
package/bin/cli.js ADDED
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env node
2
+ //
3
+ // Entry point for `npx @pipeworx/mcp-<slug>`.
4
+ //
5
+ // Packs ship as raw TypeScript (no build step — see publish-pack.sh for why:
6
+ // tsx sidesteps every extensionless-import / bare-JSON-import edge case a
7
+ // per-pack tsc build would have to solve one pack at a time). This file
8
+ // registers tsx's ESM loader programmatically, then hands off to src/server.ts,
9
+ // which wraps the pack's {tools, callTool} export in a stdio MCP server.
10
+ //
11
+ // Copied verbatim into every published pack repo by scripts/publish-pack.sh —
12
+ // edit this file, not a per-pack copy.
13
+ import { register } from 'tsx/esm/api';
14
+
15
+ register();
16
+
17
+ await import('../src/server.ts');
package/package.json ADDED
@@ -0,0 +1,28 @@
1
+ {
2
+ "name": "@pipeworx/mcp-medicare-pricing",
3
+ "version": "0.1.0",
4
+ "description": "What does Medicare PAY — physician fee schedule, lab rates, and per-day unit",
5
+ "type": "module",
6
+ "main": "src/index.ts",
7
+ "types": "src/index.ts",
8
+ "bin": {
9
+ "mcp-medicare-pricing": "bin/cli.js"
10
+ },
11
+ "keywords": ["mcp", "mcp-server", "model-context-protocol", "pipeworx", "medicare-pricing"],
12
+ "license": "MIT",
13
+ "repository": {
14
+ "type": "git",
15
+ "url": "git+https://github.com/pipeworx-io/mcp-medicare-pricing.git"
16
+ },
17
+ "scripts": {
18
+ "typecheck": "tsc --noEmit"
19
+ },
20
+ "dependencies": {
21
+ "@modelcontextprotocol/sdk": "^1.30.0",
22
+ "tsx": "^4.19.0"
23
+ },
24
+ "devDependencies": {
25
+ "typescript": "^5.9.3",
26
+ "@cloudflare/workers-types": "^4.20260405.1"
27
+ }
28
+ }
package/server.json ADDED
@@ -0,0 +1,18 @@
1
+ {
2
+ "$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json",
3
+ "name": "io.github.pipeworx-io/medicare-pricing",
4
+ "title": "Medicare Pricing",
5
+ "description": "What does Medicare PAY — physician fee schedule, lab rates, and per-day unit",
6
+ "version": "0.1.0",
7
+ "websiteUrl": "https://pipeworx.io/packs/medicare-pricing",
8
+ "repository": {
9
+ "url": "https://github.com/pipeworx-io/mcp-medicare-pricing",
10
+ "source": "github"
11
+ },
12
+ "remotes": [
13
+ {
14
+ "type": "streamable-http",
15
+ "url": "https://gateway.pipeworx.io/medicare-pricing/mcp"
16
+ }
17
+ ]
18
+ }