Skip to main content

FineRx MCP server

Give an AI assistant live access to FineRx drug-price data — the same catalog, package, price-comparison, and nearest-pharmacy data shown on the FineRx website — and the free FineRx discount card, through the Model Context Protocol.

finerx-mcp is a thin client over the FineRx public REST API (/api/public/v1). It has no direct database access and inherits the public API's authentication and rate limits, so it adds zero extra attack surface.

Tools

Tool What it does
search_drugs(query, limit=10) Find drugs by name/alias → candidates with slugs + from-prices
get_drug(slug, locale?, channel?) A drug's stats + strength/form variants + savingsCard
compare_prices(ndc, quantity, locale?, channel?) Offer matrix (chain × savings program × price × observation date) + savingsCard
find_nearby_pharmacies(zip, chains?, limit=3) Nearest store locations per chain around a ZIP
get_dataset_info() Dataset coverage, freshness, and attribution/disclaimer terms
get_savings_card(locale?, channel?, drug?) The free discount card: codes, how to use it, ways to save it — plus an image of the card, and an interactive card in hosts that render MCP Apps
email_savings_card(email, consent, locale?) Email the card to an address the person gave, after they said yes
get_prescription_options(locale?, drug?) What to do when there is no prescription yet, or the brand costs too much

Every result embeds a one-line disclaimer and, wherever a price appears, an observedAt date. No tool ever returns hidden vendors or an operator reference price.

The server also ships instructions (served to the client as system-level guidance: quote the observation date, offer the card whenever you quote a price, never say guaranteed/best/cheapest, never give medical advice), three resources — finerx://card (the card as markdown), finerx://how-it-works, and ui://widget/savings-card.html (the card as a UI component, below) — and two prompts, price_and_card(drug) and prescription_help(drug?).

Handing over the card

The card is the free LowerMyRx discount card FineRx distributes. It is not insurance, needs no signup, and is credited at the pharmacy counter by the group code — so an assistant can hand it over completely, with no click-through:

  • get_savings_card returns the three counter codes, what the card is and is not, the steps to use it, the sentence to say to the pharmacist, an optional observed price with its date, an FAQ and the legal lines — and a PNG of the card as an image content block, so a chat client can show something the person saves to their phone. The PNG is fetched once per process and cached in memory; if that fetch fails the tool still returns the card text, and imageUrl is in the JSON either way for clients that cannot render images.
  • email_savings_card sends one card-only message. It refuses without consent=true and never calls the API in that case — the assistant has to ask for the address and an explicit yes first. The result masks the address (j***@example.com); FineRx does not store it. 503 means email delivery is off (offer the image or the link instead), 429 means the abuse cap was hit.
  • compare_prices / get_drug carry the same card object as savingsCard, so the card is present in the same turn as the price. Say "lowest" only when savingsCard.price.isLowest is true; otherwise repeat the provided note.
  • Every URL the tools return carries src=<channel> (default mcp), so the assistant that sent someone is visible in FineRx's own analytics — nothing about the person is.

Renders as an app

On a host that supports UI components — ChatGPT (Apps SDK) and any host that implements the standard MCP Apps extension, which is how Claude renders one — get_savings_card does not just return JSON: the host draws the card in the conversation.

  • The component is the resource ui://widget/savings-card.html, served with mime type text/html;profile=mcp-app. get_savings_card points at it from its tool _meta, under both the standard key (ui.resourceUri) and OpenAI's alias (openai/outputTemplate), so it renders in either kind of host.
  • It shows the teal card with the three counter codes (large and selectable), the card price for the drug when one is known (with the date it was observed and the vetted note — never a "lowest" badge unless price.isLowest is true), the sentence to say to the pharmacist with a Copy button, the steps, buttons to open / print / save / email the card, the FAQ, and the legal lines. Every string comes from the tool result's labels, so it speaks the same language and uses the same words as finerxfinder.com.
  • The Email button calls email_savings_card from inside the component (which is why that tool is declared ui.visibility: ["model", "app"] / openai/widgetAccessible). Consent is a checkbox the person ticks; the address is sent once and never written back into the page.
  • The document is entirely self-contained — inline CSS and vanilla JS, no external script, stylesheet, font or image — because hosts serve it under a default-src 'none' CSP. Links are opened through the host bridge (window.openai.openExternal or ui/open-link), never window.open.
  • It renders with no data at all (a host that sends nothing still shows the three codes), with no price block, and with no labels (English fallbacks).

Testing it without a host. The tool result is the whole input, so a mocked bridge is enough:

uv run --project packages/finerx-mcp python -c \
  "from finerx_mcp.widget import load_widget_html; open('/tmp/w.html','w').write(load_widget_html())"

Prepend a <script> that defines window.openai = {toolOutput: <a /card response>, theme: "light", locale: "en", callTool: …, openExternal: …} to that file and open it in a browser for the ChatGPT bridge; or put the widget in an <iframe srcdoc> and have the parent answer ui/initialize and then post a ui/notifications/tool-result notification to exercise the standard bridge. get_savings_card's structuredContent is exactly what the component reads, so GET /api/public/v1/card is a ready-made fixture.

Prerequisites

Configuration

The server reads two environment variables:

Variable Required Default Notes
FINERX_API_KEY yes — Your frx_live_... key
FINERX_API_BASE no https://finerxfinder.com/api/public/v1 Point at another host for local testing
FINERX_CARD_IMAGE_URL no https://www.finerxfinder.com/card.png PNG get_savings_card returns, when the API response names no delivery.imageUrl
FINERX_MCP_TRANSPORT no stdio streamable-http for the remote endpoint
FINERX_MCP_HOST / FINERX_MCP_PORT no 127.0.0.1 / 8000 Bind address for the HTTP transport
FINERX_MCP_STATELESS no 1 (on) 0 restores per-session HTTP transports (see below)

Install & run

Run directly with uvx (no manual install needed):

FINERX_API_KEY=frx_live_xxxxxxxx uvx finerx-mcp

The server speaks MCP over stdio by default.

Remote (HTTP) mode

The same tools can be served over Streamable HTTP — the transport that connector catalogs (ChatGPT Apps, Claude connectors, Gemini, Grok) consume, so a user adds FineRx by URL with no local install. Set the transport (and, for a hosted deployment, the bind host/port):

FINERX_API_KEY=frx_live_xxxx \
FINERX_MCP_TRANSPORT=streamable-http \
FINERX_MCP_HOST=0.0.0.0 FINERX_MCP_PORT=9000 \
uvx finerx-mcp
# → endpoint at http://<host>:9000/mcp

Defaults stay stdio, so existing Claude Desktop/Code/Cursor configs are unaffected. The HTTP endpoint calls the same public REST API with the server's FINERX_API_KEY, so hosting it exposes no data beyond the already-public API.

HTTP mode is stateless by default. Keyless one-shot connector calls — a catalog probe, a single tool call from a chat — open a Streamable-HTTP session and never DELETE it, so in session mode the transport map only grows (measured on the hosted endpoint: 3568 sessions over 7 days, ~25 MB of swap a day, until the container restarts). Stateless mode builds a transport per request and drops it. It is safe here because no tool keeps per-session state: every call is a fresh request against the public API, and the card-image cache is process-level, not per-session. Set FINERX_MCP_STATELESS=0 if you need SSE resumability; stdio ignores the setting entirely.

Claude Desktop

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

{
  "mcpServers": {
    "finerx": {
      "command": "uvx",
      "args": ["finerx-mcp"],
      "env": {
        "FINERX_API_KEY": "frx_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
      }
    }
  }
}

Restart Claude Desktop; the FineRx tools appear in the tools menu.

Claude Code

claude mcp add finerx --env FINERX_API_KEY=frx_live_xxxx -- uvx finerx-mcp

Or add it to .mcp.json in your project:

{
  "mcpServers": {
    "finerx": {
      "command": "uvx",
      "args": ["finerx-mcp"],
      "env": { "FINERX_API_KEY": "frx_live_xxxxxxxx" }
    }
  }
}

Local development

Run against a local FineRx stack (e.g. the dev proxy on :8080):

export FINERX_API_KEY=frx_live_...        # a key you created via the CLI
export FINERX_API_BASE=http://localhost:8080/api/public/v1
uv run --project packages/finerx-mcp finerx-mcp

A smoke test that drives one tool call end-to-end lives at scripts/smoke_mcp.py in the FineRx repo.

Run the unit tests (HTTP is stubbed — no key, no network):

uv run --project packages/finerx-mcp --with pytest --with pytest-asyncio \
    pytest packages/finerx-mcp/tests -q

Terms

Data is provided under the FineRx public API terms: attribution required ("Prices via FineRx"), prices are observed estimates (not guaranteed or insured prices) and may be out of date, and nothing here is medical advice. Pharmacy location coordinates are © OpenStreetMap contributors (ODbL).

Metadata

Release files for finerx-mcp 1.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for finerx-mcp 1.4.0
File Size Uploaded
finerx_mcp-1.4.0.tar.gz 33.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for finerx-mcp 1.4.0
File Interpreter ABI Platform
finerx_mcp-1.4.0-py3-none-any.whl Python 3 none any Details

Total release size: 62.6 kB

Release files / finerx_mcp-1.4.0.tar.gz

Download URL finerx_mcp-1.4.0.tar.gz
Size 33.3 kB
Tags Source
SHA-256 checksum
How to use checksums
3dedc44170b03e96519ac646f99b58fbd0211f81d45c35aafbf25750844a6290
BLAKE2b-256 checksum
How to use checksums
0b6ed16af0d3d135513f73da35e8e8e1b5a4c8d52a652b8960eb1b00aa4826ab
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.13

Release files / finerx_mcp-1.4.0-py3-none-any.whl

Download URL finerx_mcp-1.4.0-py3-none-any.whl
Size 29.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
48e52c239995aaec7275323bd261c4f07e61c01538aa1a02d3a64a954d7c8529
BLAKE2b-256 checksum
How to use checksums
a8827b348eb5c275ac4c0f1405147925bce4ace376907fde5816121e1190c549
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.13

Release history Release notifications | RSS feed

2.2.0

2 release files

2.1.0

2 release files

2.0.0

2 release files

1.5.0

2 release files

This release

1.4.0 This release

2 release files

1.3.0

2 release files

1.2.0

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page