SA

SafetySearch MCP Server: FDA Food Safety Data

Access real-time FDA food safety data on the MCP server, track recalls, adverse events, and analysis for faster response.

Overview

The SafetySearch MCP Server exposes real-time FDA food safety data as tools that can be invoked by models or other services. It aggregates FDA recalls, adverse event reports, and related analysis into a simple HTTP API and an MCP-compatible tool manifest. Developers can integrate SafetySearch to provide up-to-date context for applications that need to monitor food safety issues, enrich conversational agents, or drive automated alerting and analytics pipelines.

By exposing the data as distinct tools (search, recalls, adverse-events, analysis), the server makes it easy for LLM-based assistants and automated systems to request specific, verifiable data rather than relying on latent model knowledge. This reduces hallucinations and enables faster, traceable responses to emerging food safety events.

Features

  • Realtime access to FDA food recalls and enforcement reports
  • Searchable adverse event reports related to foods
  • Simple REST API with MCP-compatible tool manifest for model integrations
  • Analysis endpoints that summarize recall trends and signal potential issues
  • Lightweight server designed for local deployment or containerization
  • Example clients and easy curl/Python usage for rapid prototyping

Installation / Configuration

Prerequisites:

  • Git
  • Node.js (14+) or Python 3.9+ depending on project variant (see repo README)
  • Optional: FDA API key (for higher rate limits) — available from OpenFDA

Clone the repository and install dependencies:

Bash (Node.js example)

git clone https://github.com/surabhya/SafetySearch.git
cd SafetySearch
# If Node.js version is used
npm install
npm run start

Bash (Python / pip example)

git clone https://github.com/surabhya/SafetySearch.git
cd SafetySearch
# If Python/requirements.txt is provided
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
python app.py

Environment variables (example)

# Optional: OpenFDA API key for higher rate limits
export FDA_API_KEY="your_openfda_api_key"

# Server port
export PORT=8080

Running in Docker:

# Build and run (example)
docker build -t safetysearch .
docker run -p 8080:8080 -e FDA_API_KEY="${FDA_API_KEY}" safetysearch

Available Resources

The server exposes a small set of REST endpoints and an MCP-compatible manifest describing tools for model integration.

Endpoints

EndpointMethodDescriptionQuery params
/searchGETFull-text search across FDA food safety dataq (query), limit, offset
/recallsGETList recent recalls and enforcement reportsstatus, product_type, limit
/adverse-eventsGETSearch adverse event reports related to foodq, date_range, limit
/analysisGETSummaries and trend analysis (e.g., recent spikes)type, window_days
/.well-known/mcpGETMCP tool manifest for model integrations

Sample MCP manifest snippet (returned from /.well-known/mcp)

{
  "tools": [
    {
      "name": "safetysearch.recalls",
      "description": "Retrieve recent FDA food recalls and enforcement reports",
      "url": "https://your-server.example.com/recalls"
    },
    {
      "name": "safetysearch.adverse_events",
      "description": "Search FDA adverse event reports related to food products",
      "url": "https://your-server.example.com/adverse-events"
    }
  ]
}

Quick Examples

Query recalls with curl:

curl "http://localhost:8080/recalls?limit=5"

Search adverse events via Python:

import requests

resp = requests.get("http://localhost:8080/adverse-events", params={
    "q": "salmonella", "limit": 10
})
resp.raise_for_status()
data = resp.json()
print(data["results"][:3])

Use MCP manifest to load tools in an agent (pseudocode)

mcp_manifest = requests.get("http://localhost:8080/.well-known/mcp").json()
tools = load_tools_from_manifest(mcp_manifest)
agent = Agent(model="gpt-4", tools=tools)

Use Cases

  • Automated monitoring and alerting: Poll the /recalls and /analysis endpoints to detect spikes in recalls and trigger Slack/pager alerts for supply chain or quality teams.
  • Conversational assistants: Integrate the MCP manifest so an LLM can call the safetysearch.recalls or safetysearch.adverse_events tools to answer user queries with live data instead of memorized facts.
  • Incident response dashboards: Feed recall and adverse event streams into dashboards (Grafana/Prometheus pipelines) to visualize trends by product type, geographic distribution, or manufacturer.
  • Regulatory research and analysis: Download recall records and run batch analytics to identify recurring failure modes, common contaminants, and time-to-closure metrics.
  • Supply chain validation: Check incoming shipments against recent enforcement reports automatically to block risky suppliers.

Notes and Best Practices

  • OpenFDA rate limits may apply. Use an API key for higher limits and implement caching for frequent queries.
  • Treat the server as a context provider for models: prefer calling the specific tool endpoints rather than pasting raw records into prompts.
  • Validate and log all tool outputs used in automated decision-making to maintain audit trails.
  • The MCP manifest enables model-driven tool access; ensure your deployment is secured (HTTPS, authentication) when exposing it publicly.

For repository sources, examples, and the latest instructions, see the project on GitHub: https://github.com/surabhya/SafetySearch

Tags:search