US Economic Analysis MCP Server
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
US Economic Analysis MCP Server (data-analyst-mcp)
A Model Context Protocol (MCP) server for U.S. economic analysis and official U.S. government data across 77 federal agencies (FRED, BLS, BEA, Census, Treasury, Congress.gov, FDA, CDC, EPA, and more).
Install
Requires Node.js 22 or later. Most sources need no key, so steps 2 and 3 are optional.
1. Add the server to your client
Claude Code
claude mcp add data-analyst -- npx -y data-analyst-mcpAdd --scope user to make it available in every project. To pass a key here, put -e before the --, for example
claude mcp add data-analyst -e DATA_GOV_API_KEY=your-key -- npx -y data-analyst-mcp.
Claude Desktop: claude_desktop_config.json, in ~/Library/Application Support/Claude/ (macOS) or
%APPDATA%\Claude\ (Windows). Settings → Developer → Edit Config opens it. Restart Claude Desktop after editing.
{
"mcpServers": {
"data-analyst": {
"command": "npx",
"args": ["-y", "data-analyst-mcp"],
"env": { "DATA_GOV_API_KEY": "your-key" }
}
}
}Cursor: the same mcpServers block in ~/.cursor/mcp.json (every project) or .cursor/mcp.json (one project).
VS Code: .vscode/mcp.json uses servers instead of mcpServers. An inputs entry makes VS Code ask for the key
once and store it, so the key is not written into a file you might commit.
{
"inputs": [
{ "type": "promptString", "id": "data-gov-key", "description": "api.data.gov API key", "password": true }
],
"servers": {
"data-analyst": {
"type": "stdio",
"command": "npx",
"args": ["-y", "data-analyst-mcp"],
"env": { "DATA_GOV_API_KEY": "${input:data-gov-key}" }
}
}
}Codex: ~/.codex/config.toml
[mcp_servers.data-analyst]
command = "npx"
args = ["-y", "data-analyst-mcp"]
[mcp_servers.data-analyst.env]
DATA_GOV_API_KEY = "your-key"Leave out the env block if you have no keys, or if you store them with setup (step 2).
To run from a clone instead of npm, build it and point the client at the build:
git clone https://github.com/zsu/data-analyst-mcp.gitcd data-analyst-mcp && npm install && npm run buildThen use "command": "node", "args": ["<path>/data-analyst-mcp/dist/bin/cli.js"] in the configs above, and
node dist/bin/cli.js setup <source> in place of npx -y data-analyst-mcp setup <source> below.
2. Add keys (optional)
Each key is free. Without a key, a source either falls back to a keyless route with lower limits, or offers a
manual download (manual_bundle): the user downloads the files in a browser, and the server packages them.
Variable | Sources | Without it | Free key |
| epa-aqs | manual download only | |
| bea | bulk files for the main tables; the API-only datasets need the key | |
| bls | 25 queries a day, 25 series and 10 years each; no annual averages or catalog titles | |
| census | manual download only | |
| college-scorecard, congress, fbi, fda, fec, govinfo, nrel, regulations, usda-fooddata, usgs |
| |
| dol | catalog and field lists only; data queries need the key | |
| eia |
| |
| fred | observations only; search, vintages, revision history and GeoFRED need the key | |
| hud | manual download only | |
| ipums | build the extract on the IPUMS website (free account) | |
| senate-lobbying | 15 requests a minute instead of 120 | |
| noaa | the keyless data and station-search endpoints; Climate Data Online v2 needs the key | |
| usda-nass | manual download only | |
| uspto | manual download only |
Two settings are not keys. SEC asks every client to identify itself, so set SEC_USER_AGENT to your name and email
("Jane Doe jane@example.com"). NWS_USER_AGENT is optional and does the same for the weather service.
Store a key with setup (recommended). It shows the signup link, reads the key with hidden input, and writes
it to ~/.config/data-analyst/keys.json. The key stays out of client config files, and every client reads it. It
works mid-session, with no restart.
npx -y data-analyst-mcp setup congresssetup takes any source that uses the key: setup congress stores DATA_GOV_API_KEY, and all 10 api.data.gov
sources use it. setup epa-aqs also asks for AQS_EMAIL. Or put the variables in the client's env block, as in step 1.
API keys lists every place the server looks.
3. Check it
Ask your assistant: "Is my api.data.gov key set up?" The check_key tool reports whether the key was found and where,
never its value. For census, eia, epa-aqs, noaa, usgs, bea, fred and ipums it also tests the key with one small call
to the agency's own site and says whether it was accepted, rejected or the site could not be reached. To list only the sources you can use, start the server with --hide-unconfigured (see
Options).
4. Try it
"How has the unemployment rate compared with CPI inflation since 2020?"
"What is the median household income in each county of Ohio?"
"Which drugs had the most reported adverse events last year?"
"How much did each federal agency spend in fiscal year 2024?"
"How many unhealthy air-quality days did Phoenix have in 2023?"
The assistant asks the questions that change the answer first (which measure, which years, which population), then fetches, computes and cites.
To host the server for claude.ai or a team, see docs/hosting.md.
Related MCP server: starwell-mcp
How it works
Tool | What it does |
| the method: framing, asking only critical questions, the accuracy checklist, combining sources |
| ranks the sources for a question, or lists them all |
| one source's playbook, its questions_to_ask, key status, rules and request index |
| full parameters of the requests to use; searches a source's catalog |
| how each critical question was settled (answered, Don't know, skipped, not asked and why) |
| downloads into the session workspace; returns a summary, the files, the citation and notes |
| a one-command download for the user's own computer, then packaging what they downloaded |
| builds exhibits from the full tables with declarative steps (a whitelisted expression language, no eval); the steps are recorded for |
| register the numbers cited, write the benchmark and sensitivity tables, snapshot cited pages |
| the release gate: every number in the answer is a registered fact, the method record is complete, and the analysis reproduces |
| an HTML report and replication ZIP, only when asked |
| the per-source data hand-off |
| whether a key is set up (never shows it), and tested live where the source allows |
| a small text file from the workspace |
| after a server restart (which starts a new, empty workspace), lists the earlier workspaces and reopens one (local server only) |
Asking before fetching is enforced, not just suggested. fetch returns gate_blocked until, for that
source, the model has read source_brief and the schemas of the requests it uses, and has recorded how each
critical question was settled. The model asks the questions in chat, in one round. A blocking question that
the user skips is asked once more. The server also exposes an analyze prompt and source://<id>
resources, for clients that let users pick prompts or attach resources.
Results have one shape. Success: {status: "ok" | "partial", summary, files, citation, notes}. Failure:
{status: "error", code, message, fix, retry_after_s?}. The codes are invalid_request, not_found,
not_supported, agency_rejected, agency_unavailable, key_missing, key_rejected, rate_limited,
gate_blocked, in_progress and server_error. in_progress comes from a rerun (rerun, or an audit with
rerun: true) that needs longer than a client waits for one call: the replay continues in a worker thread,
the same call made again waits on that same replay, and the finished result is kept until the workspace
changes. DATA_ANALYST_RERUN_WAIT_S sets how long a call waits first (default 45 seconds). The replay gets its own heap,
DATA_ANALYST_RERUN_HEAP_MB (default: 60 percent of the memory the process may use, a container's limit when it
has one); if it runs out, the audit reports that, and the server keeps running.
Options
Option (flag / environment) | What it does |
| serve only these sources |
| serve only the sources in these domains |
| leave out of listings the sources whose required key is not set up |
| (stdio) one fixed analysis folder, so a fetch is reused after a restart |
{ "mcpServers": { "data-analyst": { "command": "npx", "args": ["-y", "data-analyst-mcp", "--domains", "economy,health"] } } }The tool list stays the same size whatever is enabled: sources are found with find_sources, not loaded as
tools.
Every result lists its upstream requests (requests: method, credential-free URL, status, cached, time), and
citation names the publisher, page and retrieval date. Requests are rate-limited per host (a token bucket),
retried with backoff on 429 and 5xx (honoring Retry-After), and kept within each agency's per-minute budgets.
Caching follows each source's terms.
A source whose policy allows persistent copies (
cache.mode: persistent) can be cached on disk inDATA_ANALYST_CACHE(default~/.cache/data-analyst). census and bea do; opm's terms allow it, but its port downloads again for now.Most sources allow reuse only inside the analysis folder, and FRED none at all. For those, a fixed
--workspacegives reuse across restarts without keeping copies anywhere else.
As a library
import { route, brief, fetchSource, compute, registerFacts } from "data-analyst-mcp";
const r = await fetchSource("cdc", { description: "NY deaths 2017", requests: [{ name: "ny", endpoint: "query",
params: { dataset: "leading_death", $where: "state = 'New York' AND year = '2017'" } }] }, { out: "./out/ny" });
console.log(r.summary.tables[0].rows, r.citation.text);The functions: the same sources, engine, analysis and audits as the server. The exports are
listSources,route,brief,requestSchema,fetchSource,ingest,manualBundle,compute,registerFacts,writeTable,rerun,recordDecisions,auditAnswer,buildReport,auditReport,createServerandcreateApp, plus their types.No ask-first gate: it is for assistants, so the library leaves it out.
Errors: a failure throws
ToolError; itsfailureholds the code and the fix.
API keys
Install, step 2 lists the keys and how to get them. When a fetch needs a key that is not set up,
fetch returns key_missing with a setup command for you to run in your own terminal. The model never asks
for a key in chat. setup writes ~/.config/data-analyst/keys.json.
The local (stdio) server looks for a key in this order. DATA_GOV_API_KEY is the example; each source's variable is named in
its source_brief.
The
DATA_GOV_API_KEYenvironment variable, for example in the MCP client'senvblock.The file named by
DATA_GOV_API_KEY_FILE(for secret managers and mounted secrets)."env": {"DATA_GOV_API_KEY": "..."}in~/.config/data-analyst/keys.json(or$DATA_ANALYST_CONFIG_DIR/keys.json).setupwrites this file."env": {"DATA_GOV_API_KEY": "..."}in Claude Code's~/.claude/settings.json(or$CLAUDE_CONFIG_DIR/settings.json).~/.data-gov/api_key, a file that holds only the key.
The files are read again on each lookup, so a key stored during a session works without a restart.
What the server guarantees, and tests check:
No key in any result. Every tool result, error, prompt and resource is redacted for every key the server can find, in every form it can be echoed in (as is, URL-encoded, JSON-escaped).
No tool reads a key file. A path the model names (
ingest, afor_eachtable,report.jsonpaths,read_file) is refused when it is one of the files above, a.envfile,~/.ssh,~/.awsor a similar place, or when the file holds a key.No key in a written file. A key an agency echoes is replaced with
[REDACTED]in every file written to the workspace (the result says which), and never reaches the download cache or a replication package.A key goes only to its agency: never along a next-page link to another site, never from https to http. On a redirect to another host, a key in the URL or a header is dropped; a key in the request body (BLS) follows a 307/308 redirect wherever it points.
What the server cannot stop: an assistant that has its own file or shell tools (Claude Code does) can open the
key files itself. setup prints the Claude Code rule that blocks this; add it to the permissions.deny list of your
~/.claude/settings.json, for example:
{ "permissions": { "deny": ["Read(~/.config/data-analyst/**)", "Edit(~/.config/data-analyst/**)"] } }Prefer setup (or a secret manager through <VAR>_FILE) over the env block of ~/.claude/settings.json: that
file is one Claude Code reads anyway. The hosted server reads keys only from its environment and from each user's
encrypted store (see docs/hosting.md).
Hosted mode (claude.ai connector)
data-analyst-mcp serve --http serves MCP at /mcp over streamable HTTP. With DATA_ANALYST_ACCOUNTS=1, users
sign in through OAuth and store their own API keys on a write-only page. The keys are encrypted at rest, and the
model never sees them. See docs/hosting.md and the Dockerfile.
Workspace
Each session writes to its own folder under $DATA_ANALYST_OUT (default: the system temp folder,
data-analyst-mcp/<session>), with data/<source>/ and decisions.json inside. Nothing is written inside the
package. A local server that restarts (a client may restart it after a call it gave up on) starts a new folder;
the earlier one stays, and open_workspace reopens it. --workspace <folder> keeps one fixed folder instead.
Development
npm install
npm test
npm run build
npm run smokenpm testruns offline, on recorded fixtures.npm run smokedrives the built server over stdio and makes one live fetch.
Related
data-analyst: the same U.S. government data workflow as an Agent Skill (Claude Code, Claude Desktop, claude.ai, Codex), for assistants that load skills rather than MCP servers.
rsi-skill: recursive self-improvement for Claude Code and Agent Skills.
Project page: zsu.github.io/data-analyst-mcp. npm: data-analyst-mcp.
MIT licensed; see LICENSE.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Macroeconomic and other official data from 170+ publishers, resolved from natural language with provenance.
75 MCP tools: SEC financials, FRED economics, IRS 990, FDA, FX, UK Companies House.
Official cited financial data layer for AI agents (SEC EDGAR, FRED, ECB, Treasury, GLEIF).
Statistics from 28 agencies: FRED, Eurostat, ECB, World Bank, OECD. Cited values, computed answers.
Related MCP Servers
- AlicenseAqualityDmaintenanceEnables AI agents to access SEC EDGAR filings, US Treasury rates, BLS labor statistics, and economic indicators without API keys.6MIT
- AlicenseAqualityDmaintenanceMCP server serving official statistics from major data agencies (Statistics Canada, FRED, BLS, World Bank, etc.) as tools with provenance and verification, enabling search, retrieval, analysis, and monitoring via natural language.1158 npmMIT
- FlicenseNot gradedqualityBmaintenanceEnables answering US economic questions by searching, fetching, and comparing FRED data series through a supervised multi-agent workflow with built-in safety and cost controls.1-
- AlicenseNot gradedqualityBmaintenanceEnables AI agents to access official statistical and economic indicator datasets from Eurostat, World Bank, OECD, IMF, WHO, and national statistical offices across 150+ countries through natural-language dataset discovery, inspection, time-series retrieval, SQL queries, CSV export, and account/watchlist management.MIT