Skip to main content
Glama
e-Stat API Search MCP Server

e-Stat API Search MCP Server

by ichiromurata

e-Stat API Search MCP Server

This is a Model Context Protocol (MCP) server that runs on Cloudflare Workers and provides an interface to the e-Stat API (Official Statistics of Japan).

It allows AI agents (like Claude Desktop) to search for Japanese government statistical tables, inspect metadata, and retrieve statistical data for analysis.

Features

  • Search Tables (get_tables): Find statistical tables by keywords, ministry code, or category.

  • Search Surveys (get_surveys): Find available surveys if you are unsure about specific tables.

  • Get Metadata (get_metadata): Retrieve detailed metadata (classifications, area codes, time periods) for a specific table.

  • Get Data (get_data): Fetch the actual statistical data values based on the table ID and optional filters.

Related MCP server: mcp-estat-japan

Prerequisites

  • Node.js: (v18 or later recommended)

  • Cloudflare Wrangler: CLI tool for Cloudflare Workers.

  • e-Stat API Key: You must register to get an "Application ID" (appId).

Setup

  1. Clone the repository

  2. Install dependencies

    npm install
  3. Configure Environment Variables This server requires the ESTAT_API_KEY environment variable.

    For Local Development: Create a .dev.vars file in the project root:

    ESTAT_API_KEY=your_app_id_here

    For Production (Cloudflare Deployment): Set the secret using Wrangler:

    npx wrangler secret put ESTAT_API_KEY
    # Enter your App ID when prompted

Usage

Local Development

To run the MCP server locally for testing:

npm run dev

This will start the server at http://localhost:8787.

Deployment

To deploy to your Cloudflare Workers account:

npm run deploy

Connecting to Claude Desktop

To use this MCP server with Claude Desktop, add the following configuration to your Claude Desktop config file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json

  • Windows: %APPDATA%\Claude\claude_desktop_config.json

Configuration:

{
  "mcpServers": {
    "e-stat-search": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-cloudflare",
        "start",
        "https://<your-worker-name>.<your-subdomain>.workers.dev"
      ]
    }
  }
}

Note: Replace the URL with your deployed Cloudflare Worker URL, or use http://localhost:8787 if running locally along with mcp-remote.

Alternatively, if you are running locally and want to connect directly:

{
  "mcpServers": {
    "e-stat-local": {
      "command": "npx",
      "args": [
        "mcp-remote",
        "http://localhost:8787/sse"
      ]
    }
  }
}

Tools Available

get_tables

Searches for statistical tables.

  • Parameters: searchWord, statsCode, limit, etc.

get_surveys

Searches for surveys. Useful for data discovery.

  • Parameters: searchWord, limit, etc.

get_metadata

Retrieves structure and classification information for a table.

  • Parameters: statsDataId (Required).

get_data

Fetches the actual data records.

  • Parameters: statsDataId (Required), and optional filters like cdCat01, cdTime, cdArea.

Tool Schema Changelog

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

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      C
      quality
      B
      maintenance
      Enables access to Japan's official government statistics portal (e-Stat) API to search, retrieve, and analyze statistical data including census data, economic indicators, and demographic information across 17 statistical fields.
      13
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables AI agents to query Japanese public data (laws, corporations, statistics) from official government APIs, returning normalized English metadata with source attribution.
      1
      MIT