Metadata-Version: 2.4
Name: dietly-mcp
Version: 0.1.0
Summary: MCP server for DietlyAPI — nutrition lookup over 4.7M+ foods
Project-URL: Homepage, https://www.getdietly.com/api
Project-URL: Documentation, https://www.getdietly.com/api-guide
License: MIT
License-File: LICENSE
Requires-Python: >=3.10
Requires-Dist: httpx>=0.27
Requires-Dist: mcp>=1.2.0
Description-Content-Type: text/markdown

# dietly-mcp

MCP server for [DietlyAPI](https://www.getdietly.com/api) — nutrition lookup over
4.7M+ foods, with a source link for every record.

Works in Claude Desktop, Claude Code, Cursor, and anything else that speaks MCP.

## Tools

| Tool | Purpose |
|---|---|
| `search_foods(query, limit)` | Fuzzy search by name or brand. Searches localized names, so `havermout` finds the Dutch product. |
| `lookup_barcode(code)` | Exact lookup by EAN-13 / UPC-A. |
| `get_food(food_id)` | Re-fetch a food by its stable Dietly ID. |

Every response states values **per 100 g**, pre-computes the per-serving figure
where the record has a serving size, and links the public food page.

## Install

```bash
uvx dietly-mcp          # once published
# or, from this repo:
pip install -e mcp-server
```

## Configure

**Claude Desktop** — `claude_desktop_config.json`:

```json
{
  "mcpServers": {
    "dietly": {
      "command": "uvx",
      "args": ["dietly-mcp"],
      "env": { "DIETLY_API_KEY": "sk_your_key_here" }
    }
  }
}
```

**Claude Code**:

```bash
claude mcp add dietly --env DIETLY_API_KEY=sk_your_key_here -- uvx dietly-mcp
```

`DIETLY_API_KEY` is **optional** — the read endpoints are public. Without a key
you share an anonymous 30 req/min per-IP bucket and get a small fairness delay;
with one you get your plan's account-level limit and no delay. Free keys at
<https://www.getdietly.com/account>.

`DIETLY_API_BASE` can override the host for testing.

## Notes

- All nutrient values are **per 100 g**, never per serving. `serving_size_g` is
  descriptive and is null on roughly a third of records.
- Data is Open Food Facts (ODbL) plus USDA FoodData Central. Applications
  displaying it must carry the Open Food Facts attribution.
- Rate limits surface as a clear error with the retry delay rather than a raw
  429 body.
