Skip to content

MCP server ​

The NutriScan MCP server gives an AI agent the same three calls as the REST API: analyze a meal, fetch a scan and check credits. It signs in with your NutriScan API key and spends the same credits. For what it is and who it is for, see the MCP server overview.

Server URLhttps://platform-api.nutriscan.app/mcp
SettingValue
TransportStreamable HTTP. Every message is a JSON-RPC POST, and every answer is plain JSON.
SessionsNone. The server is stateless, so each request stands alone.
Sign-inAuthorization: Bearer ns_test_... or Bearer ns_live_...
Toolsanalyze_meal, get_scan, get_usage
CostSame credits as REST. No MCP fee, no seats, no subscription.

API key and header ​

Use the same keys as the REST API. You get a test key when you sign in to the console at platform.nutriscan.app and create live keys there.

http
Authorization: Bearer ns_test_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
  • A test key is free. analyze_meal returns a fixed sample result (grilled chicken with rice and salad, NutriScore B, 515 kcal) and uses no credits. Wire up the agent with it first.
  • A live key runs real scans and spends credits from your balance.

There is no OAuth sign-in yet. That is why the connector screen in claude.ai and the Claude mobile apps, which cannot send a custom header, does not work with this server yet.

Set up a client ​

Any MCP client that speaks Streamable HTTP and can send a header works. Each setup below keeps the key in an environment variable, so it never ends up in a file you commit.

Claude Code ​

Add the server from the command line:

bash
export NUTRISCAN_KEY="ns_test_..."
claude mcp add --transport http nutriscan https://platform-api.nutriscan.app/mcp \
  --header "Authorization: Bearer $NUTRISCAN_KEY"

To share the server with a team, put .mcp.json in the project root. The file holds no key; each person keeps NUTRISCAN_KEY in their own environment.

json
{
  "mcpServers": {
    "nutriscan": {
      "type": "http",
      "url": "https://platform-api.nutriscan.app/mcp",
      "headers": { "Authorization": "Bearer ${NUTRISCAN_KEY}" }
    }
  }
}

Run /mcp inside a Claude Code session to see the server and its tools. Step by step: NutriScan MCP in Claude Code.

Claude desktop app ​

Open Settings > Developer > Edit Config and add the server to claude_desktop_config.json. The app starts local commands from this file, so the mcp-remote bridge forwards to the remote server. It runs through npx, so Node.js has to be installed. Restart the app after you save.

json
{
  "mcpServers": {
    "nutriscan": {
      "command": "npx",
      "args": ["-y", "mcp-remote", "https://platform-api.nutriscan.app/mcp", "--header", "Authorization:${NUTRISCAN_AUTH}"],
      "env": { "NUTRISCAN_AUTH": "Bearer ns_test_..." }
    }
  }
}

Step by step: NutriScan MCP in the Claude desktop app.

Codex ​

Add the server to ~/.codex/config.toml:

toml
[mcp_servers.nutriscan]
url = "https://platform-api.nutriscan.app/mcp"
bearer_token_env_var = "NUTRISCAN_KEY"
tool_timeout_sec = 120

Codex stops a tool after 60 seconds by default and a scan can take up to 95, so keep tool_timeout_sec = 120. Run codex mcp list to check the server is there. Step by step: NutriScan MCP in Codex.

Other clients ​

Clients that take a url and headers in JSON use the same block as Claude Code's .mcp.json above. We have not tested each one, so check your client's docs for where the file lives.

Call it with curl ​

You can talk to the server without any client. Each request is one JSON-RPC message.

Start a connection with initialize:

bash
curl https://platform-api.nutriscan.app/mcp \
  -H "Authorization: Bearer $NUTRISCAN_KEY" \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-06-18","capabilities":{},"clientInfo":{"name":"curl","version":"1.0"}}}'

The answer names the server and the protocol version it will use:

json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "protocolVersion": "2025-06-18",
    "capabilities": { "tools": {} },
    "serverInfo": { "name": "nutriscan", "title": "NutriScan", "version": "1.0.0" },
    "instructions": "Nutrition for meals and foods. analyze_meal spends credits with a live key; a test key returns a fixed sample. For one food, send it as text with an amount."
  }
}

List the tools with tools/list. The answer carries each tool's name, description and input schema.

bash
curl https://platform-api.nutriscan.app/mcp \
  -H "Authorization: Bearer $NUTRISCAN_KEY" \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","id":2,"method":"tools/list"}'

Call a tool with tools/call:

bash
curl https://platform-api.nutriscan.app/mcp \
  -H "Authorization: Bearer $NUTRISCAN_KEY" \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"analyze_meal","arguments":{"type":"text","text":"2 eggs and a slice of toast"}}}'

The server also answers ping. Notifications, such as notifications/initialized, get an empty 202 answer.

Tools ​

analyze_meal ​

Nutrition for a meal or a single food. It runs the same scan as POST /v1/scans and returns the same result.

ArgumentTypeNotes
typestring, requiredtext for a description, meal for a meal photo, label for a photo of a pack's nutrition label.
textstring, up to 2,000 charactersThe meal or food with amounts, for example "2 eggs and a slice of toast". Only with type: "text".
image_urlstring, up to 2,048 charactersA public https URL of a JPEG, PNG or WebP photo. Only with type: "meal" or "label". Fetched once, with no redirects and a 5 second timeout.
languagestringLanguage of food names and the NutriScore reason: en, de, fr, es, it, pt, nl, pl, ru, tr, hi, ar. Default en.
contextobjectOptional hints that improve accuracy. Leave out what you do not know.

The context fields are free text:

FieldType, max lengthHint about
meal_timestring, 32When the meal is eaten, for example "lunch"
cooking_methodlist of up to 8 strings, 48 eachMethods, for example ["grilled"]
oil_quantitystring, 32How much oil went into the dish
consumed_quantitystring, 64How much was eaten, for example "half"
locationstring, 200Where the meal is from

The REST fields image_base64, stream and the other context fields are not part of this tool. A text call for a German dish:

json
{
  "name": "analyze_meal",
  "arguments": {
    "type": "text",
    "text": "1 Schweineschnitzel, paniert, 150 g, mit Kartoffelsalat",
    "language": "de",
    "context": { "meal_time": "dinner", "cooking_method": ["pan-fried"] }
  }
}

A photo of a pack label:

json
{
  "name": "analyze_meal",
  "arguments": { "type": "label", "image_url": "https://example.com/label.jpg", "language": "fr" }
}

Cost: with a live key, credits per scan as in REST, about 65 for a typical plate and at least 20. With a test key, free.

get_scan ​

An earlier scan of your account, by its id.

ArgumentTypeNotes
idstring, requiredThe scan id from analyze_meal, starting with scn_. Letters, digits, _ and -, up to 64 characters.

It returns the same JSON as GET /v1/scans/{id}. Free.

get_usage ​

Credits left and used on your account. No arguments. It returns the same JSON as GET /v1/usage, with credits_left, credits_used, can_scan and the other fields listed on limits. Free. Have the agent call it before a large batch of scans.

What a result looks like ​

A tool result carries the REST response as JSON text in one text block:

json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "content": [
      { "type": "text", "text": "{\"id\":\"scn_Q2mX8rT4vK1pLw9eZb3nYh6A\",\"status\":\"succeeded\",\"meal\":{\"name\":\"Grilled chicken with rice and salad\",\"nutri_score\":\"B\", ...}" }
    ]
  }
}

Parse the text and you have the same object as the REST API: calories, macros and 21 nutrients for the meal and for each item, items with portions, a NutriScore grade with its reason, and credits_used. Every field is described on the result.

Errors ​

Errors come back in several ways.

What went wrongWhat you get
No Authorization: Bearer ... headerHTTP 401 with JSON-RPC error -32001 and a message on how to send the key.
The scan or the REST call failedA normal tool result with "isError": true. Its text is the same error JSON as REST, for example {"error":{"code":"insufficient_credits","message":"..."}}.
Bad arguments to get_scanA tool result with "isError": true that names the argument.
Unknown tool nameJSON-RPC error -32602, Unknown tool.
Unknown methodJSON-RPC error -32601, Method not found.
Body that is not JSONHTTP 400 with JSON-RPC error -32700.
Request body over 100,000 bytesHTTP 413 with JSON-RPC error -32600. Send photos as image_url.
A GET requestHTTP 405. Send JSON-RPC with POST.

The key is checked when a tool runs. A header with a wrong or revoked key still lets a client connect and list the tools, and every tool call then returns isError: true with invalid_api_key or key_revoked.

A failed tool call looks like this:

json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "content": [
      { "type": "text", "text": "{\"error\":{\"code\":\"rate_limited\",\"message\":\"...\"}}" }
    ],
    "isError": true
  }
}

The codes, and which ones to retry, are on errors.

Limits ​

LimitValue
Rate limitYour account's REST limit: 60 requests a minute, shared with your REST calls and every key on the account. Over it, a tool call returns isError: true with rate_limited.
Scan timeUp to 95 seconds. There is no streaming through MCP.
Client timeoutCodex stops a tool after 60 seconds by default. Set tool_timeout_sec = 120. In other clients, allow at least 100 seconds.
PhotosA public https URL, up to 2,048 characters. No base64 upload through MCP.
Text2,000 characters
Credits to start a scan20

Credits ​

The MCP server has no price of its own. A scan through MCP costs the same credits as through REST, and there are no seats or subscription.

  • analyze_meal with a live key: priced from what the scan uses, about 65 credits for a typical plate, at least 20. 1 credit is $0.001.
  • analyze_meal with a test key, get_scan and get_usage: free.
  • Credits come in packs of $49, $199 and $599 and never expire. See Nutrition API pricing.

Safety ​

  • A live key spends credits, and an agent in a loop can spend them fast. Build and test with a test key, and have the agent check get_usage.
  • Keep the key in an environment variable, not in a file that gets committed. The .mcp.json above refers to ${NUTRISCAN_KEY} for that reason.
  • If a key leaks, revoke it in the console at platform.nutriscan.app and create a new one.

Not supported yet ​

  • OAuth sign-in, so the connector screen in claude.ai and the Claude mobile apps cannot add this server.
  • Photo upload as base64. Use a public https URL, or call POST /v1/scans with image_base64.
  • Streaming progress events. A scan answers once it is done.
  • Food search and barcode lookup. There are no such tools. For one food, send it as text with an amount.

Common questions ​

Does the MCP server cost extra?

No. There is no MCP fee, no seat and no subscription. analyze_meal with a live key uses the same credits as POST /v1/scans, and get_scan and get_usage are free.

Can I use the NutriScan MCP server from claude.ai or the Claude mobile apps?

Not yet. Those add a server through the connector screen, which cannot send a custom header, and the server signs you in with your API key in the Authorization header. Use Claude Code, the Claude desktop app with the config file, Codex or another client that can send a header.

How do I look up one food through MCP?

Call analyze_meal with type text and the food with an amount, such as "150 g grilled chicken breast". There is no food search or barcode tool.

Can I send a photo file instead of a URL?

Not through MCP. analyze_meal takes a public https image_url. To upload the image itself, call POST /v1/scans with image_base64.

Related pages: the MCP server overview, AI agents use case, authentication for keys, create a scan for the REST request and the Nutrition API overview.