Skip to main content
Glama

Server Details

UN FAOSTAT global food & agriculture statistics over a local SQLite mirror, via MCP.

Status
Healthy
Last Tested
Transport
Streamable HTTP
URL
Repository
cyanheads/faostat-mcp-server
GitHub Stars
1

Glama MCP Gateway

Connect through Glama MCP Gateway for full control over tool access and complete visibility into every call.

MCP client
Glama
MCP server

Full call logging

Every tool call is logged with complete inputs and outputs, so you can debug issues and audit what your agents are doing.

Tool access control

Enable or disable individual tools per connector, so you decide what your agents can and cannot do.

Managed credentials

Glama handles OAuth flows, token storage, and automatic rotation, so credentials never expire on your clients.

Usage analytics

See which tools your agents call, how often, and when, so you can understand usage patterns and catch anomalies.

100% free. Your data is private.
Tool DescriptionsA

Average 4.7/5 across 6 of 6 tools scored.

Server CoherenceA
Disambiguation5/5

Each tool serves a distinct, non-overlapping purpose: listing domains, resolving codes, querying observations, profiling commodities, describing dataframes, and querying dataframes. No ambiguity between them.

Naming Consistency5/5

All tool names follow the consistent pattern 'faostat_verb_noun' (e.g., faostat_list_domains, faostat_resolve_codes), using lowercase with underscores throughout.

Tool Count5/5

Six tools provide a well-scoped coverage of the FAOSTAT data access lifecycle: discovery, code resolution, data retrieval, profiling, and post-query analysis. Neither too few nor too many.

Completeness5/5

The tool set covers the complete workflow from domain exploration to SQL analysis, with no critical gaps for a read-only statistical data access server.

Available Tools

6 tools
faostat_commodity_profilefaostat-mcp-server: commodity profile
Read-only
Inspect

Assemble a global profile for one commodity in a single call: top-producing countries, the annual production trend, and trade flows (top exporters and importers). Accepts a commodity name, resolves it to item codes, then queries the production (QCL) and trade (TCL) domains and merges the results. Each ranking is a per-country sum across the resolved items, taken at that country's own latest year with data and grouped by unit so incomparable quantities are never added. The trend is returned inline as year/value points. Country-level only (aggregates excluded). When a required domain is not indexed locally, returns a partial profile with a notice naming the gap rather than failing. The full merged observation set spills to a DataCanvas table for deeper SQL via faostat_dataframe_query.

ParametersJSON Schema
NameRequiredDescriptionDefault
top_nNoNumber of top producers / exporters / importers to return. Max 50.
year_endNoInclusive end year for the trend (e.g. 2022).
canvas_idNoCanvas ID from a prior call to stage onto. Omit to start a fresh canvas.
item_queryYesCommodity name to profile (e.g. "maize", "wheat", "coffee green"). Matched by relevance; the 5 best-matching items are folded into one profile, so a broad name such as "milk" is narrowed — the response discloses how many items matched in total.
year_startNoInclusive start year for the trend (e.g. 1990).

Output Schema

ParametersJSON Schema
NameRequiredDescription
noticeNoNames any required domain that was not indexed, item-resolution truncation, mixed units in the rankings, or other partial-result context.
spilledYesTrue when the merged observation set was staged on a canvas table.
canvas_idNoCanvas ID holding the merged set — pass to faostat_dataframe_query / _describe.
truncatedYesTrue when the STAGED CANVAS TABLE hit the 50,000-row staging cap and is therefore a PREFIX of the merged observation set — re-query faostat_query_observations partitioned by year to stage the rest. The rankings and production_trend above are SQL aggregates over the complete match and stay exact either way.
item_queryYesThe commodity query echoed back.
table_nameNoCanvas table holding the staged observations — production plus trade when the trade domain (TCL) is indexed, production only when it is not (present when spilled). The notice names which of the two the table holds.
trend_pointsYesTotal production observations aggregated into production_trend. Exact — the aggregation runs over the complete filtered match, not a capped page.
top_exportersYesTop exporters by summed export quantity (empty when trade is not indexed).
top_importersYesTop importers by summed import quantity (empty when trade is not indexed).
top_producersYesTop producers by summed production (countries only).
itemsTruncatedYesTrue when the commodity name matched more items than the profile folded in — the profile then covers only the most relevant few.
resolved_itemsYesCommodities the query resolved to (the profile aggregates across all of them).
production_trendYesThe annual production series for the resolved commodity, summed over countries and items per year and ordered oldest-first. Aggregated in SQL over the complete filtered match, so it is not affected by the canvas staging cap.
staged_row_countNoRows actually staged on the merged canvas table (present when spilled). Equals the 50,000-row cap when truncated.
resolvedItemCodesYesItem codes the commodity query resolved to.
resolvedItemMatchesYesTotal items the commodity query matched in QCL, before the 5-item profile cap.
faostat_dataframe_describefaostat-mcp-server: dataframe describe
Read-onlyIdempotent
Inspect

List the canvas tables (faostat_xxxxxxxx) staged by faostat_query_observations and faostat_commodity_profile, each with its source tool, the query parameters that produced it, creation/expiry timestamps, row count, and column schema. Call this before faostat_dataframe_query to discover the exact table and column names to reference in SQL.

ParametersJSON Schema
NameRequiredDescriptionDefault
nameNoOptional table name (faostat_xxxxxxxx) to describe a single staged table. Omit to list all.
canvas_idNoOptional canvas ID from a prior faostat_query_observations / faostat_commodity_profile call. Omit to list the tables staged in this session (the common case).

Output Schema

ParametersJSON Schema
NameRequiredDescription
tablesYesActive staged tables for this session, newest first. Empty when none are staged.
faostat_dataframe_queryfaostat-mcp-server: dataframe query
Read-onlyIdempotent
Inspect

Run a single-statement SELECT against the canvas tables staged by faostat_query_observations and faostat_commodity_profile (table names look like faostat_xxxxxxxx). Use this for cross-country and cross-item aggregation, GROUP BY rankings, joins, and time-series analysis over the full result set the inline preview only sampled. Standard DuckDB SQL — joins, aggregates, window functions, CTEs all work. Read-only: writes, DDL, DROP, COPY, PRAGMA, ATTACH, and external-file table functions are rejected; system catalogs (information_schema, sqlite_master, duckdb_*) are denied — list staged tables via faostat_dataframe_describe. Every row carries its data-quality flag — commonly A=Official, B=time-series break, E=Estimated, I=Imputed, M=Missing (value cannot exist), T=Unofficial, X=from an international organization, plus others FAOSTAT defines per domain — keep it in projections, treat any unrecognized flag as informational, and never assume it is official.

ParametersJSON Schema
NameRequiredDescriptionDefault
sqlYesSingle-statement read-only SELECT against staged faostat_<id> tables. Columns: area_code, area, item_code, item, element_code, element, year, unit, value, flag. CAST(value AS DOUBLE) for arithmetic.
canvas_idNoOptional canvas ID from a prior faostat_query_observations / faostat_commodity_profile call. Omit to query the tables staged in this session (the common case).
row_limitNoHard cap on rows in the response. Default 1000, max 10000.

Output Schema

ParametersJSON Schema
NameRequiredDescription
rowsYesMaterialized result rows, bounded by row_limit.
noticeNoGuidance when the query returned no rows or when results were capped.
columnsYesColumn names in projection order.
row_countYesRows returned in this response — the materialized count, equal to rows.length. When truncated is true this is NOT the full result total (this path computes no exact total); page or aggregate to reach the rest.
truncatedYesTrue when row_limit capped the result and more rows exist than were returned. To reach them: page with ORDER BY + SQL LIMIT/OFFSET, raise row_limit (max 10000), or aggregate with GROUP BY.
faostat_list_domainsfaostat-mcp-server: list domains
Read-onlyIdempotent
Inspect

Discover FAOSTAT statistical domains (production, trade, food balances, food security, land use, agri-emissions, prices, value) with their codes, descriptions, last-update date, upstream row count, and local index status. Every query keys on a domain code from here. The indexed flag tells you which domains are queryable right now; un-indexed domains exist in the catalog but must be added to FAOSTAT_DOMAINS and re-synced before faostat_query_observations can read them. The catalog runs to ~69 domains with long descriptions, so responses are paged: narrow with topic / indexed_only, pass code to fetch one domain outright, or page with offset + limit — when the response reports truncated, pass the returned nextOffset to fetch the rest.

ParametersJSON Schema
NameRequiredDescriptionDefault
codeNoExact domain code lookup (e.g. "RL"), case-insensitive. Returns that one domain's full record on a single page. Takes precedence over `topic` / `indexed_only` when provided.
limitNoMaximum domains to return on this page (max 200 — above the catalog size, so raise it to fetch everything at once). Domain descriptions are long; the default keeps a browse call small.
topicNoCase-insensitive substring filter over domain code, name, and topic (e.g. "trade", "emissions", "QCL"). Omit to list the full catalog.
offsetNoZero-based pagination offset into the matching domains (code-sorted). When the response reports truncated, pass the returned nextOffset here to fetch the next page. Ignored for exact-code lookups (always single-page).
indexed_onlyNoWhen true, return only domains indexed in the local mirror (queryable now).

Output Schema

ParametersJSON Schema
NameRequiredDescription
noticeNoGuidance when a filter matched nothing, more pages remain, or no domains are indexed yet.
domainsYesMatching domains, sorted by code.
truncatedYesTrue when more matches remain beyond the returned page — fetch them with nextOffset.
nextOffsetNoOffset to pass on the next call to fetch the following page. Present only when truncated is true; absent on the last page and for exact-code lookups.
totalCountYesTotal domains in the FAOSTAT catalog, independent of any filter.
indexedCountYesDomains currently indexed in the local mirror.
totalMatchesYesDomains matching the current filters, before the page limit is applied.
faostat_query_observationsfaostat-mcp-server: query observations
Read-only
Inspect

Query a FAOSTAT domain's data cube by area(s), item(s), element(s), and year range, returning observations (area, item, element, year, value, unit, and the data-quality flag). Resolve codes first with faostat_resolve_codes — the cube is unqueryable without them. Aggregate regions (World, continents, economic groupings) are EXCLUDED by default so a naive SUM does not double-count a region with its member countries; set include_aggregates=true to get the regional 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 GROUP BY / ranking / time-series analysis via faostat_dataframe_query. Every row carries its flag — commonly A=Official, B=time-series break, E=Estimated, I=Imputed, M=Missing (value cannot exist), T=Unofficial, X=from an international organization, plus others FAOSTAT defines per domain — so honor it, treat any unrecognized flag as informational, and never assume an estimated, imputed, or unrecognized value is official.

ParametersJSON Schema
NameRequiredDescriptionDefault
limitNoMax observations returned inline — also the preview size when the result stages to a canvas table. Rows past it are never dropped silently: a match larger than limit stages in full to a DataCanvas table (canvas_id + table_name), and when no table is staged the notice reports how many matched so you can raise limit or narrow the filters. Max 1000.
domainYesFAOSTAT domain code (e.g. "QCL"). Must be indexed locally.
year_endNoInclusive end year (e.g. 2022).
canvas_idNoCanvas ID from a prior call to stage onto. Omit to start a fresh canvas (a new id is returned).
area_codesNoArea codes from faostat_resolve_codes. When set, aggregates are NOT auto-excluded — the codes are honored verbatim.
item_codesNoItem codes from faostat_resolve_codes.
year_startNoInclusive start year (e.g. 2000).
element_codesNoElement codes from faostat_resolve_codes (e.g. 5510 Production).
include_aggregatesNoWhen false (default), exclude aggregate-region rows (codes ≥ 5000 plus a few curated sub-threshold roll-ups such as China=351) so sums are not double-counted. Set true for World/continent/grouping roll-ups. Ignored when explicit area_codes are passed.

Output Schema

ParametersJSON Schema
NameRequiredDescription
domainYesThe domain code echoed back.
noticeNoGuidance on empty results, aggregate exclusion, or how to reach the spilled set.
spilledYesTrue when the full result was staged on a DataCanvas table.
canvas_idNoCanvas ID holding the staged result — pass to faostat_dataframe_query / _describe.
truncatedYesTrue when the staged table hit the 50,000-row staging cap — the staged set is a PREFIX of the match, not the complete result. Partition the query by year or code ranges to capture the rest.
table_nameNoCanvas table name holding the full result set (present when spilled).
totalCountYesObservations matched. Exact when the result was returned inline or fully staged. A floor — more matched — in two cases, both named by the notice: the match exceeded the 50,000-row staging cap (truncated is then true), or staging failed and the response fell back to an inline page.
observationsYesInline observations (preview when the full set spilled to a canvas table).
staged_row_countNoRows actually staged on the canvas table (present when spilled). Equals the full match count unless truncated, in which case it is the 50,000-row cap.
faostat_resolve_codesfaostat-mcp-server: resolve codes
Read-onlyIdempotent
Inspect

Resolve human terms to the opaque integer codes faostat_query_observations needs, within a dimension: areas (countries/regions), items (commodities), or elements (metrics like production, yield, import quantity). Pass query for fuzzy full-text matching ("maize" → item 56), name_contains for a substring filter, or code for an exact-code lookup; omit all three to list the whole dimension. Item and element results are scoped to the requested domain — only codes present in that domain's cube are returned, so a resolved code is always queryable there (areas are shared across domains). Page large listings with offset + limit: when the response reports truncated, pass the returned nextOffset to fetch the next page. Every area match is flagged country or aggregate — aggregates (World, continents, economic groupings — codes ≥ 5000 plus a few curated sub-threshold roll-ups such as China=351, which sums mainland + Taiwan + Hong Kong + Macao) double-count if summed with their member countries, so resolve before querying and exclude aggregates unless you want the regional roll-up.

ParametersJSON Schema
NameRequiredDescriptionDefault
codeNoExact code lookup. Takes precedence over `query`/`name_contains` when provided.
limitNoMaximum matches to return (max 200).
queryNoFull-text search term, FTS5-matched against the dimension labels with prefix matching (e.g. "wheat", "import quantity"). Relevance-ranked.
domainYesFAOSTAT domain code (e.g. "QCL"). Item and element resolution is scoped to the codes present in this domain's data; area code lists are shared across all indexed domains.
offsetNoZero-based pagination offset into the match set. When the response reports truncated, pass the returned nextOffset here to fetch the next page. Ignored for exact-code lookups (always single-page).
dimensionYesWhich dimension to resolve: "area" (countries/regions), "item" (commodities), or "element" (metrics).
name_containsNoCase-insensitive substring filter over the label. Used only when `query` is omitted.

Output Schema

ParametersJSON Schema
NameRequiredDescription
domainYesThe domain code echoed back.
noticeNoGuidance when nothing matched, more pages remain, or the dimension is not yet indexed.
matchesYesMatching codes, relevance-ranked for query mode, else by code.
dimensionYesThe dimension resolved.
truncatedYesTrue when more matches remain beyond the returned page — fetch them with nextOffset.
nextOffsetNoOffset to pass on the next call to fetch the following page. Present only when truncated is true; absent on the last page and for exact-code lookups.
totalMatchesYesTotal matches in this domain before the result cap.

Discussions

No comments yet. Be the first to start the discussion!

Try in Browser

Your Connectors

Sign in to create a connector for this server.