Quick Setup Guide
Quick Setup Guide
Step-by-Step Setup
1. Get Your Census API Key
- Visit: https://api.census.gov/data/key_signup.html
- Fill out the form to get your free API key
- Copy the key (looks like:
541100b6baa56ca3bafeffa63e59e80ba1f10d34)
2. Set Up Environment
# Navigate to the MCP server directory
cd /Users/nickjackolaisen/Documents/GitHub/BI/mcp-servers/government-data
# Create .env file
echo "CENSUS_API_KEY=your_key_here" > .env
# Install dependencies
pip install -r requirements.txt
3. Test the Census Client
Create a test file test_client.py:
from census_client import CensusAPIClient
client = CensusAPIClient()
result = client.fetch_bds_data(
variables=["ESTABS_ENTRY"],
year=2023,
geography="us:*"
)
print(result)
Run it:
python test_client.py
4. Configure Cursor
- Open Cursor Settings
- Find “MCP Servers” or “Model Context Protocol” section
- Add the server configuration:
{
"mcpServers": {
"government-data": {
"command": "python3",
"args": [
"/Users/nickjackolaisen/Documents/GitHub/BI/mcp-servers/government-data/server.py"
],
"env": {
"CENSUS_API_KEY": "your_key_here"
}
}
}
}
- Restart Cursor
5. Verify It Works
In Cursor, try asking:
- “Fetch business startup data for 2023 from the Census BDS API”
- “Get population data for California from ACS”
The AI assistant should be able to use the MCP tools automatically!
Troubleshooting
“ModuleNotFoundError: No module named ‘mcp’”
The MCP Python SDK might have a different package name. Try:
pip install mcp-python
# or
pip install git+https://github.com/modelcontextprotocol/python-sdk.git
“CENSUS_API_KEY must be set”
Make sure you’ve created the .env file or set the environment variable:
export CENSUS_API_KEY=your_key_here
Server not connecting in Cursor
- Check the path in your MCP config is absolute and correct
- Make sure
python3(orpython) is in your PATH - Test the server manually:
python server.pyshould start without errors - Check Cursor’s MCP logs/console for error messages