data.gov MCP server
data.gov MCP server for Copilot Studio
This MCP server gives Microsoft Copilot Studio agents read-only access to federal APIs that use the api.data.gov authentication model.
The GitHub repository contains the source code only. Copilot Studio cannot connect directly to a GitHub repository; deploy the server to a public HTTPS host first.
MCP tools
call_federal_api: Make a guarded HTTPS GET request to a.govor.milAPI.get_rate_limit_info: Call an endpoint and expose theX-RateLimit-*headers.
Required environment variables
Variable | Purpose |
| Your outbound data.gov key. Use |
| A separate secret that Copilot Studio sends to this MCP server. |
| Set to |
Optional variables include MCP_HOST (default 127.0.0.1), MCP_PORT (default 8000), MCP_PATH (default /mcp), MCP_ALLOWED_HOSTS (comma-separated host allowlist), and DATA_GOV_ALLOWED_HOSTS (comma-separated federal API host allowlist). Set MCP_HOST=0.0.0.0 only inside a container behind HTTPS ingress.
Do not use the data.gov key as the MCP server key. Store both as deployment secrets.
Deploy with Docker
Build and run locally:
docker build -t data-gov-mcp .
docker run --rm -p 8000:8000 `
-e MCP_TRANSPORT=streamable-http `
-e MCP_SERVER_API_KEY="replace-with-a-long-random-secret" `
-e DATA_GOV_API_KEY="your-data-gov-key" `
data-gov-mcpThe local MCP endpoint is:
http://localhost:8000/mcp
Copilot Studio requires a publicly reachable HTTPS endpoint. Azure Container Apps, Azure App Service, or another HTTPS container host can run the included Dockerfile. Configure the deployment to expose port 8000, set the required environment variables as secrets, and use the resulting URL ending in /mcp.
For production, set MCP_ALLOWED_HOSTS to the exact public host and keep MCP_SERVER_API_KEY out of source control and container images.
Add the server to Microsoft Copilot Studio
Microsoft currently supports the Streamable HTTP transport for existing MCP servers. SSE is no longer supported for Copilot Studio.
Open the agent in Copilot Studio.
Turn on Generative orchestration.
Open Tools and select Add a tool > New tool > Model Context Protocol.
Enter:
Server name:
data.gov Federal APIsDescription:
Read-only access to approved federal APIs using the data.gov API gateway.Server URL:
https://YOUR_PUBLIC_HOST/mcp
Select API key authentication.
Select Header and set the header name to
X-MCP-API-Key.Enter the same value configured in the deployment's
MCP_SERVER_API_KEY.Select Create, choose Create a new connection, then select Add to agent.
Review the discovered tools and test the agent with a narrow request, such as asking for one current record from a known federal API.
The server uses its private DATA_GOV_API_KEY when calling the downstream federal API. Do not ask Copilot Studio users to provide that key.
Local stdio mode
For local MCP clients that launch a process directly, stdio remains available:
py -m venv .venv
.\.venv\Scripts\Activate.ps1
py -m pip install -r requirements.txt
$env:DATA_GOV_API_KEY = "DEMO_KEY"
py server.pyLeave MCP_TRANSPORT unset for stdio mode. Use MCP_TRANSPORT=streamable-http only when running as a network service.
Security notes
Only HTTPS federal hosts are allowed by default for downstream requests.
Private, loopback, link-local, multicast, and reserved downstream addresses are rejected.
Responses are limited to 5 MB to protect server and agent memory.
The Copilot Studio-facing endpoint requires
X-MCP-API-Key.Caller-supplied
api_keyquery parameters are rejected; only the server-held key is used.The data.gov API key is sent only from the server to the downstream API and is never returned as a tool result.
Apply Power Platform data policies to control external connector access in Copilot Studio.
References: