datagovin-mcp
datagovin-mcp
Ein MCP-Server, der Claude (oder jedem MCP-Client) natürlichen Sprachzugriff auf Indiens offene Regierungsdatenplattform, data.gov.in, ermöglicht – über 100.000 öffentliche Datensätze zu Luftqualität, Landwirtschaft, Gesundheit, Kraftstoffpreisen, Volkszählung, Bildung, Niederschlag und mehr.
Der Server bringt keinerlei eigene Daten mit. Er ist ein schlanker, wohlerzogener Wrapper: Jede Abfrage ist ein Live-Aufruf an data.gov.in unter Verwendung Ihres eigenen kostenlosen API-Schlüssels. Was er hinzufügt, ist die fehlende Ebene – Auffinden und sauberes Abfragen – sodass ein Sprachmodell von „Wie hoch ist der AQI in Delhi gerade?“ bis zu echten Datenzeilen kommen kann, ohne dass Sie jemals eine Datensatz-UUID von Hand zusammensuchen müssen.
Warum es das gibt
data.gov.in hat einen riesigen Katalog, aber keine brauchbare Volltextsuche-API: Der übliche Arbeitsablauf besteht darin, die Website zu durchsuchen und die Ressourcen-ID eines Datensatzes von der Schaltfläche „API“ zu kopieren. Das ist für ein LLM schlecht geeignet. Dieser Server schließt die Lücke mit einem kuratierten, verifizierten Index, der per Schlüsselwort durchsucht werden kann, plus Werkzeuge, die das Schema eines Datensatzes abrufen und gefilterte Zeilen live liefern. Außerdem glättet er die Kanten der Upstream-API (case-sensitive Filter, gelegentliche CSV-Antworten, eine Eigenheit der Paginierung bei derletzten Seite), sodass das Modell das nicht selbst übernehmen muss.
Related MCP server: bharatlas-mcp
Werkzeuge
Werkzeug | Was es tut |
| Findet die |
| Listet die im Katalog vorhandenen Sektoren auf. |
| Live-Schema: Titel, Beschreibung, Zeilenanzahl, exakte Feldnamen und -typen. |
| Ruft tatsächlich Gefilterte Zeilen live ab. |
Einrichtung
1. Holen Sie sich einen kostenlosen API-Schlüssel. Registrieren Sie sich bei data.gov.in und erzeugen Sie einen Schlüssel auf Ihrer Profilseite. Das Ganze ist kostenlos und hat kein veröffentlichtes Anrufungslimit.
2. Abständen.
git clone https://github.com/<your-username>/datagovin-mcp.git
cd datagovin-mcp
python -m venv .venv && source .venv/bin/activate
pip install -r requirements.txt3. Legen Sie Ihren Schlüssel fest.
cp .env.example .env
# edit .env and paste your key, or just export it:
export DATA_GOV_IN_API_KEY="your_key_here"4. Verbinden Sie den Server mit Claude Desktop. Ergänzen Sie dazu Ihre MCP-Client-Konfiguration (claude_desktop_config.json):
{
"mcpServers": {
"datagovin": {
"command": "python",
"args": ["/absolute/path/to/datagovin-mcp/server.py"],
"env": { "DATA_GOV_IN_API_KEY": "your_key_here" }
}
}
}Starten Sie den Client neu und die vier Werkzeuge werden angezeigt.
Beispieldialog
Sie: Welche Datensätze haben Sie zur Luftqualität? Claude: (ruft
search_datasets("air quality")auf) → Real-Time-Air-Quality-Index nach Station.Sie: Welche Felder enthält er? Claude: (ruft
get_dataset_info(...)auf) → country, state, city, station, pollutant_id, pollutant_avg, last_update …Sie: Zeigen Sie mir PM2.5-Werte in Delhi. Claude: (ruft
query_dataset(resource_id, filters={"city": "Delhi", "pollutant_id": "PM2.5"})auf) → tatsächliche Zeilen live.
Den Katalog erweitern
Der Katalog startet mit einem verifizierten Datensatz und soll erweitert werden. Um einen Datensatz hinzuzufügen, kopieren Sie die Ressourcen-ID von der schaltenden Schaltfläche „API“ auf der data.gov.in-Seite des Datensatzes und führen Sie Folgendes aus:
python scripts/add_dataset.py <resource_id> --sector Agriculture --keywords "wheat,crop,production"Das Skript ruft den echten Titel und das Schema des Datensatzes live ab und hängt derweil einen verifizierten Eintrag an data/catalog.json an. --sector und --keywords sind optional.
Hinweise zur Upstream-API
Ein paar Verhaltensweisen von data.gov.in, die dieser Server für Sie übernimmt:
Feldnamen für Filter sind case-sensitive (
filters[State]≠filters[state]) und dies ist dokumentiert – verwenden Sie immer die exakte Feld-idausget_dataset_info.Einige ältere Datensätze liefern CSV, unabhängig von
format=json; der Client erkennt uns am Content-Type und parst sie dennoch.Paginierung der letzten Seite kann ein leeres
records-Array mitstatus: okzurückgeben; ein Null-Ergebnis bei positiver Gesamtzahl bedeutet, dass Sie über das Ende hinausgeblättert haben.Maximal ~100 Zeilen pro Anfrage – blättern Sie bei größeren Datensätzen mit
offsetweiter.
Projektstruktur
datagovin-mcp/
├── server.py # MCP entry point (stdio); defines the four tools
├── datagovin/
│ ├── client.py # async data.gov.in API wrapper (quirk handling)
│ └── catalog.py # curated catalog load + keyword search
├── data/catalog.json # verified, extensible dataset index
├── scripts/add_dataset.py # enrich the catalog by resource ID
├── requirements.txt
└── pyproject.tomlLizenz
MIT
Available Tools
4 toolsget_dataset_infoA
Get the schema of a specific dataset: its title, description, total row count, and the exact list of field names and types.
Call this BEFORE query_dataset when you need to know which fields exist or
how to spell a filter field. Field names on data.gov.in are CASE-SENSITIVE
(e.g. "State" is not "state"), so always use the exact id returned here
when building filters.
Args: resource_id: The dataset UUID, e.g. from search_datasets or the portal.
Inputs: resource_id (required). Returns: result
list_sectorsA
List the sectors covered by the curated dataset catalog (e.g. Environment, Agriculture, Health). Useful for orienting the user before a search.
Inputs: no named parameters. Returns: result
query_datasetA
Pull actual rows from a data.gov.in dataset, optionally filtered.
Fetches live data using the user's API key. limit is capped at 100 rows
per call (the upstream maximum); page through larger result sets with
offset. If a call returns zero rows but a positive total, you have paged
past the end.
IMPORTANT: filter field names are case-sensitive and must match a field id
from get_dataset_info exactly. If a filter returns nothing unexpectedly, check
the capitalisation of the field name first.
Args: resource_id: The dataset UUID (from search_datasets or the portal). filters: Optional {field_id: value} pairs, e.g. {"city": "Delhi"}. fields: Optional list of field ids to return (projection). Omit for all. limit: Rows to return, 1-100 (default 10). offset: Row offset for pagination (default 0).
Inputs: resource_id (required), limit, fields, offset, +1 more. Returns: result
search_datasetsA
Find datasets on India's Open Government Data platform by keyword.
Use this FIRST when the user asks about Indian public data (air quality,
crop production, fuel prices, census, health, education, rainfall, etc.) and
you don't already have a resource ID. Returns matching datasets with their
resource_id, which the other tools need.
Searches a curated local index of verified data.gov.in datasets. If nothing matches, tell the user they can add any dataset by copying its resource ID from the dataset's "API" button on data.gov.in, then running scripts/add_dataset.py.
Args: query: Plain-language keywords, e.g. "air quality delhi" or "wheat production". limit: Max results to return (default 10).
Inputs: query (required), limit. Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 4 tools
Each tool has a distinct responsibility: discover datasets (search_datasets), browse categories (list_sectors), inspect schema (get_dataset_info), and retrieve rows (query_dataset). No two tools could be confused for the same action.
All four tool names follow a uniform verb_noun pattern (search_datasets, list_sectors, get_dataset_info, query_dataset). While the verbs differ, each one accurately maps to its unique action, and the snake_case style is consistent throughout.
With only 4 tools, the server is tightly scoped to the core use case of discovering and retrieving Indian open government data. Each tool is necessary and none feel redundant, making the tool count highly appropriate.
The tool surface covers the end-to-end read-only workflow: search, sector overview, schema inspection, and data extraction with pagination. Minor gaps include no direct way to list every dataset in the catalog and limited dataset metadata (e.g., update date), but agents can work around these via search and get_dataset_info.
Maintenance
Related MCP Connectors
Search India datasets; inspect sources, licences and previews; get notebook and Python examples.
Query India's open geo data, and author collect maps: register a link, moderate, publish.
Indian government statistics and public data: economy, elections, health, agriculture and more
Discover, resolve, and query official Brazilian economic data with semantic search and provenance.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceExposes India's open government data (data.gov.in) APIs via the Model Context Protocol, enabling agentic AI data exploration.2MIT
- AlicenseAqualityBmaintenanceDescription: Query India's open geo data in natural language. 8 tools: list layers, inspect schemas, filter/group any column, point-in-polygon locate, spatial proximity search, downloads in 5 formats. Covers admin boundaries (state to village), city wards, forests, rivers, dams, hospitals, highways, airports, and more.1743MIT
- AlicenseAqualityDmaintenanceEnables querying and analyzing over 90,000 public datasets from the Spanish Government Open Data Portal (datos.gob.es) using natural language, with tools for search, filtering, metadata access, and SPARQL queries.105MIT

MoSPI MCP Serverofficial
AlicenseNot gradedqualityCmaintenanceProvides AI-ready access to Indian government statistics through MCP, enabling natural language queries for economic, demographic, and social indicators.148MIT