Spain Open Data MCP
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Spain Open Data MCP what was the CPI change in Spain each of the last 6 months?"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Spain Open Data MCP
Give AI agents reliable access to Spanish public data: INE statistics, the BOE and the Catastro.
🇪🇸 Versión en español más abajo
Ask your assistant things like:
"What was the annual CPI change in Spain in each of the last 6 months?"
"Did the BOE publish anything about housing today?"
"What's at 40.4168, -3.7038? How old is the building and how big is it?"
"Write a renovation-oriented report for cadastral reference 9872023VH5797S0001WX."
The model picks the right tools, chains them and cites the source of every figure.
Why this exists
Spanish public data is excellent but scattered across three very different APIs: INE's JSON, the BOE's XML-shaped JSON and Catastro's legacy web services. Each one has its own conventions, casing and error formats. An agent that talks to them directly wastes tokens on parsing and gets things wrong.
This server hides those differences behind 8 small, typed, read-only tools designed for LLMs: they return clean, structured output, they let the model limit how much it pulls into its context, and they turn upstream failures into short messages it can act on.
Related MCP server: ayudas-es-mcp
Tools
Source | Tool | What it does |
INE |
| Find statistical operations (IPC, EPA, IPV…). Accent-insensitive. |
INE |
| List the tables of an operation. |
INE |
| Latest N values of the series in a table, filterable by series name. |
INE |
| Latest N values of one series. |
BOE |
| What the BOE published on a day, filterable by keyword and section, with HTML/PDF links. |
Catastro |
| Parcel and address at a point. On a street or square, the nearest parcels within ~50 m. |
Catastro |
| Address and coordinates of a cadastral reference. |
Catastro |
| Use, built area, year built and units of a property. |
It also includes a property_report prompt that chains Catastro, INE and the BOE into a short, sourced report about a property.
All tools are marked readOnlyHint / openWorldHint, so clients can auto-approve them safely.
Quick start
# Run it without installing anything permanent (requires uv)
uvx --from git+https://github.com/gabicuesta/spain-open-data-mcp spain-open-data-mcpClaude Desktop / Claude Code
{
"mcpServers": {
"spain-open-data": {
"command": "uvx",
"args": ["--from", "git+https://github.com/gabicuesta/spain-open-data-mcp", "spain-open-data-mcp"]
}
}
}# Claude Code
claude mcp add spain-open-data -- uvx --from git+https://github.com/gabicuesta/spain-open-data-mcp spain-open-data-mcpRemote (Streamable HTTP)
spain-open-data-mcp --transport streamable-http --host 0.0.0.0 --port 8000
# endpoint: http://localhost:8000/mcpArchitecture
flowchart LR
A[AI client<br/>Claude, IDE, agent] -- MCP stdio / HTTP --> S[server.py<br/>tools · prompt · errors]
S --> I[ine.py]
S --> B[boe.py]
S --> C[catastro.py]
I & B & C --> H[http.py<br/>shared client · TTL cache · timeouts]
H --> INE[(INE Tempus3 API)]
H --> BOE[(BOE open data API)]
H --> CAT[(Catastro OVC services)]server.pyonly does wiring: tool schemas, descriptions written for the model, and translating errors.One module per source with pure async functions and Pydantic models. They're testable without MCP.
http.pyholds one sharedhttpxclient, timeouts, a 10-minute in-memory cache and readable errors.
Design decisions
The full records are in docs/adr.
Few, composable tools instead of one per endpoint. Fewer tools means better tool selection by the model. (ADR 0001)
The model controls output size. Every tool has
limit,last_norquery, and the defaults are small. Context is a budget. (ADR 0001)Tolerant parsing. These APIs serialise XML to JSON: one element comes back as a dict, many as a list, and key casing varies. Parsers search generically instead of following fixed paths. (ADR 0002)
Errors are part of the UX.
"Catastro: NO HAY NINGUNA PARCELA EN ESA UBICACION"lets the model recover. A stack trace doesn't.Privacy by construction. Only non-protected Catastro data exists in these services. No owners and no cadastral values.
Development
git clone https://github.com/gabicuesta/spain-open-data-mcp && cd spain-open-data-mcp
uv venv && uv pip install -e ".[dev]"
pytest # offline: fixtures + in-process MCP client
pytest -m live # smoke tests against the real APIs
ruff check . && ruff format --check .Try it interactively with the MCP Inspector:
npx @modelcontextprotocol/inspector uv run spain-open-data-mcpThe offline tests have two layers. Unit tests check each parser against recorded responses. Protocol tests call the tools through a real MCP client in-process: tool listing, annotations, structured output and error paths. The live tests catch upstream schema drift. CI runs them weekly.
Roadmap
More INE helpers: geographic filters and pre-selected housing and construction tables
BOE consolidated legislation search
Catastro: buildings within a radius, cartography (WMS) as images
Optional persistent cache (SQLite) for heavy use
Evals: a set of questions with expected answers to measure tool selection across models
License
MIT. Data © INE, Agencia Estatal BOE and Dirección General del Catastro, under their respective reuse terms. This project is not affiliated with any of them.
🇪🇸 En español
Servidor MCP que da a los agentes de IA acceso fiable a datos públicos españoles: estadísticas del INE, el BOE y el Catastro.
Los datos públicos españoles son muy buenos, pero están repartidos en tres APIs muy distintas, cada una con sus convenciones, sus formatos y sus errores. Este servidor los unifica en 8 herramientas pequeñas, tipadas y de solo lectura, pensadas para modelos de lenguaje: devuelven datos estructurados, dejan al modelo limitar cuánto contexto consume y convierten los fallos en mensajes accionables.
Ejemplos de preguntas:
"¿Cuál fue la variación anual del IPC en España en cada uno de los últimos 6 meses?"
"¿Ha publicado hoy el BOE algo sobre vivienda?"
"¿Qué hay en 40.4168, -3.7038? ¿De qué año es el edificio y qué superficie tiene?"
"Prepara un informe orientado a reforma para la referencia catastral 9872023VH5797S0001WX."
Instalación: usa la configuración de Quick start. Funciona con Claude Desktop, Claude Code y cualquier cliente MCP.
Decisiones clave:
Pocas herramientas que se combinan bien.
Salida acotada por defecto.
Parsing tolerante a las rarezas de cada API.
Errores legibles.
Solo datos no protegidos del Catastro: ni titulares ni valores catastrales.
Las decisiones completas están en docs/adr.
Available Tools
8 toolsboe_daily_summaryBOE: daily summaryARead-onlyIdempotent
List what the BOE published on a given day, with links to HTML and PDF.
Inputs: day, limit, query, section. Returns: date, items, returned, total_items
catastro_coordinates_from_referenceCatastro: locate a referenceBRead-onlyIdempotent
Get the address and coordinates of a cadastral reference.
Inputs: cadastral_reference (required). Returns: result
catastro_property_detailsCatastro: property detailsARead-onlyIdempotent
Use, built area, year built and units of a property. A 14-char parcel reference with
several properties returns candidates; call again with one of them.
Inputs: cadastral_reference (required). Returns: use, kind, units, address, +4 more
catastro_reference_from_coordinatesCatastro: parcel at coordinatesARead-onlyIdempotent
Find the cadastral parcel and address at a point in Spain. If the point is on a street or square, returns the nearest parcels (match='nearby', with distance_m).
Inputs: latitude (required), longitude (required). Returns: result
ine_get_seriesINE: get a seriesCRead-onlyIdempotent
Fetch the latest values of a single INE series.
Inputs: series_code (required), last_n. Returns: code, name, points
ine_get_tableINE: get table dataBRead-onlyIdempotent
Fetch the latest values of the series in an INE table.
Inputs: table_id (required), query, last_n, max_series. Returns: result
ine_list_tablesINE: list tables of an operationCRead-onlyIdempotent
List the data tables published for an INE operation.
Inputs: operation (required), limit, query. Returns: result
ine_search_operationsINE: search statistical operationsBRead-onlyIdempotent
Find INE statistical operations (IPC, EPA, Índice de Precios de Vivienda...). Accent-insensitive.
Inputs: limit, query. Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 8 tools
Each tool targets a distinct action and resource: INE tools progress from search to list to get, BOE is a single daily summary, and Catastro tools are complementary (coordinates↔reference plus property details). No two tools appear interchangeable.
All names are snake_case with a consistent source prefix (ine_, boe_, catastro_). Within each source the patterns are predictable, but action styles differ across sources (verb_noun for INE, noun_from_noun for Catastro), a minor deviation from a single global convention.
Eight tools for three data sources is well-scoped; each tool has a clear role and the set avoids both thinness and bloat.
While core retrieval is covered, there are notable gaps: BOE only offers a daily summary (no search or date range), INE lacks historical/metadata queries, and Catastro has no address-based search. These will limit some agent workflows.
Maintenance
Related MCP Connectors
Search Spain's BOE/BORME gazettes, open EU funding calls and EU TED tenders. Keyless sources.
AI legal copilot for foreigners in Spain: immigration and housing rental, cited to Spanish law.
Search open Spanish public-sector tenders, updated daily, and estimate an offer. Read-only.
Data and tools for your AI agent: company, people, SEO, social and EU register data. Pay per call.
Related MCP Servers
- AlicenseBqualityCmaintenanceEnables LLMs like Claude to query the official Spanish BOE API for consolidated legislation, daily summaries, and auxiliary government tables.3162MIT
- AlicenseAqualityCmaintenanceEnables AI clients to query Spain's official BDNS subsidy and grant listings and BOE open-data publications live, with exact counts, computed deadlines, forecast calendars, and literal PDF text of grant bases. It also surfaces BOE oposiciones and licitaciones, flagging uncertainty instead of inventing data.1056 npmMIT
- AlicenseAqualityBmaintenanceEnables Claude, Cursor, and other MCP clients to search Spanish BOE/BORME gazettes, open and forthcoming EU funding calls, and TED public procurement notices through read-only tools that return live JSON with source links.31MIT
- AlicenseBqualityAmaintenanceEnables AI agents and developers to search and inspect Spanish public data sources, learn their endpoints and pitfalls, and retrieve ready-made data such as municipal profiles, economic indicators, company records, procurement, subsidies, and location reports.13131Creative Commons Zero v1.0 Universal