MCP Server
NutrientAPI exposes the same nutrition analysis as a Model Context Protocol server. Connect it to Claude Desktop, ChatGPT, Cursor, or any MCP client and use plain language to analyze recipes, look up single foods, and get FDA-style nutrition labels.
Overview
The MCP server speaks the Model Context Protocol over streamable HTTP and exposes nutrition tools that any compliant client can call. Authentication uses OAuth 2.1 with PKCE. Recipe traffic counts against the same plan quotas as direct API calls — there is no separate MCP billing.
Per-client setup instructions are available in your dashboard after sign-in. Sign up if you don't have an account yet.
Tools exposed
Two tools. Each call counts as one recipe against your monthly quota — identical to a single POST /v1/analyze request on the REST API.
analyze_recipe
Analyze a complete recipe with 2+ ingredients. Returns per-ingredient nutrients plus recipe and per-serving totals.
Arguments
title(string, required) — name of the recipeingredients(array of strings, required) — ingredients as natural-language strings, e.g."6 oz salmon fillet"servings(integer, required, ≥ 1) — number of servings the recipe yields
Example response (returned as the text field of the MCP tool result, as a JSON string):
{
"status": "success",
"ingredients": [
{
"text": "6 oz salmon fillet",
"parsed": {
"qty": 6,
"unit": "oz",
"food": "Fish, salmon, Atlantic, farmed, cooked, dry heat",
"gram_weight": 170.1
},
"confidence": { "match": 0.95, "conversion": 0.99, "overall": 0.94 },
"nutrients": {
"kcal": 354, "protein_g": 39.3, "fat_g": 21.0,
"carbs_g": 0, "fiber_g": 0, "sugar_g": 0, "sodium_mg": 87
}
},
{
"text": "2 cups baby spinach",
"parsed": {
"qty": 2, "unit": "cup", "food": "Spinach, raw", "gram_weight": 60.0
},
"confidence": { "match": 0.92, "conversion": 0.85, "overall": 0.78 },
"nutrients": {
"kcal": 14, "protein_g": 1.7, "fat_g": 0.2,
"carbs_g": 2.2, "fiber_g": 1.3, "sugar_g": 0.3, "sodium_mg": 47
}
}
],
"totals": {
"kcal": 368, "protein_g": 41.0, "fat_g": 21.2,
"carbs_g": 2.2, "fiber_g": 1.3, "sugar_g": 0.3, "sodium_mg": 134
},
"per_serving": {
"kcal": 368, "protein_g": 41.0, "fat_g": 21.2,
"carbs_g": 2.2, "fiber_g": 1.3, "sugar_g": 0.3, "sodium_mg": 134
},
"diet_labels": ["KETO", "LOW_CARB"],
"health_labels": ["GLUTEN_FREE", "DAIRY_FREE"]
}
get_nutrition
Look up nutrition for a single food or ingredient string. Use this for queries like "how many calories in 1 cup of quinoa" or "what's in a banana." Implementation-wise it's a one-element call to the recipe pipeline with recipe-level totals and per-serving values stripped.
Arguments
ingredient(string, required) — a single food or ingredient with quantity, e.g."1 cup cooked quinoa"or"100g salmon"
Example response:
{
"status": "success",
"ingredients": [
{
"text": "1 cup cooked quinoa",
"parsed": {
"qty": 1, "unit": "cup", "food": "Quinoa, cooked", "gram_weight": 185.0
},
"confidence": { "match": 0.96, "conversion": 0.99, "overall": 0.95 },
"nutrients": {
"kcal": 222, "protein_g": 8.1, "fat_g": 3.6,
"carbs_g": 39.4, "fiber_g": 5.2, "sugar_g": 1.6, "sodium_mg": 13
}
}
],
"diet_labels": ["VEGAN", "VEGETARIAN", "GLUTEN_FREE"],
"health_labels": ["DAIRY_FREE", "PEANUT_FREE"]
}
Note: totals and per_serving are intentionally absent — this tool is a lookup, not a recipe analysis.
Error responses
When a tool can't complete, the MCP response sets isError: true and the text field carries a JSON error envelope. Common cases:
{ "error": "rate_limit", "message": "..." }— per-second or per-minute throttle hit{ "error": "quota", "message": "..." }— monthly recipe quota exhausted{ "error": "quality_check_failed", "problems": [...], "ingredients": [...] }— confidence below the threshold; partial data included{ "error": "invalid_input", "messages": [...] }— argument validation failure
Authentication
OAuth 2.1 with PKCE-S256. Modern MCP clients (Claude Desktop, ChatGPT Developer Mode, Cursor) handle the full flow automatically — paste the server URL, sign in with your NutrientAPI account, and the connection is ready. The MCP server does not accept Bearer API keys; OAuth is the only supported flow on this surface.
Endpoints
POST https://api.nutrientapi.com/oauth/register— Dynamic Client Registration (RFC 7591). Clients self-register on first connect; no manual app creation required.GET https://api.nutrientapi.com/oauth/authorize— authorization endpoint. PKCE-S256 required; theplainchallenge method is rejected.POST https://api.nutrientapi.com/oauth/token— token exchange. Access tokens last 1 hour; refresh tokens are long-lived but rotated on use.POST https://api.nutrientapi.com/oauth/revoke— token revocation (RFC 7009).
Discovery
Both standard discovery documents are served, so most MCP clients can bootstrap with just the server URL:
GET https://api.nutrientapi.com/.well-known/oauth-authorization-server(RFC 8414)GET https://api.nutrientapi.com/.well-known/oauth-protected-resource(RFC 9728)
Scope
A single scope, mcp, granting access to the two tools above. There is no consent screen — the act of connecting the client in your AI app counts as authorization.
Managing connected clients
Connected MCP clients appear in your dashboard alongside your REST API keys, tagged with an MCP badge. Clicking Disconnect immediately revokes the OAuth tokens and removes the client's access.
Worked examples
A typical Claude Desktop session calls analyze_recipe in response to a user prompt. The tool call and response are visible in Claude's tool use panel.
// Claude Desktop tool call
{
"tool": "analyze_recipe",
"arguments": {
"title": "Keto Salmon Bowl",
"ingredients": [
"6 oz salmon fillet",
"2 cups baby spinach",
"1/2 avocado",
"1 tbsp olive oil"
],
"servings": 1
}
}
Rate limits
MCP requests count against the same monthly quota and per-second rate limit as the REST API:
- Free — 25 recipes/month, 3 req/s
- Pay-as-you-go — $0.05/recipe (25 free/mo), 10 req/s
- Pro — 10,000 recipes/month, 25 req/s
- Max — 50,000 recipes/month, 50 req/s
See Rate Limits for full details and overage pricing.
Comparison to other nutrition MCPs
For a full comparison of NutrientAPI MCP against other nutrition MCPs (data sources, recipe parsing, confidence scores, hosted vs local, pricing, setup time), see NutrientAPI MCP vs Other Nutrition MCPs.