Skip to main content
Glama

xippios-usda-esmis

Typed Python client, MCP server and FastAPI routes for USDA ESMIS, the Economics, Statistics, and Market Information System of USDA's National Agricultural Library, part of the xippios SDK family. Names and semantics follow the upstream documentation; every response carries its metadata (source, endpoint, retrieved_at, request), and an answer about one release its release time and id as published_at and vintage.

Scope

Of ESMIS's API the package wraps all twelve operations that its OpenAPI document lists (docs/upstream/): the agencies, and one of them by its acronym or its number; every publication or an agency's, the publications found by keyword, and one by an identifier or its number; a publication's releases by either; the releases of every publication; and one release with its files, which download_release_file downloads. Each is read live, and the package also ships every page of esmis_api_publication_findAll as its table of every publication, refreshed before each release, which list_publications answers from without a request. The tasks take every parameter that the document lists, so no documented choice is left that a caller cannot make (sdk-core ADR-0060, decision 8).

What the package adds is a walk of a list's pages under one bound, filters that keep the releases of a list by their printed date, and filters that select rows of the packaged table by text, by agency or by the value of a column. It parses no released file (sdk-core ADR-0020) and picks no latest release for the caller: ESMIS lists a publication's releases newest first page by page, some older ones listed early and out of place, so the first row of list_releases(identifier, page=0) is the publication's latest (docs/upstream/OBSERVED.md).

Related MCP server: usda-nass

Install

uv add xippios-usda-esmis            # client only
uv add "xippios-usda-esmis[mcp]"     # + MCP server
uv add "xippios-usda-esmis[http]"    # + FastAPI router

No API key is needed.

30-second example

from pathlib import Path

from xippios.usda.esmis import download_release_file, get_release, list_releases

latest = list_releases("wasde", page=0).data[0]  # row 0 of page 0: the latest WASDE release
latest.id, latest.release_datetime  # "796099", 2026-10-09 12:00:00+00:00, as printed

release = get_release(latest.id)  # with each file's URL
[file.format for file in release.data.release_files()]  # ["pdf", "txt", "xls", "xml"]
release.meta.vintage  # "796099": the release id
release.meta.published_at  # 2026-10-09 12:00:00, the printed time without its +0000
release.meta.published_at_naive  # True: upstream's text, no zone attached (sdk-core ADR-0041)
release.meta.names  # {"agency_acronym": {"WAOB": "World Agricultural Outlook Board"}}

# Python only, no MCP tool: streams the TXT to the path you name; nothing is cached
txt = download_release_file(796099, dest=Path("wasde1026.txt"), format="txt")
txt.data.path, txt.data.bytes, txt.data.content_type  # wasde1026.txt, 122378, "text/plain"
txt.meta.endpoint  # "wasde1026.txt": the file's name as upstream prints it

What identifies a record, a publication's identifier, an agency's acronym or a release's id, is passed by position, and every other argument by name: publication_id and agency_id, the number in place of the identifier or the acronym, since, until and page of the release lists, page of search_publications, agency_acronym and page of list_publication_details, search, agency_acronym, status, frequency and resource_type of list_publications, and dest, format and name of download_release_file, whose dest is required. A number goes in as a record's id came out, as its text, or as an integer. search_publications("wasde") finds a publication's identifiers and its id, and list_releases("wasde", since=date(2026, 1, 1)) its releases since a date, in ESMIS's order, to the first page whose newest release is dated before it. list_recent_releases(since=date(2026, 10, 20)) lists what USDA released across every publication since a date, latest catalogued first. A walk of pages sends at most 24 requests, in Python and over MCP alike, and one that needs more is refused and returns nothing, naming page: after its first request where upstream's count shows it, as for list_releases("wasde") without since, WASDE's releases filling 29 pages, and list_recent_releases without since, and after its 24th where a walk from since reaches no page that ends it within them, as for WASDE's releases from a since before 1982-02-12 (docs/upstream/OBSERVED.md, "A publication's releases come newest first page by page"). A walk from a since before 2025-09-12, ESMIS's migration, is refused before any request, as the older ids do not follow the release dates; list_releases or page serves older dates. A second call within 300 seconds is answered from the client's cache, its meta.retrieved_at the time the first answer was stored.

A publication's number names that publication alone, where an identifier can belong to two, as AMS_1045 does, or hold a /, which ESMIS's web server refuses, as publication 654's only one does:

from xippios.usda.esmis import get_agency, get_publication, list_releases

# get_publication("AMS_1045") is refused and names both numbers, 1443 and 2064
get_publication(publication_id=1443).data.title  # "Dry Whey - Central U.S."
len(list_releases(publication_id=654).data)  # 3, the releases of 654 alone
get_agency("WAOB").data.id, get_agency(agency_id=3).data.acronym  # "3", "WAOB"

list_publications() answers from the table of 2522 publications packaged with this version, fetched on 2026-10-27, without a request:

from xippios.usda.esmis import list_publications

wheat = list_publications(search="wheat")  # id, identifier or title contains "wheat": 30
ers = list_publications(agency_acronym="ERS")  # as list_agencies() spells it: 121
ers.meta.retrieved_at  # 2026-10-27 17:24:48+00:00, when the table was fetched
ers.meta.endpoint  # "esmis_api_publication_findAll", the operation it came from
active = list_publications(agency_acronym="ERS", status="Active")  # 16

An acronym the packaged agency table lacks raises UnknownCode, an InvalidRequestError naming the closest ("ers": did you mean ERS?), and so does a status, frequency or resource_type that its column never holds, naming every value it holds ("active": one of 'Active', 'Inactive').

list_publication_details reads the publications live with all fifteen fields of Publication, the keywords, the description and the coming release times among them, an agency's list whole or one page of any list:

from xippios.usda.esmis import list_publication_details

waob = list_publication_details(agency_acronym="WAOB")  # 1 request: 2 publications
waob.data[0].keywords[:3]  # ["dairy", "grains", "soybeans"]
waob.data[1].title  # "Weekly Weather and Crop Bulletin"
list_publication_details(page=0).meta.total  # 2522: every publication, on 101 pages

A walk of more than 24 pages is refused after its first request, naming page, as every publication's 101 are, while an agency's list of up to 600 publications answers whole. The packaged table counts 2,008 publications for AMS, 371 for NASS and 121 for ERS, but ESMIS's own count of an agency is recorded for WAOB alone, and 2,007 of the 2,008 rows that list AMS list it beside one of its programs, such as AMS-LPS, which ESMIS's count of AMS may or may not take in.

MCP

{
  "mcpServers": {
    "usda-esmis": {
      "command": "uvx",
      "args": ["--from", "xippios-usda-esmis[mcp]", "xippios-usda-esmis-mcp"]
    }
  }
}

Tools are read-only and named usda_esmis_<verb>_<noun>. Results are capped, at 200 rows or 64 KB unless a tool has a cap of its own, with a note on how to see the rest. Five tools keep the default with a note naming their own parameters: usda_esmis_list_publications takes offset, which its note names, and reads the rest of its packaged table in further calls, beside its filters, while list_publications() in Python and its HTTP route return the whole table; usda_esmis_list_releases and usda_esmis_list_recent_releases name since, until and page, and usda_esmis_search_publications and usda_esmis_list_publication_details name page. download_release_file is no tool and no route: a bulk task, Python only (sdk-core ADR-0040). --http serves streamable HTTP instead of stdio.

Status

Upstream operation

Task function

MCP tool

Status

esmis_api_agency_findAll

list_agencies()

usda_esmis_list_agencies

alpha

esmis_api_agency_findByAcronym, or esmis_api_agency_findById for agency_id

get_agency(agency_acronym=None, *, agency_id=None), one of the two

usda_esmis_get_agency

alpha

esmis_api_publication_findAll, every page, packaged (fetched 2026-10-27; no request)

list_publications(*, search=None, agency_acronym=None, status=None, frequency=None, resource_type=None)

usda_esmis_list_publications

alpha

esmis_api_publication_findAll, or esmis_api_publication_findByAgency for agency_acronym, every page, at most 24, unless page is given

list_publication_details(*, agency_acronym=None, page=None), every field of Publication

usda_esmis_list_publication_details

alpha

esmis_api_publication_search, every page, at most 24, unless page is given

search_publications(query, *, page=None)

usda_esmis_search_publications

alpha

esmis_api_publication_findByIdentifier, or esmis_api_publication_findById for publication_id

get_publication(publication_identifier=None, *, publication_id=None), one of the two

usda_esmis_get_publication

alpha

esmis_api_release_findByIdentifier, or esmis_api_release_findByPubId for publication_id, pages walked from 0 down to since (to the first page whose newest release is dated before it), at most 24, unless page is given

list_releases(publication_identifier=None, *, publication_id=None, since=None, until=None, page=None), one of the first two

usda_esmis_list_releases

alpha

esmis_api_release_findAll, every publication's releases, pages walked from 0 down to since (to the first page whose newest release is dated more than 14 days before it), at most 24, unless page is given

list_recent_releases(*, since=None, until=None, page=None), refused past 24 pages, so without since, and for a walk from a since before 2025-09-12

usda_esmis_list_recent_releases

alpha

esmis_api_release_findById

get_release(release_id), each file's URL in its answer, Release.release_files() their names and formats

usda_esmis_get_release

alpha

esmis_api_release_findById, then the file

download_release_file(release_id, *, dest, format=None, name=None), a bulk task: dest required, the file chosen by format, name or both

none, Python only

alpha

Upstream terms and attribution

Data comes from USDA ESMIS (https://esmis.nal.usda.gov) under its own terms of use; this package adds no rights to it. The documentation and the release files are works of the United States Government (USDA National Agricultural Library, ESMIS), in the public domain in the United States (17 U.S.C. § 105); a suggested credit line is "Source: USDA National Agricultural Library, ESMIS". The pages the snapshot reads print no copyright line, and USDA's policy page is cited in docs/upstream/FETCHED.md. 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:27 UTC and on demand, never on a pull request. Its pytest step alone is handed XIPPIOS_LIVE_TESTS, and no secret. 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-esmis: docs/adr.md — the index of this package's own decisions, generated from the records in docs/adr/.

  • sdk-usda-esmis: docs/upstream/FETCHED.md — the snapshot of the upstream documentation, the reference for names, parameters and semantics.

  • sdk-usda-esmis: docs/upstream/OBSERVED.md — what the live API does that its documentation does not state, where it answers otherwise above all, 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…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables bounded, read-only access to approved HEC-HMS text project files and selected scalar, gage, and control/run relationship fields through MCP tools. Returns compact source-verified answers with versions, units, counts, truncation, and blockers while enforcing configurable root, row, character, and time limits.
      MIT
    • A
      license
      Not graded
      quality
      A
      maintenance
      Exposes 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
    • A
      license
      Not graded
      quality
      B
      maintenance
      Exposes read-only tools for querying USDA FAS PSD Online commodity supply and distribution data, with every response carrying release metadata such as source, endpoint, retrieval time and vintage. Results are capped by row count and size, with guidance returned on how to narrow a query.
      Apache 2.0
    • A
      license
      Not graded
      quality
      B
      maintenance
      Read-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