rx-shortage-mcp

rx-shortage-mcp

An MCP server that lets an LLM answer a pharmacist's question about drug shortages by normalizing drug names, finding pharmacologic alternatives, and checking their shortage status using public FDA and NLM data.

Category
访问服务器

README

Rx Shortage Alternative Finder (MCP)

An MCP server that lets an LLM answer a pharmacist's question: "Drug X is on backorder — what could be considered instead, and are any of those also short?"

When a drug goes into shortage, the obvious therapeutic alternative is often also short — a documented "cascading shortage" (e.g. cisplatin → carboplatin, where the alternative became more scarce than the original). The data to check this is public, but no single tool stitches it together. This server does, in one LLM reasoning pass.

⚠️ Decision-support, not a substitution authority. "Same pharmacologic class" ≠ "clinically interchangeable." This tool surfaces candidates for a licensed professional to evaluate. It does not check route, indication, contraindications, or therapeutic equivalence. See Safety.

Status: v1 — all four tools live, orchestrated, and safety-gated; verified live in Claude Desktop. 15/15 on the chain-success eval.


Who it's for & what makes it different

Built for informatics pharmacists and clinical-data teams who operationalize shortage response — people who care about how the data is stitched together, not just the answer. Every suggestion is grounded in real RxNorm/RxClass identifiers (no model-invented drugs) and framed as clinical decision support with transparent reasoning — a human stays in the loop; the server makes no substitution decision.

The gap it fills: FDA/ASHP tell you a drug is short. Equivalence tools (Orange Book, vendor catalogs) tell you who else makes the same molecule. Neither tells you whether the different drug you'd actually reach for — a same-class alternative — is also in shortage. This stitches FDA shortage status + RxNorm/RxClass class alternatives + a per-alternative re-check into one LLM pass.


What it does

drug name ──▶ rx_normalize_drug ──▶ RxCUI + clean name
                                        │
                                        ▼
                              rx_get_drug_class ──▶ candidate ATC-4 classes
                                        │
                                        ▼
                            rx_find_alternatives ──▶ sibling drugs in the class
                                        │
                   ┌────────────────────┴───────────────────┐
                   ▼  (LLM loops over each sibling + original)
             rx_check_shortage ──▶ Current / Resolved / no record
                   │
                   ▼
        ranked candidates, each flagged if ALSO short   (the LLM synthesizes)

The fan-out loop is the model's reasoning, not a single tool call — that's why this is an MCP server, not a script.

The four tools

Tool Purpose Source
rx_normalize_drug Messy name / brand / typo → RxCUI + ingredient RxNorm (Prescribe)
rx_get_drug_class Drug → candidate ATC-4 pharmacologic classes RxClass
rx_find_alternatives Class → sibling drugs (carries safety disclaimer) RxClass
rx_check_shortage Drug → current shortage status openFDA Drug Shortages

All four are read-only. No API key required (see below).

Example

Ask your MCP client: "Furosemide is on backorder — what could be considered instead, and are any of those also short?" The model chains the four tools and synthesizes a ranked, shortage-flagged shortlist:

Same-class option (ATC C03CA) FDA status Presentations affected Updated
furosemide (original) Current shortage 33 06/25/2026
bumetanide Current shortage 12 06/25/2026
torsemide No shortage reported 0
piretanide No shortage reported 0

The cascade insight: both first-line loop diuretics — furosemide and its usual substitute bumetanide — are in current FDA shortage; torsemide is the same-class option with no shortage reported. Candidates for a licensed professional to evaluate — not a substitution instruction; status ≠ availability, and class membership ≠ clinical interchangeability.

(Live national data — your results will reflect current shortage status, which changes over time.)

🎥 Demo video: coming soon.

Requirements

  • uv (recommended) — handles Python + deps automatically
  • Python ≥ 3.10 (uv fetches 3.12 for you if absent)
  • An MCP client — Claude Desktop or Claude Code

Install & run

git clone https://github.com/Travis-Clement-Dev/rx-shortage-mcp.git
cd rx-shortage-mcp
uv run python -m rx_shortage_mcp   # first run auto-creates the venv + installs deps

The server speaks MCP over stdio; you normally launch it through an MCP client rather than by hand.

Claude Desktop

Add to claude_desktop_config.json (macOS: ~/Library/Application Support/Claude/claude_desktop_config.json):

{
  "mcpServers": {
    "rx-shortage": {
      "command": "uv",
      "args": ["--directory", "/ABSOLUTE/PATH/TO/rx-shortage-mcp", "run", "python", "-m", "rx_shortage_mcp"]
    }
  }
}

Restart Claude Desktop, then ask: "Furosemide is on backorder — what could I consider instead, and are any of those also short?"

Optional: openFDA API key

The server runs fully keyless (~240 req/min, ~1000 req/day per IP). A free openFDA key only raises the daily ceiling. To use one, copy .env.example to .env and set OPENFDA_API_KEY.

Testing

uv run --extra dev pytest        # offline unit + safety-gate + MCP-protocol tests (deterministic)
uv run --extra dev pytest -m live # live eval: full chain over 15 drugs, asserts >=90% chain success
npx @modelcontextprotocol/inspector uv run python -m rx_shortage_mcp   # interactive tool testing

The safety gate (tests/test_safety_gate.py) fails the build if any tool ever frames output as a substitution instruction or drops the disclaimer.

Troubleshooting: if import rx_shortage_mcp ever fails, the editable install drifted — reset with rm -rf .venv uv.lock && uv sync. Let uv own the venv; don't mix in uv pip install -e ..

Safety

rx_find_alternatives returns every member of a pharmacologic class — some will be the wrong route, wrong indication, contraindicated, or withdrawn from market. The server cannot encode clinical judgment. Every alternatives response carries a disclaimer; output is framed as "candidate alternatives to consider," never "substitute with X." A licensed professional must evaluate every candidate. National-level shortage data only — no local/regional stock.

Attribution

This product uses publicly available data from the U.S. National Library of Medicine (NLM), National Institutes of Health, Department of Health and Human Services; NLM is not responsible for the product and does not endorse or recommend this or any other product.

Shortage data from the U.S. Food & Drug Administration (openFDA). openFDA data is not for making decisions regarding medical care.

License

MIT © 2026 Travis Clement

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选