loading…
Search for a command to run...
loading…
Node.js MCP server enabling AI agents to access comprehensive U.S. Census Bureau demographic and economic data, including ACS, decennial census, and business pa
Node.js MCP server enabling AI agents to access comprehensive U.S. Census Bureau demographic and economic data, including ACS, decennial census, and business patterns.
npm version CI codecov License: MIT Node.js Version
Node.js server implementing Model Context Protocol (MCP) for U.S. Census Bureau APIs.
The Census MCP Server enables AI agents and applications to access comprehensive U.S. demographic and economic data from the Census Bureau. With this server, your AI can retrieve and analyze:
Whether you're building a demographic analysis tool, location intelligence application, policy research assistant, or any application that needs U.S. census data, the Census MCP Server provides direct access to official government statistics.
A Census API key is required to use this MCP server.
To get a free Census API key:
npm install -g @bluerfalcon/census-mcp-server
npx @bluerfalcon/census-mcp-server
Add to your Claude Desktop configuration file:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%/Claude/claude_desktop_config.json
{
"mcpServers": {
"census": {
"command": "npx",
"args": ["-y", "@bluerfalcon/census-mcp-server"],
"env": {
"CENSUS_API_KEY": "your_census_api_key_here"
}
}
}
}
Create a .env file in your project directory:
CENSUS_API_KEY=your_census_api_key_here
CENSUS_API_ENDPOINT=https://api.census.gov/data/ # optional
MCP Resources provide read-only access to Census vocabularies and metadata. Use these to discover available data before querying with tools.
Browse available variables for American Community Survey datasets.
URI Patterns:
census://acs/2022/acs5/variables - All variables for 2022 ACS 5-year estimatescensus://acs/2021/acs1/variables - All variables for 2021 ACS 1-year estimatescensus://acs/2022/acs5/variables?group=B01001 - Variables in specific group (e.g., B01001 = Age/Sex)Returns: JSON with variable codes, labels, concepts, and groups
Example Use:
Read census://acs/2022/acs5/variables?group=B19013 to see median income variables
Browse available variables for various Census datasets. This is a generic resource that works across multiple Census APIs.
URI Patterns:
census://variables/healthins/sahie - Health Insurance variablescensus://variables/popest - Population Estimates variablescensus://variables/idb/1year - International Database variablescensus://variables/govs - Public Sector Employment variablescensus://variables/poverty/saipe - Poverty Statistics variablescensus://variables/rhfs - Rental Housing Finance variablescensus://variables/abs - Annual Business Survey variablescensus://variables/cre - Community Resilience Estimates variablescensus://variables/cbp - County Business Patterns variablescensus://variables/ecnbasic - Economic Census variablescensus://variables/dec/pl - Decennial Census variablescensus://variables/qwi - Quarterly Workforce Indicators variablescensus://variables/bds - Business Dynamics Statistics variablesReturns: JSON with variable codes, labels, and descriptions for the specified dataset
Example Use:
Read census://variables/healthins/sahie to see all health insurance variables
Read census://variables/cre to see community resilience variables
Get all US state and territory FIPS codes.
URI: census://geography/states
Returns: JSON list of all states with FIPS codes, names, and abbreviations
Example Use:
Read census://geography/states to see all state codes
Retrieve demographic and economic data from the American Community Survey (ACS).
Parameters:
year: Year for ACS data (e.g., 2022)dataset: "acs1" (1-year estimates) or "acs5" (5-year estimates, default)variables: Array of Census variable codes (e.g., ["B01001_001E", "B19013_001E"])geography: Geographic level ("us", "state", "county", "tract", "place")state: State FIPS code (required for county/tract/place geographies)county: County FIPS code (required for tract geography)Common Variables:
B01001_001E - Total populationB19013_001E - Median household incomeB25077_001E - Median home valueB23025_005E - Unemployment countFind more variables: ACS 5-Year Variables
Retrieve data from the U.S. Decennial Census (2020, 2010).
Parameters:
year: "2020" or "2010"dataset: "pl" (redistricting), "dhc" (demographics), or "sf1" (summary file)variables: Array of variable codes (e.g., ["P1_001N", "P2_002N", "H1_001N"])geography: Geographic level ("us", "state", "county", "tract", "block group", "place")state: State FIPS code (required for sub-state geographies)county: County FIPS code (required for tract/block group)Common Variables:
P1_001N - Total populationP1_003N - White alone populationP1_004N - Black or African American aloneP2_002N - Hispanic or Latino populationH1_001N - Total housing unitsFind more variables: 2020 Census Variables
Retrieve annual population estimates from the Population Estimates Program (PEP).
Parameters:
year: Vintage year (2020-present, default: 2023)variables: Array of variables (default: ["POP"])geography: Geographic level ("us", "state", "county")state: State FIPS code (required for county)ageGroup: Age group code (optional filter)sex: "0" (both), "1" (male), "2" (female)hispanicOrigin: "0" (both), "1" (non-Hispanic), "2" (Hispanic)Common Variables:
POP - Population estimateAGE - Age group codeSEX - Sex codePOPGROUP - Race/ethnicity groupHISP - Hispanic originFind more variables: PEP Variables
Retrieve business statistics from County Business Patterns (CBP).
Parameters:
year: Year for CBP data (1986-present, typically 2 years behind)variables: Array of variables (default: ["ESTAB", "EMP", "PAYANN"])geography: Geographic level ("us", "state", "county")state: State FIPS code (required for county)naics: NAICS industry code (2-6 digits)employmentSizeClass: Employment size codeCommon Variables:
ESTAB - Number of establishmentsEMP - Number of employeesPAYANN - Annual payroll ($1,000s)PAYQTR1 - First quarter payroll ($1,000s)NAICS2017 - Industry codeCommon NAICS Codes:
72 - Accommodation and food services541 - Professional, scientific, and technical services44-45 - Retail trade62 - Health care and social assistanceFind more variables: CBP Variables
Retrieve comprehensive business statistics from the Economic Census (every 5 years).
Parameters:
year: "2017", "2012", or "2007"variables: Array of variables (default: ["ESTAB", "EMP", "RCPTOT", "PAYANN"])geography: Geographic level ("us", "state", "county", "metro area")state: State FIPS code (optional for state, required for county)county: County FIPS code (optional)naics: NAICS industry code (2-6 digits)sector: NAICS sector code (2 digits)Common Variables:
ESTAB - Number of establishmentsEMP - Number of employeesRCPTOT - Sales/receipts/revenue ($1,000s)PAYANN - Annual payroll ($1,000s)VALADD - Value added ($1,000s)Find more variables: Economic Census Variables
Retrieve geographic metadata and reference information from the Census Bureau Geographic Information API.
Parameters:
year: Vintage year for geographic data (2020-present, default: 2023)variables: Array of geographic variables (see below for common options)geography: Geographic level ("us", "state", "county", "tract", "place", "congressional district")state: State FIPS code (required for county, tract, place, congressional district)county: County FIPS code (required for tract)Common Variables:
NAME - Geographic area nameAREALAND - Land area (square meters)AREALAND_SQMI - Land area (square miles)AREAWATR - Water area (square meters)AREAWATR_SQMI - Water area (square miles)INTPTLAT - Internal point latitude (centroid)INTPTLON - Internal point longitude (centroid)Example queries:
Find more info: Geographic Information API
Convert addresses to coordinates or find Census geographies for any U.S. location. No API key required.
Parameters:
searchType: "onelineaddress" (default), "address" (structured), or "coordinates" (reverse)address: Single line address string (for onelineaddress)street, city, state, zip: Structured address components (for address search)longitude, latitude: Coordinates (for reverse geocoding)returnGeographies: Return geographic hierarchies (default: true)benchmark: Benchmark version (default: Public_AR_Current)vintage: Geography vintage (default: Current_Current)Returns:
Example queries:
Retrieve actual geographic boundary polygons as GeoJSON. No API key required.
Parameters:
geographyType: "state", "county", "tract", "block group", or "place"state: State FIPS code or 2-letter abbreviationcounty: County FIPS code (required for tract/block group)tract: Census tract code (required for block group)geoid: Full GEOID to query specific featurename: Search by name (e.g., "California")vintage: Data vintage (default: Current)simplify: Return simplified geometries (default: false)Returns:
Example queries:
Find more info: TIGERweb Documentation
Retrieve health insurance coverage estimates from the Small Area Health Insurance Estimates (SAHIE) program.
Parameters:
year: Year for estimates (2006-2023, default: 2022)variables: Array of variables (see below for common options)geography: Geographic level ("us", "state", "county")state: State FIPS code (required for county, optional for state)county: County FIPS code (optional for specific county)ageCategory: Age group filter ("0": Under 65, "1": 18-64, "2": 40-64, "3": 50-64, "4": Under 19, "5": 21-64)incomeRange: Income category ("0": All, "1": ≤138% poverty, "2": ≤200%, "3": ≤250%, "4": ≤400%)raceEthnicity: Race/ethnicity ("0": All, "1": White non-Hispanic, "2": Black, "3": Hispanic)Common Variables:
NIC_PT - Number of people with health insuranceNUI_PT - Number of people without health insurancePCTIC_PT - Percent with health insurancePCTUI_PT - Percent without health insuranceNIPR_PT - Number in poverty rangePCTLIIC_PT - Percent low-income with insuranceExample queries:
Find more info: SAHIE Documentation
Retrieve government employment and payroll statistics from the Annual Survey of Public Employment & Payroll.
Parameters:
year: Year for data (2017-2024, default: 2024)variables: Array of variables (see below for common options)geography: Geographic level ("us", "state")state: State FIPS code (optional for specific state)governmentType: Filter by government type ("state", "local", "combined")Common Variables:
TOT_EMP - Total employment (full-time + part-time)FT_EMP - Full-time employmentPT_EMP - Part-time employmentTOT_PAY - Total payroll (in thousands)FT_PAY - Full-time payroll (in thousands)PT_PAY - Part-time payroll (in thousands)TOT_HRS - Total hours workedFT_HRS - Full-time hoursPT_HRS - Part-time hoursExample queries:
Find more info: Public Employment Documentation
Retrieve poverty estimates and median household income from the Small Area Income and Poverty Estimates (SAIPE) program.
Parameters:
year: Year for estimates (1989-2022, default: 2022)variables: Array of variables (see below for common options)geography: Geographic level ("us", "state", "county")state: State FIPS code (required for county, optional for state)county: County FIPS code (optional for specific county)Common Variables:
SAEPOVALL_PT - Poverty count (all ages)SAEPOVRTALL_PT - Poverty rate percentage (all ages)SAEPOV0_17_PT - Children in poverty (ages 0-17)SAEPOVRT0_17_PT - Child poverty rate (ages 0-17)SAEPOV5_17R_PT - School-age children in poverty (ages 5-17)SAEPOVRT5_17R_PT - School-age poverty rate (ages 5-17)SAEPOV0_4_PT - Young children in poverty (ages 0-4)SAEPOVRT0_4_PT - Young child poverty rate (ages 0-4)SAEMHI_PT - Median household incomeExample queries:
Find more info: SAIPE Documentation
Retrieve rental housing finance data from the Rental Housing Finance Survey (RHFS).
Parameters:
year: Year for data ("2015", "2018", "2021", default: "2021")group: Data group to retrieve (required, see below)propertySize: Filter by property size (optional, see below)Data Groups:
RHFS_PC - Property Configuration (building counts, unit counts, year built, etc.)RHFS_EX - Expenses (operating expenses, utilities, maintenance, etc.)RHFS_OM - Ownership and Management (ownership type, management, etc.)RHFS_IS - Income and Subsidies (rental income, government subsidies, etc.)RHFS_FM - Finances and Mortgage (mortgage status, refinancing, debt, etc.)RHFS_CI - Capital Improvements and Expenses (renovations, capital projects, etc.)Property Size Filters:
0 - All properties (default)1 - 1 unit properties2 - 2-4 unit properties3 - 5-24 unit properties4 - 25-49 unit properties5 - 50+ unit propertiesReturns:
Example queries:
Note: RHFS provides national-level statistics only and is available for years 2015, 2018, and 2021.
Find more info: RHFS Documentation
Retrieve business ownership data from the Annual Business Survey (ABS). Replaced the Survey of Business Owners (SBO) in 2017.
Parameters:
year: Year for data (2017-2023, default: 2023)variables: Array of variables (see below for common options)geography: Geographic level ("us", "state", "county", "metro area")state: State FIPS code (required for county, optional for state)county: County FIPS code (optional for specific county)sex: Owner sex ("001": All, "002": Male, "003": Female)ethnicity: Owner ethnicity ("001": All, "002": Hispanic, "003": Non-Hispanic)race: Owner race ("00": All, "10": White, "20": Black, "30": American Indian/Alaska Native, "40": Asian, "50": Native Hawaiian/Pacific Islander, "60": Two or more races)veteran: Veteran status ("001": All, "002": Veteran, "003": Non-veteran)Common Variables:
FIRMPDEMP - Number of employer firmsEMP - Number of employeesPAYANN - Annual payroll (in thousands)RCPPDEMP - Receipts/sales (in thousands)FIRMPDEMP_PCT - Percent of employer firmsEMP_PCT - Percent of employeesPAYANN_PCT - Percent of payrollRCPPDEMP_PCT - Percent of receiptsExample queries:
Find more info: ABS Documentation
Retrieve community resilience and social vulnerability data from the Community Resilience Estimates (CRE).
Parameters:
year: Year for estimates ("2019", "2021", "2022", "2023", default: "2023")variables: Array of variables (see below for common options)geography: Geographic level ("us", "state", "county", "tract")state: State FIPS code (required for county and tract, optional for state)county: County FIPS code (required for tract, optional for specific county)Common Variables:
PRED0_PE - Percent with zero vulnerability factors (most resilient)PRED12_PE - Percent with 1-2 vulnerability factors (moderate)PRED3_PE - Percent with 3+ vulnerability factors (high vulnerability)PRED0_E - Count with zero vulnerability factorsPRED12_E - Count with 1-2 vulnerability factorsPRED3_E - Count with 3+ vulnerability factorsPOPUNI - Total population universeVulnerability Components (8 factors):
Example queries:
Perfect for: Real estate applications (Zillow-like), disaster preparedness, neighborhood risk assessment, emergency planning, community development.
Find more info: CRE Documentation
Retrieve global population statistics from the U.S. Census Bureau International Database (IDB). Access population data for 200+ countries and territories worldwide from 1950 to 2100 (historical estimates and future projections).
Parameters:
year: Year for population data (1950-2100)variables: Array of IDB variable codes (e.g., ["POP", "CBR", "E0"])country: Optional FIPS country code (e.g., "CH" for China, "IN" for India, "US" for United States)ageGroup: Optional age group filter (e.g., "0-4", "5-9", "10-14")sex: Optional sex filter (0 = Both sexes, 1 = Male, 2 = Female)Common Variables:
POP - Total populationCBR - Crude birth rate (births per 1,000 population)CDR - Crude death rate (deaths per 1,000 population)E0 - Life expectancy at birth (years)GR - Population growth rate (percent)IMR - Infant mortality rate (deaths per 1,000 live births)MAB - Median age at birth (years)TFR - Total fertility rate (births per woman)NI - Natural increase (births minus deaths)NM - Net migration (immigrants minus emigrants)POP_DENS - Population density (persons per square kilometer)AREA_KM2 - Land area (square kilometers)Example queries:
Perfect for: International demographics, global population analysis, country comparisons, development indicators, migration studies, demographic projections.
Find more info: IDB Documentation
Retrieve quarterly employment statistics from the Quarterly Workforce Indicators (QWI) program. Access 32+ economic indicators including employment levels, job creation/destruction, hires, separations, earnings, and turnover rates. Data available from 1990-present at state, county, metro area, and workforce investment board area levels.
Parameters:
year: Year for QWI data (1990-present)quarter: Quarter (1-4)variables: Array of QWI variable codes (e.g., ["Emp", "HirA", "Sep", "EarnS"])geography: Geographic level (state, county, metro, wib)state: Optional state FIPS code (required for county geography)sex: Optional sex filter (0 = Both, 1 = Male, 2 = Female)agegrp: Optional age group (A00 = All, A01 = 14-18, A02 = 19-21, A03 = 22-24, A04 = 25-34, A05 = 35-44, A06 = 45-54, A07 = 55-64, A08 = 65-99)education: Optional education level (E0 = All, E1 = Less than high school, E2 = High school, E3 = Some college, E4 = Bachelor or advanced, E5 = Advanced degree)race: Optional race filter (A0 = All, A1 = White, A2 = Black, A3 = American Indian/Alaska Native, A4 = Asian, etc.)ethnicity: Optional ethnicity (A0 = All, A1 = Not Hispanic, A2 = Hispanic)industry: Optional NAICS industry code (e.g., "00" = All, "54" = Professional services)firmage: Optional firm age (0 = All, 1 = 0-1 years, 2 = 2-3 years, 3 = 4-5 years, 4 = 6-10 years, 5 = 11+ years)firmsize: Optional firm size (0 = All, 1 = 0-19 employees, 2 = 20-49, 3 = 50-249, 4 = 250-499, 5 = 500+)Common Variables:
Emp - Employment (number of jobs)EmpS - Stable employment (workers employed at firm for full quarter)HirA - Hires (all workers hired during quarter)Sep - Separations (all workers who separated during quarter)EarnS - Average earnings for stable workersEarnBeg - Beginning-of-quarter earningsEarnHirAS - Average earnings of hiresPayroll - Total payrollTurnOvrS - Turnover rate (separations / average employment)HirAS - Hire rate (hires / average employment)SepS - Separation rate (separations / average employment)JC - Job creation (net employment gains at expanding establishments)JD - Job destruction (net employment losses at contracting establishments)Example queries:
Perfect for: Job market analysis, wage trends, employment dynamics, labor market research, workforce planning, economic development, evaluating areas for relocation.
Find more info: QWI Documentation
Retrieve annual business dynamics statistics showing job creation, job destruction, establishment births/deaths, and firm startups/shutdowns. Track economic dynamism and business health from 1978-2023 at national, state, and metro/micro area levels.
Parameters:
year: Year for BDS data (1978-2023)variables: Array of BDS variable codes (e.g., ["ESTABS", "JOB_CREATION", "JOB_DESTRUCTION"])geography: Geographic level (us, state, metro)state: Optional state FIPS code (required for metro geography, optional for state)naics: Optional NAICS industry code (e.g., "00" = All, "54" = Professional services)metro: Optional metro filter (0 = All, 1 = Filter applied, M = Metropolitan, N = Micropolitan/non-metro)fage4: Optional firm age (a) 0 = Startups, b) 1-5, c) 6-10, d) 11-15, e) 16-20, f) 21-25, g) 26+)fsize: Optional firm size (a) 1-4 employees, b) 5-9, c) 10-19, d) 20-49, e) 50-99, f) 100-249, etc.)eage4: Optional establishment age (a) 0 = New, b) 1-5, c) 6-10, d) 11-15, etc.)esize: Optional establishment size (a) 1-4 employees, b) 5-9, c) 10-19, d) 20-49, etc.)Common Variables:
ESTABS - Number of establishmentsESTABS_ENTRY - New establishments (births)ESTABS_EXIT - Closing establishments (deaths)JOB_CREATION - Gross jobs createdJOB_DESTRUCTION - Gross jobs destroyedNET_JOB_CREATION - Net job change (creation - destruction)FIRMS - Number of firmsFIRMS_ENTRY - New firms (startups)FIRMS_EXIT - Closing firms (shutdowns)EMP - Employment levelJOB_CREATION_BIRTHS - Job creation from new establishmentsJOB_CREATION_CONTINUERS - Job creation from expanding establishmentsJOB_CREATION_RATE - Job creation rate (as percentage)JOB_DESTRUCTION_DEATHS - Job destruction from closing establishmentsJOB_DESTRUCTION_CONTINUERS - Job destruction from contracting establishmentsJOB_DESTRUCTION_RATE - Job destruction rate (as percentage)Example queries:
Perfect for: Business environment analysis, economic vitality assessment, entrepreneurship research, job market dynamics, evaluating economic health when considering relocation.
Find more info: BDS Documentation
Try these prompts with Claude Desktop after setup:
git clone https://github.com/mattpodwysocki/census-mcp-server.git
cd census-mcp-server
npm install
cp .env.example .env
# Edit .env and add your CENSUS_API_KEY
npm run build
npm run inspect:dev
Run the unit test suite:
npm test
Run tests with coverage report:
npm run test:coverage
Run tests in watch mode:
npm run test:watch
The Census API provides access to numerous datasets. This MCP server currently supports:
States are identified by 2-digit FIPS codes:
01 - Alabama06 - California12 - Florida36 - New York48 - TexasFull list: State FIPS Codes
Counties are identified by 3-digit codes within each state.
Industries are classified using the North American Industry Classification System (NAICS):
Full list: NAICS Codes
When you use the MCP server tools, the following data is sent to Census Bureau APIs:
We welcome contributions! Here's how you can help:
git checkout -b feature/your-feature-namenpm testnpm run lint:fixgit commit -m "Add your feature"git push origin feature/your-feature-namenpm run lint and npm test before committingMIT License - see LICENSE for details
Выполни в терминале:
claude mcp add census-mcp-server -- npx Web content fetching and conversion for efficient LLM usage.
Retrieval from AWS Knowledge Base using Bedrock Agent Runtime.
автор: modelcontextprotocolProvides auto-configuration for setting up an MCP server in Spring Boot applications.
A very streamlined mcp client that supports calling and monitoring stdio/sse/streamableHttp, and can also view request responses through the /logs page. It also
автор: xuzexin-hzНе уверен что выбрать?
Найди свой стек за 60 секунд
Автор?
Embed-бейдж для README
Похожее
Все в категории ai