validar-codigo-medico

io.github.encodiv1.0.1更新於 Sep 30, 2026

Validates ICD-10-CM against the real FY2026 catalog (NCHS/CDC) and CPT by structure/category.

已驗證Streamable HTTP可網頁執行Developer ToolsFinanceData & Analytics

概覽

AI 產生的概覽

對照官方 FY2026 目錄驗證 ICD-10-CM 代碼,並依結構驗證 CPT 代碼,每次呼叫以 USDC 計費。

功能
提供一個工具 validate_medical_code,接收 system 與一組代碼。system 為 "icd10" 時,會在隨服務打包的 FY2026 ICD-10-CM 可計費代碼目錄(約 74,719 筆)中查詢,並回傳官方簡短描述。system 為 "cpt" 時,依格式與數字區間判斷屬於 Category I、II 或 III,但不回傳處置描述。每次呼叫皆為無狀態,都會建立新的伺服器實例。
適用情境
適合助理需要確認某個 ICD-10-CM 代碼是否為真實可計費代碼,或判斷 CPT 代碼結構是否有效時使用,例如清理或複核編碼資料。它不能取代合格專業編碼人員,也不提供 CPT 描述。
執行需求
透過 streamable HTTP 存取的遠端 MCP 端點;未宣告需要本機執行環境、套件、帳號或 API 金鑰。呼叫按次計費,需要能在 Base 主網以 USDC 付款的錢包;付款資訊隨 MCP JSON-RPC 請求本身傳遞。
安裝前請注意
每次呼叫在 Base 主網花費 0.02 USDC 真實資金,透過 Coinbase Developer Platform 的 facilitator 結算;未付款的呼叫會回傳錯誤並附上重試所需的付款資訊。在本機執行專案會從共用憑證檔案讀取 CDP 憑證。輸出僅為結構或目錄驗證,不構成醫療或計費建議。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 validar-codigo-medico,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Web executable,透過 Streamable HTTP。 遠端服務在工作區中設定後即可從網頁執行環境執行。

其他 MCP 客戶端

把它新增到你客戶端的 mcpServers 設定中。

{
  "mcpServers": {
    "validar-codigo-medico": {
      "type": "http",
      "url": "https://validar-codigo-medico.encodari.workers.dev/mcp"
    }
  }
}

README

validar-codigo-medico

[validar-codigo-medico MCP server]

Remote MCP server (Cloudflare Workers) with one tool that validates medical codes against real data:

  • validate_medical_code — system: "icd10" does a real lookup against the official billable ICD-10-CM code catalog (FY2026, NCHS/CDC, public domain as a work of the U.S. government) and returns the official short description. system: "cpt" validates the real structure of a CPT code (Category I: 5 digits; Category II: 4 digits + F; Category III: 4 digits + T) and estimates its area by public numeric range — it doesn't include per-code descriptions, because the CPT catalog is owned by the AMA and requires a paid license (it can't be redistributed).

No database, no persistent state between calls: each call builds a fresh McpServer (see createServer() in src/index.ts). The ICD-10-CM catalog (~6MB, 74,719 codes) is bundled into the Worker itself as static data (src/tools/data/icd10cm.ts) and parsed once per isolate into an in-memory Map — see src/tools/codigoMedico.ts.

Why CPT has no descriptions

The CPT (Current Procedural Terminology) description catalog is owned by the American Medical Association and requires a paid license to redistribute its content — unlike ICD-10-CM, which is a work of the U.S. government and therefore public domain. That's why this tool validates a CPT code's real format (regex + numeric range, publicly available information about the code's structure) but doesn't offer the procedure's description: that requires an AMA-licensed codebook.

Billing (x402)

Charges per call via x402 — real USDC payment on Base mainnet, against the Coinbase Developer Platform (CDP) facilitator. The payment travels inside the MCP JSON-RPC itself (_meta), not as an HTTP header; see src/payments.ts.

ToolPrice
validate_medical_code$0.02 USDC

An unpaid tools/call returns isError: true with the accepts (network, amount, payTo) the client needs to pay and retry — not an unexplained exception.

Structure

src/  index.ts             # registers the tool in the McpServer and exposes the MCP HTTP handler  payments.ts          # x402 billing on Base mainnet via the CDP facilitator  tools/    codigoMedico.ts       # pure logic for validate_medical_code (testable without Workers)    codigoMedico.test.ts    data/      icd10cm.ts          # bundled FY2026 ICD-10-CM catalog (generated, do not edit by hand)scripts/  dev-node.ts           # dev server that runs the handler in plain Node, no wrangler  gen-icd10-data.mjs    # regenerates tools/data/icd10cm.ts from a new CMS/NCHS order file

Updating the ICD-10-CM catalog

When NCHS publishes a new version (new fiscal year or addenda):

  1. Download the "Code Descriptions" zip from https://ftp.cdc.gov/pub/health_statistics/nchs/publications/ICD10CM/<YEAR>/.
  2. Unzip it and locate icd10cm-codes-<YEAR>.txt.
  3. node scripts/gen-icd10-data.mjs <path-to-txt> src/tools/data/icd10cm.ts.

Running it locally

⚠️ Note on wrangler dev: the real Cloudflare Workers runtime (workerd) requires macOS 13.5+. If your Mac has an older version, wrangler dev (and npm run dev) will fail. This project includes a plain-Node shim that runs the exact same fetch() handler without needing workerd.

1. Install dependencies

bash
npm install

2. Run the unit tests

bash
npm test

3a. If your wrangler dev works (macOS 13.5+, Linux, Windows)

bash
npm run dev

3b. If wrangler dev fails because of the macOS version

bash
npm run dev:node

Starts at http://localhost:8787/mcp, reading CDP credentials from ~/.mcp-tools-factory-credentials.env (shared across all tools in this factory).

4. Test with curl

bash
# 1) initializecurl -s -X POST http://localhost:8787/mcp \  -H "Content-Type: application/json" \  -H "Accept: application/json, text/event-stream" \  -d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-06-18","capabilities":{},"clientInfo":{"name":"curl-test","version":"0.0.1"}}}'
# 2) tools/listcurl -s -X POST http://localhost:8787/mcp \  -H "Content-Type: application/json" \  -H "Accept: application/json, text/event-stream" \  -d '{"jsonrpc":"2.0","id":2,"method":"tools/list","params":{}}'
# 3) tools/call — validate_medical_code (ICD-10-CM)curl -s -X POST http://localhost:8787/mcp \  -H "Content-Type: application/json" \  -H "Accept: application/json, text/event-stream" \  -d '{"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"name":"validate_medical_code","arguments":{"system":"icd10","codes":["A00.0","Z21","does-not-exist"]}}}'

Responses come as Server-Sent Events (event: message + data: {...}); the data: line is the usual JSON-RPC response.

Deploy and listings

Deployed at https://validar-codigo-medico.encodari.workers.dev/mcp (Cloudflare Workers). Published on the official MCP registry, Smithery, mcp.so, and with an open PR to awesome-mcp-servers.

What it doesn't do (yet)

  • Doesn't include per-code CPT descriptions (see "Why CPT has no descriptions" above).
  • Charges on Base mainnet with real money. To switch back to testnet (Base Sepolia, eip155:84532) during development, change NETWORK in src/payments.ts.
  • No database or persistent state between calls (beyond the billing config and the ICD-10-CM catalog Map, cached in memory per isolate).
  • Not medical or billing advice: this is a structural/catalog validation, not a substitute for a certified professional coder.

來源:README.md,提交 6a10b7b

工具

0
工具後設資料尚未被收錄。

版本歷史

1
  1. v1.0.1最新Sep 16, 2026