food-data-central
MCP server from jlfwong/food-data-central-mcp-server
claude mcp add --transport stdio jlfwong-food-data-central-mcp-server npm start \ --env USDA_API_KEY="<INSERT USDA API KEY HERE>"
How to use
The Food Data Central MCP Server exposes access to the USDA FoodData Central API through the MCP protocol, enabling you to search for foods, retrieve detailed nutrient data, and page through large result sets. It supports multiple data types (Foundation, SR Legacy, Survey, and Branded) and provides resources and tools that map to MCP endpoints like food://details, food://foods, and food://list, as well as a command-based tool named search-foods. To use it, run the server (providing a USDA API key) and then call the built-in MCP resources or the search-foods tool to query the USDA data; Claude Desktop integration is demonstrated in the repository, showing how to configure the MCP server as a tool within Claude’s interface. The server runs as a subprocess under an MCP client, using stdio transport, so it is expected to be started by another application rather than directly by a user through a browser.
Key capabilities include:
- search-foods: Find foods by keywords with optional data type filters, pagination, and sorting.
- food://details: Fetch detailed information for a single food by its FDC ID with optional formatting and nutrient filtering.
- food://foods: Retrieve details for multiple foods by a list of FDC IDs.
- food://list: Get a paged list of foods with filters like dataType, pageSize, pageNumber, and sort options.
- Nutrient and data-type handling: Request nutritional details and data-type-specific results, including abridged or full element sets.
To interact with the MCP server from an MCP client, you will typically request resources via the food:// schema or invoke the search-foods tool with a JSON payload that describes the query and pagination parameters. Ensure your USDA API key remains secret and is provided through environment variables when starting the server.
How to install
Prerequisites:
- Node.js (LTS version) and npm installed on your system
- Access to a USDA FoodData Central API key
- Git to clone the repository (optional if you download a release)
Step-by-step installation:
-
Clone the repository (or download the source code): git clone https://github.com/jlfwong/food-data-central-mcp-server.git cd food-data-central-mcp-server
-
Install dependencies: npm install
-
Build the project (if a build step is required by the project): npm run build
-
Configure environment and run the server:
- Obtain a USDA API key from the FoodData Central API portal.
- Start the server with your API key set in the environment, for example:
export USDA_API_KEY=your-api-key-here npm start
-
(Optional) For development with hot reloading: export USDA_API_KEY=your-api-key-here npm run dev
Note:
- The exact startup command shown in the README uses npm start and relies on the USDA_API_KEY environment variable. If you deploy this server in a different environment (e.g., via Docker or a Python-based launcher), ensure the key is provided to the process via environment variables.
Additional notes
Tips and common issues:
- Ensure USDA_API_KEY is set in the environment where the MCP client starts the server; the key is required to access the USDA API.
- If you see build errors, verify Node.js and npm versions are compatible with the project’s package.json and any TypeScript configuration.
- When integrating with Claude Desktop or other MCP clients, you may need to adjust PATHs or provide an explicit path to the server script as shown in the example configuration within the README.
- If you encounter rate limits from the USDA API, consider caching results on the client side or configuring pageSize and paging parameters to reduce repeated requests.
- The server supports multiple data types; use the dataType filters in the MCP resources to narrow results to Foundation, SR Legacy, Survey, or Branded as needed.
Related MCP Servers
iterm
A Model Context Protocol server that executes commands in the current iTerm session - useful for REPL and CLI assistance
mcp
Octopus Deploy Official MCP Server
furi
CLI & API for MCP management
editor
MCP Server for Phaser Editor
DoorDash
MCP server from JordanDalton/DoorDash-MCP-Server
mcp
MCP сервер для автоматического создания и развертывания приложений в Timeweb Cloud