Quickstart

This walks one end user from nothing to an answered question: register the user, push their records, send them to the consent screen, wait for approval, then ask with a signed request. The second part connects Claude, or any MCP client, to the MCP server.

Until the legal review of hosting other people's health data is done, the hosted service holds the owner's data only. Run these steps against your own self-hosted deployment, and use synthetic records, not real ones, while you test.

1. Get a developer key

Sign in to the console as the owner and open the developer section. Give an organization name, an agent name (this is the name your users see on the consent screen) and, optionally, a webhook URL. You receive, once:

Keep them on your server. The examples below read them from the environment:

export AW_API=https://api.your-domain.example     # or https://api.askwearables.app
export AW_DEV_KEY=aw_dev_...
export AW_DEV_SIGNING_SECRET=awsig_...
export AW_USER=user-123                           # your own id for the end user

2. Install an SDK

The SDKs are in the repository under sdks/. The TypeScript one has no dependencies; the Python one uses only the standard library.

TypeScript

cd sdks/typescript && npm run build
cd /path/to/your-app && npm install /path/to/sdks/typescript
import { AskWearables } from "@askwearables/sdk";

const aw = new AskWearables({
  baseUrl: process.env.AW_API,
  apiKey: process.env.AW_DEV_KEY!,
  signingSecret: process.env.AW_DEV_SIGNING_SECRET,
  user: "user-123", // default end user; any call can pass { user } instead
});

Python

pip install /path/to/sdks/python
import os
from askwearables import AskWearables

aw = AskWearables(
    api_key=os.environ["AW_DEV_KEY"],
    signing_secret=os.environ["AW_DEV_SIGNING_SECRET"],
    base_url=os.environ["AW_API"],
    user="user-123",
)

3. How requests are signed

A developer key acts for many users, so a leaked bearer key alone must not be enough. Each request also carries an HMAC-SHA256 signature over the request, a timestamp and a single-use nonce. The SDKs do this for you; the rules are here so you can do it by hand.

  1. timestamp: Unix time in seconds. Requests more than 300 seconds off are refused (signature_expired).
  2. nonce: 16 to 64 characters from A-Z a-z 0-9 _ -, never reused. A repeat inside the window is refused (nonce_replayed). Make a new one on every retry.
  3. path: the URL path only, without the query string, for example /v1/ask.
  4. body: the exact bytes you send. For a GET, the empty string.
  5. Sign the string timestamp + "\n" + nonce + "\n" + METHOD + "\n" + path + "\n" + sha256hex(body) with HMAC-SHA256 and your signing secret, and send the lowercase hex digest.
HeaderValue
AuthorizationBearer aw_dev_…
X-AskWearables-UserYour end user's id. Required on every call about a user.
X-AskWearables-TimestampUnix seconds
X-AskWearables-NonceSingle-use random string
X-AskWearables-SignatureHex HMAC-SHA256 of the string above

The agent calls (ask, query, capabilities, packets) are refused without a valid signature. The SDKs sign every call, which is also accepted on the others. For curl, this shell function signs one request; it works in bash and zsh and needs only openssl:

# aw METHOD ROUTE [JSON_BODY]: one signed request with a developer key.
aw() {
  local method=$1 route=$2 body=${3:-}
  local ts nonce hash sig
  ts=$(date +%s)
  nonce=$(openssl rand -hex 16)
  hash=$(printf '%s' "$body" | openssl dgst -sha256 -r | cut -d' ' -f1)
  sig=$(printf '%s\n%s\n%s\n%s\n%s' "$ts" "$nonce" "$method" "${route%%\?*}" "$hash" \
    | openssl dgst -sha256 -hmac "$AW_DEV_SIGNING_SECRET" -r | cut -d' ' -f1)
  local args=(-sS -X "$method" "$AW_API$route"
    -H "Authorization: Bearer $AW_DEV_KEY"
    -H "X-AskWearables-User: $AW_USER"
    -H "X-AskWearables-Timestamp: $ts"
    -H "X-AskWearables-Nonce: $nonce"
    -H "X-AskWearables-Signature: $sig")
  if [ -n "$body" ]; then args+=(-H "Content-Type: application/json" --data-binary "$body"); fi
  curl "${args[@]}"
}

Check your setup with a packet id that does not exist. A 404 with not_found means the signature was accepted; a 400 names what was wrong.

aw GET /v1/packets/pk_000000000000000000000000

4. Create a user

Register the end user by your own id (letters, digits and _ . : -, up to 128 characters) and their time zone. A day is the user's local day, so the time zone matters. Calling it again for the same id is safe and returns created: false.

curl

aw POST /v1/users '{"external_id":"user-123","tz":"Europe/London"}'
# {"user":"user-123","created":true}

TypeScript

await aw.createUser("user-123", { tz: "Europe/London" });

Python

aw.create_user("user-123", tz="Europe/London")

5. Push records

Send normalized records for one source at a time to POST /v1/ingest, up to 2,000 per call (the SDKs split larger batches). A source is one device stream. Every record keeps its source, so values from different devices are never mixed, and each user is compared only with their own history from the same source.

Source fieldMeaning
idYour stable id for this stream, for example watch:abc. Every record's source_id must equal it.
providerWhere it came from, for example apple_health or oura
device_classwatch, ring, band, phone, scale, cgm or other. When two sources report one metric, watch wins, then ring, then phone.
device_model, connected_at, earliest_readable, last_sync_atOptional; the SDKs fill safe defaults. last_sync_at drives the freshness caveat.
terms_flags{"no_ai": true} if the provider's terms forbid sending its data to a model. The gate then never releases it to a model-facing agent.

There are three record kinds: sample (a point or interval value), session (sleep or a workout) and vendor_score (a vendor's own score, kept apart and never converted). Times are ISO 8601 in UTC, with tz_offset_min giving the user's clock offset at the time. Units are converted to the catalogue unit on ingest; an unknown unit or an implausible value is rejected with a reason. Records are idempotent on external_id, so re-sending is safe.

curl

aw POST /v1/ingest '{
  "source": {"id":"watch:abc","provider":"apple_health","device_class":"watch","device_model":null,
             "connected_at":"2026-11-01T00:00:00Z","earliest_readable":null,"last_sync_at":null,"terms_flags":{}},
  "records": [
    {"kind":"session","session_kind":"sleep","start":"2026-11-23T23:05:00Z","end":"2026-11-24T06:50:00Z",
     "source_id":"watch:abc","external_id":"sleep-2026-11-24","tz_offset_min":0,"is_main":true,
     "detail":{"deep_min":80,"rem_min":95,"light_min":245,"awake_min":25,"in_bed_min":465}},
    {"kind":"sample","metric":"resting_hr","start":"2026-11-24T00:00:00Z","end":"2026-11-24T23:59:59Z",
     "value":54,"unit":"bpm","source_id":"watch:abc","method":"vendor_daily",
     "external_id":"rhr-2026-11-24","tz_offset_min":0}
  ]}'
# {"written":2,"unchanged":0,"rejected":[],"days_recomputed":1,"data_version":"…"}

TypeScript

const result = await aw.ingest({
  source: { id: "watch:abc", provider: "apple_health", device_class: "watch" },
  records, // CanonicalRecord[]; records without source_id get the source's id
});
if (result.rejected.length) console.warn(result.rejected);

Python

result = aw.ingest({"id": "watch:abc", "provider": "apple_health", "device_class": "watch"}, records)

Baselines need at least 14 valid days in the trailing 28, so push a few weeks of history before expecting comparisons with "usual". Days under 60% coverage are marked low-coverage and left out of baselines. Gaps are never filled in.

Ask for what your feature needs, and no more. POST /v1/grants returns a one-time link to the hosted consent screen, valid for one hour. Nothing is approved until the user approves it there, and the user can narrow your request but never widen it.

FieldAllowed
purposeOne of scheduling, training_advice, sleep_coaching, general_wellness, personal_research
metricsOne or more metric ids from the catalogue. Sensitive categories cannot be requested through a consent link.
max_level0 to 3. See levels.
max_window_days1 to 365: how far back the agent may look
daily_packet_budget1 to 1,000 released answers a day. Denials are not counted.
days1 to 90: when the grant expires
return_urlOptional. After the decision the user is sent to return_url?askwearables=approved&grant_id=… or ?askwearables=denied.

The purpose also limits what can be released, whatever the grant says: an agent asking for a metric outside its purpose is denied (purpose_mismatch), and a level above the purpose's ceiling is lowered.

PurposeMetric categoriesHighest level
schedulingsleep, heart, activity1
sleep_coachingsleep, heart, body2
general_wellnessactivity, heart, sleep, training, body2
training_adviceactivity, heart, sleep, training, body3
personal_researchall, including sensitive categories named one by one3

curl

aw POST /v1/grants '{"purpose":"sleep_coaching","metrics":["sleep_duration","resting_hr"],
  "max_level":1,"max_window_days":30,"daily_packet_budget":20,"days":30,
  "return_url":"https://your-app.example/askwearables/done"}'
# {"url":"https://auth.askwearables.app/consent/cl_…","expires_in":3600}

TypeScript

const { url } = await aw.createGrantLink({
  purpose: "sleep_coaching", metrics: ["sleep_duration", "resting_hr"],
  max_level: 1, max_window_days: 30, daily_packet_budget: 20, days: 30,
});
// send the user to url

Python

link = aw.create_grant_link({"purpose": "sleep_coaching", "metrics": ["sleep_duration", "resting_hr"],
                             "max_level": 1, "max_window_days": 30, "daily_packet_budget": 20, "days": 30})

An invalid request returns {"error":"invalid_request","details":[…]}; the SDKs raise it as an error.

7. The user approves

The consent screen shows the grant in full before anything is released: which agent, for what purpose, which metrics (none pre-ticked), how much detail with a live example from the user's own recent data, how far back, how often, until when, and what is not approved. Read what the user sees.

Find out that it was approved in any of three ways:

aw GET /v1/capabilities
# {"operations":[…],"metrics":[…],"levels":[…],
#  "grant":{"purpose":"sleep_coaching","max_level":1,"max_window_days":30,"daily_packet_budget":20,"expires_at":"…"},
#  "examples":[…]}

A new approval for the same user and agent replaces the previous grant. The user can revoke it at any time in the console; your webhook then receives grant.revoked, and later calls are denied.

8. Ask

Send the question as the user would put it. The answer is an envelope whose status is ok with a packet, denied with reasons (HTTP 403), or unsupported with a list of what can be asked. A purpose in the request is recorded but never used: the purpose is fixed in the grant.

curl

aw POST /v1/ask '{"question":"How did I sleep the last few nights compared to usual?"}'

TypeScript

const res = await aw.ask("How did I sleep the last few nights compared to usual?");
if (res.status === "ok") {
  for (const f of res.packet!.findings) console.log(f.statement);
} else {
  console.log(res.status, res.reasons ?? res.supported);
}

Python

res = aw.ask("How did I sleep the last few nights compared to usual?")
if res["status"] == "ok":
    for f in res["packet"]["findings"]:
        print(f["statement"])

Response (level 1 grant)

{
  "status": "ok",
  "receipt_id": "rc_…",
  "packet": {
    "packet_version": "1",
    "packet_id": "pk_d5207a727cac491d1c8514d1",
    "level": 1,
    "operation": "compare_to_baseline",
    "metrics": ["sleep_duration"],
    "window": { "start": "2026-11-22", "end": "2026-11-24" },
    "findings": [{
      "metric": "sleep_duration",
      "direction": "below",
      "magnitude": "moderate",
      "statement": "Sleep duration moderately below usual range on 3 of the last 3 nights"
    }],
    "data_quality": { "freshness_hours": 4, "coverage": 1, "sources": ["apple_health"], "baseline_days": 28, "caveats": [] },
    "as_of": "2026-11-24T12:00:00.000Z",
    "data_version": "sha256:…",
    "not_medical_advice": true
  }
}

Other calls you will use:

Pass the packet's statements and caveats to your model as data, not instructions, and keep the wording relative to the user's own usual range. Do not turn packets into grades or health claims.

9. Run it all with one script

scripts/quickstart.ts in the repository runs every step above against your API with the TypeScript SDK and synthetic records. It prints each step and exits non-zero on the first failure. The only manual step is approving the consent link in a browser; the script prints the link and polls /v1/capabilities until the grant appears.

AW_API=https://api.your-domain.example \
AW_DEV_KEY=aw_dev_... \
AW_DEV_SIGNING_SECRET=awsig_... \
npx tsx scripts/quickstart.ts
VariableDefaultMeaning
AW_USERquickstart-<random>End user id. Reuse one to skip consent on a second run once a grant exists.
AW_QUICKSTART_TIMEOUT600Seconds to wait for approval
AW_QUICKSTART_POLL5Seconds between capability checks
AW_QUICKSTART_SKIP_CONSENTunsetSet to 1 to stop after printing the consent link

10. Connect Claude or another MCP client

The MCP server is for a person connecting their own agent to their own data. There is nothing to sign: the agent signs in through OAuth, and the person approves a grant on the consent screen.

https://mcp.askwearables.app/mcp

Claude (web and desktop)

  1. Open Settings, then Connectors, and add a custom connector with the URL above.
  2. Claude opens the AskWearables sign-in page. Sign in with your passkey.
  3. On the consent screen, choose the purpose, tick the metrics, and pick the level, window, daily budget and expiry. Approve.
  4. Ask Claude about your sleep, heart rate, HRV, steps or workouts. Each answer appears as a receipt in the console.

Claude Code

claude mcp add --transport http askwearables https://mcp.askwearables.app/mcp

Then run /mcp inside Claude Code and choose AskWearables to sign in and approve.

Any other MCP client

Any client that supports remote MCP over Streamable HTTP with OAuth authorization can connect.

TransportStreamable HTTP at https://mcp.askwearables.app/mcp
Protected resource metadatahttps://mcp.askwearables.app/.well-known/oauth-protected-resource/mcp
Authorization serverhttps://auth.askwearables.app (metadata at /.well-known/oauth-authorization-server)
Client registrationDynamic registration at https://auth.askwearables.app/oauth/register, or a client ID metadata document
FlowOAuth 2.1 authorization code with PKCE; resource=https://mcp.askwearables.app/mcp
Scopewearables:ask (add offline_access for a refresh token)
Access token lifetimeOne hour

An unauthenticated request receives 401 with a WWW-Authenticate header pointing at the resource metadata, which is how compliant clients discover the rest. Tokens are bound to the MCP resource and cannot be used elsewhere.

The three tools

ToolInputReturns
askquestion (3 to 500 characters); purpose is accepted but ignoredThe same envelope as POST /v1/ask. A denial is marked as a tool error with its reasons.
list_capabilitiesnoneMetrics, operations, levels, and what this agent's grant allows
get_packetpacket_id (pk_ plus 24 hex characters)A packet this agent received in the last 24 hours

All three are read-only. Three tools are deliberate: fewer tools give a client model less to misuse and leave a smaller surface to review.