- Home
- MCP servers
- Census API
Census API
- javascript
0
GitHub Stars
javascript
Language
2 months ago
First Indexed
3 weeks ago
Catalog Refreshed
Documentation & install
Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.
Installation
Add the following to your MCP client configuration file.
Configuration
View docs{
"mcpServers": {
"shawndrake2-mcp-census": {
"command": "node",
"args": [
"/path/to/census-api/dist/index.js"
],
"env": {
"CENSUS_API_KEY": "YOUR_API_KEY"
}
}
}
}The Census API MCP Server lets you access U.S. Census Bureau data, including demographics, population, income, housing, and more, through a configurable MCP server that you can run locally or in your environment.
How to use
You interact with the Census API MCP Server using the provided MCP tools to query Census data, explore datasets, and locate geographies. You can fetch data by specifying the year, dataset, variables, and the geographic scope you want. This enables you to retrieve targeted statistics such as median household income, total population, or unemployment counts for states, counties, or other areas.
How to install
Prerequisites: You need Node.js installed on your system. You should also have a working MCP client to connect to the server once it is running.
Create and save the Census MCP server configuration shown below in a file you will reference when starting the server. This configuration runs the Census API server as a local process and provides your API key via environment variables.
{
"census": {
"command": "node",
"args": ["/path/to/census-api/dist/index.js"],
"env": {
"CENSUS_API_KEY": "your-api-key"
}
}
}
Additional notes
Start the server by supplying your API key in the environment and running the node process with the specified script path. This will bring up the MCP endpoint locally so you can use the census tools to query data.
Example start command structure you will use after you place the config and replace the placeholder with your real key.
Configuration and tools
The Census MCP server is configured to run as a local stdio service. The single configured server exposes a Node.js script that loads and serves Census data through the MCP interface.
Key environment variable you must provide:
- CENSUS_API_KEY: Your Census API key. This key authenticates your requests to the Census Bureau data endpoints.
Usage examples
{
"year": "2022",
"dataset": "acs/acs5",
"variables": "NAME,B19013_001E",
"forClause": "state:*"
}
Tools you can use with the server
Query: Fetch Census data with full control over variables and geography. You specify the year, dataset path, variables, and forClause to define the geographic scope.
List datasets: Retrieve available Census datasets for a given year to discover what data you can access.
List variables: Search for variables within a dataset to find the exact codes you need for your queries.
List geographies: Discover available geographic levels for a dataset so you can target state, county, or other areas.
Get FIPS: Retrieve FIPS codes for states, counties, or other geographies to build precise queries.
Available tools
query
Fetch Census data with full control over variables and geography by specifying year, dataset, variables, and geographic scope.
list_datasets
List all available Census datasets for a specific year to understand data availability.
list_variables
Search for variables within a dataset to identify exact codes needed for queries.
list_geographies
List available geographic levels for a dataset to target states, counties, or other areas.
get_fips
Retrieve FIPS codes for states, counties, or other geographies to build precise queries.