npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@trellis-labs/fooddata-central-mcp

v1.1.1

Published

MCP server wrapping the USDA FoodData Central API — search and retrieve food nutrition data

Readme

FoodData Central MCP Server

An MCP server that exposes the USDA FoodData Central database — search foods, look up nutrient data by FDC ID, and find the canonical version of a food name without wading through thousands of near-duplicate manufacturer entries.

Not affiliated with the USDA. Food composition data is public domain (U.S. Government work); see Attribution below.

Quickstart

Add this to your MCP client config (Claude Desktop, Claude Code, etc.):

{
  "mcpServers": {
    "fooddata-central": {
      "command": "npx",
      "args": ["-y", "@trellis-labs/fooddata-central-mcp"],
      "env": {
        "FDC_API_KEY": "YOUR_KEY_HERE"
      }
    }
  }
}

For Claude Desktop, this goes in claude_desktop_config.json (~/Library/Application Support/Claude/claude_desktop_config.json on macOS, %APPDATA%\Claude\claude_desktop_config.json on Windows).

Get an API key

Sign up for a free key at fdc.nal.usda.gov/api-guide — takes about a minute, no credit card. A registered key gets you 1,000 requests/hour.

Don't want to sign up right now? Use FDC_API_KEY=DEMO_KEY — USDA's shared demo key works immediately with no signup, limited to 30 requests/hour. Fine for trying the server out; get a real key before relying on it for regular use.

The cheddar problem (why find_food exists)

Search "cheddar cheese" directly against FDC's full catalog and you get 64,784 hits. Page 1 is ten near-identical Branded entries — different grocery chains' private-label cheddar, none of them the food you actually meant:

CHEDDAR CHEESE | Grafton Village Cheese Co, LLC
CHEDDAR CHEESE | Three Square Inc. (Crystal Farms)
CHEDDAR CHEESE | Weis Markets, Inc.
CHEDDAR CHEESE | Weis Markets, Inc.
CHEDDAR CHEESE | Weis Markets, Inc.
... (5 more brands, same product)

The canonical, lab-analyzed answer — Cheese, cheddar (FDC 328637, Foundation) — is nowhere on that page.

find_food("cheddar cheese") returns it first:

Best match for "cheddar cheese":
FDC ID: 328637 | Name: Cheese, cheddar | Type: Foundation
Nutrient summary: Carbohydrate: 2.44 G | Energy: 408 KCAL | Protein: 23.3 G | ...
Use get_food(fdcId: 328637) for the full nutrient breakdown.

Alternates:
FDC ID: 746767 | Name: Cheese, swiss | Type: Foundation
...

It does this by preferring Foundation (USDA lab-analyzed) and SR Legacy (classic reference) data over Branded (manufacturer-submitted) noise, and only falling back to Branded results if nothing else matches or you explicitly ask for it (includeBranded: true).

Tools

find_food

Find the best canonical match for a food name. This is the tool to reach for first when you just want "the" answer for a food, not a list to sift through.

  • Input: name (string, required), includeBranded (boolean, optional, default false)
  • Output: best match with FDC ID + key-nutrient summary, up to 3 alternates, and a one-line note when normalization/aliasing or a Branded fallback was used.
  • Handles plurals, common prep words ("sliced onion" → "onion"), and a small table of food-identity aliases for less common ingredient names (e.g. "paneer" → "paneer cheese", "nori" → "seaweed sheets").
  • No LLM calls happen inside this tool — it's a search/ranking pipeline. The calling model (you) is the disambiguation layer if the top match still isn't quite right; use the alternates or search_foods for more control.

search_foods

Search FDC by keyword. Full control over data type, brand owner, and pagination — use this when you want to see the raw candidate list rather than a single resolved answer.

  • Input: query (required), dataType, pageSize (1-50, default 10), pageNumber, brandOwner.
  • Data type guidance: prefer Foundation and SR Legacy over Branded unless you specifically need manufacturer nutrition-label data. Survey (FNDDS) covers dietary-survey composite foods (e.g. "chicken sandwich").

get_food

Full nutrient breakdown for a single food by FDC ID.

  • Input: fdcId (required), format (full default or abridged), nutrients (optional filter list).
  • Known FDC quirk: some Foundation records (e.g. 328637, 746767) return HTTP 404 on full-format detail even though the record exists and is fully searchable — abridged format works fine for the same ID. This server automatically retries with abridged on a full-format 404 and notes it in the output; you don't need to handle this yourself.

get_foods

Batch lookup of up to 20 foods by FDC ID in one call — more efficient than repeated get_food calls.

list_foods

Paginated browse of the full catalog by data type, without a search term. Useful for exploring what's available rather than looking something specific up.

Privacy & data flow

Every tool call goes directly from this server to api.nal.usda.gov, using the API key you provided. There is no intermediary service, no telemetry, and no analytics in this package — your queries and your key never pass through anything but your machine and USDA's API.

Support

This is a best-effort, bootstrapped open source project. Bug reports and feature requests are welcome via GitHub Issues — no guaranteed response time, but real issues get looked at.

Interested in a hosted version (no local setup, managed API key, higher rate limits)? Open a hosted-interest issue and tell us what you'd need.

Attribution & data source

Nutrition data is sourced from the U.S. Department of Agriculture's FoodData Central, a public domain U.S. Government resource. This project is an independent, unofficial client and is not affiliated with or endorsed by the USDA.

License

MIT — see LICENSE.