Skip to main content
Glama
xaviviro

Opendata.cat MCP Server

by xaviviro

Opendata.cat MCP Server

Servidor MCP (Model Context Protocol) que connecta els models de llenguatge (Claude, ChatGPT, Gemini...) amb les dades obertes publiques de Catalunya. Cerca datasets, explora metadades i consulta dades reals de 15 portals directament des del teu assistent d'IA.

Un projecte d'opendata.cat — associacio sense anim de lucre fundada el 2012 que promou la transparencia, la difusio i l'estandarditzacio de les dades obertes a Catalunya. Inspirat en el projecte datagouv-mcp del govern frances.

Portals disponibles

Portals catalans

Portal

Datasets

API

Generalitat de Catalunya

1.059

Socrata (SoQL)

Consorci AOC

~887

CKAN datastore

Ajuntament de Barcelona

555

CKAN datastore

Idescat

138

Idescat API

Ajuntament de Reus

119

CKAN datastore

Diputacio de Barcelona

90

REST + JSON:API (CIDO)

Ajuntament de Girona

53

CKAN datastore

FGC (Ferrocarrils)

50

Opendatasoft + GTFS-RT

Renfe Rodalies

6

CKAN + GTFS-RT JSON

Fonts estatals amb focus Catalunya

Font

Datasets

Que aporta

INE

6

Poblacio, IPC, EPA (atur/ocupacio), turisme, PIB, habitatge — auto-filtrat a Catalunya

Red Electrica (REE)

4

Generacio electrica (mix energetic), demanda, balanc, preus PVPC temps real

SEPE

2

Atur registrat i contractes per municipis catalans

CNMC / Ministeri

1

Preus carburants a ~1.500 gasolineres de Catalunya, filtrables per municipi

+3.073 datasets de 15 portals. La majoria queryables amb filtres, cerca i paginacio.

El cataleg s'actualitza automaticament cada setmana. Crawling incremental amb --portal per carregar fonts noves sense re-escanejar tot.

Tipus d'acces:

  • Socrata: consulta SoQL amb filtres i cerca (Generalitat)

  • CKAN: datastore_search amb filtres i cerca (Barcelona, AOC, Reus, Girona, Renfe)

  • Diba REST: API do.diba.cat amb paginacio i filtres (Diputacio BCN)

  • CIDO JSON:API: api.diba.cat per contractacions, normatives, subvencions (Diputacio BCN)

  • Opendatasoft: API records amb filtres i cerca (FGC)

  • GTFS-RT: posicions GPS, alertes i retards dels trens FGC i Renfe Rodalies en temps real

  • Idescat: indicadors estadistics amb series temporals

  • INE: estadistica oficial d'Espanya filtrada automaticament a Catalunya

  • REE: generacio electrica, demanda i preus de l'electricitat (PVPC) en temps real

  • CNMC: preus de carburants per estacio de servei, filtrables per CCAA/provincia/municipi

  • GIS: simplificacio automatica de geometries (centroide + bbox)

  • Dades municipals AOC: 9 datasets amb dades de +1.000 municipis, filtrables per NOM_ENS

Related MCP server: Spanish Public Data MCP

Installacio rapida

Claude Desktop

Afegeix al fitxer de configuracio (~/Library/Application Support/Claude/claude_desktop_config.json a macOS o %APPDATA%\Claude\claude_desktop_config.json a Windows):

{
  "mcpServers": {
    "opendata-cat": {
      "command": "npx",
      "args": ["-y", "@opendata.cat/mcp-server"]
    }
  }
}

Claude Code (CLI)

claude mcp add opendata-cat -- npx -y @opendata.cat/mcp-server

VS Code / Cursor

Afegeix al fitxer .vscode/mcp.json del teu projecte:

{
  "servers": {
    "opendata-cat": {
      "command": "npx",
      "args": ["-y", "@opendata.cat/mcp-server"]
    }
  }
}

Windsurf / Cline / JetBrains / Gemini CLI / Warp / ChatGPT / Copilot Studio

Consulta la guia completa amb instruccions per a 13 clients MCP a opendata.cat/mcp.

Tambe pots connectar directament via Streamable HTTP sense instal·lar res:

https://opendata.cat/api/mcp

Tools disponibles

Tool

Descripcio

search_datasets

Cerca datasets per text lliure al cataleg de +3.073 datasets

get_dataset_info

Retorna metadades completes: camps, tipus, llicencia, endpoint

list_dataset_fields

Llista els camps d'un dataset amb nom, tipus i descripcio

query_dataset

Consulta dades reals directament al portal origen

list_portals

Llista els 15 portals disponibles amb estadistiques

list_categories

Llista categories i temes disponibles amb comptadors

related_datasets

Retorna datasets relacionats d'altres portals

search_radioteca

Cerca al cataleg de radioteca.cat (~485K episodis, programes i persones de Catalunya Radio, RAC1, Catalunya Musica, iCat, RTVE...). Sempre retorna URL absolut a radioteca.cat per trayabilitat

search_datasets

Cerca datasets per text lliure.

query: "qualitat aire"
portal: "barcelona"        # opcional: generalitat, barcelona, diba, aoc, reus, girona, fgc, idescat, renfe, ine, ree, sepe, cnmc
category: "Medi Ambient"   # opcional
limit: 20                  # opcional (defecte: 20)

query_dataset

Executa una consulta directament contra el portal origen i retorna dades reals.

dataset_id: "generalitat:gn9e-3qhr"
filters: {"estaci": "Sau"}   # opcional
search: "embassament"         # opcional
limit: 20                     # opcional (defecte: 20, max: 100)
offset: 0                     # opcional

Exemples de filtres per fonts estatals:

  • INE: auto-filtrat a Catalunya (poblacio, IPC, turisme...)

  • REE: ree:preus-electricitat — preus PVPC per hora

  • CNMC: filters: {"municipi": "Sabadell"} — gasolineres de Sabadell

Skills

A més de les tools i els prompts, el servidor publica skills: guies d'investigació (estil SKILL.md) que orienten l'LLM pas a pas en un domini concret — com triar el dataset, filtrar, paginar i citar bé. Es distribueixen dins el paquet (skills/) i es serveixen com a resources MCP (skill://<nom>/SKILL.md, via resources/list + resources/read) i com a prompts-pont invocables com a slash-command (/mcp__opendata_cat__skill_<nom>).

Skill

Per a què

consulta-dades-obertes

Orientació general: navegar els 15 portals, consultar directe vs cercar, paginació, cites

contractacio-publica

Investigar contractació pública: creuar PSCP, registres municipals i adjudicacions, sumar imports

radar-municipal

Retrat complet d'un municipi creuant portals (pressupost, deute, contractes, població)

patrimoni-i-hemeroteca

Recerca a Catalònica (BNC) i radioteca.cat amb selecció de subportal i cites obligatòries

Les mateixes skills es serveixen també des de l'endpoint HTTP https://opendata.cat/api/mcp.

Exemples d'us

Un cop configurat, pots fer preguntes al teu LLM com:

  • "Quin es l'estat dels embassaments de Catalunya?"

  • "Hi ha algun tren de Rodalies o FGC amb retard ara mateix?"

  • "Quina es la poblacio de Catalunya segons l'INE?"

  • "Quin es el preu de la gasolina a Sabadell avui?"

  • "Quant costa l'electricitat ara? (PVPC)"

  • "Analitza la qualitat de l'aire a Terrassa"

  • "Quina es la taxa d'atur a Catalunya?"

  • "Quantes pernoctacions turistiques hi ha a Barcelona?"

  • "Compara Girona i Tarragona en dades obertes"

  • "Dona'm les ultimes dades de pressupostos de Reus"

  • "Quin es l'endeutament de Tiana?"

Com funciona

Usuari → LLM → MCP opendata.cat → API opendata.cat (cataleg)
                                 → Portal origen (dades reals)
  1. L'MCP consulta l'API d'opendata.cat per descobrir datasets rellevants

  2. Quan l'usuari vol dades concretes, l'MCP fa la consulta directament al portal origen

  3. Les dades tornen a l'LLM, que les interpreta i presenta a l'usuari

No emmagatzema ni fa de proxy de dades. Cada consulta va directament a la font oficial.

API REST

A mes del servidor MCP, opendata.cat ofereix una API REST publica:

Endpoint

Descripcio

GET /api/all-datasets.php

Llistat complet amb paginacio, filtres i sort

GET /api/datasets.php?q=...

Cerca datasets per text lliure

GET /api/dataset.php?id=...

Detall complet d'un dataset

GET /api/categories.php

Categories i portals amb comptadors

POST /api/mcp

Servidor MCP (Streamable HTTP)

Documentacio interactiva (Swagger): opendata.cat/api/docs.html

Sobre opendata.cat

opendata.cat es una associacio catalana sense anim de lucre fundada el 2012 (registre 47468) dedicada a promoure la transparencia i l'acces a la informacio publica.

Changelog

v0.6.0 (2026-07-15)

  • Noves skills servides com a resources MCP (skill://<nom>/SKILL.md) + prompts-pont (skill_<nom>)

  • 4 skills d'investigació: consulta-dades-obertes, contractacio-publica, radar-municipal, patrimoni-i-hemeroteca

  • Empaquetades a skills/ i sincronitzades amb l'endpoint HTTP opendata.cat/api/mcp

v0.5.0 (2026-06-06)

  • Nou tool search_radioteca: cerca a radioteca.cat (~485K documents de radio catalana — 8 emissores)

  • Filtres publisher, year, type (Episode/Program/Person)

  • Tots els hits inclouen URL absoluta a radioteca.cat per trayabilitat

  • Proxy server-side a opendata.cat — la clau de Typesense no s'exposa al paquet npm

v0.3.1 (2026-04-17)

  • Handler CNMC preus carburants al paquet npm (abans nomes funcionava via HTTP)

  • Filtre per municipi i provincia: filters: {"municipi": "Sabadell"}

  • Per defecte retorna tota Catalunya (~1.500 gasolineres)

  • Nova og:image amb 13 portals i fonts estatals

v0.3.0 (2026-04-16)

  • 5 noves fonts estatals espanyoles amb focus Catalunya: INE, REE, SEPE, CNMC

  • Handler INE: estadistica oficial (poblacio, IPC, EPA, turisme, PIB, habitatge) auto-filtrat a Catalunya

  • Handler REE: generacio electrica, demanda, balanc, preus PVPC en temps real

  • Handler CNMC: preus carburants amb filtres per CCAA/provincia/municipi via API REST

  • Crawler incremental: flag --portal per carregar fonts noves sense re-escanejar tot

  • 13 portals, 2.857 datasets

v0.2.0 (2026-04-15)

  • Nou portal Renfe (Rodalies de Catalunya) — 6 datasets (estacions, viatgers, GTFS-RT temps real)

  • Handler GTFS-RT JSON amb filtre automatic a rutes Rodalies Barcelona (R1-R16, RT, RG, RL)

  • Instruccions reescrites en angles per millorar comprensio dels LLMs

  • Llistats de portals, keywords i categories a les instruccions

  • Tool descriptions i prompts traduits a angles

  • Nou prompt trens_rodalies_temps_real

v0.1.2 (2026-04-14)

  • Instructions integrades: l'LLM rep datasets destacats i pot fer query directe sense cercar

  • Fix Idescat: ara retorna l'indicador especific en lloc de 6 aleatoris

  • 9 datasets municipals AOC: pressupostos, cost serveis, endeutament de +1.000 municipis

v0.1.0 (2026-04-14)

  • Nou portal Idescat — 138 indicadors estadistics amb series temporals

  • Portals Reus i Girona

v0.0.17 (2026-04-14)

  • Decodificador GTFS-RT integrat: trens FGC en temps real

  • API REST documentada amb Swagger UI (OpenAPI 3.1)

v0.0.10 (2026-04-13)

  • Portal FGC (50 datasets via Opendatasoft)

  • 14 prompts predefinits

v0.0.1 (2026-04-12)

  • Versio inicial: Generalitat, Barcelona, Diba, AOC — 6 tools, npm

Llicencia

MIT

Available Tools

3 tools
list_dataset_fieldsAInspect

List fields of a dataset with name, data type and description.

ParametersJSON Schema
NameRequiredDescriptionDefault
dataset_idYesDataset identifier

TDQS

A3.6/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the burden. It implies a read-only operation by stating 'list', but does not explicitly disclose safety or authorization needs. For a simple tool with one parameter, this is minimally adequate.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single sentence that front-loads the core purpose and the returned fields. No redundant information.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a low-complexity tool with one parameter and no output schema, the description sufficiently specifies what the tool does and what fields are returned. However, lacking an output schema, the description does not detail the structure (e.g., list of JSON objects), which would be beneficial.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100% with dataset_id described as 'Dataset identifier'. The description does not add new meaning beyond the schema, so baseline score of 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('list fields') and the resource ('dataset'), and lists the returned attributes (name, data type, description). This distinguishes it from siblings like get_dataset_info (dataset metadata) and query_dataset (run queries).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. There is no mention of prerequisites, exclusions, or context-specific recommendations.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

search_radiotecaAInspect

Search radio shows, episodes and people indexed at radioteca.cat (Catalan radio archive, ~485K documents from Catalunya Ràdio, RAC1, Catalunya Música, iCat, Catalunya Informació, RTVE, Cadena SER, ara.cat). Searches title, description (which contains a detailed summary of what was said), program name and subheading. Returns episodes (~473K), programs (~3K) and people (~9K). IMPORTANT: always cite radioteca.cat as the source and include each hit's absolute 'url' in your reply for traceability — never paraphrase episodes without linking.

ParametersJSON Schema
NameRequiredDescriptionDefault
typeNoFilter by document type.
yearNoFilter by year (4 digits, e.g. '2025'). NOTE: only year-level filtering is indexed; for a specific day combine year + keywords and inspect the URL path (radioteca URLs include /YYYY/MM/DD/) or the 'subheading' field which often contains the date.
limitNoMaximum results (1-50). Default 10.
queryYesFree text in Catalan or Spanish. Searches title, description (contains episode summary), program and subheading. Examples: 'visita papa', 'eleccions municipals', 'crisi habitatge', 'Albert Serra cinema'.
offsetNoPagination offset. Default 0.
publisherNoFilter by broadcaster.

TDQS

A4.3/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden. It discloses that the tool searches across multiple fields, returns three types of results with counts, and requires citation and linking. It does not mention side effects or permissions, but for a read-only search tool this is sufficient.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is 3-4 sentences that convey essential information: source, search scope, result types, and critical usage instructions. It is compact but not overly terse; each sentence serves a purpose. Minor redundancy in listing broadcasters twice could be tightened, but overall it's efficient.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool has 6 parameters (including enums) and no output schema, the description provides a solid overview: it names the fields searched, result categories with counts, and important behavioral notes (citation, URL). It could be more complete by describing the output fields or return structure, but the current level is adequate for an AI agent to use correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so baseline is 3. The description adds value by explaining the year parameter's limitation (only year-level indexing) and suggesting a workaround using keywords and URL path, which goes beyond what the schema provides. This extra guidance justifies a score of 4.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool searches radio shows, episodes, and people from the specific Catalan radio archive radioteca.cat, listing exact broadcasters and document counts. It uniquely identifies the tool's resource and scope, effectively distinguishing it from sibling tools that focus on datasets.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides clear usage context (source, languages, searchable fields) and critical instructions like citing the source and including URLs for traceability. However, it does not explicitly describe when not to use this tool or mention alternative tools for different contexts.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. 5 tool updatesv0.6.0
    • Removedget_dataset_info
    • Removedlist_categories
    • Removedlist_portals
    • Removedquery_dataset
    • Removedsearch_datasets
  2. 8 tool updatesv0.5.1
    • First observedget_dataset_info
    • First observedlist_categories
    • First observedlist_dataset_fields
    • First observedlist_portals
    • First observedquery_dataset
    • First observedrelated_datasets
    • First observedsearch_datasets
    • First observedsearch_radioteca

TDQS

A3.6/5.0
Disambiguation5/5

Each tool serves a clearly distinct purpose: listing fields of a specific dataset, finding related datasets from other portals, and searching a radio archive. No overlap in functionality.

Naming Consistency2/5

Naming is inconsistent: 'list_dataset_fields' follows verb_noun, 'related_datasets' is a noun phrase without a verb, and 'search_radioteca' uses verb_noun with a proper name. No consistent pattern.

Tool Count3/5

With only 3 tools, the server feels very limited for an open data portal. However, the tools cover distinct areas, so the count is not unreasonable but could be expanded.

Completeness2/5

The server lacks fundamental open data operations such as searching datasets, listing all datasets, or retrieving dataset metadata. The inclusion of a radio archive tool seems out of scope and does not fill the gaps.

Maintenance

ActivitySlowing
ResponsivenessSyncing

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

  • A
    license
    A
    quality
    D
    maintenance
    MCP server for querying Spanish government open data APIs including grants, legislation, company registry, statistics, and open data catalog. Enables LLMs to access Spanish public information on-the-fly.
    26
    5
    MIT
  • A
    license
    Not graded
    quality
    D
    maintenance
    Connects open data to LLMs via MCP, enabling easy access to public datasets and publishing new datasets with community help.
    MIT
  • A
    license
    A
    quality
    C
    maintenance
    Enables querying and analyzing over 90,000 public datasets from the Spanish Government Open Data Portal (datos.gob.es) using natural language, with tools for search, filtering, metadata access, and SPARQL queries.
    10
    5
    MIT

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/xaviviro/Opendata.cat-MCP-Server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server