usda-psd
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
xippios-usda-psd
Typed Python client, MCP server and FastAPI routes for USDA FAS PSD Online, part of the xippios SDK family. Names and semantics follow the upstream documentation; every response carries its metadata (source, endpoint, retrieved_at, request).
Scope
Of PSD's API the package wraps all nine operations that its documentation lists
(docs/upstream/): the supply and distribution records of one commodity and market year for
one country, for every country and for the world, the list of release dates, and the five
lists of codes, which the package ships and refreshes before each release. PSD documents
path parameters alone, commodityCode, countryCode and marketYear, and the tasks take
every one. The documentation lists XML beside JSON among the forms that each operation
produces; the package asks for JSON, so XML is the one documented choice that a caller cannot
make (https://github.com/xippios/sdk-usda-psd/issues/61). PSD Online's downloadable files,
which no page of the API's documentation describes, are outside the package (https://github.com/xippios/sdk-usda-psd/issues/37). What the package
adds is one country's series over market years and filters that select records of the release
list, of a data answer by since and of the packaged lists. It ranks no country, pivots no record into a table and picks
no newest release for the caller: a caller reads every record as PSD sends it from
get_data, get_world_data and get_release_dates.
Related MCP server: usda-gats
Install
uv add xippios-usda-psd # client only
uv add "xippios-usda-psd[mcp]" # + MCP server
uv add "xippios-usda-psd[http]" # + FastAPI routerSet DATA_GOV_API_KEY in the environment. Nothing is read from files. The package
depends on xippios-usda-fas, the shared package of the FAS sources, for the api.data.gov
gateway, FAS's answer for a market year without data and the kit of the FAS portal's
documentation.
30-second example
from xippios.usda.psd import get_data
from xippios.usda.psd.enums import AttributeId
result = get_data("0410000", 2023, country_code="US") # wheat, 2023, United States
production = next(r for r in result.data if r.attribute_id == AttributeId.PRODUCTION)
production.value, production.unit_id # Decimal('49095.0'), 8 (UnitId._1000_MT)
result.meta.vintage # "2026-07": the PSD release that last revised these figures
result.meta.published_at # None: PSD gives a month, no day
result.meta.retrieved_at, result.meta.requestCodes are PSD's own (commodity 0410000 wheat, 0440000 corn, 2222000 soybeans;
country US, BR, E4), checked against the lists packaged in reference/ before any
call. Leave out the country for every country at once, or use get_world_data for the
world total; a market year PSD holds no data for answers the empty list with a note in
meta.notes, and meta.names names the codes of the rows. attribute_id and unit_id
are PSD's integer ids; enums.AttributeId and enums.UnitId name the packaged ones and
compare equal to them. The MCP server returns at most 200 rows per call, and every country
at once is up to about 1,900 rows, so pass a country there or continue with offset,
which the response cache answers. get_release_dates tells when PSD last revised each
country and market year, and its meta.vintage the newest release of the whole list;
compare it with a stored meta.vintage, or pass that vintage as since, to fetch only
what changed. get_data takes since too and keeps the records that a later release
revised, get_data("0410000", 2023, since="2026-09"), while its meta.vintage stays the
newest release of the whole answer, the marker to store for the next call, also where no
record is kept.
The list_* tasks look codes up in the packaged lists, without a call:
from xippios.usda.psd import list_commodities, list_countries
result = list_countries(region_code="R01") # PSD's region North America (list_regions)
[c.country_code for c in result.data] # ["CA", "GL", "MX", "SB", "US"], upstream order
result.meta.endpoint, result.meta.retrieved_at # "PSDData_GetCountries", 2026-10-28T21:42:03Z
list_countries(search="united").data # TC, UK, US: code, name or GENC code, ignoring case
list_countries(search="usa").data # US United States, by its GENC code "USA"
list_commodities(search="soybean").data # meal, oil and oilseed, each also "(Local)"meta.retrieved_at of a list is when the package fetched it, and its meta.vintage is
None, since upstream gives these lists no version. Over MCP usda_psd_list_countries
returns all 251 countries through a cap of its own.
get_time_series puts together one country's records of a commodity over a range of
market years, one request for the commodity's release list and then one per market year, and
changes none: no derived totals, no unit conversion, no gap filling.
from xippios.usda.psd import get_time_series
from xippios.usda.psd.enums import AttributeId
series = get_time_series(
"0440000", "US", start_year=2021, end_year=2023, attribute_id=AttributeId.PRODUCTION
)
[(r.market_year, r.value) for r in series.data] # the release list, then 3 requests
get_time_series("0440000", "US", start_year=2023, end_year=2023, attribute_id=[28, 88])
get_time_series("0440000", "US", start_year=2023, end_year=2023) # every attributeget_time_series starts at 1960 at the earliest, spends one request on the commodity's
release list and one per market year, at most 100 market years in Python and over HTTP and 24
over MCP, leaves a year without data out and names it in meta.notes, and counts against the
hourly quota like every other request; without attribute_id it keeps every attribute. A
range that ends past the newest market year of the release list is refused whole with
NotFoundError naming that year, since PSD answers a market year it has not released with
the empty list, as it answers one without data.
MCP
{
"mcpServers": {
"usda-psd": {
"command": "uvx",
"args": ["--from", "xippios-usda-psd[mcp]", "xippios-usda-psd-mcp"],
"env": { "DATA_GOV_API_KEY": "..." }
}
}
}Tools are read-only and named usda_psd_<verb>_<noun>. Results are capped at
200 rows or 64 KB with a note on how to narrow the query; usda_psd_list_countries has a
cap of its own, 300 rows, so all 251 countries arrive. --http serves streamable HTTP
instead of stdio, and --series-years N sets the most market years one
usda_psd_get_time_series call fetches, 24 by default, from 1 to 100.
Status
Upstream operation | Task function | MCP tool | Status |
|
|
| alpha |
|
|
| alpha |
|
|
| alpha |
|
|
| alpha |
|
|
| alpha |
|
|
| packaged; |
|
|
| packaged; |
|
|
| packaged; |
|
|
| packaged; |
|
|
| packaged; |
0.6.0 covers nine tasks, as 0.5.0 did, and requires xippios-core 0.5.x (~=0.5.0) and
xippios-usda-fas 0.1.x (~=0.1.0); the ranking get_top_countries, the pivot
get_balance_sheet and the pick of the newest release get_latest_release of 0.4.0 left in
0.5.0, since a source package answers upstream's records and none of them, and 0.4.0 does
not work with core 0.5.0.
Alpha until 1.0: the public surface may change in a minor version (conventions §12);
CHANGELOG.md lists every change.
Every request counts against api.data.gov's quota of 1,000 requests per hour per key,
shared by every package using the same DATA_GOV_API_KEY; the list_* tasks spend none.
The client keeps its own pace of one request per second and keeps each answer for 300 s in
core's response cache, so a second read of a path sends nothing; once the quota is spent
it waits for the quota to come back when that takes at most 30 s, and otherwise raises
RateLimitError with retry_after instead of sending.
Upstream terms and attribution
Data comes from USDA FAS PSD Online (https://apps.fas.usda.gov/psdonline/) under its own terms of use;
this package adds no rights to it. Documentation snapshot: docs/upstream/.
Workflows
ci.yml runs ruff, its format check, mypy, pytest and pre-commit on Python 3.12, 3.13 and
3.14, requires a changelog entry of every pull request but Dependabot's and refuses a
fixture file over 256 KiB that a pull request adds or changes. It runs on every pull request and,
called by publish.yml, once for a release, and its job ci is the check the
organization's ruleset requires. It is handed no secret, and no variable switches it off.
publish.yml is the release train (conventions §12): on a push to main whose
pyproject.toml names a version that has no tag yet and has its section in CHANGELOG.md,
it runs ci.yml, refuses a core pinned to git, tags the merge commit, builds the package
and, once a reviewer of the environment pypi approves the run, publishes it to PyPI by
trusted publishing. Every push to main and a dispatch start it, and a push that brings no
release ends quietly. It is handed no secret: the step that tells a release is handed the
job's token as GH_TOKEN, the tag goes with the job's token and PyPI trusts the workflow
itself. Its job tag holds the one checkout of the repository that keeps its credentials,
since it pushes the tag with the job's token; every other checkout sets
persist-credentials: false (conventions §13). No variable switches it off.
live.yml runs every live test against the upstream with --tb=short --assert=plain, so
its public log holds neither a failing test's arguments nor the values an assertion compared.
It runs every night at 01:25 UTC and on demand, never on a pull request.
Its pytest step alone is handed XIPPIOS_LIVE_TESTS and, each from the secret of the same
name, DATA_GOV_API_KEY, so the checkout, setup-uv and uv sync see none.
A variable WORKFLOW_LIVE of off, the repository's over the organization's, switches it off.
conventions.yml calls the organization's review of a pull request against the documents
listed under Documents below, the check conventions / conventions, when a pull request
opens, is pushed to, reopens or is edited, and on a push to main or a dispatch the review
of the range of commits, range / range. It hands the review the organization's
secret of the model's key, by name. A variable WORKFLOW_CONVENTIONS of off, the
repository's over the organization's, switches both off.
adr-index.yml calls the organization's check of the ADR index, adr-index / adr-index,
which runs scripts/adr_index.py --check, when a pull request opens, is pushed to or
reopens. It hands over nothing, and the called workflow reads its switch itself: a variable
WORKFLOW_ADR_INDEX of off, the repository's over the organization's, skips the check.
siblings.yml runs .github/scripts/check-siblings.sh, which installs the wheel beside
every sibling on PyPI under the same provider namespace that shares its core minor and
beside the source packages it depends on, and proves that the namespace levels stay portions
(sdk-core ADR-0006, sdk-core ADR-0021). It runs on every pull request and push to main, a
check the ruleset does not require, in a workflow of its own, since ci.yml is core's file,
which publish.yml calls for a release. It hands the script the job's read-only token as
GITHUB_TOKEN, for the listing of the organization's repositories, since GitHub limits the
calls of a runner without one. A variable WORKFLOW_SIBLINGS of off, the repository's
over the organization's, switches it off.
Documents
sdk-core: docs/conventions.md — the conventions every xippios source package follows: its layout, names, results, tests and releases.
sdk-core: docs/adr.md — the index of the family's architecture decisions, which the conventions cite.
sdk-core: docs/definition-of-done.md — what a change satisfies before its pull request is opened.
sdk-core: docs/review-checklist.md — what the review of a pull request checks, in order.
sdk-usda-psd: docs/adr.md — the index of this package's own decisions, generated from the records in
docs/adr/.sdk-usda-psd: docs/upstream/FETCHED.md — the snapshot of the upstream documentation, the reference for names, parameters and semantics.
sdk-usda-psd: docs/upstream/OBSERVED.md — what PSD was seen to do that its documentation never states, each note with the probe that showed it.
Licence
Apache-2.0. See LICENSE.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
AI-powered commodity price forecasts and Brazil trade intelligence via MCP. Access Brazilian exports and imports from MDIC/ComexStat since 2000, by HS4, HS6 and NCM code, partner country, USD FOB and kilograms — plus crop production, supply & demand, climate data and production forecasts for major commodities including soybeans, coffee, corn, beef and cocoa. Compare trade flows, markets, countries and time periods with like-for-like windows. Every answer identifies the measurement period and data source. 15 read-only tools. Metered in credits. Connect directly via Streamable HTTP — no installation required: https://mcp.kyrodata.com/mcp Authentication: Bearer key or OAuth 2.1 (PKCE). Official MCP registry: com.kyrodata/kyrodata
Search 77k public-sector open data APIs across 10 countries. Read-only, no API key.
Read-only discovery for Malaysian public datasets with freshness, licence, and provenance.
UN Comtrade international trade statistics via MCP. Country/HS lookups, flows, balances, rankings.
Related MCP Servers
- AlicenseNot gradedqualityAmaintenanceExposes read-only tools for querying USDA NASS Quick Stats, covering reported counts, filtered data pulls, parameter values, crop progress and condition, county yield and production, acreage and forecasts, and prices received. Results are capped with guidance on narrowing queries.Apache 2.0
- AlicenseNot gradedqualityBmaintenanceRead-only MCP tools for querying USDA FAS Global Agricultural Trade System census export and import records by partner country, year, month and HS10 code prefix, plus the release-date lists for each flow. Results are capped with notes on omitted rows, and responses carry release vintages and retrieval metadata.Apache 2.0
- AlicenseNot gradedqualityAmaintenanceEnables querying USDA FAS Export Sales Reporting data through read-only tools, including weekly export quantities by commodity, destination country and market year, latest-week and top-destination slices, data release dates, and lookups of commodity, country, region and unit codes. Cross-references ESR's own integer codes against packaged reference lists so valid commodities and destinations are resolved before any request.Apache 2.0
- AlicenseNot gradedqualityAmaintenanceEnables read-only access to USDA ESMIS data through MCP tools, returning capped results with release metadata and guidance for viewing the remainder.150 PyPIApache 2.0