mcp-openfda
v0.1.0
Published
MCP server for openFDA — drug adverse events, labels, recalls, device safety reports. No API key required (optional for higher rate limits).
Maintainers
Readme
mcp-openfda
An MCP (Model Context Protocol) server that gives LLMs direct access to openFDA — search drug adverse events, labels, recalls, and device safety reports.
No API key required. An optional key increases rate limits from 40 to 240 requests/minute.
Quick Start
Add to your MCP client config (Claude Code, Cursor, Windsurf, etc.):
{
"mcpServers": {
"openfda": {
"command": "npx",
"args": ["-y", "mcp-openfda"]
}
}
}That's it. No configuration needed.
Tools
Drug Safety
| Tool | Description |
|------|-------------|
| drug_adverse_events | Search FAERS adverse event reports by drug name, reaction, seriousness, indication, and date range |
| drug_labels | Search FDA-approved labeling (SPL) — indications, warnings, dosing, adverse reactions, drug interactions |
| drug_enforcement | Search drug recalls and enforcement actions by drug, firm, classification, and status |
Device Safety
| Tool | Description |
|------|-------------|
| device_adverse_events | Search Medical Device Reports (MDR) by device name, event type (Death/Injury/Malfunction), and date range |
Aggregation
| Tool | Description |
|------|-------------|
| openfda_count | Aggregate top values for any field across any endpoint — e.g. top reactions for a drug, top recalled firms |
Example Prompts
Once connected, you can ask your LLM:
- "What adverse events have been reported for Ozempic?"
- "Show me the warnings section from the Keytruda label"
- "Find Class I drug recalls in the last 6 months"
- "What are the top 10 adverse reactions reported for metformin?"
- "Search for device malfunction reports for insulin pumps"
- "Compare adverse event profiles between Ozempic and Mounjaro"
- "Has there been any recall activity for Novo Nordisk products?"
Typical Workflow
1. drug_adverse_events → Find safety signals for a drug
2. drug_labels → Check label warnings and contraindications
3. openfda_count → Aggregate top reactions or compare drugs
4. drug_enforcement → Check recall history
5. device_adverse_events → Review device safety for related devicesEnvironment Variables
| Variable | Default | Description |
|----------|---------|-------------|
| OPENFDA_API_KEY | (none) | Optional. Get one free at open.fda.gov. Increases rate limit from 40 to 240 req/min. |
Rate Limiting
The server includes a built-in token-bucket rate limiter:
- With API key: 4 requests/second (240/min)
- Without API key: 0.6 requests/second (40/min)
- Automatic retry on 429 (rate limit exceeded) with 2-second backoff
Development
git clone https://github.com/cmanohar/mcp-openfda.git
cd mcp-openfda
npm install
npm run build
node dist/index.js # runs on stdioHow It Works
This server wraps four openFDA API endpoints:
- Drug Adverse Events (
/drug/event.json) — FAERS reports - Drug Labels (
/drug/label.json) — SPL/package inserts - Drug Enforcement (
/drug/enforcement.json) — recalls and enforcement actions - Device Adverse Events (
/device/event.json) — MDR reports
All endpoints support a count parameter for field-level aggregation, exposed via the openfda_count tool.
License
MIT
