Skip to main content
Glama
beenthatt-rehman

datagovin-mcp

datagovin-mcp

MCP-сервер, который даёт Claude (или любому MCP-клиенту) доступ на естественном языке к платформе открытых государственных данных Индии — data.gov.in: более 100 000 публичных наборов данных о качестве воздуха, сельском хозяйстве, здравоохранении, ценах на топливо, переписи населения, образовании, осадках и многом другом.

Сервер не поставляет собственных данных. Это тонкая, корректная обёртка: каждый запрос — живое обращение к data.gov.in с использованием вашего собственного бесплатного API-ключа. Добавляется недостающий слой — поиск данных и аккуратная работа с ними, — чтобы языковая модель могла перейти от вопроса «какой сейчас AQI в Дели?» прямо к реальным строкам, не заставляя вас вручную искать UUID набора данных.

Зачем это нужно

У data.gov.in огромный каталог, но нет полноценного полнотекстового поиска в API: обычный путь — открыть сайт и скопировать resource ID набора с кнопки «API». Для языковой модели это плохо подходит. Этот сервер закрывает разрыв с помощью курируемого и проверенного индекса, по которому можно искать ключевые слова, и инструментов, которые запрашивают схему набора и выгружают отфильтрованные строки в реальном времени. Заодно он сглаживает шероховатости вышестоящего API (регистрозависимые фильтры, отдельные CSV-ответы, особенность пагинации на последней странице) — чтобы модели не приходилось с ними разбираться.

Related MCP server: bharatlas-mcp

Инструменты

Инструмент

Что делает

search_datasets(query, limit)

Находит resource_id набора по ключевому слову в курируемом индексе.

list_sectors()

Перечисляет секторы, представленные в каталоге.

get_dataset_info(resource_id)

Актуальная схема: название, описание, количество строк, точные имена полей и типы.

query_dataset(resource_id, filters, fields, limit, offset)

Получает реальные отфильтрованные строки в реальном времени.

Установка

1. Получите бесплатный API-ключ. Зарегистрируйтесь на data.gov.in и сформируйте ключ на странице своего профиля. Это бесплатно, опубликованных ограничений на количество запросов нет.

2. Установите.

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.txt

3. Укажите свой ключ.

cp .env.example .env
# edit .env and paste your key, or just export it:
export DATA_GOV_IN_API_KEY="your_key_here"

4. Подключите его к Claude Desktop. Добавьте это в конфигурацию вашего MCP-клиента (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" }
    }
  }
}

Перезапустите клиент — появятся четыре инструмента.

Пример диалога

Вы: Какие у вас есть наборы данных по качеству воздуха? Клод: (вызывает search_datasets("air quality")) → Индекс качества воздуха по станциям в реальном времени.

Вы: Какие у него есть поля? Клод: (вызывает get_dataset_info(...)) → country, state, city, station, pollutant_id, pollutant_avg, last_update…

Вы: Покажи измерения PM2.5 в Дели. Клод: (вызывает query_dataset(resource_id, filters={"city": "Delhi", "parameter": "PM2.5"})) → актуальные строки.

Как пополнять каталог

Каталог поставляется стартовым проверенным набором данных и рассчитан на дальнейший рост. Чтобы добавить любой набор, скопируйте его resource ID с кнопки «API» на его странице на data.gov.in и запустите:

python scripts/add_dataset.py <resource_id> --sector Agriculture --keywords "wheat,crop,production"

Скрипт получает актуальные название и схему набора в реальном времени и добавляет проверенную запись в data/catalog.json. --sector и --keywords являются необязательными.

Примечания об API data.gov.in

Несколько особенностей data.gov.in, которые сервер берёт на себя:

  • Имена полей для фильтра чувствительны к регистру (filters[State] ≠ filters[state]), и это не документировано. Всегда используйте точное поле id из ger_dataset_info.

  • Некоторые старые наборы данных возвращают CSV даже при format=json; клиент обнаруживает CSV по заголовку Content-Type и всё равно его разбирает.

  • Пагинация последней страницы может вернуть пустой массив records со статусом ok; результат с нулевым количеством записей при положительном общем значении означает, что вы листаете за пределами конца.

  • Максимум ~100 строк за запрос — бяльшие наборы листайте постранично с параметром offset.

Структура проекта

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.toml

Лицензия

MIT

Available Tools

4 tools
get_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.

NameRequiredDescriptionDefault
resource_idYes

Output Schema

NameRequiredDescription
resultYes

TDQS

A4.8/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

The description accurately lays out the tool's observable behavior: it returns schema metadata, and it cautions that field names are case-sensitive, giving the practical consequence (use the exact 'id'). It does not mention side effects, errors, or authentication requirements—but for a GET-style read-only tool these are seldom necessary. The case-sensitivity disclosure is worth credit because it changes how the agent uses the returned data.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Every portion contributes: the opening line states the operation, the second line supplies usage context with a sequencing cue, the warning adds a necessary behavioral nuance, and the Args block gives the parameter source. No sentence is filler; the length is appropriate for the information density.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

With a single required parameter and an output schema present, the description fully covers the needed information: the dataset scope, the source of the identifier, and a critical data-quality principle. The tool is simple enough that no further prerequisites or error-handling notes are needed.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema provides only the parameter name 'resource_id' with zero description coverage. The description compensates fully by explaining that it is a UUID and pointing the agent to 'search_datasets or the portal' for sourcing it. This eliminates any guesswork about how to obtain or format the value.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states the precise operation ('Get the schema of a specific dataset') and enumerates exactly what is returned: title, description, row count, and field names/types. This clearly distinguishes it from the sibling tools (search_datasets searches, query_dataset queries, list_sectors lists sectors) without any ambiguity.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

It gives an explicit sequencing instruction: 'Call this BEFORE query_dataset when you need to know which fields exist or how to spell a filter field.' This tells the agent exactly when to use the tool and what to use with it, and the case-sensitivity warning that has a direct effect on subsequent filter construction. It could mention alternatives more cleanly, but the instruction is refreshingly complete and non-obvious.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

list_sectorsA

List the sectors covered by the curated dataset catalog (e.g. Environment, Agriculture, Health). Useful for orienting the user before a search.

NameRequiredDescriptionDefault

No parameters

Output Schema

NameRequiredDescription
resultYes

TDQS

A4.5/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full behavioral disclosure burden. The word 'List' conveys that this is a non-mutating, harmless operation, and the examples clarify the nature of the returned content. While it does not address edge cases like ordering or format, the output schema is present to cover return shape, so the description is adequate for a simple catalog-listing tool.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two short sentences with no filler: the first delivers the core action and resource, and the second adds the practical 'why/when' context. The example list is compact and useful, and the front-loading is excellent.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a zero-parameter, low-complexity tool with an output schema, the description is complete: it states what the tool returns, gives example values, and explains its role in the workflow (before a search). Nothing an agent needs to decide whether to call this tool correctly is missing.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool takes zero parameters, so the baseline for this dimension is 4. The description refers to the sectors themselves (the result content) rather than parameters, which is appropriate for a parameterless operation.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description names a specific verb ('List') and resource ('sectors covered by the curated dataset catalog'), with concrete examples (Environment, Agriculture, Health). It also frames its distinct role as an orientation step 'before a search', clearly differentiating it from the sibling search/get/query tools.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The phrase 'Useful for orienting the user before a search' gives a clear usage context. It does not explicitly list alternative tools or when-not-to-use conditions, but it positions this tool as the pre-search starting point, which is sufficient guidance for the sibling set provided.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

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).

NameRequiredDescriptionDefault
limitNo
fieldsNo
offsetNo
filtersNo
resource_idYes

Output Schema

NameRequiredDescription
resultYes

TDQS

A4.7/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the full burden of behavioral disclosure — and it delivers. It reveals the API-key auth requirement, the upstream 100-row hard cap, the paged-past-the-end signature (zero rows with positive total), and the case-sensitivity pitfall for filter fields. This is exactly the kind of non-obvious behavior an agent needs before calling.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The structure is effective: a crisp opening sentence, then operational details, a highlighted IMPORTANT warning, and a per-parameter Args block. There is minor redundancy — the 100-row cap and the 1-100 limit are stated in both the prose and the Args — and the description runs long because it is dense with value; every sentence earns its place, but a tighter consolidation would be possible.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a 5-parameter tool with 0% schema coverage and no annotations, the description covers everything an agent needs to call it correctly: auth requirements, pagination pitfalls, filter capitalization traps, and full parameter semantics. The output schema exists, so not explaining return values is acceptable. The description is complete enough that an agent could perform correct data pulls on the first generic run.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must fully compensate — and it does. The Args block explains what the schema cannot: where resource_id comes from (search_datasets or portal), the exact shape of filters with a concrete example ({'city': 'Delhi'}), the semantic meaning of fields as a projection, and the effective 1-100 range for limit, given that pagination semantics only exist in the description.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description opens with a specific verb+resource: 'Pull actual rows from a data.gov.in dataset, optionally filtered.' This clearly differentiates it from siblings: search_datasets (discovery), list_sectors (catalog navigation), and get_dataset_info (metadata), by explicitly positioning it as the tool that retrieves the live data rows themselves.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description gives clear contextual usage guidance: it explains pagination semantics, when a zero-row result means you have paged past the end, and the dependency flow for filters ('must match a field id from get_dataset_info exactly'). It does not explicitly state 'use X instead when...' selection criteria, so exclusions between siblings are only implied, not spelled out, so a 4 is appropriate.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

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).

NameRequiredDescriptionDefault
limitNo
queryYes

Output Schema

NameRequiredDescription
resultYes

TDQS

A4.6/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the behavioral burden and handles it well: it discloses that this searches a curated local index of verified datasets and provides a fallback path when nothing matches. It also clarifies that results are matching datasets, though it doesn't describe potential failure modes or whether the local index is refreshed.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is organized into purpose, usage timing, fallback, and parameters, making it easy for an agent to parse. Every sentence adds information; nothing is redundant.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a 2-parameter tool with an existing output schema, the description covers the key points: what it returns, when to invoke it, what to do if nothing matches, and how to onboard new datasets. This is sufficient for correct tool selection and invocation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema provides no descriptions (0% coverage), but the description fully compensates with a clear Args section. query is explained with plain-language examples, and limit is described as the max result count with a default value for schema coverage 0%.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states a specific action ('Find datasets'), a concrete resource (India's Open Government Data platform), and the method (by keyword). It also distinguishes the tool from get_dataset_info and query_dataset by noting that this tool returns resource_id, which the other tools need.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description clearly says to use this tool FIRST when the user asks about Indian public data and no resource ID is already known. It implies the alternative tools are used when a resource ID is already available, though it never names them explicitly, so a direct comparison is missing.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 4 tool updatesv0.1.0
    • First observedget_dataset_info
    • First observedlist_sectors
    • First observedquery_dataset
    • First observedsearch_datasets

TDQS

A4.7/5.0

Scored across 4 tools

Disambiguation5/5

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.

Naming Consistency5/5

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.

Tool Count5/5

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.

Completeness4/5

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

ActivityStale
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    A
    maintenance
    Description: 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.
    40
    MIT
  • A
    license
    A
    quality
    C
    maintenance
    Enables 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.
    10
    5
    MIT
  • A
    license
    Not graded
    quality
    C
    maintenance
    Provides AI-ready access to Indian government statistics through MCP, enabling natural language queries for economic, demographic, and social indicators.
    147
    MIT