Back to Discover

cdc-health-mcp-server

connector

cyanheads

Search and query CDC public health data — mortality, vaccinations, surveillance, behavioral risk.

View on GitHub
0 starsSynced Aug 9, 2026

Install to Claude Code

/plugin marketplace add cyanheads/cdc-health-mcp-server

README

@cyanheads/cdc-health-mcp-server

Search and query CDC public health data — mortality, vaccinations, surveillance, behavioral risk (Socrata SODA API) via MCP. STDIO or Streamable HTTP.

4 Tools • 2 Resources • 1 Prompt

Version License Docker MCP SDK npm TypeScript Bun

Install in Claude Desktop Install in Cursor Install in VS Code

Framework

Public Hosted Server: https://cdc.caseyjhand.com/mcp


Tools

Four tools for discovering and querying CDC public health data. Three query the CDC Open Data portal (Socrata); one queries CDC WONDER mortality statistics:

ToolDescription
cdc_discover_datasetsSearch the catalog by keyword, category, or tag. Entry point for all queries.
cdc_get_dataset_schemaFetch column schema, row count, and metadata for a dataset. Essential before writing SoQL queries.
cdc_query_datasetExecute SoQL queries — filter, aggregate, sort, full-text search, and field selection.
cdc_query_wonderQuery CDC WONDER for national mortality statistics (deaths, population, crude/age-adjusted rates) by year, age, sex, and race, filtered by ICD-10 cause. Covers five CDC mortality databases — final and provisional, underlying-cause and multiple-cause.

cdc_discover_datasets

Search the CDC dataset catalog to find relevant datasets.

  • Full-text search across dataset names and descriptions
  • Filter by domain category (e.g., "NNDSS", "Vaccinations", "Behavioral Risk Factors")
  • Filter by domain tags (e.g., ["covid19", "surveillance"]) — a dataset matches on any one tag, so each tag added widens the result set; narrow with query or category, which intersect with the tag set
  • Returns dataset IDs, names, truncated descriptions, a column count with a short column sample, and update timestamps — use cdc_get_dataset_schema for the full column list
  • Each result carries its catalog assetType (dataset, filter, chart, map, story, file, href); a columnCount of 0 marks an entry that is not tabular and yields no data from the other tools
  • Pagination via offset for browsing large result sets — offset plus limit must not exceed 10,000, the ceiling the catalog enforces
  • domain selects the host contacted, data.cdc.gov (default) or chronicdata.cdc.gov — both front the same catalog and return the same entries, so switching hosts neither widens nor narrows a search

cdc_get_dataset_schema

Fetch the full column schema for a specific dataset.

  • Column names, data types, and descriptions
  • Row count and last-updated timestamp
  • Essential for understanding column types before writing $where clauses
  • Accepts four-by-four dataset identifiers (e.g., bi63-dtpu)
  • Fails with not_queryable when the ID names a non-tabular catalog asset, rather than returning an empty column list
  • domain selects the host contacted, data.cdc.gov (default) or chronicdata.cdc.gov — a four-by-four ID resolves on either

cdc_query_dataset

Execute SoQL queries against any CDC dataset.

  • Full SoQL support: $select, $where, $group, $having, $order
  • Full-text search across all text columns via $q
  • Up to 5,000 rows per request with pagination
  • Returns the SoQL clauses it sent as effectiveQuery, values in their original text rather than URL-encoded, so a clause can be copied back into the parameter it came from
  • All response values are strings (per SODA v2.1) — parse based on column type metadata
  • domain selects the host contacted, data.cdc.gov (default) or chronicdata.cdc.gov — a four-by-four ID returns the same rows from either

cdc_query_wonder

Query CDC WONDER for national US mortality statistics — a separate CDC system from the Socrata datasets the other tools query.

database picks which of CDC's five mortality databases answers the query:

ValueCDC databaseYearsRace groupsmcd_icd10
underlying_1999_2020 (default)D76 — Underlying Cause of Death1999–20204 bridged
provisionalD176 — Provisional Mortality Statistics2018 → current year6 single-raceyes
underlying_2018_2024D158 — Underlying Cause of Death, Single Race2018–20246 single-race
multiple_1999_2020D77 — Multiple Cause of Death1999–20204 bridgedyes
multiple_2018_2024D157 — Multiple Cause of Death, Single Race2018–20246 single-raceyes
  • Group results by any of year, age_group, sex, race (1–4 dimensions)
  • Filter by ICD-10 underlying cause, sex, age groups, and year range
  • age_groups carries the whole list CDC offers: the eleven ten-year groups plus NS, the group for a death whose age was not recorded. Listing the eleven without NS returns fewer deaths than the same query unfiltered, so include it to match an all-ages total or select it alone to count those deaths
  • mcd_icd10 matches a cause recorded anywhere on the death certificate rather than only the one certified as underlying — "died with a respiratory condition listed", which no underlying-cause query can produce. Accepted only by the three databases marked above; the others reject it. A multiple-cause database queried without it returns the same figures as the underlying-cause database for the same years, and says so
  • year_range carries the union of every database's span; a range outside the span of the one selected is rejected with that database's actual years named
  • A race breakdown does not carry across the two race families — bridged race combines Asian and Pacific Islander into one group, single race splits them and adds a multiracial category, so the two series are not comparable
  • Both cause filters also take 999--999, CDC's marker for deaths whose cause it is still withholding under the provisional database's six-month reporting lag. Only provisional records them; the other databases reject the code, and the tool says which one to select
  • Row dimension values are CDC's own labels with surrounding whitespace removed, so the same year keys identically across databases — CDC pads a few of them, and "2024 " and "2024" would otherwise read as two different years
  • Provisional rows carry CDC's own year labels, e.g. 2025 (provisional) and 2026 (provisional and partial), rather than a bare year
  • Returns deaths, population, and crude death rate, plus age-adjusted rate when WONDER can standardize by age — omitted when grouping by age_group or filtering to a single age group
  • National totals only — sub-national (state/county) breakdowns are not available through the WONDER API (CDC vital-statistics policy)
  • CDC replaces some measure values with a status token — Suppressed (withheld for confidentiality), Unreliable (a rate from fewer than 20 deaths), Not Applicable (no population denominator). Those cells read null in rows; cellNotes names the row, column, and token for each
  • CDC also hides whole rows before sending the table — strata with zero deaths, and strata whose death count is suppressed. Those rows are absent from rows with nothing marking the gap, so messages carries CDC's own statement whenever it happened
  • CDC rejects requests made less than 15 seconds apart, measured from the end of the previous response and counted across all five databases; the server spaces consecutive requests 16 seconds automatically

Resources and prompt

TypeNameDescription
Resourcecdc://datasets50 most-viewed catalog entries for orientation, each with its asset type and column count
Resourcecdc://datasets/{datasetId}Dataset metadata and column schema (equivalent to schema tool)
Promptanalyze_health_trendPicks between CDC WONDER and the Socrata catalog for the question at hand, then runs a 5-step workflow: discover, inspect, baseline query, compare, synthesize

Features

Built on @cyanheads/mcp-ts-core:

  • Declarative tool definitions — single file per tool, framework handles registration and validation
  • Unified error handling across all tools
  • Pluggable auth (none, jwt, oauth)
  • Swappable storage backends: in-memory, filesystem, Supabase, Cloudflare KV/R2/D1
  • Structured logging with optional OpenTelemetry tracing
  • Runs locally (stdio/HTTP) or on Cloudflare Workers from the same codebase

CDC-specific:

  • Wraps the Socrata SODA API v2.1 — no auth required, optional app token for higher rate limits
  • Adds CDC WONDER mortality access (cdc_query_wonder) — national deaths, population, and crude/age-adjusted rates across five mortality databases spanning 1999 through the current year, final and provisional, underlying-cause and multiple-cause; a separate XML-over-HTTP CDC system
  • Discovery-first approach for a heterogeneous catalog (~1,080 datasets across many health domains)
  • Two CDC Socrata hosts via the domain input — data.cdc.gov (default) and chronicdata.cdc.gov, restricted to this allowlist. Both front one Socrata tenant: a single catalog whose assets — PLACES small-area estimates, the Heart Disease & Stroke Atlas and Environmental Public Health Tracking among them — are discoverable and queryable from either host
  • Conservative request spacing for rate limit compliance (no rate-limit headers returned by Socrata)
  • Handles SODA string-typed responses — all values returned as strings, parsed via column type metadata

Getting started

Public Hosted Instance

A public instance is available at https://cdc.caseyjhand.com/mcp — no installation required. Point any MCP client at it via Streamable HTTP:

{
  "mcpServers": {
    "cdc-health-mcp-server": {
      "type": "streamable-http",
      "url": "https://cdc.caseyjhand.com/mcp"
    }
  }
}

Self-Hosted / Local

Add the following to your MCP client configuration file.

{
  "mcpServers": {
    "cdc-health-mcp-server": {
      "type": "stdio",
      "command": "bunx",
      "args": ["@cyanheads/cdc-health-mcp-server@latest"],
      "env": {
        "MCP_TRANSPORT_TYPE": "stdio",
        "MCP_LOG_LEVEL": "info"
      }
    }
  }
}

Or with npx (no Bun required):

{
  "mcpServers": {
    "cdc-health-mcp-server": {
      "type": "stdio",
      "command": "npx",
      "args": ["-y", "@cyanheads/cdc-health-mcp-server@latest"],
      "env": {
        "MCP_TRANSPORT_TYPE": "stdio",
        "MCP_LOG_LEVEL": "info"
      }
    }
  }
}

Or with Docker:

{
  "mcpServers": {
    "cdc-health-mcp-server": {
      "type": "stdio",
      "command": "docker",
      "args": ["run", "-i", "--rm", "-e", "MCP_TRANSPORT_TYPE=stdio", "ghcr.io/cyanheads/cdc-health-mcp-server:latest"]
    }
  }
}

For Streamable HTTP, set the transport and start the server:

MCP_TRANSPORT_TYPE=http MCP_HTTP_PORT=3010 bun run start:http
# Server listens at http://localhost:3010/mcp

Prerequisites

Installation

  1. Clone the repository:
git clone https://github.com/cyanheads/cdc-health-mcp-server.git
  1. Navigate into the directory:
cd cdc-health-mcp-server
  1. Install dependencies:
bun install

Configuration

All configuration is validated at startup via Zod schemas in src/config/server-config.ts. Key environment variables:

VariableDescriptionDefault
MCP_TRANSPORT_TYPETransport: stdio or httpstdio
MCP_HTTP_PORTHTTP server port3010
MCP_AUTH_MODEAuthentication: none, jwt, or oauthnone
MCP_LOG_LEVELLog level (debug, info, warning, error, etc.)info
LOGS_DIRDirectory for log files (Node.js only)<project-root>/logs
STORAGE_PROVIDER_TYPEStorage backend: in-memory, filesystem, supabase, cloudflare-kv/r2/d1in-memory
CDC_APP_TOKENSocrata app token for higher rate limitsnone
CDC_BASE_URLBase URL for SODA API requestshttps://data.cdc.gov
CDC_CATALOG_URLBase URL for Socrata Discovery APIhttps://api.us.socrata.com/api/catalog/v1
OTEL_ENABLEDEnable OpenTelemetry instrumentation (spans, metrics, completion logs)false

Running the server

Local development

  • Build and run the production version:

    # One-time build
    bun run rebuild
    
    # Run the built server
    bun run start:http
    # or
    bun run start:stdio
    
  • Run checks and tests:

    bun run devcheck  # Lints, formats, type-checks, and more
    bun run test      # Runs the test suite
    

Project structure

DirectoryPurpose
src/mcp-server/toolsTool definitions (*.tool.ts). Three CDC data tools.
src/mcp-server/resourcesResource definitions. Catalog overview and dataset detail.
src/mcp-server/promptsPrompt definitions. Health trend analysis workflow.
src/services/socrataSocrata SODA API service layer — HTTP client, catalog search, metadata, queries.
src/configServer-specific environment variable parsing and validation with Zod.

Development guide

See CLAUDE.md for development guidelines and architectural rules. The short version:

  • Handlers throw, framework catches — no try/catch in tool logic
  • Use ctx.log for logging, ctx.state for storage
  • Register new tools and resources in the createApp() arrays

Contributing

Issues and pull requests are welcome. Run checks and tests before submitting:

bun run devcheck
bun run test

License

This project is licensed under the Apache 2.0 License. See the LICENSE file for details.

Rendered live from cyanheads/cdc-health-mcp-server's GitHub README — not stored, always reflects the source repo.

3 Install Methods

NameDescriptionCategorySource
npm packageInstall via npm (stdio transport)mcp-server@cyanheads/cdc-health-mcp-server
npm packageInstall via npm (streamable-http transport)mcp-server@cyanheads/cdc-health-mcp-server
streamable-http remoteHosted streamable-http endpointmcp-serverhttps://cdc.caseyjhand.com/mcp

0 Comments

Login required
Log in to post a comment or update on this repo.

No comments yet — be the first to share an update.