Skip to content
unofficial WeightWatchers MCP

Local HTTP API for WeightWatchers

ww serve exposes the same tools as REST/JSON with an OpenAPI 3.1 description, and as MCP over HTTP at /mcp. For scripts, n8n, Home Assistant or a backend in any language.

Unofficial. Not affiliated with WeightWatchers (WW International, Inc.). Uses the private API behind the WW apps, which may break and may violate the WW terms. What that means

ww serve starts a local HTTP server with the same tools as the MCP server, as REST/JSON with an OpenAPI 3.1 description. Use it from scripts, n8n, Home Assistant, Apple Shortcuts, or from your own backend in any language. The same server speaks MCP over HTTP at /mcp.

It is generated from the same tool definitions as the MCP server, so the tool reference describes every endpoint's arguments. It runs on your machine, with your WW session, and listens on 127.0.0.1 unless you say otherwise.

Start it

ww login                 # once: the server uses the stored session
ww serve                 # http://127.0.0.1:8787
ww serve --read-only     # only read tools

ww-api is the same server as a standalone command. It renews the token like the CLI does.

FlagMeaningDefault
--host <addr>Address to bind. Non-loopback only when given explicitly, with a warning.127.0.0.1
--port <n>Port. 0 picks a free one.8787
--read-onlyOnly tools annotated read-only.off
--allow-rawAlso expose the raw ww_api_call tool (GET only, unless WW_ALLOW_RAW_WRITES=1 is set). Never combined with --read-only.off
--no-mcpDo not serve MCP at /mcp.MCP on
--rate-limit <n>Requests per minute and client address; 0 = off.120
--quietNo request log on stderr.log on
--show-keyPrint the API key (creating it if needed) and exit.

ww_login is never exposed: it opens a page on the machine that runs the server.

API key

Every route except /healthz and /docs needs Authorization: Bearer <key>.

  • On the first start a key (wwk_...) is generated, stored in $WW_HOME/api-key (mode 600) and printed once. Show it again with ww serve --show-key.
  • WW_API_KEY (at least 16 characters) overrides the file and is never written to disk.
  • Rotate by deleting the file and restarting.
  • The key is compared in constant time and never returned or logged. The WW token and password never leave the server.

The API key only protects this server. It is not the WW session.

Endpoints

Method and pathKeyDescription
GET /healthzno{ ok, version, tools, readOnly }. No account access.
GET /docsnoStatic page rendering the OpenAPI document; asks for the key in the browser.
GET /openapi.jsonyesOpenAPI 3.1, one operation per tool plus the read routes below.
GET /v1/tools, GET /v1/tools/{name}yesTools with annotations, JSON input schema and example.
POST /v1/tools/{name}yesCall a tool; the JSON body is its arguments.
POST /mcpyesMCP over Streamable HTTP, stateless.

Read routes (GET, arguments as path and query):

RouteTool
/v1/statusww_status
/v1/day, /v1/day/{date}ww_day
/v1/tracked[/{date}]ww_tracked
/v1/water[/{date}]ww_get_water
/v1/activity[/{date}]ww_activity_week (seven days from the date)
/v1/weight, /v1/weight/statusww_weight_entries (?limit=), ww_weight_status
/v1/search?q=banana&limit=10ww_search_food
/v1/recipes/search?q=pastaww_search_recipes
/v1/recipes, /v1/foods, /v1/meals, /v1/favoritesww_list_my_*, ww_list_favorite_foods (?limit=&offset=)
/v1/frequentww_frequent_and_recent

Everything that writes goes through POST /v1/tools/{name}, so every write is an explicit, annotated call. With --read-only those tools answer 404 unknown_tool.

Responses

{ "ok": true, "data": { "...": "structured result" }, "text": "the same as pretty JSON" }

data is the tool's structured result (arrays and scalars are wrapped as { "result": ... }). text is cut at 40000 characters with "truncated": true; data stays complete. Errors:

{ "ok": false, "error": { "code": "validation_error", "message": "...", "issues": [{ "path": "date", "message": "..." }] } }
StatuscodeMeaning
400validation_error, invalid_jsonBad arguments or body.
401unauthorizedMissing or wrong API key.
401ww_login_required, ww_auth_failedThe server has no usable WW session: run ww login.
403raw_writes_disabledRaw POST/PUT/DELETE without WW_ALLOW_RAW_WRITES=1.
403upstream_forbiddenWW refused.
404unknown_tool, not_found, upstream_not_foundUnknown or hidden tool, route, or ID.
405method_not_allowedWrong HTTP method.
409upstream_rejectedWW rejected the request.
413 / 415payload_too_large, unsupported_media_typeBody over 1 MB; not application/json.
429rate_limited, upstream_rate_limitedThis server's limit (with Retry-After) or WW's.
502 / 504upstream_error, upstream_unreachable, upstream_timeout, timeoutWW failed or is unreachable; a tool call over 120 s.

For write tools a 504 can mean the change was applied anyway: read it back before repeating.

Examples

export WW_KEY="$(ww serve --show-key)"

curl -s http://127.0.0.1:8787/healthz

curl -s -H "Authorization: Bearer $WW_KEY" http://127.0.0.1:8787/v1/day/2026-12-03

curl -s -H "Authorization: Bearer $WW_KEY" "http://127.0.0.1:8787/v1/search?q=banana&limit=5"

curl -s -X POST http://127.0.0.1:8787/v1/tools/ww_track \
  -H "Authorization: Bearer $WW_KEY" -H "Content-Type: application/json" \
  -d '{"date":"2026-12-03","items":[{"name":"Snack","points":3,"timeOfDay":"anytime"}]}'

The argument shapes of write tools are in the tool reference; the example field of GET /v1/tools/{name} has a valid sample for each.

From Node (a backend that talks to ww serve):

const res = await fetch('http://127.0.0.1:8787/v1/day', { headers: { authorization: `Bearer ${process.env.WW_KEY}` } });
const { data } = await res.json();

MCP over HTTP

POST /mcp speaks the Model Context Protocol (Streamable HTTP, stateless JSON responses) with the same tool selection and the same API key. For clients that support custom headers:

{ "mcpServers": { "ww": { "type": "http", "url": "http://127.0.0.1:8787/mcp", "headers": { "Authorization": "Bearer <key>" } } } }

Clients that only offer OAuth (for example the ChatGPT connector UI) cannot use it: there is no OAuth here. --no-mcp switches it off.

Security

  • Binds to 127.0.0.1. Another address needs --host and prints a warning. Without TLS an exposed server sends the key and your health data in clear text: put a TLS reverse proxy and a firewall in front.
  • Key in constant time, rate limit per client address, 1 MB body limit, request timeout 30 s, tool timeout 120 s.
  • No request bodies, query strings or keys in the log (path and status only).
  • no-store and nosniff on every response; /docs is a static shell with a strict Content-Security-Policy.
  • Rate limiting uses the socket address. Behind a reverse proxy every request looks like the proxy: rate-limit there as well.
  • --read-only is enforced on the server, not just hidden: write tools do not exist for REST and MCP.
  • Raw access: ww_api_call is off unless --allow-raw, host allowlist applies, and writes need WW_ALLOW_RAW_WRITES=1 in the server's environment.

Docker

docker run -d --name ww-api -p 127.0.0.1:8787:8787 \
  -e WW_EMAIL -e WW_PASSWORD -e WW_API_KEY -v ww-data:/data \
  --entrypoint node unofficial-weightwatchers-mcp src/http/main.js --host 0.0.0.0 --read-only

Inside the container the server must bind 0.0.0.0; publish the port on loopback only (-p 127.0.0.1:...). WW_EMAIL and WW_PASSWORD let it sign in again when the WW session expires; the /data volume keeps the session and the generated API key. Use --entrypoint with the image's default node src/index.js for the stdio MCP server instead.

Continue with