Global food & agriculture statistics from the UN FAOSTAT bulk-download corpus, served from a local SQLite mirror with a DataCanvas SQL surface, over MCP. STDIO & Streamable HTTP.
git clone https://github.com/cyanheads/faostat-mcp-server{
"mcpServers": {
"faostat": {
"command": "node",
"args": ["/path/to/faostat-mcp-server/dist/index.js"]
}
}
}MCP Servers overview
<div align="center"> <h1>@cyanheads/faostat-mcp-server</h1> <p><b>Global food & agriculture statistics from the UN FAOSTAT bulk-download corpus, served from a local SQLite mirror with a DataCanvas SQL surface, over MCP. STDIO & Streamable HTTP.</b> <div>6 Tools • 0 Resources • 0 Prompts</div> </p> </div> <div align="center"> [](./CHANGELOG.md) [](./LICENSE) [](https://modelcontextprotocol.io/) [](https://www.npmjs.com/package/@cyanheads/faostat-mcp-server) [](https://www.typescriptlang.org/) [](https://bun.sh/) [](https://github.com/cyanheads/faostat-mcp-server/releases/latest/download/faostat-mcp-server.mcpb) [](https://cursor.com/en/install-mcp?name=faostat-mcp-server&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsIkBjeWFuaGVhZHMvZmFvc3RhdC1tY3Atc2VydmVyIl19) [](https://vscode.dev/redirect?url=vscode:mcp/install?%7B%22name%22%3A%22faostat-mcp-server%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40cyanheads%2Ffaostat-mcp-server%22%5D%7D) [](https://www.npmjs.com/package/@cyanheads/mcp-ts-core) </div> <div align="center"> **Public Hosted Server:** [https://faostat.caseyjhand.com/mcp](https://faostat.caseyjhand.com/mcp) </div> --- ## Overview [FAOSTAT](https://www.fao.org/faostat/) is the UN Food and Agriculture Organization's authoritative global statistics service — crop and livestock production, agricultural trade, food balances, food security and nutrition, land use, fertilizer use, and agrifood-systems emissions for 245+ countries and territories from 1961 to the present. Each domain is a data cube of **area** (country/region) × **item** (commodity) × **element** (metric) × **year**, with a data-quality flag on every observation. This server does not call the FAOSTAT REST query API — that endpoint is auth-gated (`HTTP 401` keyless). Instead it syncs FAOSTAT's keyless **bulk-download service** (per-domain ZIPs of normalized CSVs plus their dimension code lists) into a persistent local **SQLite mirror** (embedded, with FTS5 over the dimension labels) and serves every query from that mirror — fast, offline-capable, and free of per-request rate limits. Analytical query results spill to a **DataCanvas** (DuckDB-backed) so an agent can run SQL `GROUP BY`, rankings, joins, and time-series analysis over the full result set. > [!IMPORTANT] > **First run requires a mirror build.** The corpus is not bundled. Run `bun run mirror:init` once to download and index the selected FAOSTAT domains before querying. The read tools return `index_not_ready` until the first sync completes. See [Building the mirror](#building-the-mirror). ## Tools Six tools organized around the mirror's discover → resolve → query flow, with a DataCanvas pair for SQL over large result sets: | Tool | Description | |:---|:---| | `faostat_list_domains` | Discover FAOSTAT statistical domains with codes, descriptions, last-update date, upstream row count, and local index status. The entry point — every query keys on a domain code. | | `faostat_resolve_codes` | Resolve human terms to the opaque integer codes a query needs (areas, items, elements), flagging each area as a country or an aggregate region. | | `faostat_query_observations` | Query a domain's cube by area(s), item(s), element(s), and year range. Inline preview for small results; large sets spill to a DataCanvas table. | | `faostat_commodity_profile` | Workflow: assemble top producers, the production trend, and trade flows for one commodity from the production and trade domains in a single call. | | `faostat_dataframe_query` | Run a read-only SQL `SELECT` against the canvas tables staged by the analytical tools. | | `faostat_dataframe_describe` | List the canvas tables staged this session, each with provenance, row count, and column schema. | ### `faostat_list_domains` Discover the catalog and what's queryable right now. - Full FAOSTAT catalog read live from the bulk manifest, annotated with local mirror status - Per-domain `indexed` / `index_ready` flags, local row count, and last completed sync - `topic` substring filter over code, name, and topic (e.g. `"trade"`, `"emissions"`, `"QCL"`) - `indexed_only` to list just the domains queryable from the local mirror --- ### `faostat_resolve_codes` Turn names into the integer codes the cube requires — FAOSTAT is unqueryable without code resolution. - FTS5 full-text matching (`query`, e.g. `"maize"` → item 56), substring filter (`name_contains`), or exact-code lookup (`code`) - Resolves within a `dimension`: `area` (countries/regions), `item` (commodities), or `element` (metrics like production, yield, import quantity) - Every area match is flagged `country` or `aggregate` (World, continents, economic groupings; codes ≥ 5000) so an agent can avoid summing a region with its member countries - Surfaces the CPC crosswalk code for items where available - Omit all of `query` / `name_contains` / `code` to list the whole dimension --- ### `faostat_query_observations` The core data tool — query a domain's cube and get observations with their data-quality flag. - Filter by `area_codes`, `item_codes`, `element_codes` (resolve them first), and a `year_start` / `year_end` range - **Aggregate regions are excluded by default** (`include_aggregates: false`) so a naive `SUM` does not double-count a region with its members — set `include_aggregates: true` for World/continent roll-ups, or pass explicit `area_codes` to query exactly what you name - Small result sets return inline; large ones spill to a DataCanvas table (returned `canvas_id` + `table_name`) for SQL aggregation - Every row carries its flag (`A`=Official, `E`=Estimated, `I`=Imputed, `B`=break, `X`=external) — honor it; never treat estimated/imputed values as official --- ### `faostat_commodity_profile` A workflow tool that assembles a global profile for one commodity in a single call. - Accepts a commodity name, resolves it to item codes, then queries the production (`QCL`) and trade (`TCL`) domains and merges the results - Returns top-producing countries, top exporters, and top importers (ranked by the latest year present), plus a production-trend point count — countries only, aggregates excluded - Returns a **partial profile** with a notice naming the gap when a required domain (e.g. trade) is not indexed, rather than failing - The full merged production + trade observation set spills to a DataCanvas table for deeper SQL --- ### `faostat_dataframe_query` / `faostat_dataframe_describe` SQL analytics over the canvas tables (`faostat_xxxxxxxx`) that `faostat_query_observations` and `faostat_commodity_profile` stage. Call `faostat_dataframe_describe` first to discover table and column names, then `faostat_dataframe_query` for cross-country and cross-item aggregation, `GROUP BY` rankings, joins, window functions, and CTEs — standard DuckDB SQL. - **Read-only.** Writes, DDL, `DROP`, `COPY`, `PRAGMA`, `ATTACH`, and external-file table functions are rejected by the framework SQL gate. System catalogs (`information_schema`, `sqlite_master`, `duckdb_*`) are denied so a caller can't enumerate staged tables it doesn't hold a handle for — list them via `faostat_dataframe_describe`. - Staged-table columns: `area_code`, `area`, `item_code`, `item`, `element_code`, `element`, `year`, `unit`, `value`, `flag`. Keep `flag` in projections and honor it in interpretation. - `canvas_id` is optional on both tools — omit it to operate on the tables staged in the current session (the common case). All tool output is also rendered as human-readable markdown (`content[]`) alongside the structured payload, so tool-only MCP clients reach the same data. ## Features Built on [`@cyanheads/mcp-ts-core`](https://www.npmjs.com/package/@cyanheads/mcp-ts-core): - Declarative tool definitions — single file per tool, framework handles registration and validation - Unified error handling — handlers throw, the framework catches, classifies, and formats; typed error contracts give agents actionable recovery hints - Pluggable auth: `none`, `jwt`, `oauth` - Structured logging with optional OpenTelemetry tracing - STDIO and Streamable HTTP transports FAOSTAT-specific: - **Persistent local SQLite mirror** of the FAOSTAT bulk corpus via the framework `MirrorService` — one indexed table per selected domain plus shared dimension tables, with FTS5 over the dimension labels driving code resolution - **Streaming bulk-ZIP ingester** — fetches the manifest, compares each domain's update date against the stored checkpoint to skip unchanged domains, and stream-parses the normalized CSV (∼18× decompression ratio) into SQLite without materializing the full file in memory - **Config-driven domain selection** (`FAOSTAT_DOMAINS`) — the indexed set can grow without code changes; `faostat_list_domains` always shows the full catalog and which domains are locally queryable - **DataCanvas SQL surface** (DuckDB) — analytical cube queries spill to a staged table for ad-hoc `GROUP BY` / ranking / time-series analysis Agent-friendly o
What people ask about faostat-mcp-server
What is cyanheads/faostat-mcp-server?
+
cyanheads/faostat-mcp-server is mcp servers for the Claude AI ecosystem. Global food & agriculture statistics from the UN FAOSTAT bulk-download corpus, served from a local SQLite mirror with a DataCanvas SQL surface, over MCP. STDIO & Streamable HTTP. It has 1 GitHub stars and was last updated 2d ago.
How do I install faostat-mcp-server?
+
You can install faostat-mcp-server by cloning the repository (https://github.com/cyanheads/faostat-mcp-server) or following the README instructions on GitHub. ClaudeWave also provides quick install blocks on this page.
Is cyanheads/faostat-mcp-server safe to use?
+
cyanheads/faostat-mcp-server has not been audited yet by our security agent. Review the original repository on GitHub before using it in production.
Who maintains cyanheads/faostat-mcp-server?
+
cyanheads/faostat-mcp-server is maintained by cyanheads. The last recorded GitHub activity is from 2d ago, with 2 open issues.
Are there alternatives to faostat-mcp-server?
+
Yes. On ClaudeWave you can browse similar mcp servers at /categories/mcp, sorted by popularity or recent activity.
Deploy faostat-mcp-server to your cloud
Ship this repo to production in minutes. Each platform spins up its own environment with editable env vars.
Maintain this repo? Add a badge to your README
Drop the badge into your GitHub README to show it's tracked on ClaudeWave. Each badge links back to this page and reflects the live Trust Score.
[](https://claudewave.com/repo/cyanheads-faostat-mcp-server)<a href="https://claudewave.com/repo/cyanheads-faostat-mcp-server"><img src="https://claudewave.com/api/badge/cyanheads-faostat-mcp-server" alt="Featured on ClaudeWave: cyanheads/faostat-mcp-server" width="320" height="64" /></a>More MCP Servers
Fair-code workflow automation platform with native AI capabilities. Combine visual building with custom code, self-host or cloud, 400+ integrations.
User-friendly AI Interface (Supports Ollama, OpenAI API, ...)
An open-source AI agent that brings the power of Gemini directly into your terminal.
The fastest path to AI-powered full stack observability, even for lean teams.
🕷️ An adaptive Web Scraping framework that handles everything from a single request to a full-scale crawl!
⭐AI-driven public opinion & trend monitor with multi-platform aggregation, RSS, and smart alerts.🎯 告别信息过载,你的 AI 舆情监控助手与热点筛选工具!聚合多平台热点 + RSS 订阅,支持关键词精准筛选。AI 智能筛选新闻 + AI 翻译 + AI 分析简报直推手机,也支持接入 MCP 架构,赋能 AI 自然语言对话分析、情感洞察与趋势预测等。支持 Docker ,数据本地/云端自持。集成微信/飞书/钉钉/Telegram/邮件/ntfy/bark/slack 等渠道智能推送。