usda-mcp-server

v0.1.11 pre-1.0

Search foods, compare nutrients, and look up the full USDA FoodData Central database via MCP. STDIO or Streamable HTTP.

usda.caseyjhand.com/mcp
claude mcp add --transport http usda-mcp-server https://usda.caseyjhand.com/mcp
codex mcp add usda-mcp-server --url https://usda.caseyjhand.com/mcp
{
  "mcpServers": {
    "usda-mcp-server": {
      "url": "https://usda.caseyjhand.com/mcp"
    }
  }
}
gemini mcp add --transport http usda-mcp-server https://usda.caseyjhand.com/mcp
{
  "mcpServers": {
    "usda-mcp-server": {
      "command": "bunx",
      "args": [
        "mcp-remote",
        "https://usda.caseyjhand.com/mcp"
      ]
    }
  }
}
{
  "mcpServers": {
    "usda-mcp-server": {
      "type": "http",
      "url": "https://usda.caseyjhand.com/mcp"
    }
  }
}
curl -X POST https://usda.caseyjhand.com/mcp \
  -H "Content-Type: application/json" \
  -H "Accept: application/json, text/event-stream" \
  -d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-11-25","capabilities":{},"clientInfo":{"name":"curl","version":"1.0.0"}}}'

Tools

5

usda_list_nutrients

Look up the FDC nutrient reference table — all tracked nutrients with their numeric IDs, names, SR reference numbers, units, and categories. Use to resolve a nutrient name (e.g. "vitamin C") to its FDC ID (1162) before passing it to the nutrients[] filter on other tools. Filter by category (macronutrients, vitamins, minerals, lipids, amino_acids, or other) to narrow results. The data is static — call once and reuse the IDs.

read
invocation
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "usda_list_nutrients",
    "arguments": {}
  }
}
schema
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "category": {
      "description": "Filter to a nutrient category. Omit to return all ~150 tracked nutrients. Options: macronutrients, vitamins, minerals, lipids, amino_acids, other.",
      "type": "string",
      "enum": [
        "macronutrients",
        "vitamins",
        "minerals",
        "lipids",
        "amino_acids",
        "other"
      ]
    }
  },
  "additionalProperties": false
}
view source ↗

usda_search_foods

open-world

Search USDA FoodData Central foods by keyword. Returns matching foods with FDC IDs and a preview of key nutrients (energy, protein, fat, carbs — not guaranteed complete). Use the returned fdcId with usda_get_food for the full nutrient profile, or usda_compare_foods for side-by-side comparisons. When dataType is omitted, defaults to SR Legacy (common whole foods with complete profiles) — or to Branded when brandOwner is set, since only Branded records carry one. Set dataType to ["Branded"] for packaged products, or include a UPC/GTIN code as the query. Pass brandOwner (e.g. "General Mills") to narrow branded results.

read
invocation
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "usda_search_foods",
    "arguments": {
      "query": "<query>"
    }
  }
}
schema
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "query": {
      "type": "string",
      "minLength": 1,
      "description": "Search terms — food name, ingredient, or UPC/GTIN code for branded products. Examples: \"chicken breast raw\", \"banana\", \"012345678901\"."
    },
    "dataType": {
      "description": "FDC data sources to search. Omitting this defaults to [\"SR Legacy\"] (common whole foods, complete nutrient profiles), or to [\"Branded\"] when brandOwner is set. Include \"Branded\" for packaged products. Multiple values allowed.",
      "type": "array",
      "items": {
        "type": "string",
        "enum": [
          "SR Legacy",
          "Foundation",
          "Survey (FNDDS)",
          "Branded"
        ]
      }
    },
    "brandOwner": {
      "description": "Filter branded results by brand owner name (e.g. \"General Mills\", \"Kraft\"). Only Branded records carry one, so setting this defaults dataType to [\"Branded\"] unless dataType is given explicitly.",
      "type": "string"
    },
    "foodCategory": {
      "description": "Filter by USDA food category (e.g. \"Poultry Products\", \"Vegetables and Vegetable Products\"). Case-sensitive.",
      "type": "string"
    },
    "pageSize": {
      "default": 10,
      "description": "Number of results per page. Default 10, maximum 50.",
      "type": "integer",
      "minimum": 1,
      "maximum": 50
    },
    "pageNumber": {
      "default": 1,
      "description": "Page number (1-based). Use with totalPages to paginate.",
      "type": "integer",
      "minimum": 1,
      "maximum": 9007199254740991
    }
  },
  "required": [
    "query",
    "pageSize",
    "pageNumber"
  ],
  "additionalProperties": false
}
view source ↗

usda_get_food

Get the full nutrient profile for one food by FDC ID. Returns all available nutrients (or a filtered subset via the nutrients[] param) with optional per-portion scaling. Use usda_search_foods to discover FDC IDs. Provide quantity + unit to scale all nutrient values from per-100g to the specified portion (e.g. quantity=200, unit="g" → per-200g values). Use unit="serving" to scale to the food's first defined portion weight. Narrow nutrients[] to specific IDs to reduce response size for focused queries.

read
invocation
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "usda_get_food",
    "arguments": {
      "fdcId": "<fdcId>"
    }
  }
}
schema
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "fdcId": {
      "type": "integer",
      "minimum": 1,
      "maximum": 9007199254740991,
      "description": "FDC ID of the food. Use usda_search_foods to discover IDs."
    },
    "nutrients": {
      "description": "Filter to specific nutrient IDs (e.g. [1003, 1004, 1005, 1008] for protein, fat, carbs, energy). Use usda_list_nutrients to look up IDs. Omit to return all available nutrients.",
      "type": "array",
      "items": {
        "type": "integer",
        "minimum": 1,
        "maximum": 9007199254740991
      }
    },
    "quantity": {
      "description": "Amount of food to scale nutrient values to. Must be positive. When provided, unit is required. Omit for per-100g values (FDC database native basis).",
      "type": "number",
      "exclusiveMinimum": 0
    },
    "unit": {
      "description": "Unit for quantity. \"serving\" uses the food's first defined portion weight. Required when quantity is provided.",
      "type": "string",
      "enum": [
        "g",
        "oz",
        "lb",
        "kg",
        "serving"
      ]
    }
  },
  "required": [
    "fdcId"
  ],
  "additionalProperties": false
}
view source ↗

usda_get_foods

Fetch nutrient profiles for 2–20 foods in a single API call. More efficient than calling usda_get_food N times when you already have multiple FDC IDs. All values are per 100g (no portion scaling). Use the nutrients[] filter to limit response size — strongly recommended for batch calls. For side-by-side comparison with a formatted table, use usda_compare_foods instead. Failed IDs (not found or no data) are reported in the failed[] array rather than aborting the entire batch.

read
invocation
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "usda_get_foods",
    "arguments": {
      "fdcIds": "<fdcIds>"
    }
  }
}
schema
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "fdcIds": {
      "minItems": 2,
      "maxItems": 20,
      "type": "array",
      "items": {
        "type": "integer",
        "minimum": 1,
        "maximum": 9007199254740991
      },
      "description": "FDC IDs to fetch — 2 to 20 IDs. Use usda_search_foods to discover IDs."
    },
    "nutrients": {
      "description": "Filter to specific nutrient IDs (e.g. [1003, 1004, 1005, 1008]). Strongly recommended — full profiles can be large. Use usda_list_nutrients to look up IDs.",
      "type": "array",
      "items": {
        "type": "integer",
        "minimum": 1,
        "maximum": 9007199254740991
      }
    }
  },
  "required": [
    "fdcIds"
  ],
  "additionalProperties": false
}
view source ↗

usda_compare_foods

Compare nutrients side-by-side for 2–5 foods. Returns a structured table — one row per nutrient, one column per food — formatted as markdown. Best for "spinach vs kale iron" or "which has more protein?" questions. Omit nutrients[] to use the 12 most common defaults (energy, protein, fat, saturated fat, carbs, fiber, sugars, sodium, potassium, calcium, iron, vitamin C); provide nutrients[] with specific FDC IDs to compare different nutrients. All values are scaled to the same gram basis (default 100g). If one or more FDC IDs are not found, the comparison proceeds with the valid foods — only throws too_few_foods when fewer than 2 IDs return data.

read
invocation
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "usda_compare_foods",
    "arguments": {
      "fdcIds": "<fdcIds>"
    }
  }
}
schema
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "fdcIds": {
      "minItems": 2,
      "maxItems": 5,
      "type": "array",
      "items": {
        "type": "integer",
        "minimum": 1,
        "maximum": 9007199254740991
      },
      "description": "FDC IDs to compare — 2 to 5 foods. Use usda_search_foods to discover IDs."
    },
    "nutrients": {
      "description": "Nutrient IDs to include in the comparison. Defaults to the 12 most common: energy (1008), protein (1003), total fat (1004), saturated fat (1258), carbohydrate (1005), fiber (1079), total sugars (2000), sodium (1093), potassium (1092), calcium (1087), iron (1089), vitamin C (1162). Use usda_list_nutrients to look up other IDs.",
      "type": "array",
      "items": {
        "type": "integer",
        "minimum": 1,
        "maximum": 9007199254740991
      }
    },
    "quantity": {
      "default": 100,
      "description": "Gram basis for comparison. All values scaled to this amount. Must be positive. Default 100.",
      "type": "number",
      "exclusiveMinimum": 0
    },
    "unit": {
      "default": "g",
      "description": "Unit for quantity. Default \"g\". Does not support \"serving\" (use a fixed gram basis for consistent comparison).",
      "type": "string",
      "enum": [
        "g",
        "oz",
        "lb",
        "kg"
      ]
    }
  },
  "required": [
    "fdcIds",
    "quantity",
    "unit"
  ],
  "additionalProperties": false
}
view source ↗

Resources

2

Full nutrient profile for a specific food by FDC ID. Returns all available nutrients per 100g — equivalent to usda_get_food without portion scaling. Use usda_search_foods to discover FDC IDs.

uri usda://food/{fdcId} mime application/json

Access the complete FDC nutrient reference — all ~150 tracked nutrients with their numeric IDs, names, SR reference numbers, units, and categories. Use to resolve nutrient names to FDC IDs for the nutrients[] filter on usda_get_food, usda_get_foods, usda_compare_foods, and usda_list_nutrients.

uri usda://nutrients mime application/json