Search foods, compare nutrients, and look up the full USDA FoodData Central database.
One address for any MCP client. No sign-in needed on this server.
5 read
Grouped by tool name. At most: only reads or looks up information.
Odel charges nothing per call. The publisher may charge for its own service.
Search foods, compare nutrients, and look up the full USDA FoodData Central database via MCP. STDIO or Streamable HTTP.
Public Hosted Server: https://usda.caseyjhand.com/mcp
Nutrition data for roughly 400,000 foods from USDA FoodData Central, the US government's authoritative food composition database. Search by keyword or UPC, pull full nutrient profiles scaled to any portion, and compare foods side by side.
| Tool | Description |
|---|---|
usda_search_foods | Search foods by keyword, ingredient, or UPC/GTIN across SR Legacy, Foundation, Survey (FNDDS), and Branded data sources |
usda_get_food | Full nutrient profile for one food by FDC ID, with optional per-portion scaling |
usda_get_foods | Batch nutrient fetch for 2–20 FDC IDs in a single request |
usda_compare_foods | Side-by-side nutrient comparison for 2–5 foods, formatted as a markdown table |
usda_list_nutrients | Static FDC nutrient reference table (~150 nutrients) with IDs, names, units, and categories |
| Resource | Description |
|---|---|
usda://food/{fdcId} | Full nutrient profile for a specific food by FDC ID |
usda://nutrients | Complete FDC nutrient reference list |
All resource data is also reachable via tools. Use usda_search_foods to discover FDC IDs before reading food resources.
usda_search_foods tooldataType[] filter across SR Legacy, Foundation, Survey (FNDDS), and Branded, defaulting to ["SR Legacy"] (or ["Branded"] once brandOwner is set)brandOwner and foodCategory filters narrow results; pageSize (max 50, default 10) and pageNumber paginatequery_empty (blank query), query_syntax (FDC rejected the query syntax), no_results (nothing matched in the requested data sources)usda_get_food toolfdcId; optional nutrients[] filter to specific IDsunit (g / oz / lb / kg / serving) with an optional quantity scales every value from the FDC per-100g basis; quantity defaults to 100 for mass units and 1 for serving, and unit="serving" multiplies the food's first defined portion weight by quantityallPortions[] alongside the scaled resultnot_found (bad FDC ID), quantity_without_unit, no_portion_data (serving requested but the food has no portion data)usda_get_foods toolnutrients[] filter strongly recommended — full profiles for 20 foods are largefailed[] instead of aborting the batchusda_compare_foods toolnutrients[] is givenquantity + unit basis (default 100 g; quantity is an amount in unit, so unit: "oz" alone compares per 100 oz)too_few_foods when fewer than 2 resolveusda_list_nutrients toolcategory filter: macronutrients, vitamins, minerals, lipids, amino_acids, othernutrients[] elsewhereusda://food/{fdcId} resourceusda_get_food without portion scaling — full nutrient profile per 100g as application/jsonfdcId must be a bare positive integer (no sign, leading zero, decimal, or exponent); anything else throws invalid_idnot_found when the ID doesn't exist in FDCusda://nutrients resourceusda_list_nutrients with no category filterapplication/json with a 1-hour public cache hint, since the table is bundled at build time and identical for every callerBuilt on @cyanheads/mcp-ts-core: stdio and Streamable HTTP transports, pluggable auth (none / jwt / oauth), swappable storage (in-memory, filesystem, Supabase, Cloudflare KV/R2/D1), structured logging with optional OpenTelemetry tracing.
FoodData Central-specific:
api.nal.usda.gov/fdc/v1)/foods) with per-food partial failure reportingAgent-friendly output:
dataType) on every food result so callers know whether they're reading curated research data or label-derived branded valuesusda_get_foods, usda_compare_foods) return successes alongside structured failed[] / missingData[] entries rather than failing the whole requestA public instance is available at https://usda.caseyjhand.com/mcp — no installation required. It serves Streamable HTTP; each client takes its own config shape.
For Claude Code:
claude mcp add --transport http usda-mcp-server https://usda.caseyjhand.com/mcp
For Cline (cline_mcp_settings.json):
{
"mcpServers": {
"usda-mcp-server": {
"type": "streamableHttp",
"url": "https://usda.caseyjhand.com/mcp"
}
}
}
For Cursor (mcp.json):
{
"mcpServers": {
"usda-mcp-server": {
"url": "https://usda.caseyjhand.com/mcp"
}
}
}
Claude Desktop adds remote servers under Settings → Connectors.
Add the following to your MCP client configuration file. See data.gov API key signup to generate a free API key.
{
"mcpServers": {
"usda-mcp-server": {
"type": "stdio",
"command": "bunx",
"args": ["@cyanheads/usda-mcp-server@latest"],
"env": {
"MCP_TRANSPORT_TYPE": "stdio",
"MCP_LOG_LEVEL": "info",
"USDA_FDC_API_KEY": "your-api-key"
}
}
}
}
Or with npx (no Bun required):
{
"mcpServers": {
"usda-mcp-server": {
"type": "stdio",
"command": "npx",
"args": ["-y", "@cyanheads/usda-mcp-server@latest"],
"env": {
"MCP_TRANSPORT_TYPE": "stdio",
"MCP_LOG_LEVEL": "info",
"USDA_FDC_API_KEY": "your-api-key"
}
}
}
}
Or with Docker:
{
"mcpServers": {
"usda-mcp-server": {
"type": "stdio",
"command": "docker",
"args": [
"run", "-i", "--rm",
"-e", "MCP_TRANSPORT_TYPE=stdio",
"-e", "USDA_FDC_API_KEY=your-api-key",
"ghcr.io/cyanheads/usda-mcp-server:latest"
]
}
}
}
For Streamable HTTP, set the transport and start the server:
MCP_TRANSPORT_TYPE=http MCP_HTTP_PORT=3010 USDA_FDC_API_KEY=your-api-key bun run start:http
# Server listens at http://localhost:3010/mcp
usda_list_nutrients and the static nutrient reference work without it.git clone https://github.com/cyanheads/usda-mcp-server.git
cd usda-mcp-server
bun install
cp .env.example .env
# edit .env and set USDA_FDC_API_KEY
| Variable | Description | Default |
|---|---|---|
USDA_FDC_API_KEY | Required for FoodData Central-backed tools (search, get, batch, compare) — not for startup or usda_list_nutrients. Get a free key at api.data.gov. | — |
MCP_TRANSPORT_TYPE | Transport: stdio or http. | stdio |
MCP_HTTP_PORT | Port for HTTP server. | 3010 |
MCP_AUTH_MODE | Auth mode: none, jwt, or oauth. | none |
MCP_LOG_LEVEL | Log level (RFC 5424). | info |
LOGS_DIR | Directory for log files (Node.js only). | <project-root>/logs |
STORAGE_PROVIDER_TYPE | Storage backend. | in-memory |
OTEL_ENABLED | Enable OpenTelemetry instrumentation (spans, metrics, completion logs). | false |
See .env.example for the full list of optional overrides.
Build and run:
# One-time build
bun run rebuild
# Run the built server
bun run start:stdio
# or
bun run start:http
Run checks and tests:
bun run devcheck # Lint, format, typecheck, security
bun run test # Vitest test suite
bun run lint:mcp # Validate MCP definitions against spec
docker build -t usda-mcp-server .
docker run --rm -e USDA_FDC_API_KEY=your-key -p 3010:3010 usda-mcp-server
The Dockerfile defaults to HTTP transport, stateless session mode, and logs to /var/log/usda-mcp-server. OpenTelemetry peer dependencies are installed by default — build with --build-arg OTEL_ENABLED=false to omit them.
| Directory | Purpose |
|---|---|
src/index.ts | createApp() entry point — registers tools, resources, and inits FdcService. |
src/config | Server-specific environment variable parsing and validation with Zod (USDA_FDC_API_KEY). |
src/mcp-server/tools | Tool definitions (*.tool.ts) — search, get, batch, compare, list-nutrients. |
src/mcp-server/resources | Resource definitions (*.resource.ts) — food profile and nutrient reference. |
src/services/fdc | FdcService — USDA FDC API client, normalization, and static nutrient reference data. |
tests/ | Unit tests mirroring src/ — every tool, resource, and the FDC service. |
See CLAUDE.md for development guidelines and architectural rules. The short version:
try/catch in tool logicctx.log for request-scoped logging, ctx.state for tenant-scoped storagesrc/mcp-server/*/definitions/index.tsIssues are welcome. Run checks and tests before submitting:
bun run devcheck
bun run test
Apache-2.0 — see LICENSE for details.