# USDA NASS MCP

> USDA NASS connects your AI client to the National Agricultural Statistics Service (NASS) API. Query detailed US data on crop yields, cattle inventory, farm economics, and demographics using natural language. Get production statistics for corn, soybeans, wheat, and more—all from one place.

## Overview
- **Category:** data-analytics
- **Price:** Free
- **Tags:** crop-statistics, livestock-data, farm-economics, demographics, agricultural-data

## Description

Connecting your AI client to the National Agricultural Statistics Service (NASS) API means you can query deep, detailed US data on farming—from corn yields to cattle counts—using plain English. You don't have to wrestle with those complicated government websites; your agent handles all that dirty work.

**Crop Production Summaries:** The `get_crop_summary` tool lets you pull production totals and yield stats for major crops like soybeans or wheat. You can narrow down the results by specific states or years, so you get exactly what you need.

**Livestock Inventory Totals:** If you're tracking animal populations, `get_livestock_summary` provides current inventory counts and production summaries for commodities like cattle, hogs, chickens, milk, or eggs. It gives you the latest numbers across those sectors.

**Agricultural Economic Data:** You can get financial metrics by running `get_economics_data`. This pulls stuff like prices paid to farmers, commodity expenses, or even land values for a specific state and year. It's all tied together by commodity.

**Farm Demographics:** Need to know who’s working the farms? The `get_demographics_data` tool retrieves population data about farm operators. You can filter this down by age, occupation, or even pinpoint it to a specific state and year.

**Search Broad Commodity Data Sets:** When you're just trying to figure out what data exists for a certain commodity—say, 'barley'—you run `search_by_commodity`. This gives you a wide search across all available stats: production numbers, price history, and inventory counts. It’s your starting point.

**General Data Querying:** The `get_quick_stats` tool lets you run a general query against the whole NASS database. You feed it multiple filters—like sector, state, year, or if you want annual or monthly figures—and it runs the report. It’s super flexible.

**Parameter Discovery:** Before you hit send on any major query, use `get_param_values`. This tool lists all the valid values for every filter NASS uses—states, commodities, units. You'll know exactly what parameters to plug in, which saves a ton of time.

**Data Metadata Lookup:** If you want to know what data set exists or how often it gets updated, `get_survey_info` displays metadata about the USDA NASS surveys. It tells you precisely what data they collect and the frequency of that collection. You'll also use `get_demographics_data` if you wanna see population trends by specific sectors.

**Commodity Identification:** To make sure you’re using the right terms, you can run a broad search for all available statistics—production, price, or inventory—for one specific commodity name. This is how you nail down your subject matter before building the final report.

When you use these tools together, your AI client acts like an expert agricultural analyst. You don't just get data; you get full context on farming economics and demographics that you can ask for in plain English.

## Tools

### get_survey_info
Displays metadata about USDA NASS surveys, detailing what data is collected and how frequently.

### search_by_commodity
Performs a broad search for all available statistics—production, price, inventory, acreage—for one specific commodity name.

### get_crop_summary
Gets production summaries for major crops like corn or soybeans, letting you filter by state and year.

### get_demographics_data
Retrieves data about farm operators (age, occupation) using the demographics sector, optionally filtered by state/year.

### get_economics_data
Pulls economic metrics—like prices paid or production expenses—for a given commodity, state, and year.

### get_livestock_summary
Provides current inventory and production totals for livestock commodities like cattle, hogs, milk, or eggs.

### get_param_values
Lists available values (like valid states, units, or commodity names) so you know what parameters to use in your queries.

### get_quick_stats
Runs a general query across the NASS database using multiple filters like sector, state, year, and frequency (annual/monthly).

## Prompt Examples

**Prompt:** 
```
Show me the corn production summary for Iowa in 2024.
```

**Response:** 
```
Iowa corn production in 2024: 2,480 million bushels produced from 12.8 million harvested acres, with an average yield of 193.8 bushels/acre. The average price received by farmers was $4.45/bushel. Iowa remains the #1 corn-producing state in the US.
```

**Prompt:** 
```
What are the current cattle inventory numbers for Texas?
```

**Response:** 
```
Texas cattle inventory (Jan 2024): Total cattle and calves at 13.5 million head (down 2% from 2023). Beef cows: 4.1 million, Milk cows: 0.58 million, Other cattle: 8.82 million. Texas remains the #2 cattle state after Montana.
```

**Prompt:** 
```
Show me what commodity values are available for filtering.
```

**Response:** 
```
Available commodities include: CORN, SOYBEANS, WHEAT, COTTON, RICE, SORGHUM, OATS, BARLEY, HAY, PEANUTS, POTATOES, SUGARCANE, SUNFLOWER, CATTLE, HOGS, CHICKENS, TURKEYS, MILK, EGGS, HONEY, WOOL and 200+ more. Use `get_param_values` with any parameter to see the complete list.
```

## Capabilities

### Retrieve Crop Production Summaries
Gets detailed yield and production statistics for any major crop by commodity name, with optional filters for state or year.

### Analyze Farm Demographics
Retrieves population data about farms—like operator age or occupation—with optional filtering by state and year.

### Get Agricultural Economic Data
Pulls financial metrics, including prices paid/received by farmers, commodity expenses, and land values.

### Pull Livestock Inventory Totals
Provides current production summaries for various livestock commodities like cattle, hogs, chickens, milk, or eggs.

### Discover Valid Query Parameters
Uses a parameter discovery tool to show you what values are valid for any filter (states, commodities, units) before you build your main query.

### Search Broad Commodity Data Sets
Runs a wide search across all available data—production, price, and inventory—for a specific commodity name.

## Use Cases

### Assessing regional risk for soybeans.
A trader needs to know if Iowa's soybean production is sustainable. They start by running `get_crop_summary` for SOYBEANS and a specific year. Then, they run `get_economics_data` on that same region to check the average price received, giving them two key data points in one sequence.

### Building a demographic report.
A researcher wants to link farm structure to output. They first pull demographics using `get_demographics_data` for a region and then use the resulting states/years as filters when calling `get_quick_stats` to get correlated crop yield data.

### Tracking dairy market health.
A dairy consultant needs an overview. They run `get_livestock_summary` for MILK and EGGS to check current inventory levels, then use `search_by_commodity` to pull in related economic data to see price trends over the last five years.

### Quickly finding all available metrics.
A new analyst doesn't know what sectors are available. They start with `get_param_values`. This immediately lists every possible commodity and sector, guiding them to use the correct parameters for a subsequent call like `get_quick_stats`.

## Benefits

- Compare full-cycle data points. You can combine yield metrics from `get_crop_summary` with the average price paid by farmers via `get_economics_data` to understand total market value for any commodity.
- Map resource constraints easily. Use `get_livestock_summary` alongside `get_quick_stats` (setting sector to ANIMALS & PRODUCTS) to track how changes in cattle inventory correlate with regional economic shifts.
- Build reports without guessing parameters. Instead of failing, run `get_param_values` first. This shows you exactly which states or commodity codes are valid for your query before you spend time building it.
- Understand the source data quality. Use `get_survey_info` to check how often a metric is collected and what methodology NASS used, giving you context that raw numbers can't provide.
- Analyze population trends alongside production. You can cross-reference crop yields (`get_crop_summary`) with farmer demographics (`get_demographics_data`) to see if shifts in the operator age group correlate with declining local output.

## How It Works

The bottom line is: You ask a question about American farming, and your AI client gets the precise data from NASS APIs without any manual API calls or web navigation.

1. Subscribe to the server and provide your USDA NASS API Key (free at nass.usda.gov/developer).
2. Tell your AI client what data you need in plain language, referencing specific commodities or states.
3. The agent uses the correct tool (e.g., `get_crop_summary`) to fetch and format the statistics for you.

## Frequently Asked Questions

**How do I get a USDA NASS API key?**
Visit [**nass.usda.gov/developer**](https://www.nass.usda.gov/developer/index.php) and register for a free API key. The key is delivered instantly via the web form. It's completely free with no usage cost.

**What crops and commodities are available?**
The NASS Quick Stats database covers all major US agricultural commodities: CORN, SOYBEANS, WHEAT, COTTON, RICE, SORGHUM, OATS, BARLEY, HAY, PEANUTS, POTATOES for crops; CATTLE, HOGS, CHICKENS, TURKEYS, MILK, EGGS, HONEY for livestock; plus fruit, vegetables, nursery products and many more. Use `get_param_values` with param 'commodity' to see the complete list.

**Can I filter data by state and year?**
Yes! All query tools support optional state and year parameters. State can be the full name (e.g. 'IOWA') or abbreviation (e.g. 'IA'). Year accepts specific years (e.g. '2024') or ranges. The data returned includes the state, year, commodity, value and unit for each record.

**What kind of economic data is available?**
The ECONOMICS sector includes: prices received by farmers for crops and livestock, prices paid by farmers (inputs, feed, fuel), farm production expenses, farm real estate values, cash rent for cropland and pasture, and agricultural income data. Use `get_economics_data` to query by commodity, state and year.

**How do I find all valid parameters before running a query with `get_quick_stats`?**
Start by calling the `get_param_values()` tool. This function returns the complete list of acceptable values for any filter—like states, commodities, or frequency types. Use this first; it's how you debug your input before querying data.

**What is the best way to correlate crop production with farm income?**
You need a two-step process using separate tools. First, use `get_crop_summary()` for yield and acreage. Next, run `get_economics_data()`. Make sure you filter both calls by the same state and year so the data points match up.

**I need a broad view; how do I search across multiple types of statistics for one commodity?**
Run `search_by_commodity(commodity_name)`. This tool pulls in all available stats—production, price, inventory, and acreage—in one query. It's much faster than running individual summaries for each data type.

**How do I know which survey data is the most recent or how often it’s collected?**
Check the metadata first by calling `get_survey_info()`. This tells you about collection frequencies and methodologies. If you're looking for operator details, use `get_demographics_data()` separately.