crop-prices
by RootedInData
README.md
# crop-prices
A Claude Code plugin for US commodity crop prices. It bundles an MCP server that
fetches prices for 37 crops from three free sources, and a skill that turns them
into a one-screen market brief.
| Source | What it is | Freshness |
|---|---|---|
| Yahoo Finance | Front-month futures (CBOT, ICE) | Daily |
| USDA NASS | Average price received by US farmers | Monthly (yearly for nuts, tobacco, sugarbeets) |
| FRED (IMF) | Global benchmark prices | Monthly |
## What you get
**MCP tools**
- `list_commodities`: crops and groups the server knows about.
- `get_current_price`: latest price for one crop (futures first, then farm, then global).
- `get_price_history`: a price series with start, end, low, high, and % change. Supports
state-level farm prices (e.g. Iowa soybeans).
- `compare_commodities`: rank up to 12 crops by % change over the same period.
- `get_group_snapshot`: current prices for a whole group (grains, oilseeds, fiber, softs,
specialty, forage, other).
**Skill: `crop-market-brief`**
Ask "give me a crop market brief" and Claude writes a short report: a headline,
futures price tables by group, a 12-month trend table, and notes on units and how
fresh each price is.
## Install
Requirements: [uv](https://docs.astral.sh/uv/) (the server runs with `uv run`).
```
/plugin marketplace add RootedInData/crop-prices
/plugin install crop-prices@crop-prices
```
### USDA NASS API key (optional)
Futures and global prices work without a key. For USDA farm prices, get a free key
at https://quickstats.nass.usda.gov/api and set it:
```
claude plugin configure crop-prices
```
The key is stored as a sensitive plugin option. For local development you can put it
in `.env` instead (see `.env.example`).
## Notes on the data
- Every price comes with its unit and source. Units differ across sources, even for
the same crop (soybeans: cents/bushel futures, $/bushel farm price, $/metric ton global).
- Futures and farm prices measure different things; the skill never computes a
% change between them.
- Prices are nominal (not adjusted for inflation).
- Not investment advice.
## Development
```
uv sync
uv run pytest
uv run python -m server.crop_prices_server # run the server over stdio
claude --plugin-dir . # load the plugin for one session
```
## Self-hosting over HTTP (optional)
The plugin runs the server on your machine over stdio. `server/http_app.py` serves the
same tools over Streamable HTTP, protected by a bearer token, for hosting.
**Run locally**
```
export MCP_AUTH_TOKEN=$(python3 -c "import secrets; print(secrets.token_urlsafe(32))")
uv run uvicorn server.http_app:app --port 8080
claude mcp add --transport http crop-prices-http http://localhost:8080/mcp \
--header "Authorization: Bearer $MCP_AUTH_TOKEN"
```
Requests without the token get 401. If `MCP_AUTH_TOKEN` is unset, every request is refused.
**Deploy to Google Cloud Run** (needs a project with billing enabled; small personal use
normally stays in the free tier, but Google Cloud has no hard spending cap)
```
PROJECT=your-project-id REGION=us-central1
gcloud services enable run.googleapis.com cloudbuild.googleapis.com \
artifactregistry.googleapis.com secretmanager.googleapis.com --project $PROJECT
printf %s "$MCP_AUTH_TOKEN" | gcloud secrets create mcp-auth-token --data-file=- --project $PROJECT
printf %s "$NASS_API_KEY" | gcloud secrets create nass-api-key --data-file=- --project $PROJECT
# Let Cloud Run's default service account read the secrets
SA=$(gcloud projects describe $PROJECT --format="value(projectNumber)")-compute@developer.gserviceaccount.com
for s in mcp-auth-token nass-api-key; do
gcloud secrets add-iam-policy-binding $s --member=serviceAccount:$SA \
--role=roles/secretmanager.secretAccessor --project $PROJECT
done
gcloud run deploy crop-prices --source . --region $REGION --project $PROJECT \
--max-instances 1 --memory 512Mi --allow-unauthenticated \
--set-secrets MCP_AUTH_TOKEN=mcp-auth-token:latest,NASS_API_KEY=nass-api-key:latest
```
`--allow-unauthenticated` lets requests reach the app; the app itself checks the token.
Then connect with `claude mcp add --transport http crop-prices-cloud <service-url>/mcp
--header "Authorization: Bearer $MCP_AUTH_TOKEN"`. Set a budget alert in the Billing console.
## License
MIT
This server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessNo issues