Skip to content

Latest commit

 

History

History
170 lines (138 loc) · 3.65 KB

File metadata and controls

170 lines (138 loc) · 3.65 KB

Public Health MCP Server

This MCP (Model Context Protocol) server provides tools for accessing epidemiological data and trend analysis.

Overview

The server currently provides three main tools:

  1. fetch_epi_signal - Fetch specific COVID-19 signals from Delphi Epidata API
  2. detect_rising_trend - Detect rising trends in time series data using rolling regression
  3. get_server_info - Server information and capabilities

Features

Epidemiological Signal Fetching

  • Access to Delphi EpiData API for COVID-19 signals
  • Multiple signal types including:
    • COVID symptom searches
    • Doctor visits for COVID-like symptoms
    • Vaccine acceptance rates
    • Hospital admissions
    • Death rates
  • Flexible geographic and time filtering
  • Real-time data access

Rising Trend Detection

  • Statistical trend analysis using rolling linear regression
  • Configurable window sizes and thresholds
  • Log-scale analysis for exponential growth detection
  • Multiple time series support
  • Smoothing options for noise reduction

Installation

  1. Install dependencies:
pip install -r requirements.txt
  1. Make the server executable:
chmod +x mcp_public_health.py

Usage

Running the Server

python mcp_public_health.py

The server runs using FastMCP with SSE transport.

Tool Examples

Fetch Epidemiological Signal

Fetch COVID-like symptoms data:

{
  "name": "fetch_epi_signal",
  "arguments": {
    "signal": "smoothed_wcli",
    "time_type": "day",
    "geo_type": "state",
    "start_time": "20231201",
    "end_time": "20231231"
  }
}

Fetch COVID cases by county:

{
  "name": "fetch_epi_signal",
  "arguments": {
    "signal": "confirmed_7dav_incidence_prop",
    "geo_type": "county",
    "geo_values": ["06037", "36061"]
  }
}

Detect Rising Trends

Analyze trend in fetched data:

{
  "name": "detect_rising_trend",
  "arguments": {
    "signal_name": "smoothed_wcli",
    "value_column": "value",
    "window_size": 7,
    "min_log_slope": 0.01
  }
}

Get Server Information

{
  "name": "get_server_info",
  "arguments": {}
}

Available Signals

The following epidemiological signals are available through the Delphi EpiData API:

  • smoothed_wwearing_mask_7d - People Wearing Masks
  • smoothed_wcovid_vaccinated_appointment_or_accept - Vaccine Acceptance
  • sum_anosmia_ageusia_smoothed_search - COVID Symptom Searches on Google
  • smoothed_wcli - COVID-Like Symptoms
  • smoothed_whh_cmnty_cli - COVID-Like Symptoms in Community
  • smoothed_adj_cli - COVID-Related Doctor Visits
  • confirmed_7dav_incidence_prop - COVID Cases
  • confirmed_admissions_covid_1d_prop_7dav - COVID Hospital Admissions
  • deaths_7dav_incidence_prop - COVID Deaths

Data Structure

Signal Response Format

[
  {
    "geo_value": "ca",
    "time_value": "2023-12-01",
    "value": 2.3456,
    "stderr": 0.1234,
    "sample_size": 1000
  }
]

Trend Detection Response Format

{
  "rising_periods": [
    ["2023-12-05", "2023-12-12"],
    ["2023-12-20", "2023-12-25"]
  ],
  "total_periods": 2,
  "sample_log_slopes": [0.023, 0.018, 0.031],
  "status": "success",
  "analysis_details": {
    "window_size": 7,
    "min_log_slope": 0.01,
    "data_points_analyzed": 31
  }
}

Configuration

The server uses FastMCP framework with SSE transport and includes:

  • Comprehensive error handling
  • Debug logging support
  • Type-safe tool definitions
  • Real-time data processing capabilities

Integration

This server integrates with:

  • LangChain MCP adapters
  • LangGraph agent workflows
  • Public health dashboard systems
  • Real-time monitoring applications