OpenGov MCP Server is a Model Context Protocol server that enables MCP clients like Claude Desktop to access Socrata Open Data APIs. This integration allows you to search for, retrieve, and analyze public datasets from government data portals, including cities, states, and federal agencies.
The easiest way to use this MCP server is with npx:
Create or edit your Claude Desktop configuration:
Create or edit claude_desktop_config.json
in your home directory:
{
"mcpServers": {
"opengov": {
"command": "npx",
"args": ["-y", "opengov-mcp-server@latest"],
"env": {
"DATA_PORTAL_URL": "https://data.cityofchicago.org"
}
}
}
}
You can replace the DATA_PORTAL_URL with any Socrata-powered data portal, such as:
https://data.cityofchicago.org
https://data.cityofnewyork.us
https://data.sfgov.org
https://data.lacity.org
Restart Claude Desktop (if it was already running)
The first time you run a query, npx will automatically download and run the latest version of the server.
If you prefer to run from source:
Clone the repository:
git clone https://github.com/srobbin/opengov-mcp-server.git
cd opengov-mcp-server
Install dependencies and build:
npm install
npm run build
Create Claude Desktop configuration:
Create or edit claude_desktop_config.json
in your home directory:
{
"mcpServers": {
"opengov": {
"command": "node",
"args": [
"/path/to/your/opengov-mcp-server/dist/index.js"
],
"env": {
"DATA_PORTAL_URL": "https://data.cityofchicago.org"
}
}
}
}
Replace /path/to/your/opengov-mcp-server
with the actual path where you cloned the repository.
Restart Claude Desktop (if it was already running)
Once installed, you can ask Claude Desktop questions that require accessing public data, such as:
How many cars were towed in Chicago this month?
You can follow up with more detailed questions:
Which make and color were towed the most?
Also, were there any interesting vanity plates?
The MCP server provides the following data access capabilities:
The server accepts the following parameters:
type
(required): Operation type
catalog
: Search and list datasetscategories
: List dataset categoriestags
: List dataset tagsdataset-metadata
: Get dataset detailscolumn-info
: Get dataset column informationdata-access
: Query and retrieve recordssite-metrics
: Get portal statisticsdomain
(optional): Data portal hostname (without protocol)
query
(optional): Search query for datasets
datasetId
: Dataset identifier for specific operations
soqlQuery
(optional): SoQL query for filtering data
limit
(optional): Maximum results to return (default: 10)
offset
(optional): Results to skip for pagination (default: 0)
Here are example query formats that Claude Desktop will use automatically:
// Find datasets about budgets
{
"type": "catalog",
"query": "budget",
"limit": 5
}
// Get information about a dataset
{
"type": "dataset-metadata",
"datasetId": "6zsd-86xi"
}
// Query dataset records with SQL-like syntax
{
"type": "data-access",
"datasetId": "6zsd-86xi",
"soqlQuery": "SELECT * WHERE amount > 1000 ORDER BY date DESC",
"limit": 10
}
The server requires one environment variable:
DATA_PORTAL_URL
: The Socrata data portal URL (e.g., https://data.cityofchicago.org
)This can be set in the Claude Desktop configuration (as shown above), in your environment variables, or via command line.
To add this MCP server to Claude Code, run this command in your terminal:
claude mcp add-json "opengov" '{"command":"npx","args":["-y","opengov-mcp-server@latest"],"env":{"DATA_PORTAL_URL":"https://data.cityofchicago.org"}}'
See the official Claude Code MCP documentation for more details.
There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json
file so that it is available in all of your projects.
If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json
file.
To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"opengov": {
"command": "npx",
"args": [
"-y",
"opengov-mcp-server@latest"
],
"env": {
"DATA_PORTAL_URL": "https://data.cityofchicago.org"
}
}
}
}
To add an MCP server to a project you can create a new .cursor/mcp.json
file or add it to the existing one. This will look exactly the same as the global MCP server example above.
Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.
The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.
You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.
To add this MCP server to Claude Desktop:
1. Find your configuration file:
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%\Claude\claude_desktop_config.json
~/.config/Claude/claude_desktop_config.json
2. Add this to your configuration file:
{
"mcpServers": {
"opengov": {
"command": "npx",
"args": [
"-y",
"opengov-mcp-server@latest"
],
"env": {
"DATA_PORTAL_URL": "https://data.cityofchicago.org"
}
}
}
}
3. Restart Claude Desktop for the changes to take effect