Skip to main content
Glama
datagovin-mcp

datagovin-mcp

datagovin-mcp

MCP 서버로, Claude(또는 모든 MCP 클라이언트)에게 인도의 오픈 정부 데이터 플랫폼인 data.gov.in에 대한 자연어 접근을 제공합니다. 대기질, 농업, 보건, 연료 가격, 인구조사, 교육, 강우량 등 100,000개 이상의 공개 데이터셋을 다룹니다.

이 서버는 자체 데이터를 포함하지 않습니다. 얇고 안정적으로 동작하는 래퍼일 뿐입니다. 모든 쿼리는 사용자 자신의 무료 API 키를 사용해 data.gov.in에 실시간으로 호출됩니다. 이 서버가 더하는 것은 누락된 계층, 즉 데이터셋 검색과 깔끔한 쿼리입니다. 그래서 언어 모델은 "지금 델리의 AQI(대기질 지수)는 어떤가요?"에서 실제 데이터 행으로, 데이터셋 UUID를 손으로 찾아다닐 필요 없이 바로 도달할 수 있습니다.

왜 이런 프로젝트인가

data.gov.in은 방대한 카탈로그를 갖고 있지만 쓸 만한 전체 텍스트(full-text) 검색 API가 없습니다. 일반적인 절차는 웹사이트를 둘러본 뒤 "API" 버튼에서 데이터셋의 리소스 ID를 복사하는 것입니다. 이는 LLM에는 적합하지 않습니다. 이 서버는 키워드로 검색 가능한 큐레이션되고 검증된 인덱스와, 데이터셋의 스키마를 가져오고 필터링된 행을 실시간으로 추출하는 도구를 함께 제공해 그 격차를 메웁니다. 또한 업스트림 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" }
    }
  }
}

클라이언트를 재시작하면 네 가지 도구가 나타납니다.

대화 예시

사용자: 대기질에 대한 데이터셋은 무엇이 있으며? Claude: (search_datasets("air quality") 호출) → 측정소별 실시간 대기질 지수.

사용자: 어떤 필드들이 있지? Claude: (get_dataset_info(...) 호출) → country, state, city, station, pollutant_id, pollutant_avg, last_update…

사용자: Delhi의 PM2.5 측정값을 보여줘요. Claude: (query_dataset(resource_id, filters={"city": "Delhi", "pollutant_id": "PM2.5"}) 호출) → 라이브 행.

카탈로그 확장

카탈로그는 검증된 데이터가 초기 시드(seed)로 포함된 채 배포되며, 계속 성장하도록 설계되었습니다. 데이터셋을 추가하려면 data.gov.in 페이지의 "API" 버튼에서 리소스 ID를 복사한 뒤 다음을 실행하세요:

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

이 스크립트는 데이터셋의 실제 제목과 스키마를 라이브로 가져와 검증된 항목을 data/catalog.json에 추가합니다. --sector와 --keywords는 선택 사항입니다.

업스트림 API에 관한 노트

이 서버가 대신 처리해 주는 data.gov.in만의 몇 가지 동작:

  • 필터 필드 이름은 대소문자를 구분합니다 (filters[State] ≠ filters[state]). 이는 문서화되어 있지 않으므로, 항상 get_dataset_info가 제공하는 정확한 필드 id를 사용하세요.

  • 일부 레거시 데이터는 format=json 여부와 무관하게 CSV를 반환합니다. 클라이언트는 이를 Content-Type으로 감지하고 그대로 파싱합니다.

  • 마지막 페이지 페이징에서는 status: ok인데 빈 records 배열을 반납하는 경우가 있습니다. 결과 건수는 0인데 총합(total)이 양수라면 마지막 페이지를 지나간 것입니다.

  • 요청당 최대 대략 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.

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

    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

    ActivityInactive
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      B
      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.
      17
      43
      MIT
    • A
      license
      A
      quality
      D
      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.
      149
      MIT