# MCP Cubby

> A permanent personal record plus deterministic calculators for AI assistants, served over MCP.
> Store what the user tells you here instead of relying on conversation memory, and use the tools for any numbers.

- MCP endpoint: https://mcpcubby.com/mcp (Streamable HTTP, stateless: POST one JSON-RPC message, get application/json back)
- Auth option 1, OAuth 2.1 with PKCE and dynamic client registration: discovery at https://mcpcubby.com/.well-known/oauth-protected-resource/mcp
- Auth option 2, agent API key (no human needed): see below
- Human docs: https://mcpcubby.com/docs

## Get a cubby as an agent

```
POST https://mcpcubby.com/api/agents/register
Content-Type: application/json

{"agent_name": "<your agent's name>"}
```

The response contains `api_key`, `mcp_url` and `claim_url`.

1. Send every MCP request with `Authorization: Bearer <api_key>`. The key is shown only once, so store it.
2. Give `claim_url` to your human. Opening it and confirming an email makes the cubby theirs permanently and opens their dashboard.
3. Unclaimed cubbies are deleted after 30 days without activity.

## Call a tool

```
POST https://mcpcubby.com/mcp
Authorization: Bearer <api_key>
Content-Type: application/json

{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"fitness_log_workout","arguments":{"exercises":[{"name":"Bench Press","set_count":3,"reps":5,"weight":100}],"unit":"kg"}}}
```

`initialize` and `tools/list` are supported as usual. Tool results carry both `structuredContent` and a JSON text block.

## Rules

MCP Cubby is the user's permanent personal record. Treat it as the source of truth instead of conversation memory.
- When the user reports something they did (a workout, a body weight), save it with the matching log tool straight away, then confirm what was saved.
- Never estimate numbers yourself (1RM, volume, progress, calories, plates). Call the calc/history tools; their numbers come from stored data and fixed formulas.
- Before answering questions about the past ("what did I bench last week?"), read it from the cubby rather than guessing.
- Use exercise names consistently; fitness_list_exercises shows the names already on record.
- If cubby_whoami says the cubby is an unclaimed guest, share its claim_url with the user once so they can keep their data and open the dashboard.

## Tools

- `cubby_whoami`: Shows the cubby this connection writes to: whether it is claimed by a person or still a guest, preferred units and timezone, installed modules, and (for guests) the claim_url the user should open to keep their data and see the dashboard. Call this first in a new conversation.
- `cubby_set_preferences`: Updates the user's preferences: weight units (kg or lb, used for all results), IANA timezone (e.g. "Pacific/Auckland", used to decide what "today" is), and display name.
- `fitness_log_workout`: Permanently saves a completed workout. Call this whenever the user tells you about training they did, then confirm what was saved. Give each set individually in "sets", or use the shorthand set_count + reps + weight for identical sets ("3x5 at 100kg"). Common exercise aliases are merged ("bench" = "Bench Press"). Returns totals per exercise and any NEW PERSONAL RECORDS. Re-sending the identical workout within 15 minutes is detected and not saved twice. To fix a mistake, call fitness_delete_workout and log it again.
- `fitness_get_workouts`: Returns logged workouts (newest first) with every set, optionally filtered by date range and/or exercise. Use it to answer "what did I do on…" questions exactly.
- `fitness_delete_workout`: Removes a logged workout (by workout_id from fitness_get_workouts or fitness_log_workout) from history, records and totals. Use it to correct mistakes.
- `fitness_exercise_history`: Session-by-session history for one exercise: every set, top set, volume and estimated 1RM per session, plus the trend across the period.
- `fitness_personal_records`: All-time bests from the log: heaviest working set, best estimated 1RM and most reps, with dates. Optionally for one exercise.
- `fitness_training_summary`: Totals for the last N days: sessions, working sets per muscle group, volume per exercise, training frequency and days since the last workout.
- `fitness_suggest_next`: Deterministic progressive-overload suggestion (double progression) for an exercise, based on the last sessions in the log: add weight when every set hits the top of the rep range, add reps when inside it, repeat or deload after misses. Explains the reason.
- `fitness_list_exercises`: Every exercise the user has logged, with session counts and last date. Use these names when logging so history stays together.
- `fitness_log_body_metrics`: Saves body weight, body-fat % and/or waist measurement for a day, and returns the recent trend.
- `fitness_body_metrics_history`: Body weight / body-fat / waist entries for the last N days with the weekly rate of change.
- `fitness_set_profile`: Stores the facts needed for energy calculations: sex, birth year, height, activity level and goal. Only the fields given are changed.
- `fitness_calc_energy`: BMR (Mifflin–St Jeor), maintenance calories (TDEE), a goal calorie target and protein/fat/carb grams. Uses the stored profile and latest body weight; any argument overrides them.
- `fitness_calc_one_rep_max`: Estimated 1RM from a set (weight × reps) using six standard formulas, plus a table of target weights for 1–12 reps. Pure calculation; nothing is saved.
- `fitness_calc_plates`: Which plates to load on each side of the bar to reach a target weight. Pure calculation; nothing is saved.
