
Research
/Security News
737 Chrome VPN Extensions Linked to Brand Impersonation and Browser Traffic Redirection
The campaign amassed more than 75,000 installs by targeting Russian-speaking users seeking access to blocked services.
@cyanheads/census-mcp-server
Advanced tools
Query U.S. Census Bureau data, variables, and geography via MCP. STDIO or Streamable HTTP.
Query U.S. Census Bureau data, variables, and geography via MCP. STDIO or Streamable HTTP.
Public Hosted Server: https://census.caseyjhand.com/mcp
8 tools covering the full Census data workflow — from dataset discovery and variable search through geography resolution and ranked comparisons:
| Tool | Description |
|---|---|
census_list_datasets | Browse available Census Bureau datasets (ACS5, ACS1, Population Estimates, Decennial, County Business Patterns, Economic Census, Nonemployer Statistics) with vintage years and dataset codes. |
census_list_geographies | List the geography levels supported by a dataset and year, with parent requirements and example FIPS values. |
census_search_variables | Keyword search across variable labels and concept groups. On ACS, returns estimate and margin-of-error codes together. |
census_get_variable | Fetch full metadata for one or more variable codes — label, concept, predicate type, universe, MOE sibling. |
census_list_predicate_values | List the codes a filter dimension accepts (EMPSZES, LFO, POPGROUP, NAICS2017…), from the dataset dictionary or a live wildcard enumeration. |
census_resolve_geography | Convert place names (e.g., "King County, WA") or street addresses to Census FIPS identifiers via TIGERweb and Census Geocoder. |
census_query_data | Query a Census dataset for variables at a specific geography. Returns estimates with MOE, suppression codes resolved to readable reasons, and predicate filtering for the business datasets. |
census_compare_geographies | Rank and compare variables across multiple geographies — all counties in a state, all states nationally, or a named set. Sorted table output, with the same predicate filtering. |
census_list_datasetsBrowse available Census Bureau datasets.
cbp), Economic Census (ecnbasic), and Nonemployer Statistics (nonemp)acs/acs5) are the values to pass to other toolsavailable_years is exhaustive, not a sample: any other year fails with year_not_available before a request goes out, naming the years that do work. It is narrower than what the Census API hosts — pep/charv reaches its 2020-2022 estimates through the YEAR filter inside the 2023 vintage, and the cbp/nonemp vintages left out reject the NAME column every query here sendscensus_search_variablesSearch Census variables by keyword.
NAICS2017 in cbptotal_matches indicates how many matched before the limitcensus_list_predicate_valuesList the codes a filter dimension accepts, so a predicates map can be written without guessing.
NAICS* and POPGROUP always publish one (thousands of codes — narrow them with query); on the current vintages EMPSZES, LFO, RCPSZES, TAXSTAT, and TYPOP publish none, so the live route is the only place their codes appeardec/ddhca declares 5,543 POPGROUP codes and publishes 2,996, cbp declares 6,694 NAICS2017 codes and publishes 2,003. The declared list is checked against the dataset's own published rows and the dead codes are dropped; source says whether that check ran and the notice says how many were withheld. A keyword that matched only withheld codes names them, so "total population" on dec/ddhca reports that 001 is declared and serves nothing rather than reading like a typoquery matches code and label; results are sorted by code and a truncated list is disclosed rather than passed off as completeecnbasic publishes TAXSTAT and TYPOP per industry, so within_naics scopes the enumeration — and the notice says the result is complete for that industry alone. A per-industry dimension is left unchecked for the same reason, since an unscoped check would withhold codes a scoped query does returncensus_resolve_geographyConvert place names and addresses to Census FIPS identifiers.
geography_type overrides itgeography_type. The value is the level's own Census API name, so it feeds geography_level unchangedcounty_fips pins a tract name to one county, since a tract name is unique only inside its county. Only county and tract sit within a county, so it restricts resolution to those two levels rather than being dropped on a layer that cannot apply itambiguous_name, with every candidate carrying the code resolving it would have returned, plus the state that separates same-named placesstate_fips (→ parent_fips) and fips_summary (→ geography_fips) ready to pass to other tools; a statistical area omits state_fips, since it can span several states and takes no parentcensus_query_dataQuery a Census dataset for one or more variables at a specific geography.
census_resolve_geography first for place namesgeography_fips: "*" to return all geographies at the level within the parentparent_fips returns parent_required naming what to add, and a parent the level does not sit within returns parent_not_accepted naming the input to drop — neither reaches the API as an opaque 400parent_fips and county_fips are zero-padded to the widths the Census matches on, so "5" and "05" both find Arkansas; either also takes "*", which is what reaches every block group in a state. geography_fips takes its width from geography_level and is passed through as givengeography_fips (bare level code, round-trips back into this tool) and geography_geoid (level plus parents, nationally unique)no_data with dataset-aware recovery, not a retried upstream errorpredicates map for the datasets that filter on one — {"NAICS2017": "5112"} narrows a cbp count to software publishers, and census_list_predicate_values supplies the codes. Keys are validated against the dataset's own variables before the queryapplied_filters. That label is load-bearing: cbp defaults NAICS2017 to the all-industries total, but dec/ddhca defaults POPGROUP to one population group and ecnbasic defaults its NAICS dimension to a single sector, so an unfiltered value can read like a total without being one. A dimension that publishes no label attribute (pep/charv YEAR, the nonemp NAICS codes before 2012) has no default to echo, and the notice says so rather than leaving it looking undefaultedpep/charv publishes an April 1 estimates base alongside its July 1 estimate, and MONTH is what separates them — not YEAR, which both rows carry. Each row names its record in a record field and on its rendered heading, and the notice gives the predicate that pins one ({"MONTH": "7"})value, so a null estimate says which of three things it is: suppressed is a number the Census withheld, a value alongside it is text (GEO_ID returns "0500000US53033"), and neither is an empty cellCENSUS_API_KEYcensus_compare_geographiesRank and compare variables across multiple geographies.
within parameter to constrain to a parent FIPS; omit for national comparisongeographies list to filter to specific geographies — full GEOIDs ("53033", "06037") work across states; bare level codes ("033") need within to disambiguate. Entries matching no row, and bare codes that matched more than one state, are named in a noticecensus_query_data, reported against within / within_countypredicates map as census_query_data, applied to every geography — without it the ranking runs on whatever default the API picks, named in the notice and echoed per row in applied_filterspep/charv without a pinned record fails with ambiguous_rows naming MONTH and the code to pass. With one pinned, each geography ranks once and the row says which record it isvalue field as census_query_data for a text cell; text has no ordering, so sorting on a column of it leaves every row tiedCENSUS_API_KEYBuilt on @cyanheads/mcp-ts-core:
Census-specific:
Agent-friendly output:
fips_summary and state_fips return values are ready to pass as geography_fips and parent_fips to the next tool-666666666) surfaced as human-readable reasons instead of raw numbersAPI key: Register a free key at api.census.gov/data/key_signup.html. Variable search and geography resolution work without a key; data queries (
census_query_data,census_compare_geographies) require one.
Add the following to your MCP client configuration file:
{
"mcpServers": {
"census-mcp-server": {
"type": "stdio",
"command": "bunx",
"args": ["@cyanheads/census-mcp-server@latest"],
"env": {
"MCP_TRANSPORT_TYPE": "stdio",
"MCP_LOG_LEVEL": "info",
"CENSUS_API_KEY": "your-census-api-key"
}
}
}
}
Or with npx (no Bun required):
{
"mcpServers": {
"census-mcp-server": {
"type": "stdio",
"command": "npx",
"args": ["-y", "@cyanheads/census-mcp-server@latest"],
"env": {
"MCP_TRANSPORT_TYPE": "stdio",
"MCP_LOG_LEVEL": "info",
"CENSUS_API_KEY": "your-census-api-key"
}
}
}
}
Or with Docker:
{
"mcpServers": {
"census-mcp-server": {
"type": "stdio",
"command": "docker",
"args": [
"run", "-i", "--rm",
"-e", "MCP_TRANSPORT_TYPE=stdio",
"-e", "CENSUS_API_KEY=your-census-api-key",
"ghcr.io/cyanheads/census-mcp-server:latest"
]
}
}
}
For Streamable HTTP, set the transport and start the server:
MCP_TRANSPORT_TYPE=http MCP_HTTP_PORT=3010 CENSUS_API_KEY=... bun run start:http
# Server listens at http://localhost:3010/mcp
census_query_data and census_compare_geographies; other tools work without it.git clone https://github.com/cyanheads/census-mcp-server.git
cd census-mcp-server
bun install
cp .env.example .env
# edit .env and set CENSUS_API_KEY
| Variable | Description | Default |
|---|---|---|
CENSUS_API_KEY | Required for data queries. Register free at api.census.gov/data/key_signup.html. | — |
CENSUS_DEFAULT_YEAR | Default vintage year when no year is specified. | 2024 |
CENSUS_VARIABLE_CACHE_TTL_HOURS | Hours to cache variables.json per dataset+year in memory. | 24 |
MCP_TRANSPORT_TYPE | Transport: stdio or http. | stdio |
MCP_HTTP_PORT | Port for HTTP server. | 3010 |
MCP_AUTH_MODE | Auth mode: none, jwt, or oauth. | none |
MCP_LOG_LEVEL | Log level (debug, info, notice, warning, error). | info |
OTEL_ENABLED | Enable OpenTelemetry instrumentation. | false |
See .env.example for the full list of optional overrides.
# One-time build
bun run rebuild
# Run the built server
bun run start:stdio
# or
bun run start:http
Run checks and tests:
bun run devcheck # Lint, format, typecheck, security audit
bun run test # Vitest test suite
bun run lint:mcp # Validate MCP definitions against spec
docker build -t census-mcp-server .
docker run --rm -e CENSUS_API_KEY=your-key -p 3010:3010 census-mcp-server
The Dockerfile defaults to HTTP transport, stateless session mode, and logs to /var/log/census-mcp-server. OpenTelemetry peer dependencies are installed by default — build with --build-arg OTEL_ENABLED=false to omit them.
| Path | Purpose |
|---|---|
src/index.ts | createApp() entry point — registers tools and initializes services. |
src/config/server-config.ts | Census-specific env var parsing and validation with Zod. |
src/mcp-server/tools/definitions/ | Tool definitions (*.tool.ts). |
src/services/census-api/ | Census Data API client — data queries, suppression code mapping, retry logic. |
src/services/geography/ | Geography resolution — TIGERweb named-place lookup and Census Geocoder address-to-tract. |
src/services/variable-cache/ | In-process variables.json cache with TTL and keyword search. |
tests/ | Vitest tests mirroring src/ structure. |
See CLAUDE.md for development guidelines and architectural rules. The short version:
try/catch in tool logicctx.log for request-scoped logging, ctx.state for tenant-scoped storagesrc/mcp-server/tools/definitions/index.tsIssues and pull requests are welcome. Run checks and tests before submitting:
bun run devcheck
bun run test
Apache-2.0 — see LICENSE for details.
FAQs
Query U.S. Census Bureau data, variables, and geography via MCP. STDIO or Streamable HTTP.
The npm package @cyanheads/census-mcp-server receives a total of 1,178 weekly downloads. As such, @cyanheads/census-mcp-server popularity was classified as popular.
We found that @cyanheads/census-mcp-server demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Research
/Security News
The campaign amassed more than 75,000 installs by targeting Russian-speaking users seeking access to blocked services.

Company News
Open source maintainers are under more pressure than ever. We're raising our open source program from the Team plan to the Business plan, free.

Security News
The supply chain control that delays freshly published gems now covers lockfile generation and gem vendoring in Ruby projects.