Content
README in English is [here](README_en.md)
# e-Stat MCP Server
[政府統計の総合窓口(e-Stat)](https://www.e-stat.go.jp/)の[API機能](https://www.e-stat.go.jp/api/) MCP server to make it accessible to generative AI.
## What is MCP?
Model Context Protocol (MCP) is a format for teaching generative AI what an application provides. Anthropic proposed it in November 2024, and it is becoming a standard. An implementation as a server that waits for requests from generative AI is called an MCP server. Many MCP servers are being created to make existing services accessible to generative AI.
## Tools
* get_tables
- Performs statistical table information acquisition (URL: getStatsList).
* get_surveys
- Acquires a list of statistical survey names from statistical table information acquisition (URL: getStatsList).
* get_metadata
- Acquires meta information (URL: getMetaInfo).
- Required parameter
- 統計表ID(statsDataId)
* get_data
- Acquires statistical data (URL: getStatsData).
- Required parameter
- 統計表ID(statsDataId)
Each function is implemented to convert the e-Stat API response into a simplified JSON format.
## How to use
### Acquiring an Application ID for e-Stat
Please register as a user of e-Stat and obtain an application ID according to the [User Guide](https://www.e-stat.go.jp/api/api-info/api-guide).
### Claude Desktop Settings
If you are using Claude Desktop, add the following description to `claude_desktop_config.json`. `claude_desktop_config.json` is located in `~/Library/Application\ Support/Claude/` on Mac and `%AppData%\Claude\` on Windows.
#### If you have a built jar file
```json
{
"mcpServers": {
"eStatMCP": {
"command": "java",
"args": [
"-jar",
"build/libs/<your-jar-name>.jar"
],
"env": {
"ESTAT_API_KEY": "<アプリケーションID>",
"RESPONSE_SIZE": "100"
}
}
}
}
```
#### Using Docker
```json
{
"mcpServers": {
"eStatMCP": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"-e",
"ESTAT_API_KEY",
"-e",
"RESPONSE_SIZE",
"ichiro21/estat-mcp"
],
"env": {
"ESTAT_API_KEY": "<アプリケーションID>",
"RESPONSE_SIZE": "100"
}
}
}
}
```
Please enter your e-Stat application ID in `<アプリケーションID>`.
Specify the number of data to be received from the e-Stat API at one time in `RESPONSE_SIZE`. Use this when you want to limit the context length of the AI chat. The default on the e-Stat API side is 100,000.
### VS Code Settings
If you are using VS Code, add the following description to `settings.json`. You can open `settings.json` by selecting `Preferences: Open User Settings (JSON)` from the menu that appears when you press `Ctrl + Shift + P` in VS Code.
#### Using Docker
```json
{
"mcp": {
"servers": {
"eStatMCP": {
"type": "stdio",
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"-e",
"ESTAT_API_KEY",
"-e",
"RESPONSE_SIZE",
"ichiro21/estat-mcp"
],
"env": {
"ESTAT_API_KEY": "${env:ESTAT_API_KEY}",
"RESPONSE_SIZE": "100"
}
}
}
}
}
```
In VS Code, you can call OS environment variables like `${env:ESTAT_API_KEY}` in the settings. If you do not use OS environment variables, you can enter them directly or have VS Code remember them. (See the example entry [here](https://code.visualstudio.com/docs/copilot/chat/mcp-servers#_add-an-mcp-server-to-your-workspace))
### Building the Server Program
To build this MCP server, you need Java 17 or later and Gradle. Create a jar file with the following command.
```shell
./gradlew clean build -x test
```
## Example Usage
### Get statistics on the economy
[https://claude.ai/share/ac66bee7-1178-4f8a-977c-cdd6629c0f21](https://claude.ai/share/ac66bee7-1178-4f8a-977c-cdd6629c0f21)
If you have not decided on the survey name you want to investigate, you can search for statistical surveys before searching for statistical tables.
### Get statistics on population
[https://claude.ai/share/5f6874e2-4fc6-42e5-a8dd-6e8feb6158df](https://claude.ai/share/5f6874e2-4fc6-42e5-a8dd-6e8feb6158df)
It got the latest data on population estimates.
### Get the results of the Tokyo household survey (partially)
[https://claude.ai/share/d393e0cc-50ec-4770-9ae0-600740bb275d](https://claude.ai/share/d393e0cc-50ec-4770-9ae0-600740bb275d)
The metadata of the household survey results table was too large and exceeded Claude's context length.
### Get the population by 5-year age group from population estimates
[https://claude.ai/share/e33bbc27-6094-4feb-984f-5c2cf6d5e5a2](https://claude.ai/share/e33bbc27-6094-4feb-984f-5c2cf6d5e5a2)
It accurately acquired the data when I specified the name of the statistical survey and the item name. I specified to search by "statistical table" in order to prevent it from acquiring the "reference table" of population estimates.
Connection Info
You Might Also Like
markitdown
MarkItDown-MCP is a lightweight server for converting URIs to Markdown.
markitdown
Python tool for converting files and office documents to Markdown.
Filesystem
Node.js MCP Server for filesystem operations with dynamic access control.
TrendRadar
TrendRadar: Your hotspot assistant for real news in just 30 seconds.
mempalace
The highest-scoring AI memory system ever benchmarked. And it's free.
mempalace
The highest-scoring AI memory system ever benchmarked. And it's free.