USDA Nutrition MCP Server

USDA Nutrition MCP Server

mcp-nutrition-tools•byzen-apps

An MCP-enabled server and HTTP API exposing USDA FoodData Central food search, nutrition lookup, and food comparison tools to Claude Desktop and other MCP clients.

License: MIT License•Runtime: Awaiting documentation review•Category: productivity work

WHAT IT DOES

  • •Provides a search_foods tool to search the USDA database by text.
  • •Provides a get_food_nutrition tool for detailed nutrition of a specific food.
  • •Provides a compare_foods tool to compare nutrition between multiple foods.
  • •Runs as both an MCP protocol server and a FastAPI HTTP server.

BEST FOR

  • •Comparing nutrition between foods such as chicken breast and salmon via Claude.
  • •Looking up detailed USDA nutrition data for specific foods by FDC ID.

ABOUT MCP-NUTRITION-TOOLS

USDA Nutrition MCP Server is cataloged as an MCP server attributed to zen-apps. An MCP-enabled server and HTTP API exposing USDA FoodData Central food search, nutrition lookup, and food comparison tools to Claude Desktop and other MCP clients. It is categorized under productivity work. See the capability inspector for recorded interfaces and their independent review status; consult upstream documentation for the current interface.

HOW TO INSTALL

Installation configuration is not reviewed. No executable setup is offered for this entry; inspect the source repository before proceeding.

LICENSE

Catalog license label: MIT License. Check the source repository's current license and terms before using, modifying or distributing this software.

能力检查器

能力定义尚未审核。未核验的采集内容不会作为可信接口展示。

Tools (0)

暂无可展示的已审核记录。这不表示上游不支持此能力。

Resources (0)

暂无可展示的已审核记录。这不表示上游不支持此能力。

Prompts (0)

暂无可展示的已审核记录。这不表示上游不支持此能力。

NEWSLETTER - COMING LATER

Newsletter subscriptions are not open yet

Email delivery is not connected. This page does not collect email addresses or create subscriptions.

Browse the registry for current listings instead.

Community Reviews

Coming later

Reviews for USDA Nutrition MCP Server are not available yet

Review publishing and storage are not connected. This page does not collect or publish ratings or comments, including after sign-in.

FREQUENTLY ASKED QUESTIONS

What MCP tools does this server expose?

It exposes search_foods for text search, get_food_nutrition for detailed nutrition of a specific food, and compare_foods for comparing nutrition between multiple foods.

Is there a hosted option besides running it locally?

Yes, the project offers three deployment options: a hosted service, local development, and a custom server.

上游原版 README

在 GitHub 查看同一版本原文

README.md · 8259a7dfa80f · 采集于 2026-11-13 13:55:03 UTC

保留上游原文,不做 AI 改写。为安全起见过滤脚本、表单和不安全链接。

当前显示最后一次成功采集的文档快照,请以来源页面为准。

🥗 USDA Nutrition MCP Enabled Server

Professional Model Context Protocol (MCP) enabled server for USDA FoodData Central
Transforms 600k+ foods into intelligent nutrition tools for Claude Desktop and other MCP clients

License: MIT Python 3.11+ MCP Compatible Hosted Service

🌟 What This Demonstrates

This project showcases professional MCP implementation skills:

✅ Dual Architecture - Both MCP protocol server AND HTTP API
✅ Production Bridge - Smart mcp_bridge.py with hosted/local/custom server support
✅ Three Deployment Options - Hosted service, local development, custom server
✅ Type-Safe Models - Pydantic schemas with proper validation
✅ Docker + Cloud Run - Complete deployment pipeline

🚀 Quick Start for Claude Desktop

Download just the bridge file - no need to clone the entire repository:

# Download the bridge
wget https://raw.githubusercontent.com/zen-apps/mcp-nutrition-tools/main/src/mcp_bridge.py

# Install dependencies
pip install mcp httpx

Then add to your Claude Desktop config:

{
  "mcpServers": {
    "usda-nutrition": {
      "command": "python3",
      "args": ["/path/to/downloaded/mcp_bridge.py"]
    }
  }
}

Mac Users with Virtual Environment

# Navigate to your project
cd /Users/yourusername/your-project-folder

# Create new venv in the project folder
python3 -m venv venv

# Activate it
source venv/bin/activate

# Install dependencies
pip install mcp httpx

# Test it works
python src/mcp_bridge.py --server-url https://usda-nutrition-mcp-356272800218.us-central1.run.app

Option 2: Full Repository (For Development)

{
  "mcpServers": {
    "usda-nutrition": {
      "command": "python3",
      "args": ["/path/to/mcp-nutrition-tools/src/mcp_bridge.py"],
      "cwd": "/path/to/mcp-nutrition-tools"
    }
  }
}

Option 2: Local Development

{
  "mcpServers": {
    "usda-nutrition": {
      "command": "python3",
      "args": [
        "/path/to/mcp-nutrition-tools/src/mcp_bridge.py",
        "--server-url",
        "http://localhost:8080"
      ],
      "cwd": "/path/to/mcp-nutrition-tools"
    }
  }
}

Option 3: Custom Server

{
  "mcpServers": {
    "usda-nutrition": {
      "command": "python3", 
      "args": [
        "/path/to/mcp-nutrition-tools/src/mcp_bridge.py",
        "--server-url",
        "https://your-server.com"
      ],
      "cwd": "/path/to/mcp-nutrition-tools"
    }
  }
}

See examples/configs/claude_desktop_config_examples.json for detailed configuration examples.

🔧 For Non-Claude Desktop Users

Direct HTTP API

Live API: https://usda-nutrition-mcp-oc46l7ob5a-uc.a.run.app
Documentation: https://usda-nutrition-mcp-oc46l7ob5a-uc.a.run.app/docs

# Search foods
curl -X POST "https://usda-nutrition-mcp-oc46l7ob5a-uc.a.run.app/tools/search_foods" \
  -H "Content-Type: application/json" \
  -d '{"query": "chicken breast", "page_size": 5}'

# Get nutrition details  
curl -X POST "https://usda-nutrition-mcp-oc46l7ob5a-uc.a.run.app/tools/get_food_nutrition" \
  -H "Content-Type: application/json" \
  -d '{"fdc_id": 171688}'

See API_USAGE.md for complete integration examples with Python, JavaScript, LangChain, and OpenAI.

🛠 MCP Tools Available

Once configured, Claude Desktop gets these nutrition tools:

  • search_foods - Search USDA database by text
  • get_food_nutrition - Get detailed nutrition for specific food
  • compare_foods - Compare nutrition between multiple foods

Example Claude Interaction

You: "Compare the protein content of chicken breast vs salmon"

Claude: Uses MCP tools automatically:

  1. search_foods("chicken breast") → Finds FDC ID 171077
  2. search_foods("salmon") → Finds FDC ID 175167
  3. compare_foods([171077, 175167]) → Gets comparison data
  4. Provides detailed analysis with recommendations

🏗 Architecture Deep Dive

Dual Server Design

Claude Desktop ←→ mcp_bridge.py ←→ HTTP API ←→ USDA FoodData Central
     (MCP)              ↑              ↑              ↑
                   Smart Bridge    FastAPI       Rate Limited
                                                   Client

Key Implementation Details:

  • src/mcp_server.py - FastMCP protocol server
  • src/mcp_http_server.py - FastAPI HTTP server
  • src/mcp_bridge.py - Smart bridge with server auto-detection
  • src/usda_client.py - API client with retry logic
  • src/models/ - Type-safe Pydantic schemas

Smart Bridge Logic

The bridge automatically detects server type and provides appropriate user feedback:

# Hosted service detection
if "usda-nutrition-mcp-oc46l7ob5a-uc.a.run.app" in args.server_url:
    print("🌐 Using hosted service (1,000 requests/hour shared)")

# Local development  
elif "localhost" in args.server_url:
    print("🏠 Using local server (requires your USDA API key)")

📦 Installation & Development

# Clone and setup
git clone https://github.com/zen-apps/mcp-nutrition-tools
cd mcp-nutrition-tools
pip install -r requirements.txt

# Get USDA API key (for local development)
# Visit: https://fdc.nal.usda.gov/api-guide.html
echo "FDC_API_KEY=your_key_here" > .env

# Test MCP server
python -m src.mcp_server

# Test HTTP server  
python -m src.mcp_http_server

# Run tests
python -m pytest tests/ -v

# Code quality
ruff check src/
ruff format src/
mypy src/

🐳 Deployment Options

Local Development

# Run HTTP server locally
python -m src.mcp_http_server

# Run with Docker
make up

Production Deployment

# Deploy to Google Cloud Run
export FDC_API_KEY="your_usda_key"
./scripts/deploy-gcp.sh

The production deployment includes:

  • Automatic SSL/HTTPS
  • Health checks and monitoring
  • Auto-scaling based on demand
  • Structured logging

🔑 Configuration

Environment Variables

  • FDC_API_KEY - USDA FoodData Central API key (required for local)
  • ENVIRONMENT - "development" or "production"
  • LOG_LEVEL - Logging level (DEBUG, INFO, etc.)

Rate Limits

  • Hosted Service: 1,000 requests/hour (shared)
  • Local Deployment: 1,000 requests/hour (your key)
  • Enterprise: Contact for higher limits

🧪 Testing Strategy

# Quick connectivity test
python test_quick.py

# Full test suite with mocking
python -m pytest tests/ -v

# Test specific MCP tools
python examples/live_demo.py

The test suite includes:

  • USDA API mocking with httpx-mock
  • Async MCP server testing
  • Integration test examples
  • Performance benchmarking

🤝 Contributing

  1. Fork the repository
  2. Create feature branch: git checkout -b feature/amazing-feature
  3. Run tests: python -m pytest tests/
  4. Run linting: ruff check src/
  5. Submit pull request

📄 License

MIT License - see LICENSE file for details.


🎯 Ready to use? See examples/configs/claude_desktop_config_examples.json for setup instructions!

🔗 Live API: https://usda-nutrition-mcp-oc46l7ob5a-uc.a.run.app/docs

Install configuration

Are you the maintainer?

Claim this server with your GitHub account to request manual ownership verification.

README Embed Badge
Markdown

Link to the catalog listing for USDA Nutrition MCP Server from your README. This badge does not certify ownership, compatibility or security.

[![MCP catalog listing](https://img.shields.io/badge/MCP-awesome--mcp-orange?style=flat-square)](https://awesome-mcp.com/servers/mcp-nutrition-tools)

REPOSITORY STATS

GitHub StarsUnavailable
ForksUnavailable

Public repository statistics could not be verified. Check the configured source address; unavailable counts are not zero.

下载与拉取统计

来源、范围和时段分别列出;不相加,不代表安装人数、活跃用户或安全审核。

尚无已审核的包 / 镜像标识,暂不展示下载统计。

Related productivity work MCP Servers

Alternative and complementary servers in the same category

View all in productivity work →
Tuqui hosted MCP server for Odoo
tuqui-odoo-mcp-for-claude-chatgpt•tuqui-ai

Tuqui is a hosted MCP server that connects Odoo with Claude and ChatGPT so users can ask about sales, stock, customers and overdue invoices in plain language.

Repository stats unavailable
Productivity & Ops