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.
- 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.
- 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).
-
Clone the repository
-
Install dependencies
npm install
-
Configure Environment Variables This server requires the
ESTAT_API_KEYenvironment variable.For Local Development: Create a
.dev.varsfile in the project root:ESTAT_API_KEY=your_app_id_hereFor Production (Cloudflare Deployment): Set the secret using Wrangler:
npx wrangler secret put ESTAT_API_KEY # Enter your App ID when prompted
To run the MCP server locally for testing:
npm run devThis will start the server at http://localhost:8787.
To deploy to your Cloudflare Workers account:
npm run deployTo 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"
]
}
}
}Searches for statistical tables.
- Parameters:
searchWord,statsCode,limit, etc.
Searches for surveys. Useful for data discovery.
- Parameters:
searchWord,limit, etc.
Retrieves structure and classification information for a table.
- Parameters:
statsDataId(Required).
Fetches the actual data records.
- Parameters:
statsDataId(Required), and optional filters likecdCat01,cdTime,cdArea.