OI

ondata/istat_mcp_server

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

24 stars 5 forks 质量 85 趋势 24MIT

MCP 服务器通过 SDMX API 查询意大利统计(ISTAT)——兼容任何 MCP 客户端

概览

MCP 服务器用于访问来自 ISTAT SDMX API 的意大利统计数据。 该模型上下文协议(MCP)服务器通过 SDMX REST API 为 Claude Desktop 提供了来自 ISTAT(国家统计研究所)的意大利统计数据访问。它实现了两层缓存机制以最小化 API 调用,并提供了八种工具用于发现、查询和检索统计数据。 - 用于数据发现和检索:- discover_dataflows - 通过关键词查找可用数据集(带黑名单过滤)- get_structure - 获取数据结构ID的维度定义和代码列表- get_constraints - 获取每个维度的可用约束值及描述(结合结构 + 约束 + 代码列表描述;同样输出也可通过 istat-get-constraints-cli 命令获得,详见 SKILL)。

概述(AI 翻译)

英文 |意大利文

MCP 服务器用于访问来自 ISTAT SDMX API 的意大利统计数据。

概述

该模型上下文协议(MCP)服务器通过 SDMX REST API 为 Claude Desktop 提供了来自 ISTAT(国家统计研究所)的意大利统计数据访问。它实现了两层缓存机制以最小化 API 调用,并提供了八种工具用于发现、查询和检索统计数据。

特色

  • 8 MCP工具用于数据发现和检索:
  • discover_dataflows - 按关键词查找可用数据集(带黑名单过滤)
  • get_structure - 获取数据结构ID的维度定义和代码列表
  • get_constraints - 获取每个维度的可用约束值及描述(结合结构 + 约束 + 代码表描述;同样输出也可通过 istat-get-constraints-cli 命令获得,详见 SKILL.md)
  • get_codelist_description - 获取代码列表值的意大利语/英语描述
  • get_concepts - 通过ID获取ISTAT概念的意大利语或英语描述(包裹istat-get-concepts-cli命令)

本页由 AI 翻译,技术细节请以原文为准。

README

以下为原文 README 节选,完整内容请查看原文。

ISTAT MCP Server

English | Italiano

MCP server for accessing Italian statistical data from the ISTAT SDMX API.

Overview

This Model Context Protocol (MCP) server provides Claude Desktop with access to Italian statistical data from ISTAT (Istituto Nazionale di Statistica) through the SDMX REST API. It implements a two-layer caching mechanism to minimize API calls and provides eight tools for discovering, querying, and retrieving statistical data.

Features

  • 8 MCP Tools for data discovery and retrieval:

    • discover_dataflows - Find available datasets by keywords (with blacklist filtering)
    • get_structure - Get dimension definitions and codelists for a datastructure ID
    • get_constraints - Get available constraint values for each dimension with descriptions (combines structure + constraints + codelist descriptions; the same output is available from the istat-get-constraints-cli command, see SKILL.md)
    • get_codelist_description - Get descriptions in Italian/English for codelist values
    • get_concepts - Get the Italian or English description of an ISTAT concept by ID (wraps the istat-get-concepts-cli command)
    • get_data - Fetch actual statistical data in TSV table format (with blacklist validation)
    • get_cache_diagnostics - Debug tool to inspect cache status
    • get_territorial_codes - Resolve ISTAT REF_AREA codes for Italia, ripartizioni, regioni, province, and comuni
  • Recommended Workflow (simple and efficient):

    1. Discover: Use discover_dataflows to find the dataflow you’re interested in
    2. Get Complete Metadata: Use get_constraints to see all dimensions with valid values AND descriptions in one call
      • This is the RECOMMENDED approach - one call instead of many
      • Internally combines get_structure + get_codelist_description for all dimensions
      • All data cached for 1 month → subsequent calls are instant
      • Returns complete information ready for building filters in get_data
    3. Fetch Data: Use get_data with the appropriate dimension filters to retrieve actual data

    Alternative workflow (manual approach):

    • Use get_structure with a datastructure ID to see dimensions and their codelists
    • Then call get_codelist_description manually for each codelist you need
    • Use get_concepts to get the Italian or English description of a specific concept ID (e.g. a dimension name)
  • Two-Layer Cache:

    • In-memory cache (cachetools) for fast access during session
    • Persistent disk cache (diskcache) that survives restarts
  • Rate Limiting: Maximum 4 API calls per minute with automatic queuing

  • Retry Logic: Exponential backoff on transient errors

在 GitHub 查看完整 README

安装

This server does not publish a one-line install command.

Open the repository installation guide 新手?先看 mcpskill.org 教程 →

配置

{ "mcpServers": { "istat": { "command": "/path/to/istat_mcp_server/.venv/bin/python", "args": ["-m", "istat_mcp_server"], "cwd": "/path/to/istat_mcp_server" } } }