Skip to main content
Glama
datagovin-mcp

datagovin-mcp

by Oolrich

india-data

Claude answering a GDP question using datagovin-mcp

An MCP server that lets LLMs like Claude search and query India's Open Government Data platform (data.gov.in): GDP, trade, industry, agriculture and hundreds of thousands of other datasets published by Indian ministries.

"How did India's quarterly GDP growth move through COVID?" Claude searches the catalog, finds the MoSPI dataset, pulls the series and answers with real numbers, citing the source dataset and how current it is.

Tools

Tool

What it does

search_datasets

Keyword search over the catalog, with sector and ministry filters. Returns compact summaries with the period each dataset covers.

describe_dataset

A dataset's schema: dimension columns, and for wide tables, which metrics and periods it contains.

query_dataset

Rows with exact-match filters (by column name or id), column selection and pagination.

get_series

Reshapes wide year/quarter tables into tidy {metric, period, value} rows.

All tools are marked read-only.

Related MCP server: MoSPI MCP Server

Why this is more than an API wrapper

data.gov.in data is published as-is by each ministry, and it is messy in ways that trip up LLMs:

  • Wide tables. The quarterly GDP dataset has ~150 columns (value_rs_in_crore___2011_12___q1, …). get_series parses the column names into (metric, period) pairs and returns a sorted series.

  • Inconsistent naming within one dataset. The same dataset mixes ___q2 and __q3 ids and 2021-22 - Q2 vs 2021-22- Q3 names; another mixes Total - As on 31.03.2019 with Total as on 31.03.2018. The normalizer treats these as the same metric, so no periods get silently dropped.

  • Token bloat. Catalog responses include every column of every dataset. Search results are trimmed to summaries, and wide tables return only dimension columns unless asked.

  • Stale data. Many datasets stop years ago. Every summary reports the last update date and the period covered, and the server instructions ask the model to tell the user how current the data is.

  • Reliability and safety. Responses are cached (TTL), HTTP 429/5xx errors are retried with exponential backoff, dataset ids are validated as UUIDs before any request, and the API key is never echoed in errors.

Setup

  1. Get a free API key: register at data.gov.in and copy the key from your My Account page.

  2. Install with uv:

git clone https://github.com/Oolrich/india-data && cd india-data
uv sync --extra dev
  1. Check it works against the live API:

export DATA_GOV_IN_API_KEY=your-key
uv run python scripts/smoke_test.py

Use with Claude Desktop

Add this to claude_desktop_config.json (Settings → Developer → Edit Config), then restart Claude:

{
  "mcpServers": {
    "data-gov-in": {
      "command": "uv",
      "args": ["--directory", "/absolute/path/to/india-data", "run", "datagovin-mcp"],
      "env": { "DATA_GOV_IN_API_KEY": "your-key" }
    }
  }
}

Configuration

Variable

Default

Purpose

DATA_GOV_IN_API_KEY

(required for data)

Your data.gov.in key. Catalog search works without it.

DATA_GOV_IN_MAX_SCAN

500

How many catalog entries one search scans, newest first.

DATA_GOV_IN_MAX_SERIES_RECORDS

1000

Row cap when building a series.

Development

uv run pytest

Tests run offline against a fake API built from real catalog responses, and they include an end-to-end test over the MCP protocol.

Limitations

  • Search scans the newest catalog entries and matches keywords locally, because the catalog API has no full-text search. Use sector to reach older datasets.

  • Filters are exact-match, as supported by the upstream API.

  • Data is exactly as published by the source ministry. Check the dataset title and update date before relying on it.

Inspired by the datagovindia R package, rebuilt for LLM agents.

License

MIT

Available Tools

4 tools
describe_datasetA
Read-onlyIdempotent

Show a dataset's schema: its dimension columns, and for wide time-series tables, which metrics and periods it covers. Call this before query_dataset or get_series.

Args: dataset_id: The 'id' from search_datasets.

Inputs: dataset_id (required).

get_seriesA
Read-onlyIdempotent

Read a wide time-series table (one column per year/quarter) as tidy rows: [{, metric, period, value}], sorted by period.

Args: dataset_id: The 'id' from search_datasets. item: Optional case-insensitive filter on any dimension value, e.g. "GDP" or "Odisha". metric: Optional case-insensitive filter on the metric name, e.g. "growth" or "value". max_rows: Maximum rows to return (1-1000).

Inputs: dataset_id (required), item, metric, max_rows.

query_datasetA
Read-onlyIdempotent

Fetch rows from a dataset, with exact-match filters and column selection.

Args: dataset_id: The 'id' from search_datasets. filters: Column (name or id) -> exact value, e.g. {"State/UT": "Odisha"}. columns: Columns (names or ids) to return. Defaults to all, except that very wide time-series tables return only their dimension columns (use get_series for those). limit: Rows per page (1-100). offset: Row offset for pagination; use 'next_offset' from the previous call.

Inputs: dataset_id (required), limit, offset, columns, +1 more.

search_datasetsA
Read-onlyIdempotent

Search the data.gov.in catalog for datasets.

Args: query: Keywords that must all appear in the title, description, ministry or sector, e.g. "gdp quarterly". sector: Optional exact sector name, e.g. "Economy", "Finance", "Industries", "Agriculture". org: Optional ministry/organisation substring, e.g. "Statistics" or "Petroleum". limit: Maximum results to return (1-25).

Returns compact summaries (id, title, ministry, last update, and the period the data covers). Newest datasets are scanned first.

Inputs: org, limit, query, sector.

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    A4.2/5.0

    Scored across 4 tools

    Disambiguation5/5

    Each tool serves a distinct stage of the workflow: search the catalog, describe a dataset, fetch rows, or extract wide time-series data. The query_dataset vs get_series overlap is explicitly clarified by their descriptions, so an agent can select correctly.

    Naming Consistency5/5

    All tool names follow a consistent snake_case verb_noun pattern: search_datasets, describe_dataset, query_dataset, get_series. The convention is predictable and readable.

    Tool Count5/5

    Four tools are tightly scoped to the data.gov.in catalog workflow, and each earns its place. The set avoids unnecessary surface area while covering discovery, inspection, and data retrieval.

    Completeness4/5

    The surface covers catalog search, schema inspection, row queries, and time-series extraction, which are the core read-only operations. Minor gaps exist around richer metadata or facet browsing, but agents can work around them.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • 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.
      149
      MIT
    • A
      license
      A
      quality
      D
      maintenance
      Enables natural-language access to India's Open Government Data platform, letting users discover datasets, inspect schemas, and query live data from data.gov.in.
      4
      MIT
    • A
      license
      A
      quality
      B
      maintenance
      Gives a language model direct access to Peru's National Open Data Platform: searching datasets, viewing their metadata and resources, previewing CSV columns and rows, and running filters and aggregations over full CSVs with source citation. It also exposes catalog resources and a prompt template for answering questions with public data.
      6
      MIT