Skip to main content
Glama
README.md
# KcalSnap MCP & Food Photo Nutrition API

Estimate **calories, protein, carbs, fat, edible gram weights, and USDA FoodData Central matches** from any food photo over **MCP (Streamable HTTP)** or **REST**.

- **Remote MCP endpoint:** `https://kcalsnap.com/mcp` (Official MCP Registry: `com.kcalsnap/kcalsnap`)
- **REST endpoint:** `POST https://kcalsnap.com/api/v1/analyze`
- **Docs & quickstart:** https://kcalsnap.com/developers/
- **Machine-readable specs:** [`openapi.json`](./openapi.json) · [llms.txt](https://kcalsnap.com/llms.txt) · [Example catalog](https://kcalsnap.com/developers/examples/catalog.json)
- **iOS app:** [KcalSnap on the App Store](https://apps.apple.com/app/kcalsnap-calorie-tracker/id6804732623) (free for iPhone, English & Lithuanian)

---

## Connect via MCP (Streamable HTTP)

KcalSnap runs a stateless remote MCP server at `https://kcalsnap.com/mcp`. No local binary or package install is required.

### Claude Code

```bash
claude mcp add --transport http kcalsnap https://kcalsnap.com/mcp \
  --header "Authorization: Bearer YOUR_KCALSNAP_API_KEY"
```

### Cursor / VS Code / Windsurf / Claude Desktop (`mcpServers`)

```json
{
  "mcpServers": {
    "kcalsnap": {
      "type": "http",
      "url": "https://kcalsnap.com/mcp",
      "headers": {
        "Authorization": "Bearer YOUR_KCALSNAP_API_KEY"
      }
    }
  }
}
```

> Using **x402** (autonomous pay-per-call with USDC on Base)? Omit the `Authorization` header and pass payment in `params._meta["x402/payment"]`.

---

## MCP Tools

| Tool | Cost | What it does |
| --- | --- | --- |
| `analyze_food` | 1 credit or `0.01 USDC` | Analyzes a base64 JPEG, PNG, or static WebP food photo (up to 2 MB, 2048px per side) and returns per-item foods, estimated edible grams, kcal, protein, carbs, fat, and USDA/AI provenance. Accepts optional `language` (`en` / `lt`), `known_total_grams` (scales component portions to a measured plate weight), `note` (hidden ingredients like cooking oil or sauces), and `idempotency_key` (safe retries for 24 hours). |
| `check_balance` | Free | Reconciles expired reservations and returns remaining prepaid credits for the configured Bearer API key. |

---

## Pricing (No Subscription)

Unused prepaid credits never expire. No-food images and failed analyses do not consume a credit or settle x402 payment.

| Option | Price | Scans | Unit cost |
| --- | --- | --- | --- |
| `pack_500` (Card via Stripe) | $5.00 | 500 | $0.0100 |
| `pack_3000` (Card via Stripe) | $25.00 | 3,000 | $0.0083 (17% off) |
| `pack_7000` (Card via Stripe) | $50.00 | 7,000 | $0.0071 (29% off) |
| `pack_16000` (Card via Stripe) | $100.00 | 16,000 | $0.0063 (38% off) |
| x402 (Base USDC) | $0.01 / call | Pay as you go | $0.0100 |

Buy prepaid card credits at https://kcalsnap.com/developers/credits/ or generate a key locally with `quickstart.mjs`.

---

## REST CLI Quickstart (Node 22+, Zero Dependencies)

[`quickstart.mjs`](./quickstart.mjs) handles local key creation, Stripe Checkout links, idempotent retries, and local response caching:

```bash
node quickstart.mjs init
node quickstart.mjs checkout --pack=pack_500
node quickstart.mjs balance
node quickstart.mjs scan meal.jpg
```

---

## Measured Accuracy & Benchmarks

KcalSnap matches detected foods against an in-memory copy of **13,649 USDA FoodData Central** (Foundation, SR Legacy, and Survey) foods with zero external USDA hops, falling back to structured AI macro estimation when no USDA match exists.

- [We hid the scales before testing calorie estimates (179 weighed-food photos)](https://kcalsnap.com/journal/dfood-weighed-photo-benchmark/)
- [Nutrition5k calorie benchmark (48 measured meal groups, 288 runs)](https://kcalsnap.com/journal/nutrition5k-calorie-benchmark/)
- [USDA food-matching experiment & 4 matcher fixes](https://kcalsnap.com/journal/jev-food-matcher/)
- [In-memory USDA lookups, volume packs, WebP & meal context notes](https://kcalsnap.com/journal/faster-food-api-volume-packs-meal-notes/)

---

## Support

Built by **MB Nexus consulting** (Lithuania) · [hello@kcalsnap.com](mailto:hello@kcalsnap.com) · [Support](https://kcalsnap.com/support.html) · [Privacy](https://kcalsnap.com/privacy.html)