nass_query
Pack: nass · Endpoint: https://gateway.pipeworx.io/nass/mcp
Search USDA agricultural statistics by commodity, statistic, geography, and year. Returns production, yield, acreage, prices, and livestock data (e.g., commodity=“CORN”, state_fips=“06” for California).
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
_apiKey | string | yes | NASS API key (free from quickstats.nass.usda.gov/api) |
commodity | string | yes | Commodity name, e.g., “CORN”, “SOYBEANS”, “WHEAT”, “CATTLE”, “MILK”, “COTTON” |
stat_category | string | no | Statistic category, e.g., “YIELD”, “PRODUCTION”, “AREA PLANTED”, “AREA HARVESTED”, “PRICE RECEIVED”, “INVENTORY” |
state | string | no | State name, e.g., “IOWA”, “ILLINOIS”, “CALIFORNIA” (optional) |
year | string | no | Year or range, e.g., “2024” or “2020:2025” (optional) |
agg_level | string | no | Aggregation level: “NATIONAL”, “STATE”, or “COUNTY” (optional) |
freq | string | no | Frequency: “ANNUAL”, “MONTHLY”, or “WEEKLY” (optional) |
source | string | no | Data source: “SURVEY” or “CENSUS” (optional, defaults to all) |
sector | string | no | Sector: “CROPS”, “ANIMALS & PRODUCTS”, “ECONOMICS”, “DEMOGRAPHICS”, “ENVIRONMENTAL” (optional) |
group | string | no | Commodity group, e.g., “FIELD CROPS”, “FRUIT & TREE NUTS”, “VEGETABLES” (optional) |
Example call
Arguments
{
"_apiKey": "your-nass-api-key",
"commodity": "CORN",
"stat_category": "YIELD",
"state": "IOWA",
"year": "2024"
}
curl
curl -X POST https://gateway.pipeworx.io/nass/mcp \
-H 'Content-Type: application/json' \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"nass_query","arguments":{"_apiKey":"your-nass-api-key","commodity":"CORN","stat_category":"YIELD","state":"IOWA","year":"2024"}}}'
TypeScript (@pipeworx/sdk)
import { Pipeworx } from '@pipeworx/sdk';
const pipeworx = new Pipeworx();
const result = await pipeworx.call('nass_query', {
"_apiKey": "your-nass-api-key",
"commodity": "CORN",
"stat_category": "YIELD",
"state": "IOWA",
"year": "2024"
});
More examples
{
"_apiKey": "your-nass-api-key",
"commodity": "SOYBEANS",
"stat_category": "PRODUCTION",
"year": "2020:2025",
"agg_level": "NATIONAL"
}
Response shape
Always returns: count, data, truncated
| Field | Type | Description |
|---|---|---|
count | integer | Number of records returned |
data | array | Array of up to 200 agricultural records |
truncated | boolean | True if results exceed 200 records and were truncated |
Full JSON Schema
{
"type": "object",
"properties": {
"count": {
"type": "integer",
"description": "Number of records returned"
},
"data": {
"type": "array",
"items": {
"type": "object",
"properties": {
"commodity": {
"type": [
"string",
"null"
],
"description": "Commodity name (e.g., CORN, SOYBEANS)"
},
"stat_category": {
"type": [
"string",
"null"
],
"description": "Statistical category (e.g., YIELD, PRODUCTION)"
},
"state": {
"type": [
"string",
"null"
],
"description": "State name"
},
"county": {
"type": [
"string",
"null"
],
"description": "County name"
},
"agg_level": {
"type": [
"string",
"null"
],
"description": "Aggregation level (NATIONAL, STATE, COUNTY)"
},
"year": {
"type": [
"integer",
"null"
],
"description": "Year of the record"
},
"frequency": {
"type": [
"string",
"null"
],
"description": "Frequency (ANNUAL, MONTHLY, WEEKLY)"
},
"period": {
"type": [
"string",
"null"
],
"description": "Reference period description"
},
"value": {
"type": [
"string",
"null"
],
"description": "Numeric or categorical value"
},
"unit": {
"type": [
"string",
"null"
],
"description": "Unit of measurement"
},
"description": {
"type": [
"string",
"null"
],
"description": "Short description of the statistic"
}
}
},
"description": "Array of up to 200 agricultural records"
},
"truncated": {
"type": "boolean",
"description": "True if results exceed 200 records and were truncated"
}
},
"required": [
"count",
"data",
"truncated"
]
}
Connect
Add this to your MCP client config, or use one-click install buttons:
{
"mcpServers": {
"nass": {
"url": "https://gateway.pipeworx.io/nass/mcp"
}
}
}
See Getting Started for client-specific install steps.