Skip to content

MCP server

The MCP server exposes the nutrition catalog as tools. Claude Code and Cursor connect with an X-API-Key header. Claude.ai, Claude Desktop, and Claude mobile use browser sign-in when the API has OAuth enabled. The account must be on the MCP plan.

Install

Claude.ai, Claude Desktop, and Claude mobile

Custom connector
Server URL: https://calorieapiadmin.com/mcp
Browser sign-in is off on this server until the API enables OAuth.
Use the Claude Code or Cursor tab with an API key until then.

Claude Code

Terminal
claude mcp add --transport http calorie-api https://calorieapiadmin.com/mcp --header "X-API-Key: YOUR_KEY"

Cursor

.cursor/mcp.json
{
  "mcpServers": {
    "calorie-api": {
      "url": "https://calorieapiadmin.com/mcp",
      "headers": {
        "X-API-Key": "YOUR_KEY"
      }
    }
  }
}

Other header-capable clients

Connection
URL: https://calorieapiadmin.com/mcp
Transport: HTTP (streamable)
Header: X-API-Key: YOUR_KEY
Use this for clients that can set a header. Browser sign-in for Claude apps stays off until the API enables OAuth.

Authentication

When the API has OAuth enabled, Claude apps sign in in the browser. A request that has neither a bearer token nor an API key is then HTTP 401 and carries a WWW-Authenticate challenge so the client can discover the sign-in server. Until that switch is on, use an API key. Claude Code and Cursor send the key on every request as X-API-Key. The key must belong to the MCP plan. Keys from Free, Basic, Core, Plus, or Custom are refused. Photo calls made through OAuth also need the nutrition:vision scope. A missing scope is HTTP 403 with scope="nutrition:vision" in WWW-Authenticate.

  • Create the key in Dashboard → API keys. The full value is shown once, at creation.
  • Do not put the key in a public repo, a screenshot, or an email.
  • This plan cannot call REST search, foods, calc, or vision. Those routes return 403.
  • Account, billing, and auth routes still work.

Tools

Tool schemas

search_foods(query, limit (1-25), verified_only)Search the catalog by name and return calories and macros per 100 g, plus a food_id.
get_food_nutrition(food_id)Full nutrient list for one food_id from search_foods.
suggest_foods(query)Short autocomplete suggestions for a partial food name.
lookup_barcode(upc (8-14 digits))UPC or EAN digits to macros per 100 g. Open Food Facts is the fallback when the catalog misses.
calculate_portion(food_id, grams)Scale one food_id to a gram weight.
calculate_recipe(ingredients[{food_id, grams}], servings)Totals and per-serving macros for up to 40 ingredients.
calculate_macro_targets(age, gender, weight_kg, height_cm, activity, goal)Daily calorie and macro targets from age, sex, weight, height, activity, and goal.
analyze_food_photo(image_base64, content_type)Estimate foods in a JPEG, PNG, or WebP. Pass image_base64 yourself.

search_foods returns food_id values. calculate_portion, calculate_recipe, and get_food_nutrition need those ids. Do not invent a food_id.

Limits and errors

Paid plan

Rate20 calls per minute, shared with any REST calls on the same account
Quota10,000 successful MCP calls per month
Results25 foods per search
Distinct foods2% of the catalog per month
Photos150 per month and 20 per day

Trial

Length7 days, card required
Rate5 calls per minute
Quota200 calls total, not reset on the 1st
Results10 foods per search
Photos10 calls total

Error cases

AuthNo key, invalid key, or a plan without mcp_access
PlanCommercial header, or REST routes on an MCP-only key (HTTP 403)
LimitRate, quota, distinct-food cap, or photo cap
UnavailableThe tool could not complete. Retry later. The message does not include a stack trace.

Photos

analyze_food_photo requires image_base64 as raw base64, without a data: prefix. JPEG, PNG, or WebP. Maximum decoded size is 2 MB. Clients do not attach images automatically. Passing a URL is not enabled.

Troubleshooting

  • 401 on the MCP URL while OAuth is enabled: Claude is starting sign-in. Approve the consent screen with an MCP-plan account. For Claude Code, the header name is X-API-Key.
  • 403 on /api/v1/search: expected. This plan is MCP only. Use the tools, or buy a REST plan.
  • Claude opens a sign-in page and then says the account cannot connect: that login is not on the MCP plan. Start the trial from the MCP pricing page.
  • The model names a food but never calls search_foods: the food_id it invents will fail. Ask it to search first.
  • A photo call returns a size error: compress below 2 MB and send raw base64.

Frequently asked questions

Which clients can connect?

Claude Code and Cursor send an X-API-Key header. Browser sign-in for Claude.ai, Claude Desktop, and Claude mobile stays off until the API enables OAuth. The account must be on the MCP plan.

Does this plan include the REST API?

No. MCP tools only. REST search, foods, calc, and vision return 403. Billing and account pages still work.

What are the trial limits?

7 days, card required. Trial: 5/min, 200 calls total, 10 results, 10 photos. Paid: 20/min, 10,000/month, 25 results, 150 photos/month, 20 photos/day.

Is this for a commercial app?

No. Personal use only. A commercial header is rejected. Apps that resell the data need a REST plan and a commercial license.

How do food photos work?

Pass image_base64 yourself. JPEG, PNG, or WebP, up to 2 MB, no data: prefix.

Will I be charged when the trial ends?

Yes, unless you cancel before the trial ends. Cancel from the billing page.