NutriRef MCP server
x402 프로토콜 기반의 호출당 결제 마이크로페이먼트를 통해 AI 에이전트에게 구조화된 USDA 영양 데이터를 제공합니다.
다른 이름 Younghef/nutriref-api, nutriref-api
- 스타
- 1
- Tools
- —
- 다운로드, 30일
- —
- 최신 버전
- 0.2.3
- 마지막 커밋
- 2026년 6월 15일
- 라이선스
- MIT
NutriRef MCP란?
NutriRef은(는) MCP server입니다. x402 프로토콜 기반의 호출당 결제 마이크로페이먼트를 통해 AI 에이전트에게 구조화된 USDA 영양 데이터를 제공합니다.
프로젝트 README에서 생성된 요약
NutriRef MCP server 정보
NutriRef는 독특한 마이크로페이먼트 시스템을 통해 AI 에이전트에게 구조화된 USDA FoodData Central 영양 정보를 제공합니다. 기존의 API 키나 사용자 인증 방식 대신 x402 프로토콜을 사용하여 USDC를 통한 자동 결제를 지원합니다. 이를 통해 에이전트는 Base 메인넷의 충전된 지갑에서 요청당 $0.001에서 $0.005 사이의 소액을 직접 결제할 수 있습니다.
개발자는 PyPI를 통해 nutriref-mcp 패키지를 설치하여 Claude Desktop 또는 Claude Code와 같은 MCP 클라이언트에 이 서버를 통합할 수 있습니다. 이 서버는 nutrition_search, nutrition_detail, nutrition_compare, nutrition_recipe의 네 가지 특정 도구를 제공합니다. 자동 결제 루프를 활성화하려면 사용자가 설정에 결제용 private key를 제공해야 합니다. 시스템은 Redis 캐시를 사용하여 동일한 데이터에 대한 반복 요청 시 추가적인 USDA 호출 없이 빠르게 응답합니다.
이 설정은 수동 가입 절차 없이 신뢰할 수 있는 영양 데이터가 필요한 자율 에이전트를 위해 설계되었습니다. 라이브 서비스는 nutriref.xyz에서 호스팅되지만, 소프트웨어는 오픈 소스이므로 개인 USDA API 키를 사용하여 Docker로 직접 호스팅할 수 있습니다.
활용 사례
- 1특정 식품 검색AI 에이전트가 검색 쿼리를 사용하여 다양한 식품의 영양 정보를 조회할 수 있습니다.
- 2상세 영양 프로필 조회개발자가 에이전트에게 특정 식품 ID에 대한 전체 13가지 영양소 스키마를 가져오도록 지시할 수 있습니다.
- 3식품 간 영양 가치 비교에이전트가 어떤 식품이 단백질 함량이 가장 높거나 나트륨 함량이 가장 낮은지 식별할 수 있습니다.
- 4레시피 총 영양 성분 계산AI가 무게에 따라 영양소 값을 계산하고 이를 합산하여 특정 레시피의 총 영양 성분을 제공할 수 있습니다.
프로젝트의 README를 바탕으로 작성되었습니다. 모든 활용 사례는 해당 내용의 인용문과 대조하여 확인합니다.
구성
NUTRIREF_BASE_URLPAYER_PRIVATE_KEY
| 이름 | 설명 | 유형 |
|---|---|---|
| NUTRIREF_BASE_URL | — | |
| PAYER_PRIVATE_KEY | — |
자동 검사
2026년 11월 15일에 실행됨전체 보고서 →아직 인증되지 않았습니다. 서버는 80점 이상의 점수, 심각한 결함 없음, 그리고 검사에 충분한 데이터를 갖추어야 합니다. 검사 방식 · 점수를 높이기 위해 수정할 항목
- 소스 저장소 연결 및 접근 가능younghef/nutriref-api is public and reachablegithub.com/younghef/nutriref-api ↗통과
- 패키지가 이 저장소를 소스로 명시검사되지 않음
- 빌드 출처(Sigstore 증명)검사되지 않음
- 오픈 소스 라이선스 (OSI)MITspdx.org/licenses/MIT.html ↗통과
- 최근 1년 내 커밋 또는 릴리스Last commit or release 2026-06-15github.com/younghef/nutriref-api ↗통과
- OpenSSF Scorecard검사되지 않음
- 패키지 이름이 인기 패키지와 유사하지 않음검사되지 않음
- 패키지 및 해당 종속성에 중요한 보안 권고 없음검사되지 않음
- 모델에 대한 숨겨진 지침 없음0 tool descriptions and the README read; no override phrases, credential paths or hidden characters통과
- 파괴적인 도구에 라벨 표시됨검사되지 않음
- 원격 엔드포인트가 MCP 핸드셰이크에 응답검사되지 않음
README
GitHub에서 보기NutriRef
Pay-per-call USDA nutrition data for AI agents. Structured FoodData Central via the x402 micropayment protocol — agents pay $0.001–$0.005 in USDC per request, no signup, no API keys, no human auth flows.
Live at https://nutriref.xyz. Spec at /openapi.json · Swagger at /docs · Bazaar discovery at /.well-known/x402.
Endpoints
| Method | Path | Price | Cache |
|---|---|---|---|
GET |
/v1/nutrition/search?q=&limit= |
$0.001 | 24h |
GET |
/v1/nutrition/detail/{fdc_id} |
$0.002 | 7d |
POST |
/v1/nutrition/compare |
$0.003 | derived |
POST |
/v1/nutrition/recipe |
$0.005 | derived |
All values per 100g. Missing nutrients are null, not 0. compare returns per-nutrient winners (highest protein, lowest sodium, etc.). recipe scales by grams and sums.
Use it from Claude (or any MCP agent)
NutriRef ships an MCP server that exposes the four endpoints as native tools. Install it from PyPI:
pip install nutriref-mcp
Then add this to your MCP client config (Claude Desktop's claude_desktop_config.json, Claude Code's MCP settings, etc.):
{
"mcpServers": {
"nutriref": {
"command": "nutriref-mcp",
"env": {
"PAYER_PRIVATE_KEY": "0x...your-funded-wallet-key...",
"NUTRIREF_BASE_URL": "https://nutriref.xyz"
}
}
}
}
Prefer not to install? Use
uvx nutriref-mcpas thecommandto run it on demand. To work from a clone instead,pip install -e ".[mcp]"and setcommandtopythonwithargs: ["-m", "mcp_server"].
The wallet needs USDC on Base mainnet — gas is sponsored by the facilitator, so you only need stablecoin balance. The agent now has nutrition_search, nutrition_detail, nutrition_compare, nutrition_recipe and auto-pays per call.
Use it from any HTTP client
Unpaid requests get 402 Payment Required with x402 payment instructions. Any x402-aware client signs a gasless USDC authorization (EIP-3009) and retries automatically:
import asyncio
from eth_account import Account
from x402.client import x402Client
from x402.http.clients.httpx import wrapHttpxWithPayment
from x402.mechanisms.evm.exact import register_exact_evm_client
account = Account.from_key("0x...funded-wallet-key...")
client = x402Client(); register_exact_evm_client(client, account)
async def main():
async with wrapHttpxWithPayment(client, base_url="https://nutriref.xyz") as http:
r = await http.get("/v1/nutrition/detail/2012128")
print(r.json())
asyncio.run(main())
Response example
GET /v1/nutrition/detail/173944:
{
"fdc_id": 173944,
"description": "Banana, raw",
"data_type": "Foundation",
"serving_size": 100, "serving_size_unit": "g",
"calories": 89.0, "protein": 1.1, "fat": 0.3,
"carbs": 22.8, "fiber": 2.6, "sugar": 12.2,
"sodium": 1.0, "cholesterol": null, "saturated_fat": 0.1,
"vitamin_c": 8.7, "calcium": 5.0, "iron": 0.3, "potassium": 358.0
}
Self-hosting
NutriRef is open source; the live instance at nutriref.xyz is one deployment among many possible. To run your own:
cp .env.example .env
# fill in USDA_API_KEY (free at https://fdc.nal.usda.gov/api-key-signup.html)
# and X402_RECEIVER_ADDRESS (an EVM address that should receive payments)
docker compose up --build
curl http://localhost:8000/health
Configuration
| Var | Required | Default | Purpose |
|---|---|---|---|
USDA_API_KEY |
yes | — | Free key from fdc.nal.usda.gov |
USDA_BASE_URL |
no | https://api.nal.usda.gov/fdc/v1 |
|
REDIS_URL |
no | redis://redis:6379/0 |
Response cache |
X402_NETWORK |
no | base-sepolia |
base for mainnet |
X402_RECEIVER_ADDRESS |
yes | — | EVM address that receives USDC |
X402_FACILITATOR_URL |
no | https://x402.org/facilitator |
https://api.cdp.coinbase.com for mainnet |
CDP_API_KEY_ID |
mainnet only | — | Coinbase Developer Platform key ID |
CDP_API_KEY_SECRET |
mainnet only | — | Coinbase Developer Platform key secret |
LOG_LEVEL |
no | INFO |
For mainnet you need a Coinbase CDP account and the public x402 facilitator at https://api.cdp.coinbase.com. Testnet works for free with the community facilitator at https://x402.org/facilitator.
Architecture
agent → x402 middleware → route handler → cache (Redis) → USDA FDC API
search and detail cache USDA responses directly. compare and recipe compose from the cached detail data — no extra USDA calls when warm. The cache is a meaningful cost lever: warm requests return in <50ms and never hit USDA.
Tests
pip install -e ".[dev]"
pytest
Example: Claude agent that uses NutriRef
examples/meal-planner/ is a complete, ~150-line agent that gives Claude
the four NutriRef endpoints as tools and asks it to plan a day of meals
hitting a calorie/protein goal. Worth reading if you're wiring NutriRef
into your own agent — the tool schemas and the payment loop are all
there. See examples/meal-planner/README.md.
Repo layout
app/ # FastAPI service
main.py # app factory + x402 init
routes/ # search, detail, compare, recipe
landing.py # / (public landing page)
discovery.py # /.well-known/x402, /llms.txt, /.well-known/ai-plugin.json, /logo.svg
usda.py # async USDA client
cache.py # Redis wrapper
normalize.py # USDA → flat 13-nutrient schema
mcp_server/ # MCP server wrapper for agent use
examples/ # worked agent examples (meal planner)
scripts/ # CDP wallet bootstrap + payer-side test
tests/ # pytest + respx + fakeredis
Acknowledgments
- USDA FoodData Central for the data.
- x402 for the payment protocol.
fastapi-x402for the server middleware (with a small EIP-712 patch we apply at startup for Base mainnet USDC).
NutriRef MCP 질문
NutriRef 사용 비용은 얼마인가요?
사용하는 엔드포인트에 따라 요청당 $0.001에서 $0.005 사이의 USDC 비용이 발생합니다.
사용을 위해 API 키나 사용자 인증이 필요한가요?
아니요, 이 서비스는 별도의 가입이나 API 키가 필요 없는 x402 마이크로페이먼트 프로토콜을 사용합니다.