Skip to main content
MCP server CX Codex

NHANES (design-correct survey analysis) — Claude Code MCP server

Connects assistants directly to CDC NHANES files with built-in survey weights and design variance. Designed for analyses requiring Taylor linearization and NCHS standards.

Install into Claude Code · Platform CLI All methods and platforms ↓
claude mcp add --env NHANES_MCP_CACHE=<NHANES_MCP_CACHE> --env NHANES_MCP_DATA_DIR=<NHANES_MCP_DATA_DIR> --transport stdio nhanes-design-correct-survey-analysis -- uvx nhanes-mcp
Open on GitHub

What NHANES (design-correct survey analysis) does

Standard language models often compute simple averages on NHANES files, yielding flawed numbers. This MCP server enforces valid survey methodology by default. It downloads public files from CDC servers, merges records on SEQN, and selects the appropriate sample weight in WT_ANALYSIS. Subsetting via the domain parameter keeps the full sample design intact, so Taylor linearization variance calculations stay sound.

The server provides 17 tools across the research workflow. They help explore CDC codebooks, recode missing values with set_missing, and collapse repeated rows via flag_from_long_table. For survival analysis, it supports design-based Cox models linked to mortality records. Supported cycles range from 1999–2000 through 2021–2023.

Running the server requires uv on your system. Black Swan Causal Labs is not affiliated with CDC, and researchers must comply with the public NCHS data use agreement.

What it helps with

  • Merge multi-cycle NHANES survey files using individual SEQN identifiers
  • Assign correct probability weights automatically for exam or dietary data
  • Calculate Korn-Graubard confidence intervals with official NCHS reliability flags
  • Fit design-adjusted Cox survival models with Linked Mortality File follow-up

Example prompts for the agent

  • Search NHANES codebooks for blood pressure variables from 2017 to 2020 and compute weighted prevalence.
  • Pool 2015-2018 cycles, apply domain filtering for diabetes, and calculate mean fasting glucose.
  • Run a design-based Cox model linking body mass index with mortality follow-up.

How to install NHANES (design-correct survey analysis)

Platform CLI

claude mcp add --env NHANES_MCP_CACHE=<NHANES_MCP_CACHE> --env NHANES_MCP_DATA_DIR=<NHANES_MCP_DATA_DIR> --transport stdio nhanes-design-correct-survey-analysis -- uvx nhanes-mcp

Replace <…> with your own values. uvx runs the command named after the package; if the README names another one, use uvx --from nhanes-mcp <command>

Step by step, with commands for each platform: How to add an MCP server to Claude Code, Codex, Cursor, VS Code, Gemini CLI and more

Questions about NHANES (design-correct survey analysis)

How do I install NHANES (design-correct survey analysis) in Claude Code?

Run claude mcp add nhanes-mcp -- uvx nhanes-mcp in your terminal. You need uv installed beforehand to execute the server.

Why use this MCP server instead of generic dataset analysis?

Naive calculations produce biased estimates because NHANES uses complex multi-stage sampling. The server enforces proper probability weights, strata tracking, and Taylor series variance estimation.

Which NHANES cycles are available?

It covers cycles from 1999–2000 through 2017–2018, the pre-pandemic 2017–March 2020 dataset, and the 2021–2023 release. Files are downloaded directly from CDC endpoints.

Similar MCP servers

All MCP servers for Science and research →

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor