# Connect Dravia to this agent

The person you are talking to wants to use their Dravia account (fitness app: workouts, diet, water, weight, diary, reminders, gym occupancy; professionals also see their students) from this conversation. Follow these steps. Talk to the person in their own language; the commands below are for you.

## 1. See whether Dravia is already connected

If an MCP server named `dravia` is already configured and its tools (`get_overview`, `log_water`, ...) are available, skip to step 3.

## 2. Connect

Dravia is a remote MCP server (Streamable HTTP) at `https://dravia.ai/mcp`. It supports OAuth 2.1 with dynamic client registration, so most runtimes connect by just adding the URL; the person signs in and authorizes in the browser. Pick what your runtime supports:

**A. Your runtime supports remote MCP servers with OAuth (preferred)**

- Claude Code: `claude mcp add --transport http dravia https://dravia.ai/mcp` — then run `/mcp` and choose "dravia" to authenticate.
- Codex CLI: `codex mcp add dravia --url https://dravia.ai/mcp` — then `codex mcp login dravia`.
- Claude.ai, ChatGPT, Mistral and other chat apps: Settings → Connectors (or Integrations) → add a custom connector/MCP server with the URL `https://dravia.ai/mcp`.
- Cursor, Windsurf, VS Code, Gemini CLI, OpenClaw and others: add to the MCP configuration file:

```json
{ "mcpServers": { "dravia": { "url": "https://dravia.ai/mcp" } } }
```

The runtime opens `https://dravia.ai/agent`; the person signs in to Dravia and clicks Authorize.

**B. Your runtime cannot do OAuth, but can send a header**

Ask the person to open `https://dravia.ai/agent`, sign in, click **Authorize** and copy the connection code (it starts with `drv_`). Treat the code as a password: never print it back, never store it anywhere but the MCP configuration. Then:

- Claude Code: `claude mcp add --transport http dravia https://dravia.ai/mcp --header "Authorization: Bearer <code>"`
- Codex CLI: `export DRAVIA_TOKEN=<code>` and `codex mcp add dravia --url https://dravia.ai/mcp --bearer-token-env-var DRAVIA_TOKEN`
- JSON configuration:

```json
{ "mcpServers": { "dravia": { "url": "https://dravia.ai/mcp", "headers": { "Authorization": "Bearer <code>" } } } }
```

- If headers are impossible, the same code can go in the URL: `https://dravia.ai/mcp/<code>`.

**C. No MCP support at all**

With a connection code you can call the server directly over HTTP. Every call is one JSON-RPC 2.0 message:

```bash
curl -s https://dravia.ai/mcp -H "Authorization: Bearer <code>" -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}'
curl -s https://dravia.ai/mcp -H "Authorization: Bearer <code>" -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"log_water","arguments":{"amount_ml":300}}}'
```

## 3. Use it

- Start with `get_overview` to learn the person's day, plan and timezone, then answer naturally: no ids, field names or JSON in your replies unless asked.
- Logging: `log_water`, `log_weight`, `log_meal` (free text — Dravia's AI estimates calories), `add_diary_entry`, `set_exercise_load` (load and/or the reps actually done per set, kept apart from the prescribed reps), `update_exercise` (rename, note, sets, load, reps, rest), `add_exercise`, `remove_exercise`, `rename_workout`, `complete_workout`, `log_workout`, `log_cardio` (run, walk, ride or treadmill: distance and time, calories estimated).
- Building plans: `create_workout_plan`, `add_workout`, `remove_workout`, `set_active_workout_plan`, `create_diet_plan`, `add_diet_meal`, `remove_diet_meal`, `set_active_diet_plan` (structure them yourself, or pass the person's own text as `description`).
- Reading: `get_water`, `get_weight`, `get_meals`, `get_workout_plan` (next workout and loads), `get_workout`, `get_workout_history`, `get_gyms` (how busy their gyms are now), `get_diary`, `get_reminders`, `get_diet_plan`, `get_account`.
- Diary notes: `add_diary_entry` accepts `color` (red, yellow, green, pink, cyan, blue, purple, white; defaults to white). `get_diary` returns each note's id and color. `update_diary_entry` edits the text and/or color of that note, preserving its original day, time and any linked goal. Goal-only records are not editable with this tool.
- Professionals (Trainer / Nutrition / Full plans) also get `pro_overview`, `pro_list_students`, `pro_student_summary`, `pro_payments`, `pro_mark_payment_paid`, and the agenda: `pro_agenda` (bookings by date), `pro_schedule` (book a one-off or recurring class/appointment with a student or anyone by name) and `pro_cancel_appointment` (one date, from a date on, or the whole series). Anyone can ask `get_appointments` for the classes their professionals booked.
- The app day rolls over at 03:00 in the person's timezone. Dates are YYYY-MM-DD ("yesterday" is accepted too); send times as HH:MM local time; loads and weights are in kilograms.
- When a tool answers that the Plus plan is required, relay that message as is and do not retry.

Full reference: https://dravia.ai/
