data-gov MCP Server
This crate provides a Model Context Protocol (MCP) server
exposing the high-level helpers from the data-gov crate and the lower-level CKAN
bindings from data-gov-ckan. The server operates strictly as a thin proxy: it does
not modify either library and forwards requests directly to the underlying
implementations.
Features
- Search data.gov datasets with the ergonomic
DataGovClient - Retrieve dataset details and organization metadata
- Access raw CKAN endpoints such as
package_search,package_show, andorganization_list - Works over standard MCP JSON-RPC framing on STDIN/STDOUT
Prod Readiness
This software is brand new, and has not been thoroughly tested or hardened. Use at your own risk.
Usage
The process reads JSON-RPC 2.0 messages (one per line) from standard input and writes responses to standard output. On startup it emits a ready message that advertises the available methods.
Available Tools
The MCP server exposes the following tools (methods):
High-level Data.gov tools
data_gov.search: Search datasets on data.gov with optional filtersdata_gov.dataset: Fetch detailed metadata for a dataset by name or IDdata_gov.autocompleteDatasets: Autocomplete dataset names based on a partial querydata_gov.listOrganizations: List publishing organizations (agencies) on data.govdata_gov.downloadResources: Download one or more dataset resources to the local filesystem
Low-level CKAN tools
ckan.packageSearch: Perform a low-level CKAN package_search requestckan.packageShow: Retrieve detailed metadata for a dataset using CKANckan.organizationList: List CKAN organizations with optional sorting and pagination
MCP protocol tools
tools/list: List all available tools and their schemastools/call: Call a tool by name with argumentsinitialize,initialized,shutdown: MCP protocol lifecycle
Each request is expected to follow the shape:
Responses mirror the JSON-RPC 2.0 schema and either contain a result payload or
an error object.
Solr query syntax
The data_gov.search tool accepts a query string that supports Solr-style
syntax (wildcards, phrase matching, boolean operators). For advanced fielded
filters, use the ckan.packageSearch tool and provide an filter/fq string
in Solr syntax (for example: organization:nasa-gov AND res_format:CSV). The
MCP server forwards q and fq directly to the underlying CKAN client.
VSCode Integration
To use the MCP server in VSCode, add the following to your workspace .vscode/mcp.json. Adjust the command path accordingly to the location of the MCP server.
For more information on configuring VSCode to use MCP servers:
https://code.visualstudio.com/docs/copilot/customization/mcp-servers#_add-an-mcp-server
{
"servers": {
"data-gov": {
"type": "stdio",
"command": "target/debug/data-gov-mcp-server",
"args": []
}
},
"inputs": []
}
This will configure VSCode to launch the MCP server and connect to it for tool-based workflows.
Configuration
Environment variables allow the server to reuse API configuration without altering the upstream crates:
DATA_GOV_API_KEY– CKAN API key for higher rate limitsDATA_GOV_BASE_URL– Override the default CKAN base pathDATA_GOV_USER_AGENT– Custom user agent applied to both clients
These settings are optional; when omitted the defaults from the existing libraries are used.
Development
The crate lives under tools/mcp/data-gov-mcp-server and is part of the main
Cargo workspace. Tests and formatting can be run from the repository root:
Disclaimer & license
This is an independent project and is not affiliated with data.gov or any government agency. For authoritative information, refer to the official data.gov portal.
Licensed under the Apache License 2.0.