Usda MCP Server

Search foods, compare nutrients, and look up the full USDA FoodData Central database.

Local serverstdio

What is the Usda MCP server?

Search foods, compare nutrients, and look up the full USDA FoodData Central database. The usda mcp server wraps that behind the Model Context Protocol, so an assistant can use it through 7 defined tools rather than through you.

What it actually does

  • Declarative tool and resource definitions — single file per primitive, framework handles registration and validation
  • Unified error handling — handlers throw, framework catches, classifies, and formats
  • Pluggable auth: none, jwt, oauth
  • Swappable storage backends: in-memory, filesystem, Supabase, Cloudflare KV/R2/D1
  • Structured logging with optional OpenTelemetry tracing
  • STDIO and Streamable HTTP transports

Its toolset

Everything the assistant can do here goes through one of these:

  • usda_search_foods — Search foods by keyword across SR Legacy, Foundation, Survey FNDDS, and Branded data sources, with nutrient preview and pagination
  • usda_get_food — Full nutrient profile for one food by FDC ID, with optional per-portion scaling (g, oz, lb, kg, or serving)
  • usda_get_foods — Batch nutrient fetch for 2–20 FDC IDs in a single request; failed IDs reported in failed[] instead of aborting
  • usda_compare_foods — Side-by-side nutrient comparison for 2–5 foods, formatted as a markdown table scaled to a common gram basis
  • usda_list_nutrients — Static FDC nutrient reference table (~150 nutrients) with IDs, names, units, and categories — no API call required
  • Prerequisites — The Prerequisites tool exposed by this server
  • Installation — The Installation tool exposed by this server

Configuration

You will need 3 environment variables: MCP_TRANSPORT_TYPE, MCP_LOG_LEVEL, USDA_FDC_API_KEY. The server will not start without them, which is usually why the tools fail to appear on a first run. Keep credentials in your client's env block or a secrets manager rather than in a file you might commit.

  • Bun v1.3.2 or higher (or Node.js v24+). - A free USDA FDC API key — register at api.data.gov/signup. The key is required; without it the server will not start.

Adding it to your client

Setup follows the usual MCP pattern — install or clone the server, register it in your client's configuration file, restart the client. The configuration blocks on this page cover the common clients.

When to reach for it

Among the file and storage access options, the useful question is rarely "what can it do" but "what does it cost you to run" — permissions, credentials, and how much of your context its toolset consumes. Usda's toolset — usda_search_foods, usda_get_food, usda_get_foods and 4 more — is a fair guide to whether it matches your workflow. It is maintained by cyanheads; worth a glance at recent repository activity before you build anything load-bearing on it.

This entry was verified against Usda's own documentation before publication; SyncDev keeps the directory reviewed rather than auto-generated.

Caveats

  • It runs with your machine's permissions. That is convenient and also the reason to think about what you point it at before you approve a tool call.
  • Missing credentials fail quietly in some clients — if no tools show up, check the environment block first.
  • MCP clients confirm each tool call by default. Leave that on until you have watched what the usda mcp server does with a few real requests.

Available tools

ToolWhat it does
usda_search_foodsSearch foods by keyword across SR Legacy, Foundation, Survey FNDDS, and Branded data sources, with nutrient preview and pagination
usda_get_foodFull nutrient profile for one food by FDC ID, with optional per-portion scaling (g, oz, lb, kg, or serving)
usda_get_foodsBatch nutrient fetch for 2–20 FDC IDs in a single request; failed IDs reported in failed[] instead of aborting
usda_compare_foodsSide-by-side nutrient comparison for 2–5 foods, formatted as a markdown table scaled to a common gram basis
usda_list_nutrientsStatic FDC nutrient reference table (~150 nutrients) with IDs, names, units, and categories — no API call required
PrerequisitesThe Prerequisites tool exposed by this server.
InstallationThe Installation tool exposed by this server.

How to install the Usda MCP server

{
  "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"
      }
    }
  }
}

Configuration as documented by the project. Restart the client after saving.

Configuration

  • Bun v1.3.2 or higher (or Node.js v24+). - A free USDA FDC API key — register at api.data.gov/signup. The key is required; without it the server will not start.
VariableDescriptionRequired
MCP_TRANSPORT_TYPEConfiguration value read at startup.Optional
MCP_LOG_LEVELConfiguration value read at startup.Optional
USDA_FDC_API_KEYCredential the server authenticates with.Yes

Example prompts to try

  • Use Usda to usda search foods.
  • Use Usda to usda get food.
  • Use Usda to usda get foods.

Frequently asked questions

It connects Usda to MCP-compatible AI assistants such as Claude and Cursor, exposing 7 tools (usda_search_foods, usda_get_food, usda_get_foods, and more) that the assistant can call on your behalf. Instead of copying data back and forth by hand, the assistant works with Usda directly.