Socket
Book a DemoInstallSign in
Socket

@uh-joan/fda-mcp-server

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@uh-joan/fda-mcp-server

MCP server for FDA drug information lookup and safety data. Provides access to FDA drug labels, adverse events, and regulatory information through the openFDA API.

0.3.0
latest
Source
npmnpm
Version published
Maintainers
1
Created
Source

FDA MCP Server

npm version License: MIT

A Model Context Protocol (MCP) server that provides access to the FDA's openFDA database with advanced query capabilities. This server enables AI assistants and applications to search for drug information, safety data, adverse events, recalls, and regulatory information using powerful boolean logic, field targeting, wildcards, and complex multi-condition queries.

Features

  • 🔍 Comprehensive Drug Search: Search across ALL FDA database fields (openfda, products, submissions sections)
  • 🧠 Complex Query Support: Boolean operators (AND, OR), field combinations, range queries, wildcards, and special modifiers
  • 🎯 Field-Specific Search: Target specific database fields with dedicated parameters for each search type:
    • General: 34 fields for comprehensive drug data
    • Adverse Events: 66 fields for safety data and reactions
    • Drug Labels: 167 fields for prescribing information
    • Recalls: 39 fields for enforcement reports and safety alerts
    • Shortages: 44 fields for supply availability data
  • ⚠️ Adverse Events: Access safety data and adverse reaction reports with advanced filtering
  • 📢 Drug Recalls: Search for FDA drug recalls and safety alerts with detailed field targeting
  • 🏷️ Drug Labels: Get detailed prescribing information and FDA-approved drug labels
  • 🚨 Drug Shortages: Monitor current drug supply shortages and availability with comprehensive field access
  • 🔍 Advanced Search Patterns: Wildcards (child*, *5*), range queries ([65+TO+*]), special modifiers (_exists_, _missing_)
  • 🔄 Unified API: Single tool interface with multiple search types and query complexity
  • 🚀 No API Key Required: Basic access works without authentication (rate limited)

Installation

Option 1: Install from NPM

npm install -g @uh-joan/fda-mcp-server

Option 2: Install from Source

git clone https://github.com/uh-joan/fda-mcp-server.git
cd fda-mcp-server
npm install
npm link

Configuration

Claude Desktop Integration

Add the following to your Claude Desktop configuration file:

Location:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json

Configuration:

{
  "mcpServers": {
    "fda": {
      "command": "fda-mcp-server",
      "env": {
        "FDA_API_KEY": "your_api_key_here"
      }
    }
  }
}

Environment Variables

API Reference

Tool: fda_drug_info

Unified tool for FDA drug information lookup and safety data.

Parameters

ParameterTypeRequiredDefaultDescription
methodstringYes-Operation type: lookup_drug
search_termstringYes-Search term or complex query (supports AND/OR, wildcards, ranges, field combinations)
search_typestringNogeneralType of search: general, label, adverse_events, recalls, shortages
fields_for_generalstringNo-Specific field for general drug data searches (34 available fields)
fields_for_adverse_eventsstringNo-Specific field for adverse events searches (66 available fields)
fields_for_labelstringNo-Specific field for label searches (167 available fields)
fields_for_recallsstringNo-Specific field for recalls and enforcement searches (39 available fields)
fields_for_shortagesstringNo-Specific field for drug shortages searches (44 available fields)
limitintegerNo10Maximum results to return (1-100)

Methods

Unified Drug Lookup (lookup_drug)

Search for comprehensive drug information with different search types and optional field targeting:

Comprehensive Search (All Fields):

{
  "method": "lookup_drug",
  "search_term": "aspirin",
  "search_type": "general"
}

Field-Specific Search:

{
  "method": "lookup_drug",
  "search_term": "Discontinued",
  "search_type": "general",
  "fields_for_general": "products.marketing_status"
}

Complex Boolean Query:

{
  "method": "lookup_drug",
  "search_term": "openfda.generic_name:aspirin+AND+products.dosage_form:TABLET",
  "search_type": "general"
}

Drug Labels and Prescribing Information:

{
  "method": "lookup_drug",
  "search_term": "Lipitor",
  "search_type": "label"
}

Label Field-Specific Search:

{
  "method": "lookup_drug",
  "search_term": "pregnancy",
  "search_type": "label",
  "fields_for_label": "warnings"
}

Adverse Events and Safety Data:

{
  "method": "lookup_drug",
  "search_term": "metformin",
  "search_type": "adverse_events",
  "limit": 25
}

Drug Recalls and Safety Alerts:

{
  "method": "lookup_drug",
  "search_term": "insulin",
  "search_type": "recalls",
  "limit": 20
}

Drug Shortages:

{
  "method": "lookup_drug",
  "search_term": "bupivacaine",
  "search_type": "shortages",
  "limit": 10
}

Complex Query Syntax

The FDA MCP Server supports powerful openFDA query syntax for advanced searches:

Boolean Operators

AND Queries - Find results matching multiple criteria:

{
  "method": "lookup_drug",
  "search_term": "openfda.generic_name:ibuprofen+AND+products.dosage_form:TABLET",
  "search_type": "general"
}

OR Queries - Find results matching any criteria:

{
  "method": "lookup_drug",
  "search_term": "openfda.generic_name:ibuprofen+OR+openfda.brand_name:advil",
  "search_type": "general"
}

Wildcard Patterns

Prefix wildcards - Find names starting with a pattern:

{
  "method": "lookup_drug",
  "search_term": "child*",
  "search_type": "general",
  "fields_for_general": "openfda.brand_name"
}

General wildcards - Find any field containing a pattern:

{
  "method": "lookup_drug",
  "search_term": "*5*",
  "search_type": "general"
}

Range Queries

Age ranges - Find adverse events for specific age groups:

{
  "method": "lookup_drug",
  "search_term": "patient.patientonsetage:[65+TO+*]",
  "search_type": "adverse_events"
}

Date ranges - Find events within date ranges:

{
  "method": "lookup_drug",
  "search_term": "receiptdate:[2023-01-01+TO+2023-12-31]",
  "search_type": "adverse_events"
}

Special Modifiers

Field exists - Find records where a field has any value:

{
  "method": "lookup_drug",
  "search_term": "_exists_:serious",
  "search_type": "adverse_events"
}

Field missing - Find records where a field is empty:

{
  "method": "lookup_drug",
  "search_term": "_missing_:companynumb",
  "search_type": "adverse_events"
}

Complex Multi-Field Examples

Advanced adverse events - Serious events in elderly patients:

{
  "method": "lookup_drug",
  "search_term": "patient.drug.medicinalproduct:acetaminophen+AND+serious:1+AND+patient.patientonsetage:[65+TO+*]",
  "search_type": "adverse_events"
}

Grouped conditions - Multiple drug names with conditions:

{
  "method": "lookup_drug",
  "search_term": "(patient.drug.medicinalproduct:(cetirizine+OR+loratadine))+AND+serious:2",
  "search_type": "adverse_events"
}

Geographic filtering - Events by country with drug and severity:

{
  "method": "lookup_drug",
  "search_term": "occurcountry:US+AND+patient.drug.medicinalproduct:lipitor+AND+serious:1",
  "search_type": "adverse_events"
}

Usage Examples

Comprehensive Drug Search (All Fields)

// Search across all FDA database fields (267 total fields)
{
  "method": "lookup_drug",
  "search_term": "aspirin",
  "search_type": "general"
}

Field-Specific Searches

General Search Fields (34 available):

// Find all discontinued drugs
{
  "method": "lookup_drug",
  "search_term": "Discontinued",
  "search_type": "general",
  "fields_for_general": "products.marketing_status"
}

// Search by manufacturer
{
  "method": "lookup_drug",
  "search_term": "Pfizer",
  "search_type": "general",
  "fields_for_general": "openfda.manufacturer_name"
}

// Find drugs by dosage form
{
  "method": "lookup_drug",
  "search_term": "TABLET",
  "search_type": "general",
  "fields_for_general": "products.dosage_form"
}

Adverse Events Fields (66 available):

// Find headache reactions
{
  "method": "lookup_drug",
  "search_term": "headache",
  "search_type": "adverse_events",
  "fields_for_adverse_events": "patient.reaction.reactionmeddrapt"
}

// Find serious adverse events
{
  "method": "lookup_drug",
  "search_term": "1",
  "search_type": "adverse_events",
  "fields_for_adverse_events": "serious"
}

// Find events by patient gender (1=male, 2=female)
{
  "method": "lookup_drug",
  "search_term": "1",
  "search_type": "adverse_events",
  "fields_for_adverse_events": "patient.patientsex"
}

Label Search Fields (167 available):

// Find labels with specific warnings
{
  "method": "lookup_drug",
  "search_term": "pregnancy",
  "search_type": "label",
  "fields_for_label": "warnings"
}

// Search for drug interactions
{
  "method": "lookup_drug",
  "search_term": "warfarin",
  "search_type": "label",
  "fields_for_label": "drug_interactions"
}

// Find dosage information for specific conditions
{
  "method": "lookup_drug",
  "search_term": "pediatric",
  "search_type": "label",
  "fields_for_label": "dosage_and_administration"
}

Recalls Fields (39 available):

// Find recalls by recalling firm
{
  "method": "lookup_drug",
  "search_term": "Pfizer",
  "search_type": "recalls",
  "fields_for_recalls": "recalling_firm"
}

// Find Class I recalls (most serious)
{
  "method": "lookup_drug",
  "search_term": "I",
  "search_type": "recalls",
  "fields_for_recalls": "classification"
}

// Search recalls by product description
{
  "method": "lookup_drug",
  "search_term": "tablet",
  "search_type": "recalls",
  "fields_for_recalls": "product_description"
}

Shortages Fields (44 available):

// Find current shortages by status
{
  "method": "lookup_drug",
  "search_term": "Currently+in+Shortage",
  "search_type": "shortages",
  "fields_for_shortages": "status"
}

// Search shortages by therapeutic category
{
  "method": "lookup_drug",
  "search_term": "CEPHALOSPORIN",
  "search_type": "shortages",
  "fields_for_shortages": "therapeutic_category"
}

// Find shortages by company name
{
  "method": "lookup_drug",
  "search_term": "Pfizer",
  "search_type": "shortages",
  "fields_for_shortages": "company_name"
}

Detailed Drug Label

// Get FDA-approved prescribing information for Tylenol
{
  "method": "lookup_drug",
  "search_term": "Tylenol",
  "search_type": "label"
}

Safety and Adverse Events

// Check adverse events for ibuprofen
{
  "method": "lookup_drug",
  "search_term": "ibuprofen",
  "search_type": "adverse_events"
}

Drug Recalls

// Search for recalls related to blood pressure medications
{
  "method": "lookup_drug",
  "search_term": "lisinopril",
  "search_type": "recalls",
  "limit": 10
}

Drug Shortages

// Monitor current drug supply shortages
{
  "method": "lookup_drug",
  "search_term": "bupivacaine",
  "search_type": "shortages",
  "limit": 10
}

Available Search Fields

The API supports searching across 350+ FDA database fields total. Use field-specific parameters for targeted searches:

  • fields_for_general: 34 fields for general drug data searches
  • fields_for_adverse_events: 66 fields for adverse events searches
  • fields_for_label: 167 fields for drug label searches
  • fields_for_recalls: 39 fields for recalls and enforcement searches
  • fields_for_shortages: 44 fields for drug shortages searches

OpenFDA Section (16 fields)

  • openfda.application_number - FDA application number
  • openfda.brand_name - Brand/trade name of the drug
  • openfda.generic_name - Generic name of the drug
  • openfda.manufacturer_name - Name of the manufacturer
  • openfda.nui - Numeric identifier for ingredients
  • openfda.package_ndc - Package-level National Drug Code
  • openfda.pharm_class_cs - Chemical structure pharmacologic class
  • openfda.pharm_class_epc - Established pharmacologic class
  • openfda.pharm_class_pe - Physiologic effect pharmacologic class
  • openfda.pharm_class_moa - Mechanism of action pharmacologic class
  • openfda.product_ndc - Product-level National Drug Code
  • openfda.route - Route of administration
  • openfda.rxcui - RxNorm concept unique identifier
  • openfda.spl_id - Structured Product Labeling identifier
  • openfda.spl_set_id - SPL document set identifier
  • openfda.substance_name - Name of the active substance
  • openfda.unii - Unique Ingredient Identifier

Products Section (9 fields)

  • products.active_ingredients.name - Name of active ingredient
  • products.active_ingredients.strength - Strength of active ingredient
  • products.dosage_form - Dosage form (e.g., "TABLET", "CAPSULE")
  • products.marketing_status - Marketing status (e.g., "Discontinued", "Prescription")
  • products.product_number - Product number within application
  • products.reference_drug - Reference drug designation
  • products.reference_standard - Reference standard designation
  • products.route - Route of administration
  • products.te_code - Therapeutic equivalence evaluation code

Submissions Section (10+ fields)

  • submissions.application_docs - Application documentation
  • submissions.review_priority - Review priority designation
  • submissions.submission_class_code - Submission classification code
  • submissions.submission_class_code_description - Description of submission class
  • submissions.submission_number - Sequential submission number
  • submissions.submission_property_type.code - Property type code
  • submissions.submission_public_notes - Public notes about submission
  • submissions.submission_status - Current status of submission
  • submissions.submission_status_date - Date of status change
  • submissions.submission_type - Type of submission

Usage Examples by Field Type

Search by Marketing Status:

{
  "method": "lookup_drug",
  "search_term": "Discontinued",
  "search_type": "general",
  "fields_for_general": "products.marketing_status"
}

Search by Manufacturer:

{
  "method": "lookup_drug",
  "search_term": "Pfizer",
  "search_type": "general", 
  "fields_for_general": "openfda.manufacturer_name"
}

Search by Dosage Form:

{
  "method": "lookup_drug",
  "search_term": "INJECTION",
  "search_type": "general",
  "fields_for_general": "products.dosage_form"
}

Search by Active Ingredient:

{
  "method": "lookup_drug",
  "search_term": "acetaminophen",
  "search_type": "general",
  "fields_for_general": "products.active_ingredients.name"
}

Response Format

All responses include:

{
  "success": true,
  "query": "aspirin",
  "search_type": "general",
  "total_results": 150,
  "results": [...],
  "metadata": {
    "total": 150,
    "skip": 0,
    "limit": 10
  }
}

Search Tips

Drug Names

  • Use both generic names (e.g., "acetaminophen") and brand names (e.g., "Tylenol")
  • Try different name variations if initial search returns no results
  • Include common spellings and abbreviations
  • Use wildcards for partial matches (e.g., child* for children's medications)

Search Types

  • general: Comprehensive search across all FDA database fields (34 fields available)
  • label: Detailed prescribing information and FDA-approved labels (167 fields available)
  • adverse_events: Safety data and adverse reaction reports (66 fields available)
  • recalls: Drug recalls and safety alerts (39 fields available)
  • shortages: Current drug supply shortages and availability (44 fields available)

Complex Query Strategies

  • Boolean Logic: Combine conditions with AND/OR operators
  • Field Targeting: Use openfda.field_name:value syntax for precise searches
  • Range Queries: Use [min+TO+max] for age, date, or numeric ranges
  • Wildcards: Use * for pattern matching (*5*, MEF*)
  • Special Modifiers: Use _exists_:field or _missing_:field for data completeness

Field-Specific Searching

  • Use fields_for_general for general drug data (34 options)
  • Use fields_for_adverse_events for adverse events (66 options)
  • Use fields_for_label for drug label searches (167 options)
  • Use fields_for_recalls for recalls and enforcement (39 options)
  • Use fields_for_shortages for drug shortages (44 options)
  • Examples: products.marketing_status, patient.reaction.reactionmeddrapt, warnings, recalling_firm, status
  • Enables precise queries like finding discontinued drugs, specific adverse reactions, label warnings, recall classifications, or shortage statuses

Advanced Query Examples

  • Multi-condition: drug:aspirin+AND+form:TABLET+AND+status:active
  • Age-specific: patient.patientonsetage:[18+TO+65] for adults
  • Geographic: occurcountry:US+AND+serious:1 for US serious events
  • Time-based: receiptdate:[2023-01-01+TO+2023-12-31] for 2023 data

Optimizing Results

  • Start with simple queries, then add complexity as needed
  • Use comprehensive search (no field specified) for broad drug discovery
  • Use field-specific search for targeted queries
  • Start with brand names for better label results
  • Use generic names for broader adverse event data
  • Try complex boolean queries for research-grade specificity
  • Check both generic and brand names for comprehensive information

Rate Limits

  • Without API Key: 240 requests per minute, 1,000 requests per day
  • With API Key: 120,000 requests per day (register at https://open.fda.gov/apis/)

Development

Setup

git clone https://github.com/uh-joan/fda-mcp-server.git
cd fda-mcp-server
npm install

Testing

# Test the server directly
echo '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}' | node src/index.js

# Test with a drug lookup
echo '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"fda_drug_info","arguments":{"method":"lookup_drug","search_term":"aspirin"}}}' | node src/index.js

File Structure

fda-mcp-server/
├── src/
│   ├── index.js          # Main MCP server
│   └── fda-search.js     # FDA API integration
├── package.json          # Project configuration
├── README.md            # Documentation
└── LICENSE              # MIT License

Contributing

  • Fork the repository
  • Create a feature branch (git checkout -b feature/amazing-feature)
  • Commit your changes (git commit -m 'Add some amazing feature')
  • Push to the branch (git push origin feature/amazing-feature)
  • Open a Pull Request

License

This project is licensed under the MIT License - see the LICENSE file for details.

Support

Built with ❤️ for safer medication information access

Keywords

mcp

FAQs

Package last updated on 08 Jul 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.