Thailand NSO MCP Server
Enables natural language discovery, querying, and analysis of Thailand's official statistics from the National Statistical Office via SDMX REST API. It provides tools for searching dataflows, exploring structures, and fetching data with caching and bilingual support.
README
Thailand NSO MCP Server
An MCP server that lets an LLM discover, query and
analyse Thailand's official statistics from the National Statistical Office (NSO,
agency TNSO) via the SDMX REST API — in natural language.
When connected to your chat tool (e.g. Gemini or Claude) it can generate analysis like the below: <img width="1007" height="917" alt="image" src="https://github.com/user-attachments/assets/3b132f28-21a3-4262-b7c1-66a0bc942030" />
This implementation based on a port of ondata/istat_mcp_server
(Italy / ISTAT), adjusted to point to the Thaliand NSO SDMX endpoint at
https://ns1-stathub.nso.go.th/rest.
It uses a 9-tool workflow (like the ISTAT MCP), same two-layer caching; the data source, agency, languages (Thai/English) and geography (Thai provinces) are swapped in.
Note we use Buddhist Era dates. TNSO publishes time periods in the Buddhist Era calendar (BE = Gregorian + 543). So
2567means 2024. Passstart_period/end_periodas BE years.
Tools
| Tool | What it does |
|---|---|
discover_dataflows |
Search ~900 TNSO dataflows by keyword (Thai/English; any keyword matches (OR), or match_all for AND), or by covers — the dimension codes a dataflow must actually have data for (e.g. {"CWT": ["10","20"]} → every dataflow carrying both Bangkok and Chon Buri). |
get_structure |
Dimensions + codelists for a data structure (DSD). |
get_constraints |
Valid values (with labels) per dimension + available time range. Start here. |
get_codelist_description |
Thai/English labels for every code in a codelist. |
get_concepts |
Resolve an SDMX concept id to its Thai/English name. |
get_data |
Fetch observations as a TSV table (+ reproducible CSV/curl URLs). On an empty result it self-diagnoses (invalid codes / out-of-range period) and suggests verified non-empty alternatives. |
check_data_availability |
Pre-flight check that a specific filter/period combination returns rows before a full get_data. |
get_territorial_codes |
Thai geography codes: region (CL_AREA), province (CL_CWT, 77 changwat), district (CL_AMPHOE). |
get_cache_diagnostics |
Inspect the on-disk cache. |
Typical workflow: discover_dataflows → get_constraints → get_data
(use get_territorial_codes first when you need province/region codes). get_data
self-diagnoses empty results and suggests working alternatives; use
check_data_availability to pre-check a combination before fetching.
Install & run
Requires Python ≥ 3.11. Using uv (recommended):
git clone https://github.com/aard-ai/tnso-mcp-server.git
cd tnso-mcp-server
uv venv
uv pip install -e ".[dev]"
# Run the server (stdio transport)
uv run python -m tnso_mcp_server
Or with pip:
cd tnso-mcp-server
python -m venv .venv && source .venv/bin/activate
pip install -e ".[dev]"
python -m tnso_mcp_server
Register with an MCP client
Claude Code:
claude mcp add tnso -- uv --directory /abs/path/to/tnso-mcp-server run python -m tnso_mcp_server
Claude Desktop (claude_desktop_config.json):
{
"mcpServers": {
"tnso": {
"command": "uv",
"args": ["--directory", "/abs/path/to/tnso-mcp-server", "run", "python", "-m", "tnso_mcp_server"]
}
}
}
Configuration
Copy .env.example to .env to override defaults (API base URL, timeouts, cache TTLs,
log level, dataflow blacklist). All values have sensible defaults, so .env is optional.
Example
discover_dataflows(keywords="aging")
-> DF_01DI_IND_AGING — "Aging Index dataflow"
discover_dataflows(covers={"CWT": ["10", "20"]})
-> every dataflow whose data covers both Bangkok (10) and Chon Buri (20)
get_constraints(dataflow_id="DF_01DI_IND_AGING")
-> dimensions POP_IND, SEX, AREA, CWT, ...; TIME_PERIOD range 2557–2567 (BE)
get_territorial_codes(level="province", name="bangkok")
-> { code: "10", name_en: "Krung Thep Maha Nakhon (Bangkok)", name_th: "กรุงเทพมหานคร" }
get_data(dataflow_id="DF_01DI_IND_AGING", dimension_filters={"CWT": ["10"]}, start_period="2560", end_period="2567")
-> TSV table of the aging index for Bangkok, 2017–2024
Tests
uv run pytest -m "not integration" # fast unit tests (no network)
uv run pytest -m integration # live tests against the real TNSO API
uv run pytest # everything
MIT (same as the upstream istat_mcp_server).
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。