MoSPI MCP Server

MoSPI MCP Server

mospi•bynso-india

An MCP server built with FastMCP that provides AI-ready access to India's Ministry of Statistics and Programme Implementation (MoSPI) open data APIs for economic, demographic and social indicators.

License: MIT•Runtime: Awaiting documentation review•Category: databases storage

WHAT IT DOES

  • •Exposes four tools that follow a sequential workflow: list_datasets, get_indicators, get_metadata and get_data.
  • •Covers a wide range of official statistical datasets including employment, inflation, GDP, energy, education, gender, health, housing, agriculture and financial statistics.
  • •Validates API parameters against Swagger YAML specifications rather than hardcoded values.
  • •Includes OpenTelemetry integration for observability and supports Docker-based deployment.

BEST FOR

  • •Asking natural language questions about Indian economic, demographic and social statistics through an AI assistant.
  • •Retrieving filtered dataset values such as state-wise or year-specific indicators by following the tool workflow.

ABOUT MOSPI

MoSPI MCP Server is cataloged as an MCP server attributed to nso-india. An MCP server built with FastMCP that provides AI-ready access to India's Ministry of Statistics and Programme Implementation (MoSPI) open data APIs for economic, demographic and social indicators. It is categorized under databases storage. See the capability inspector for recorded interfaces and their independent review status; consult upstream documentation for the current interface.

HOW TO INSTALL

Installation configuration is not reviewed. No executable setup is offered for this entry; inspect the source repository before proceeding.

LICENSE

Catalog license label: MIT. Check the source repository's current license and terms before using, modifying or distributing this software.

能力检查器

能力定义尚未审核。未核验的采集内容不会作为可信接口展示。

Tools (0)

暂无可展示的已审核记录。这不表示上游不支持此能力。

Resources (0)

暂无可展示的已审核记录。这不表示上游不支持此能力。

Prompts (0)

暂无可展示的已审核记录。这不表示上游不支持此能力。

NEWSLETTER - COMING LATER

Newsletter subscriptions are not open yet

Email delivery is not connected. This page does not collect email addresses or create subscriptions.

Browse the registry for current listings instead.

Community Reviews

Coming later

Reviews for MoSPI MCP Server are not available yet

Review publishing and storage are not connected. This page does not collect or publish ratings or comments, including after sign-in.

FREQUENTLY ASKED QUESTIONS

Do the MCP tools need to be called in a particular order?

Yes. The tools are meant to be called sequentially; skipping get_metadata results in invalid filter codes.

Can the server be self-hosted?

Yes. The README provides self-hosting instructions, including running the server with the FastMCP CLI over HTTP or stdio transport.

上游原版 README

在 GitHub 查看同一版本原文

README.md · ec2160e7a453 · 采集于 2026-11-13 12:17:03 UTC

保留上游原文,不做 AI 改写。为安全起见过滤脚本、表单和不安全链接。

当前显示最后一次成功采集的文档快照,请以来源页面为准。

MoSPI MCP Server

License: MIT Python 3.11+ FastMCP MCP Server Tests

MCP (Model Context Protocol) server for accessing India's Ministry of Statistics and Programme Implementation (MoSPI) data APIs. Built with FastMCP 3.3.


Table of Contents


Overview

This server provides AI-ready access to official Indian government statistics through the Model Context Protocol (MCP). It acts as a bridge between AI assistants (Claude, ChatGPT, Cursor, etc.) and MoSPI's open data APIs, enabling natural language queries for economic, demographic, and social indicators.

Key Features:

  • Following statistical datasets covering employment, unemployment, inflation, industrial and services production, GDP and national accounts, energy and renewable energy, higher and school education, gender, health and nutrition, disability, housing and sanitation, household consumption and expenditure, time use, agriculture and livestock, land holdings, debt and investment, AYUSH, environment and climate, banking and financial statistics, economic census, unincorporated enterprises, telecom and digital connectivity.
  • Sequential 4-tool workflow designed for LLM consumption
  • Swagger-driven parameter validation
  • Full OpenTelemetry integration for observability
  • Production-ready Docker deployment
  • Note: Some NSS rounds include sub-parts (NSS77A, NSS79C, NSS76C, NSS80E), which are shown as separate entries in the README for user understanding. On the server, however, these sub-parts are accessible through their respective parent NSS round dataset (NSS77, NSS79, NSS76, NSS80) itself, rather than as independent datasets.

Dataset Reference

Sr. No.DatasetFull NameUse For
1PLFSPeriodic Labour Force SurveyEmployment, unemployment, labour force participation, worker population ratio, wages, employment by industry and occupation
2CPIConsumer Price IndexRetail inflation, cost of living, inflation by commodity group, state-wise and rural/urban price indices
3IIPIndex of Industrial ProductionIndustrial growth, manufacturing output, mining, electricity generation, sector-wise production indices
4ASIAnnual Survey of IndustriesFactory performance, industrial employment, wages, fixed capital, output, value added, productivity
5NASNational Accounts StatisticsGDP, GVA, national income, sector-wise economic growth, savings, capital formation
6WPIWholesale Price IndexWholesale inflation, producer prices, commodity price indices, inflation trends
7ENERGYEnergy StatisticsEnergy production, consumption, installed capacity, fuel mix, energy intensity, renewable energy statistics
8AISHEAll India Survey on Higher EducationUniversities, colleges, enrolment, teachers, Gross Enrolment Ratio (GER), Gender Parity Index (GPI), higher education infrastructure
9ASUSEAnnual Survey of Unincorporated Sector EnterprisesUnincorporated enterprises, MSMEs, employment, output, value added, informal sector statistics
10GENDERGender StatisticsGender indicators, women empowerment, sex ratio, labour participation, education, health, crimes against women
11NFHSNational Family Health SurveyFertility, family planning, maternal and child health, nutrition, infant mortality, health indicators
12ENVSTATSEnvironment StatisticsClimate, biodiversity, forests, air and water quality, environmental resources, pollution indicators
13RBIRBI StatisticsBanking, money supply, foreign exchange reserves, exchange rates, balance of payments, external sector, financial indicators
14NSS77Survey 1 - Situation Assessment of Agricultural Households / Land and Livestock Holdings
Survey 2 - All India Debt and Investment Survey (AIDIS)
Survey 1: Land holdings, livestock ownership, crop insurance and farming assets.
Survey 2: Household assets, liabilities, debt, investment, borrowing patterns and wealth distribution.
15NSS78NSS 78th Round – Multiple Indicator SurveyDrinking water, sanitation, housing amenities, migration, digital connectivity, household living conditions
16CPIALRLConsumer Price Index for Agricultural and Rural LabourersRural inflation, agricultural labourer cost of living, rural wage index, inflation trends
17HCESHousehold Consumption Expenditure SurveyHousehold consumption, expenditure patterns, poverty estimation, inequality, consumer behaviour
18TUSTime Use SurveyTime allocation, unpaid care work, paid work, household activities, gender time-use patterns
19ECEconomic CensusEstablishments, enterprises, employment, ownership, economic activity, district-wise business statistics
20NSS79Survey 1 - Survey on AYUSH
Survey 2 - Comprehensive Annual Modular Survey (CAMS)
Survey 1: AYUSH awareness and utilisation, treatment preferences, expenditure on AYUSH services.
Survey 2: Education, health expenditure, financial inclusion and digital literacy.
21UDISEUDISE+ (Unified District Information System for Education Plus)Schools, enrolment, dropout, teachers, PTR, GER, NER, GPI, CWSN, ICT facilities, school infrastructure
22MNRERenewable Energy Statistics (Ministry of New and Renewable Energy)Installed renewable energy capacity, solar, wind, hydro, bioenergy, state-wise renewable energy generation
23NSS76Survey 1 - Drinking Water, Sanitation, Hygiene and Housing Conditions
Survey 2 - Persons with Disabilities in India
Survey 1: Drinking water sources, water treatment, sanitation, housing characteristics, flood experience.
Survey 2: Disability prevalence, education, employment, accessibility, assistive devices, care arrangements.
24NSS75ENSS 75th Round – Social Consumption on EducationLiteracy, educational attainment, school attendance, education expenditure, internet and computer access, GER/NAR
25NSS80Survey 1 - Comprehensive Modular Survey: Telecom (CMST)
Survey 2 - Comprehensive Modular Survey: Education (CMSE)
Survey 1: Mobile phone ownership, internet usage, telecom access, digital services, online banking, cyber security awareness.
Survey 2: School enrolment, education expenditure, tuition fees, private coaching, scholarships, sources of education funding.
26NSS73NSS 73rd Round – Unincorporated Non-Agricultural EnterprisesEnterprise type, enterprise ownership, hired workers, annual emoluments, GVA per worker, employment type, working hours, activity category, sector-wise and state-wise enterprise statistics
27NSS74NSS 74th Round – Services Sector EnterprisesService sector enterprises, registration status, establishments by activity, ICT use, workers per establishment, value per establishment, structural ratios
28NSS71Survey 1 - Social Consumption: Education in India
Survey 2 - Social Consumption: Health in India
Survey 1: Literacy rate, completed level of education, dropout/never-enrolled, attendance and enrolment status, expenditure per student.
Survey 2: Medical expenditure and healthcare, economic independence and mobility, childbirth hospitalisation
29NSS72NSS 72nd Round – Household Expenditure on Services and Durable GoodsHousehold expenditure on transport and miscellaneous consumer services, durable goods acquisition, MPCE, budget share, households having NAE, quintile class of UMPCE
30NSS72TNSS 72nd Round – Domestic Tourism Expenditure in IndiaOvernight and same-day trips, purpose of trip, mode of travel, type of stay, nights spent, tourism expenditure per trip, package vs non-package trips
31ISPIndex of Service ProductionServices sector growth, monthly services output, sub-sector indices

MCP Tools

The server exposes 4 tools that follow a sequential workflow:

list_datasets   get_indicators   get_metadata   get_data
StepToolDescription
1list_datasets()Overview of all datasets. Start here to find the right dataset.
2get_indicators(dataset)List available indicators for the chosen dataset.
3get_metadata(dataset, ...)Get valid filter values (states, years, categories) and API parameters.
4get_data(dataset, filters)Fetch data using filter key-value pairs from metadata.

Important: Tools must be called in order. Skipping get_metadata will result in invalid filter codes.


Quick Start

If you want to connect your AI agent of choice with the MCP server, you can directly connect it with MOSPI's MCP server. Video Guides to connect ChatGPT or Claude to MCP are available here -

https://github.com/user-attachments/assets/a08376ca-8835-479f-9374-1cca63d5631c

https://github.com/user-attachments/assets/a2d65b8f-c938-43fa-856c-35088063f4bd

To get more information, visit - https://www.datainnovation.mospi.gov.in/mospi-mcp

The instructions below are for self-hosting the MCP server.

Installation

# Clone the repository
git clone https://github.com/nso-india/esankhyiki-mcp.git
cd esankhyiki-mcp

# Create virtual environment (recommended)
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

# Install dependencies
pip install -r requirements.txt

Running the Server

# HTTP transport (remote access)
python mospi_server.py

# OR using FastMCP CLI
fastmcp run mospi_server.py:mcp --transport http --port 8000

# stdio transport (local MCP clients)
fastmcp run mospi_server.py:mcp

Server runs at http://localhost:8000/mcp

Connecting from CLI Tools

Server URL: https://mcp.mospi.gov.in/

Claude Code

claude mcp add esankhyiki-mcp --transport http https://mcp.mospi.gov.in/

Verify with claude mcp list.

Cursor / Windsurf

Add to .cursor/mcp.json or .windsurf/mcp.json:

{
  "mcpServers": {
    "esankhyiki-mcp": {
      "command": "npx",
      "args": ["mcp-remote", "https://mcp.mospi.gov.in/"]
    }
  }
}

Antigravity

Add to your Antigravity MCP settings:

{
  "mcpServers": {
    "mospi_api": {
      "serverUrl": "https://mcp.mospi.gov.in/"
    }
  }
}

Verify Connection

curl -s -X POST https://mcp.mospi.gov.in/ \
  -H "Content-Type: application/json" \
  -H "Accept: application/json, text/event-stream" \
  -d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-03-26","capabilities":{},"clientInfo":{"name":"test","version":"0.1"}}}'

A successful response returns serverInfo with "name": "MoSPI Data Server".

Local Server

If running locally:

claude mcp add esankhyiki-mcp --transport http http://localhost:8000/mcp

Or with the FastMCP Python client:

import asyncio
from fastmcp import Client

async def main():
    async with Client("http://localhost:8000/mcp") as client:
        overview = await client.call_tool("list_datasets", {})
        print(overview)

asyncio.run(main())

Deployment

Docker

# Build the image
docker build -t mospi-mcp .

# Run the container
docker run -d -p 8000:8000 --name mospi-server mospi-mcp

Docker Compose

Includes Jaeger for distributed tracing visualization:

docker-compose up -d

Services:

FastMCP Cloud

  1. Push code to GitHub
  2. Sign in to FastMCP Cloud
  3. Create project with entrypoint mospi_server.py:mcp

Architecture

mospi-mcp-api/
├── mospi_server.py          # FastMCP server - tools, validation, routing
├── mospi/
│   └── client.py            # MoSPI API client - HTTP requests to api.mospi.gov.in
├── swagger/                 # Swagger YAML specs per dataset (source of truth for params)
│   └── swagger_user_*.yaml
├── observability/
│   └── telemetry.py         # OpenTelemetry middleware for tracing
├── tests/                   # Pytest suite (covering all datasets)
├── Dockerfile               # Production container with OTEL instrumentation
├── docker-compose.yml       # Full stack with Jaeger
└── requirements.txt

Design Principles

PrincipleImplementation
Swagger as Source of TruthAPI parameters validated against YAML specs in swagger/, not hardcoded
Auto-routingCPI routes to Group/Item endpoint based on filters; IIP routes to Annual/Monthly
Validation FirstAll filters validated before API calls with clear error messages
LLM-OptimizedTool docstrings document parameters, return values, and workflow sequence

Testing

pip install -r tests/requirements-test.txt
pytest tests/ -v -p no:anyio

Runs in-process against the MCP server (no running server needed). Covers all datasets across all 4 tools. See CONTRIBUTING.md for details.


Configuration

Environment variables for OpenTelemetry:

VariableDescriptionDefault
OTEL_SERVICE_NAMEService name in tracesmospi-mcp-server
OTEL_EXPORTER_OTLP_ENDPOINTOTLP collector endpointhttp://localhost:4317
OTEL_EXPORTER_OTLP_PROTOCOLProtocol (grpc or http/protobuf)grpc
OTEL_TRACES_EXPORTERExporter type (otlp, console, none)otlp

See .env.example for full configuration options.


Contributing

We welcome contributions! Please see CONTRIBUTING.md for guidelines on:

  • Adding new datasets
  • Project structure
  • Development setup
  • Code style

Resources


License

This project is licensed under the MIT License - see the LICENSE file for details.


DIID

The Data Innovation Lab aims to promote innovation and the use of Information Technology in official statistics, including modernizing survey methods. It seeks to address the current challenges faced by the National Statistical System (NSS). The lab will serve as a platform for testing and developing new ideas through proof-of-concept projects. It will foster collaboration with a wide range of participants such as entrepreneurs, researchers, start-ups, academic institutions, and renowned national and international organizations. By creating an open and dynamic environment, the lab will support the advancement of statistical systems and help improve the quality and efficiency of data collection and analysis.

Know more: https://www.datainnovation.mospi.gov.in/home

Acknowledgments

Made in partnership with Bharat Digital in pursuit of modernising and humanising how governments use technology in service of the public.

Install configuration

Are you the maintainer?

Claim this server with your GitHub account to request manual ownership verification.

README Embed Badge
Markdown

Link to the catalog listing for MoSPI MCP Server from your README. This badge does not certify ownership, compatibility or security.

[![MCP catalog listing](https://img.shields.io/badge/MCP-awesome--mcp-orange?style=flat-square)](https://awesome-mcp.com/servers/mospi)

REPOSITORY STATS

GitHub StarsUnavailable
ForksUnavailable

Public repository statistics could not be verified. Check the configured source address; unavailable counts are not zero.

下载与拉取统计

来源、范围和时段分别列出;不相加,不代表安装人数、活跃用户或安全审核。

尚无已审核的包 / 镜像标识,暂不展示下载统计。

Related databases storage MCP Servers

Alternative and complementary servers in the same category

View all in databases storage →
AIStor MCP server
mcp-server-aistor•minio

This is a Model Context Protocol (MCP) server for interacting with AIStor object stores.

Repository stats unavailable
Databases & Storage
InfluxDB v2 MCP Server
influxdb-mcp-server•idoru

A Model Context Protocol (MCP) server that exposes access to an InfluxDB v2 instance using the InfluxDB OSS API v2.

Repository stats unavailable
Databases & Storage