U.S. Government Open Data — Claude Code MCP server: features and setup
Connect an AI agent to U.S. government APIs covering topics from the economy to health and legislation. Useful when a question calls for combining records from multiple agencies.
claude mcp add --env DATA_GOV_API_KEY=<DATA_GOV_API_KEY> --env FRED_API_KEY=<FRED_API_KEY> --env CENSUS_API_KEY=<CENSUS_API_KEY> --env BLS_API_KEY=<BLS_API_KEY> --env BEA_API_KEY=<BEA_API_KEY> --transport stdio us-government-open-data -- npx -y us-gov-open-data-mcpWhat U.S. Government Open Data does
The server gives an agent tools for querying more than 40 U.S. government APIs. It covers economic indicators, public spending, legislation, health, the environment, and other areas. Built-in guidance helps the model relate information from different agencies, and results include details of the API requests behind them.
Connections can use stdio or HTTP Stream, and large responses can be handled with JavaScript in a WASM sandbox. Load only the modules or domains you need. Node.js 22 or later is required. Claude Code setup passes DATA_GOV_API_KEY, FRED_API_KEY, CENSUS_API_KEY, BLS_API_KEY, and BEA_API_KEY; some APIs can be queried without a key. Individual endpoints can return unexpected results, so check the cited sources when the details matter.
What it helps with
- compare economic indicators from separate government APIs
- look up a bill and examine its vote by party
- review FDA reports alongside clinical-trial records
- trace federal spending in a chosen area
- find lobbying and campaign contribution records
Example prompts for the agent
- Compare U.S. GDP, unemployment, inflation, and interest rates using government data.
- Find information on the Inflation Reduction Act and explain how the vote split by party.
- Compare federal healthcare spending with health outcome data.
How to install U.S. Government Open Data
Platform CLI
claude mcp add --env DATA_GOV_API_KEY=<DATA_GOV_API_KEY> --env FRED_API_KEY=<FRED_API_KEY> --env CENSUS_API_KEY=<CENSUS_API_KEY> --env BLS_API_KEY=<BLS_API_KEY> --env BEA_API_KEY=<BEA_API_KEY> --transport stdio us-government-open-data -- npx -y us-gov-open-data-mcpReplace <…> with your own values. 16 more environment variables are in the server README
Platform CLI
codex mcp add us-government-open-data --env DATA_GOV_API_KEY=<DATA_GOV_API_KEY> --env FRED_API_KEY=<FRED_API_KEY> --env CENSUS_API_KEY=<CENSUS_API_KEY> --env BLS_API_KEY=<BLS_API_KEY> --env BEA_API_KEY=<BEA_API_KEY> -- npx -y us-gov-open-data-mcpReplace <…> with your own values. 16 more environment variables are in the server README
Config file
{
"mcpServers": {
"us-government-open-data": {
"command": "npx",
"args": [
"-y",
"us-gov-open-data-mcp"
],
"env": {
"DATA_GOV_API_KEY": "<DATA_GOV_API_KEY>",
"FRED_API_KEY": "<FRED_API_KEY>",
"CENSUS_API_KEY": "<CENSUS_API_KEY>",
"BLS_API_KEY": "<BLS_API_KEY>",
"BEA_API_KEY": "<BEA_API_KEY>"
}
}
}
}Replace <…> with your own values. 16 more environment variables are in the server README
Config file
{
"servers": {
"us-government-open-data": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"us-gov-open-data-mcp"
],
"env": {
"DATA_GOV_API_KEY": "<DATA_GOV_API_KEY>",
"FRED_API_KEY": "<FRED_API_KEY>",
"CENSUS_API_KEY": "<CENSUS_API_KEY>",
"BLS_API_KEY": "<BLS_API_KEY>",
"BEA_API_KEY": "<BEA_API_KEY>"
}
}
}
}Replace <…> with your own values. 16 more environment variables are in the server README
Platform CLI
gemini mcp add -e DATA_GOV_API_KEY=<DATA_GOV_API_KEY> -e FRED_API_KEY=<FRED_API_KEY> -e CENSUS_API_KEY=<CENSUS_API_KEY> -e BLS_API_KEY=<BLS_API_KEY> -e BEA_API_KEY=<BEA_API_KEY> us-government-open-data npx -y us-gov-open-data-mcpReplace <…> with your own values. 16 more environment variables are in the server README
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 U.S. Government Open Data
How do I install U.S. Government Open Data in Claude Code?
Run `claude mcp add --env DATA_GOV_API_KEY=<DATA_GOV_API_KEY> --env FRED_API_KEY=<FRED_API_KEY> --env CENSUS_API_KEY=<CENSUS_API_KEY> --env BLS_API_KEY=<BLS_API_KEY> --env BEA_API_KEY=<BEA_API_KEY> --transport stdio us-government-open-data -- npx -y us-gov-open-data-mcp`. Node.js 22 or later is required.
What does U.S. Government Open Data do?
It connects an agent to more than 40 U.S. government APIs for searching and combining information across agencies. Results include details about the source requests.
Does the server require API keys?
The Claude Code setup accepts DATA_GOV_API_KEY, FRED_API_KEY, CENSUS_API_KEY, BLS_API_KEY, and BEA_API_KEY. Some APIs work without a key.