Idescat MCP Server

cat.idescat由 idescat.cat 發布官方發布者v1.1.1更新於 Oct 27, 2026

Query official statistics of Catalonia (Idescat): tables, metadata and JSON-stat data via MCP.

已驗證Streamable HTTP可網頁執行位置與生活資料與分析

概覽

AI 產生的概覽

加泰隆尼亞官方統計(Idescat)的遠端 MCP 伺服器:瀏覽統計項目、檢視資料表中介資料,並取得 JSON-stat 資料或 Markdown 表格。

可以做什麼
  • 列出並檢視統計項目:完整目錄、依縮寫查詢詳情,以及每個統計項目包含的資料表
  • 檢視資料表結構:維度、類別、單位以及可用的地域劃分
  • 取得 JSON-stat 資料表資料,可整表或依維度、地域與最近期別篩選,並支援伺服器端加總、占比與百分比變化
  • 產生現成的 Markdown 表格,含標題、單位、狀態說明與原始資料表連結
  • 讀取隨附資源,例如使用指引、地域代碼詞彙表與統計目錄
適用情境
當你需要加泰隆尼亞的官方統計資料(人口、普查、GDP、勞動力等指標),涵蓋加泰隆尼亞全境、縣、市鎮或省,並希望助理直接取數並製表而非自行推測時適用。
執行需求
需要一個遠端 Streamable HTTP 端點;無需身分驗證、API 金鑰或本機執行環境。資料公開,標籤為加泰隆尼亞語。僅支援 stdio 的用戶端需透過 mcp-remote 之類的橋接,需安裝 Node.js。
安裝前請注意
所有工具皆為唯讀,資料公開,不會暴露憑證。請求會送往 Idescat 的 API,依伺服器指引應標註來源資料表。大型資料表上限為 20,000 個儲存格,未篩選的查詢可能被拒絕。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 Idescat MCP Server,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Web executable,透過 Streamable HTTP。 遠端服務在工作區中設定後即可從網頁執行環境執行。

交給代理程式安裝

把這段提示詞貼上到 Claude Code、Codex、Cursor 等代理程式,或 SourceWeft 對話中。代理程式會讀取該伺服器的安裝指南,先向你展示發布者、端點和登入方式,經你同意後再把它新增到你的客戶端。金鑰不會寫進任何命令。

閱讀 https://sourceweft.com/mcp/cat.idescat%2Fmcp/install.md,並按其中說明把這個 MCP 伺服器接入我的客戶端。修改任何設定之前,先告訴我它的發布者、端點和登入方式,等我確認。不要把 API 金鑰寫進命令或我會提交的檔案;問我金鑰應從哪裡取得。

檢視代理程式所依據的安裝指南

其他 MCP 客戶端

把它新增到你客戶端的 mcpServers 設定中。

{
  "mcpServers": {
    "idescat": {
      "type": "http",
      "url": "https://api.idescat.cat/mcp"
    }
  }
}

README

Idescat MCP server

MCP (Model Context Protocol) server that exposes tools to query the official statistics of Catalonia, published by Idescat (Institut d'Estadística de Catalunya), from any MCP client (Claude, Windsurf, Cursor, VS Code, etc.).

  • Public endpoint: https://api.idescat.cat/mcp
  • Transport: Streamable HTTP (MCP spec 2026-07-28, per-request metadata and server/discover, with legacy initialize compatibility for 2025-11-25 and earlier), stateless — each POST request is independent, with no sessions. POST responses use JSON or SSE according to the client's Accept header; no persistent SSE stream is offered via GET.
  • Authentication: none required (the data is public).
  • Data: official Idescat statistics in JSON-stat; labels and descriptions are in Catalan; territorial scope is Catalonia and its territorial breakdowns (counties, municipalities, provinces, etc.).

Installation

The public endpoint is https://api.idescat.cat/mcp. Add one of the snippets below to your MCP client's configuration. Different clients expect a different key (serverUrl, url, ...) and sometimes a type.

Windsurf/Devin, Antigravity (serverUrl)

json
{	"mcpServers": {		"idescat": {			"serverUrl": "https://api.idescat.cat/mcp"		}	}}

Cursor, Roo Code, Zoo Code (type: streamable-http)

json
{	"mcpServers": {		"idescat": {			"type": "streamable-http",			"url": "https://api.idescat.cat/mcp"		}	}}

Cline (type: streamableHttp)

json
{	"mcpServers": {		"idescat": {			"type": "streamableHttp",			"url": "https://api.idescat.cat/mcp"		}	}}

VS Code and the emerging standard form (servers, type: http)

json
{	"servers": {		"idescat": {			"type": "http",			"url": "https://api.idescat.cat/mcp"		}	}}

Claude.ai (custom connector)

Claude.ai (web and desktop apps) can reach the remote server directly as a custom connector, no configuration file needed.

  1. Open Customize → Connectors
  2. Click Add custom connector.
  3. Fill in the fields:
    • Name: Idescat
    • Remote MCP server URL: https://api.idescat.cat/mcp
  4. Click Add. No authentication (OAuth / API key) is needed, since the data is public.
  5. Back in a chat, enable the Idescat connector from the tools/attachments menu. Its tools and resources are now available to the assistant.
  6. (Optional) In the connector's tool settings, switch each Idescat tool from Needs approval to Always allow so the assistant can run them without asking for confirmation every time. All the tools are read-only, so this is safe.

Claude Desktop and stdio-only clients (bridge with mcp-remote)

Clients that only speak stdio can reach the remote server through the mcp-remote bridge:

json
{	"mcpServers": {		"idescat": {			"command": "npx",			"args": ["-y", "mcp-remote", "https://api.idescat.cat/mcp"]		}	}}

Not sure which key your client expects? (catch-all)

Most clients ignore keys they don't recognise, so this superset works with many of them at once:

json
{	"mcpServers": {		"idescat": {			"url": "https://api.idescat.cat/mcp",			"serverUrl": "https://api.idescat.cat/mcp",			"type": "streamable-http",			"streamableHttp": "https://api.idescat.cat/mcp"		}	}}

Protocol versions

The server is dual-era (MCP versioning):

EraProtocol versionsHow the version is chosenBehaviour
Legacy2025-11-25, 2025-06-18, 2025-03-26, 2024-11-05initialize negotiationExactly as before: JSON-RPC in → JSON-RPC out, ping, initialize; errors keep HTTP 200 (-32002 for a missing resource).
Modern2026-07-28params._meta["io.modelcontextprotocol/protocolVersion"] on every request (or server/discover)Results carry resultType: "complete", _meta serverInfo, and ttlMs/cacheScope on cacheable methods. initialize/ping don't exist here (-32601 → HTTP 404); a missing resource is -32602; an unsupported version is -32022; header violations are -32020 (HTTP 400).

Modern requests must also send matching headers: MCP-Protocol-Version (equal to the _meta version), Mcp-Method (equal to the JSON-RPC method), and Mcp-Name for tools/call (the tool name) and resources/read (the URI; UTF-8 values may use the =?base64?...?= sentinel). Origin is always accepted — the data is public and the API answers CORS *.

Modern clients may open subscriptions/listen: the server answers on an SSE stream with notifications/subscriptions/acknowledged carrying an empty filter (no notification types are supported — the server is stateless and the listings don't change), followed by the gradual close defined by the spec. Clients should rely on ttlMs instead.

Available tools

ToolDescription
get_idescat_statsFull list of available statistics.
get_idescat_statInformation about a statistic (by acronym: censph, pibc, ...).
get_idescat_stat_tablesList of tables of a statistic.
get_table_metadataTable metadata (dimensions, categories, units, ...).
get_table_dataTable data in JSON-stat: full, or filtered by dimension/territory/periods with the optional filters and last parameters (max. 20,000 cells after applying filters). Supports server-side calculations: age-range filters (">=65"), sum of a dimension's categories and derive (share / difference / percent_change).
get_table_geoTerritorial divisions available for a table (cat, prov, com, mun, ...).
render_tableReady-pivoted Markdown table (selectable rows/columns) with an attribution link to the table on the Idescat website. Accepts the same calculations as get_table_data (age-range filters, sum, derive) and reports them in a "Calculations:" block under the table.

Available resources

Beyond the tools, the server exposes MCP resources — content a client can attach to the context without executing any action.

Static resources (resources/list):

URIDescription
idescat://instructionsUsage guidance.
idescat://glossary/geoGlossary of territorial codes (cat, prov, com, mun, ...).
idescat://catalog/statsFull catalogue of statistics.

Resource templates (resources/templates/list) — parametrised URIs:

URI templateDescription
idescat://stat/{stat}Information about a statistic (e.g. .../censph).
idescat://stat/{stat}/tablesList of tables of a statistic.
idescat://table/{stat}/{table}Table metadata (e.g. .../censph/538).
idescat://table/{stat}/{table}/dataJSON-stat data of a table (max. 20,000 cells).

The transport is stateless, so subscribe and resources/list_changed notifications are not offered (there is no persistent connection).

Server-side calculations

Language models are notoriously unreliable at mental arithmetic on long series of values. get_table_data and render_table therefore accept three optional parameters that make the server compute the result deterministically instead of leaving the model to add, subtract or divide the returned values itself:

json
{ "filters": { "AGE": ">=65", "SEX": "TOTAL" }, "last": 1 }{ "sum": ["AGE"] }{ "derive": { "share": "AGE", "percent_change": "previous" } }
  • Age-range filters. For dimensions coded Y000, Y005_009, Y_GE100, etc., a filter value can be a range expression (">=65", ">65", "<16", "<=15", "16-64"); the server resolves it to the exact list of codes and fails with range_not_representable when the published groups cannot express the bound exactly.
  • sum collapses the listed dimensions by adding up their categories; the result is a single SUM category. TOTAL is excluded automatically.
  • derive appends derived metrics to the metric dimension: share (<METRIC>_SHARE = 100 × value / value at TOTAL of the given dimension), difference (<METRIC>_DIFF vs. the previous or a given period) and percent_change (<METRIC>_PCT = 100 × (value − base) / base).

The engine relies on Idescat's conventions: additivity is declared by extension["%"] on the metric dimension (only additive metrics can be summed or shared), TOTAL is the total code, and non-computable cells come back as null with status d. Everything applied is recorded in extension.derived (ranges, summed codes, formulas, warnings) and render_table prints it under the table as a Calculations: block.

Unsafe requests are refused: metric_not_additive, geo_not_summable (the territorial dimension is never summed — use the geo parameter with the division that already publishes the aggregate), range_not_representable, incomplete_data and total_not_available.

Agent skills

Two skills in the Agent Skills open format (a directory with a SKILL.md file: YAML frontmatter + Markdown instructions) teach agents how to use Idescat data correctly. They are published on the website and advertised in the ARD manifest:

SkillURLDescription
jsonstathttps://www.idescat.cat/dev/api/taules/jsonstat/SKILL.mdHow to read JSON-stat 2.0 datasets: dimension index, row-major order, stride/offset arithmetic, null and status handling. Generic — useful with any JSON-stat producer.
workflowhttps://www.idescat.cat/dev/api/taules/workflow/SKILL.mdHow to query Idescat data reliably (via this MCP server or the Tables API): choosing the statistic and territorial level, metadata-first flow, the 20,000-cell limit and filters, and mandatory source citation.

Repository files

The following files define the server's guidance and resources and are served, unchanged, to MCP clients:

  • instructions.md — usage guidance the server sends to clients during the handshake and exposes as the idescat://instructions resource. It explains how to choose a statistic, the data-retrieval flow, how to interpret JSON-stat, and the source-attribution rules.
  • resources.json — declaration of the MCP resources and resource templates the server exposes (the two tables in the Available resources section above), including each URI, title, description, MIME type, and its backing file or tool.
  • resources/geo.md — glossary of territorial codes (cat, prov, at, com, mun, dis, sec) used by the geo parameter, exposed as the idescat://glossary/geo resource.

The repository also includes:

Discovery (Agentic Resource Discovery)

The server is advertised using the Agentic Resource Discovery (ARD) specification (v0.91) so agents can find it automatically:

  • An ARD manifest is published at https://www.idescat.cat/.well-known/ard.json and https://api.idescat.cat/.well-known/ard.json (served with Access-Control-Allow-Origin: * on both hosts). It carries a top-level specVersion so the same document is valid both as an ARD manifest and as an AI Catalog file: /.well-known/ai-catalog.json is served directly by an internal rewrite of ard.json (no redirect) as application/ai-catalog+json — the predecessor format that some MCP discovery flows still request first. The manifest advertises four entries: this MCP server (application/mcp-server-card+json), the Idescat Tables API, described by its OpenAPI document (application/openapi+json) at https://www.idescat.cat/dev/api/taules/openapi.json, and the two agent skills (application/agent-skills+md, the AI Catalog media type for a skill published as a Markdown SKILL.md file).
  • The MCP server card (application/mcp-server-card+json) is served at https://api.idescat.cat/mcp/server-card, the location the experimental Server Card discovery specification reserves as <streamable-http-url>/server-card. A GET (or HEAD) on the bare endpoint https://api.idescat.cat/mcp returns 405 — the endpoint is POST-only, although POST responses can use SSE. The Card and the MCP handshake (serverInfo) share the name cat.idescat/mcp, matching the MCP Registry. The Card response honours the spec's caching contract: Cache-Control: public, max-age=3600, an ETag that answers If-None-Match with 304, and CORS headers (Allow-Methods: GET, Allow-Headers: Content-Type, If-None-Match, Expose-Headers: ETag).
  • The legacy Card aliases /.well-known/mcp/server-card.json and /.well-known/mcp.json are served directly on api.idescat.cat by an internal rewrite (identical bytes, no redirect — some crawlers do not follow them); on www.idescat.cat they redirect (307) to https://api.idescat.cat/mcp/server-card.
  • The MCP entry in ard.json points to the Card URL and exposes the transport endpoint via metadata.mcpEndpoint (https://api.idescat.cat/mcp). It uses application/mcp-server-card+json: the older application/mcp-server+json media type was deprecated in ARD ADR-0008.
  • The website pages also include a link to the manifest: <link rel="ard" href="/.well-known/ard.json" type="application/json"> (the ard link relation replaces the predecessor ai-catalog relation).
  • robots.txt includes an Agentmap: directive pointing to the manifest.
  • The MCP server is also advertised in the site's llms.txt file.

MCP Registry

The server is listed in the official MCP Registry under the name cat.idescat/mcp (see server.json). MCP clients and aggregators can retrieve its metadata from the registry API:

https://registry.modelcontextprotocol.io/v0.1/servers/cat.idescat%2Fmcp/versions/latest

Interactive testing with MCP Inspector

bash
npx @modelcontextprotocol/[email protected]

Pinning a specific version (e.g. @2.0.0) keeps the tool reproducible and avoids picking up unexpected changes; it requires Node.js >= 22.19.0. Any npm warn deprecated ... / ERESOLVE messages come from the Inspector's own dependencies and are harmless — they do not affect this MCP server.

Select the "Streamable HTTP" transport and enter the endpoint URL.

Links

來源:README.md,提交 c385655

工具

7

get_idescat_stats

Obtains the complete list of Idescat statistics (all, normalized and non-normalized). It has no parameters. The response contains a 'statistics' array where each element has: 'acronym' (lowercase acronym, e.g., 'censph', to be used as the 'stat' argument of the other tools), 'name' (title), 'description' (summary), 'datasets' (boolean), 'geo' (array of available territorial disaggregations), and 'url' (initial web address, relative to https://www.idescat.cat). Use it when the user asks what statistics are available or when a statistic needs to be found by name or territorial disaggregation. THREE KEY FIELDS to decide the flow: (1) 'datasets' — if true, the statistic is normalized and you can use the rest of the tools (get_idescat_stat_tables, get_table_metadata, get_table_data, get_table_geo, render_table); if false, ONLY the information from this tool and get_idescat_stat is available. (2) 'geo' — available levels of geographical disaggregation (e.g., 'cat'=Catalonia, 'prov'=provinces, 'at'=territorial plan areas, 'com'=counties and Aran, 'mun'=municipalities, 'dis'=districts, 'sec'=census sections). ALWAYS CHECK 'geo' before choosing a statistic for a territorial query: if the user asks for county data, choose a statistic that includes 'com' in 'geo'. (3) 'url' — home page of the statistic on the Idescat website. POPULATION FIGURES: when population data is requested, there are several sources: the main and richest is CENSPH (population and housing census, annual); for semi-annual estimates there is EP (population estimates, semi-annual); and there is also PMH (municipal register of inhabitants, annual). By default, choose CENSPH (or EP if semi-annual data is requested) and NEVER use PMH for population data unless the user explicitly asks for it.

無需輸入參數。

get_idescat_stat

Obtains information about an Idescat (Statistical Institute of Catalonia) statistic given its acronym. Use it when the user asks about a specific statistic identified by its acronym (for example, CENSPH, EPA, PIBC, AFI, etc.). The 'datasets' field is a key boolean: if true, the statistic is normalized and therefore available in get_idescat_stat_tables and the rest of the table-level tools (metadata, data, divisions, etc.); if false, the statistic is NOT normalized and get_idescat_stat_tables will not recognize it (it would return an identifier error), so the only information available is what this same tool returns ('url', 'time_ref', 'update_date', 'update_title', 'update_text'). To know if a statistic has queryable tables, this tool is enough, without calling get_idescat_stat_tables. The 'url' field is a relative address to https://www.idescat.cat. The 'geo' field is an array with the available geographical disaggregation levels (e.g., 'cat', 'prov', 'at', 'com', 'mun', 'dis', 'sec'). POPULATION FIGURES: when population data is requested, the main and richest source is CENSPH (population and housing census, annual); for semi-annual estimates there is EP (population estimates, semi-annual); and there is also PMH (municipal register of inhabitants, annual). By default, choose CENSPH (or EP if semi-annual data is requested) and NEVER use PMH for population data unless the user explicitly asks for it.

輸入參數stat必填

get_idescat_stat_tables

Obtains the list of tables for an Idescat statistic given its official acronym. Use it when the user asks what tables or information a statistic has. The response contains a 'tables' array where each element has 'id' (numerical identifier) and 'name' (table title). Present each table as: name (id). Inform the user that they can request more details about a table by indicating its identifier.

輸入參數stat必填

get_table_metadata

Obtains the metadata for a specific Idescat table in JSON-stat format, given the statistic acronym (stat) and the table identifier (table). Use it when the user wants to know the details of a table: dimensions, categories available for each dimension (time periods, territorial scopes, sex, etc.), date of last update, units, etc. The acronym and identifier are previously obtained with get_idescat_stat_tables. At the end of the response, always include this Markdown link (substituting {stat} and {table} in lowercase): [See the results in this table](https://www.idescat.cat/pub/?id={stat}&n={table}). TERRITORIAL DIVISIONS: the response includes 'link.related', an array with other available territorial divisions (provinces, counties, municipalities, etc.); therefore it is often NOT necessary to call get_table_geo. If you pass the 'geo' parameter (for example geo='com' or geo='mun'), you get the metadata for that division, which includes the codes and labels (category.index / category.label) for the geographical dimension and the rest of the dimensions; use these codes directly to build the 'filters' parameter of get_table_data or render_table, without having to test and correct. SIZE CONTROL: check the 'size' field (array): the product of all its elements is the total number of cells. If it exceeds 20,000 (common case for municipal data), DO NOT retrieve the entire table; use get_table_data with filters (filters, last) to reduce the selection. If it is equal to or less than 20,000, you can retrieve it entirely with get_table_data.

輸入參數geostat必填table必填

get_table_data

Retrieves the data (values) of an Idescat table in JSON-stat format for a territorial division. You can retrieve the ENTIRE table (without filters) or only a SUBSET by passing the OPTIONAL parameters 'filters' (specific categories per dimension) and/or 'last' (number of last time periods); filtering returns smaller responses and allows querying tables that as a whole would exceed the limit. The filters use the dimension identifiers and category codes (category.index) returned by get_table_metadata (with the same 'geo'). IMPORTANT: the 20,000 cell limit is checked AFTER applying the filters; if it exceeds it, it returns a 'Dataset too large' error and you must add more filters (filters, last). You can call get_table_metadata beforehand to know the dimensions, periods, and category codes. The result contains: 'id' (dimension names in order), 'size' (number of categories per dimension), 'value' (flat array of values), 'dimension' (details per dimension: codes in category.index, labels in category.label, units in category.unit), 'role' (which dimensions are time, geo, or metric), 'status' (marks special values). HOW TO READ 'value' (row-major order): the array is FLAT; the LAST dimension of 'id' varies fastest and the first slowest. To get the value of a combination of categories (one per dimension) follow these 4 steps: (1) for each dimension, look for the POSITION (0-based) of the chosen category in dimension.{nom}.category.index — this 'index' can be a code→position object or a list of codes (the position is the index within the list); ALWAYS use this index, DO NOT assume alphabetical order or by label; (2) the stride of each dimension = product of the 'size' of the SUBSEQUENT dimensions (the last dimension has stride 1); (3) offset = sum of (position × stride) of all dimensions; (4) the searched value is value[offset]. Use the order of the 'id' array in all steps (NOT the order of keys in 'dimension'). EXAMPLE: id=['territory','sex'], size=[3,2], territory.index={BC

輸入參數geosumlaststat必填table必填derivefilters

get_table_geo

Obtains the list of territorial divisions available for an Idescat table (for example: cat=Catalonia, com=counties and Aran, mun=municipalities, prov=provinces, at=territorial plan areas). The response contains a 'divisions' array where each element has 'id' (division code) and 'name' (label). Often it is NOT necessary to call it because get_table_metadata already returns these divisions in 'link.related'. Use it only if you need the list of divisions without having called the metadata. The 'id' code is the value to pass to the 'geo' parameter of get_table_metadata, get_table_data, or render_table. If not specified, these tools use the 'cat' division (Catalonia as a whole) by default.

輸入參數stat必填table必填

render_table

Returns a Markdown table already built with the filtered data from an Idescat table, ready to be shown to the user without having to interpret the JSON-stat. It includes the title, units, the table with category labels, status notes (e.g., provisional data), and ALWAYS a final link to the table on the Idescat website that must be kept in the response to the user. By default, it puts the time dimension in rows and the first dimension with more than one category in columns; this can be changed with the 'rows' and 'cols' parameters. All other dimensions with more than one category must be reduced to a single category with 'filters'. IMPORTANT (error self-correction): if the tool returns the error with 'pending_dimensions', DO NOT change tools: call render_table again adding the 'filters' parameter with a single category for each pending dimension (you can start from the 'suggested_filters' field that comes in the same error response, but choose the appropriate category for the user's question according to 'categories'). If it then returns the size error (maximum 40 rows × 15 columns), follow the 'how_to_fix' field: if the time dimension has too many columns, add the 'last' parameter (e.g., last: 12), and if the rows dimension is too large, filter it with 'filters' or swap 'rows'/'cols'. You can chain 'filters' and 'last' in the same call. The values '..' indicate data not available. CALCULATIONS: never add, subtract or compute percentages yourself from the returned values; use filters ranges, sum and derive and report the server's result, checking that the Calculations notes under the table (codes used, warnings) match the question.

輸入參數geosumcolslastrowsstat必填table必填derivefilters

版本歷史

3
  1. v1.1.1最新Oct 26, 2026
  2. v1.1.0Oct 16, 2026
  3. v1.0.0Sep 16, 2026

評分

已滿足適用檢查項的 100%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通必需25 分
  • 已宣告認證方式必需10 分
  • 已列出工具必需15 分
  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分