INE MCP: Querying Official Spanish Statistics Institute Data from AI Assistants
INE MCP is a Model Context Protocol server published by Spain’s National Statistics Institute (Instituto Nacional de Estadística, INE). It connects INE’s public JSON API to MCP clients such as Claude, Codex, Cursor, VS Code, Windsurf, Gemini CLI and Zed. Users ask questions in natural language, for example “What was the unemployment rate for men in Murcia over the last four quarters?”, and the assistant finds the relevant statistical operation, selects a data table, sets the filters, and returns the figures along with a link to the official INE table. The repository is written in Python and licensed under EUPL-1.2. Version 1.0.0 was released on 2026-11-26. When this material was collected, the repository had 157 stars and 5 forks.
Use cases
The server targets situations that need official Spanish statistics. It covers Spain as a whole as well as regional levels: autonomous communities, provinces and municipalities. Example questions in the README include Madrid’s CPI over the past year, Labour Force Survey tables that break down unemployment by age group or sex, and the latest population figures for each province.
Every figure is fetched live from the INE API at request time and does not depend on the model’s memory. Results include the statistical operation, the data table, the table’s public URL and the filters used, so they can be cited directly in reports or data checks.
Prerequisites
- Python 3.11 or later
- uv
- git
- An MCP-compatible client
The data is public, so the server needs no API key and no account authentication.
Installation
The clone URL in the README points to INE’s own GitLab, which differs from the es-ine/mcp repository on GitHub. Whether the two copies of the code are fully in sync is not verified.
git clone https://gitlab.ine.es/prod-estadistica/metodologia/ia-ready/mcp.git ine-mcp
cd ine-mcp
uv sync
uv run ine-mcp
The server uses the stdio transport by default and waits for an MCP client to connect after it starts. The terminal shows no output until a client connects, and the README notes that this is expected.
To update an existing clone, run git pull in the repository directory, then run uv sync again. The repository includes tests, which run as follows:
uv run pytest
Client setup
In the commands and configuration below, replace /path/to/ine-mcp with the absolute path of the cloned directory. Each command-line client registers the server with one line:
claude mcp add ine -- uv run --directory /path/to/ine-mcp ine-mcp
codex mcp add ine -- uv run --directory /path/to/ine-mcp ine-mcp
code --add-mcp '{"name":"ine","command":"uv","args":["run","--directory","/path/to/ine-mcp","ine-mcp"]}'
Most clients that read a JSON configuration file use the same mcpServers block. After pasting it in, restart the client:
{
"mcpServers": {
"ine": {
"command": "uv",
"args": ["run", "--directory", "/path/to/ine-mcp", "ine-mcp"]
}
}
}
Configuration file locations for each client:
- Claude Desktop (macOS):
~/Library/Application Support/Claude/claude_desktop_config.json - Claude Desktop (Windows):
%APPDATA%\Claude\claude_desktop_config.json - Cursor:
~/.cursor/mcp.jsonglobally,.cursor/mcp.jsonper project - Windsurf:
~/.codeium/windsurf/mcp_config.json - Gemini CLI:
~/.gemini/settings.json
The Microsoft Store version of Claude Desktop uses a longer path, which the README lists separately in full. VS Code’s .vscode/mcp.json uses a different format: the top-level key is servers, and "type": "stdio" must be added. Codex uses ~/.codex/config.toml instead:
[mcp_servers.ine]
command = "uv"
args = ["run", "--directory", "/path/to/ine-mcp", "ine-mcp"]
If the server does not appear in the client, the README’s troubleshooting advice is to confirm that the path is absolute and then fully restart the client.
Tools and call order
The server provides 5 read-only tools, which must be called in the following order:
ine_select_operation: searches the catalogue of statistical operations by name and description, for example CPI, the Labour Force Survey or GDPine_select_multiple_tables: lists the data tables under one or more operations, with optional filtering by search termine_select_multiple_table_groups: returns the variables (groups) that make up a data tableine_select_multiple_values: returns the values of the selected variables, such as provinces or sex categoriesine_select_multiple_table_data: extracts observations bytvparameter pairs and time period
The call order is enforced in code and cannot be turned off. Each step accepts only identifiers returned by the previous step. If a tool is called too early or with an ID that was never returned, the server responds with an error starting with BLOCKED that names the missing step and the tool to call next. Step 5 requires steps 2 through 4 to be complete for that table, and every tv filter must be correctly formatted with values taken from the step 4 response.
All 5 tools are annotated with readOnlyHint and openWorldHint, and the first 4 are also marked idempotent. Each tool accepts multiple requests in one call and processes them in parallel. Workflow state within a session is maintained by src/ine_mcp/state.py, and cache.py provides an in-memory TTL cache. Resources/ine_mcp_instructions.md contains the usage instructions the server sends to clients and is bundled into the package.
The README states that the Streamable HTTP transport is supported, and the transport selection logic is in server.py. The README gives no command or arguments for starting in HTTP mode, so the exact usage is not verified.
Limitations and caveats
- No hosted endpoint has been released yet, so the server can only run locally.
- Data availability and response times depend on the public INE API. For empty responses or failed requests, the README recommends retrying later.
- The catalogue includes 166 statistical operations. Of these, 110 have data tables and support the full 5-step flow. The remaining 56 are listed in the coming soon section of
Resources/Catalogue.mdand will return data only after INE publishes their tables. - Tool descriptions are in English. For data labels, the README overview says Spanish, while the limitations section says Spanish and English. The actual returned results are authoritative.
- The code is licensed under EUPL-1.2. Read
LICENSE.mdin the repository before modifying or redistributing it. - When reusing the figures, INE requires crediting INE as the data source and including the table URL from the results.
- The software is provided “as is” without any warranty, and the project is still under active development. Users need to review and test it themselves before using it in production.
- The server requires no personal data and forwards to the public INE API only the queries needed to answer a question.
Testing checklist
- Time taken by
uv syncon a 1C1G VPS, and memory usage whileuv run ine-mcpis running - How to start Streamable HTTP mode, and whether it can run on a VPS as a remote MCP service for local clients
- Whether the code at the GitLab clone URL matches the GitHub repository es-ine/mcp
- Whether, when questions are asked in Chinese, the assistant correctly matches Spanish or English operation names at the
ine_select_operationstep - The default TTL cache duration in
config.py, and whether it can be adjusted