EY.ai MCP Server TypeScript Census Example
Model Context Protocol (MCP) Server built with TypeScript
This is a Model Context Protocol (MCP) server that provides US Census Bureau data capabilities for AI agents and LLM applications. Built with TypeScript and the MCP SDK, it exposes census demographic data through standardized MCP tools. Features include real-time population data from the 2020 Decennial Census, FIPS state code queries, and full MCP protocol compliance. The server enables AI agents to seamlessly integrate demographic information into their workflows using the standard MCP interface.
Available MCP Tools (1)
This MCP server exposes the following tools through the Model Context Protocol. These tools can be accessed by any MCP-compatible client such as Claude Desktop or through the MCP Inspector for testing.
get-population
Get population data for US states by FIPS state code. Pass an array of state codes (e.g., [1, 6, 36] for Alabama, California, New York) or use [0] to get all states.
# Example: Get Texas and New York population data
{
"states": [
48,
36
]
}
Parameters:
• states
(array, required)
Array of FIPS state codes (e.g., [1, 6, 36]). Use [0] for all states.
Common FIPS Codes: CA(6), TX(48), FL(12), NY(36), PA(42), IL(17), OH(39), GA(13), NC(37), MI(26), All States(0)
MCP Server Endpoints
Connect to this MCP server using the following endpoints:
HTTP Endpoints
# MCP Protocol Endpoint
http://mcp-census-03-dev-lrgzv.dev-workflow-uat-nov-22-brunch.002.eastus2.containers.sbp.eyclienthub.com/mcp
# Health Check Endpoint
http://mcp-census-03-dev-lrgzv.dev-workflow-uat-nov-22-brunch.002.eastus2.containers.sbp.eyclienthub.com/health
Test MCP Streamable Interface
Test the MCP server using curl commands. Follow these steps to call MCP tools from your terminal:
Quick Start Guide:
- Click "Initialize & Get Session" - Creates a new MCP session and captures the session ID
- Copy the tool call command below - The session ID will be automatically inserted
- Paste in your terminal and run - You'll see the census population data returned
Tip: Keep your browser console open (F12) to see detailed logs during initialization
# Step 1: Initialize session
curl -X POST http://mcp-census-03-dev-lrgzv.dev-workflow-uat-nov-22-brunch.002.eastus2.containers.sbp.eyclienthub.com/mcp -H "Content-Type: application/json" -H "Accept: application/json, text/event-stream" -d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"curl-test","version":"1.0.0"}}}'
Your Session ID:
This session ID will be automatically inserted into the tool call command when you click "Copy" below
# Step 2: Call tool: get-population
curl -X POST http://mcp-census-03-dev-lrgzv.dev-workflow-uat-nov-22-brunch.002.eastus2.containers.sbp.eyclienthub.com/mcp -H "Content-Type: application/json" -H "Accept: application/json, text/event-stream" -H "mcp-session-id: YOUR_SESSION_ID" -d '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"get-population","arguments":{"states":[48,36]}}}'
Note: You must initialize a session first (Step 1 above) before copying this command.
Once initialized, the session ID will be automatically inserted when you copy this command.
MCP Inspector Testing
Use the MCP Inspector to test and debug the server's tools:
# Launch MCP Inspector (manual)
npx @modelcontextprotocol/inspector \
--transport http \
--server-url http://mcp-census-03-dev-lrgzv.dev-workflow-uat-nov-22-brunch.002.eastus2.containers.sbp.eyclienthub.com/mcp
Claude Desktop Configuration
Add this configuration to your claude_desktop_config.json file:
{
"mcpServers": {
"census": {
"url": "http://mcp-census-03-dev-lrgzv.dev-workflow-uat-nov-22-brunch.002.eastus2.containers.sbp.eyclienthub.com/mcp"
}
}
}
Quick Start
Get started with this Model Context Protocol (MCP) server locally or with Docker. This server exposes census data tools that can be used by AI agents and LLM applications.
Local Development
Install dependencies and start the MCP server on your local machine:
# Install project dependencies
npm install
# Build the TypeScript project
npm run build
# Start MCP server with Inspector (port 5008)
npm run mcp
# Or start MCP server only (port 5008)
npm start
# Open the MCP server home page in browser
open http://mcp-census-03-dev-lrgzv.dev-workflow-uat-nov-22-brunch.002.eastus2.containers.sbp.eyclienthub.com/
Docker Deployment
Run the MCP server in a Docker container. Internal port 8080 is mapped to external port 5008:
# Build Docker image with MCP server
npm run docker-build
# Run container (maps external 5008 to internal 8080)
npm run docker-run
# Stop and remove the running MCP server container
npm run docker-stop
Port Mapping: Docker maps -p 5008:8080 (external:internal)
Testing
# Run tests
npm test
# Run tests with coverage
npm run test:coverage