Skip to main content
Glama
StefanOOE

mcp-eightsleep

by StefanOOE

mcp-eightsleep

A small, read-only Model Context Protocol server (stdio) for the sleep data of an Eight Sleep mattress cover.

It returns one night as ready-made text - scores, times, stages, HRV, heart and respiratory rate against your own averages, bed and room temperature - so an agent can quote the numbers instead of digging them out of a large JSON document (and mixing them up). Built for a daily morning check-in, next to data from a sports watch.

Unofficial. This project is not affiliated with or endorsed by Eight Sleep. Eight Sleep publishes no developer API; see How it works and use it at your own risk.

Tool

get_night(target_date?, history_days=0)

Parameter

Meaning

target_date

YYYY-MM-DD, the day you woke up ("last night" = today, the default)

history_days

0-13: one short line per earlier night

Example output (made-up numbers):

# Eight Sleep night (woke up Thu 22.10)
Sleep fitness score 78: quality 80, routine 70
In bed 21:40-06:58, asleep 22:05-06:50, fell asleep in 0h15
Sleep 7h45 (your avg 7h20, 7-day 7h30, score 85/100); sleep need 7h30, sleep debt 0h45
Stages: deep 1h30 (19%), REM 1h40 (21%), light 4h35; awake after falling asleep 0h25, 3 wake-ups
HRV 42 ms (your avg 40, 7-day 41, score 80/100)
Heart rate 55 bpm (your avg 56, 7-day 56, score 75/100)
Respiratory rate 14.2/min (your avg 14.5, 7-day 14.4, score 90/100)
Temperature: bed 26.1-28.4 °C, room 19.5-20.3 °C
Snoring 0h12 (3%)
## Nights before (1 with data)
- Tue 20.10: score 70, sleep 7h00, deep 1h20, HRV 39 ms, HR 58 bpm

Times are shown in the time zone of your device (or EIGHTSLEEP_TIMEZONE). A night without data (away, other side of the bed, not processed yet) is named as such, not skipped.

The server cannot change anything: no temperature, alarm, base or away-mode control.

Related MCP server: WHOOP MCP

Setup

Requires Python 3.10+.

git clone https://github.com/StefanOOE/mcp-eightsleep.git
cd mcp-eightsleep
python3 -m venv .venv && .venv/bin/pip install .

Environment variable

Meaning

EIGHTSLEEP_EMAIL, EIGHTSLEEP_PASSWORD

your Eight Sleep login (required)

EIGHTSLEEP_TIMEZONE

optional IANA time zone, default: the one of your device

Accounts that sign in with Apple or Google need a password set in the Eight Sleep app first.

MCP client configuration (e.g. Claude Desktop, Claude Code or any other MCP client):

{
  "mcpServers": {
    "mcp-eightsleep": {
      "command": "/path/to/mcp-eightsleep/.venv/bin/python",
      "args": ["-m", "mcp_eightsleep"],
      "env": {"EIGHTSLEEP_EMAIL": "you@example.com", "EIGHTSLEEP_PASSWORD": "..."}
    }
  }
}

Keep the password out of shared config files - pass it from a secret store or an .env that your MCP client expands.

How it works

  • Login: OAuth password grant against auth-api.8slp.net, with the client id/secret of the Eight Sleep Android app as used by the community Home Assistant integration. The token is kept in memory, renewed before it expires, and once more after a 401.

  • Data: GET client-api.8slp.net/v1/users/{id}/trends (model version v2) for the requested days - one record per night, filed under the day you woke up.

  • Only the Python standard library plus the mcp SDK; no data is stored on disk.

Because the API is private, it can change without notice. Keep the call rate low - one call per check-in is plenty.

Development

.venv/bin/pip install -e '.[dev]'
.venv/bin/python -m pytest -q

The tests use a fake HTTP layer and a fake client - no account or network needed.

License

MIT

Available Tools

1 tool
get_nightA

One night measured by the Eight Sleep mattress, as ready-made text: sleep fitness score, time in bed and asleep, stages, HRV, heart rate and respiratory rate (each with the user's average, 7-day average and score), bed/room temperature. target_date (YYYY-MM-DD) is the day the user WOKE UP - 'last night' = today (default). history_days (0-13) adds one short line per earlier night. Quote the numbers as they are.

ParametersJSON Schema
NameRequiredDescriptionDefault
target_dateNo
history_daysNo

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A4.3/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the behavioral burden and does well: it discloses the returned metrics, the ready-made text format, the meaning of target_date, and the additive behavior of history_days. It does not explicitly state read-only/no-side-effect behavior or describe missing-data handling, but the read-oriented nature is strongly implied by 'get' and 'measured'.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is dense but well structured: it front-loads what data is returned, then explains date semantics, history behavior, and the instruction to quote numbers as-is. Every sentence adds useful information, with no filler.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a two-parameter read tool with an output schema, the description is largely complete: it covers the returned metrics, both parameters, defaults, and history behavior. Minor gaps remain around no-data cases and timezone assumptions, but nothing critical to correct invocation is missing.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must compensate, and it does: target_date is explained as YYYY-MM-DD for the wake-up day with 'last night' as today's default, and history_days is constrained to 0-13 with per-night line behavior. This adds substantial meaning beyond the bare schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly identifies the resource and contents: one night of Eight Sleep mattress data returned as ready-made text, including sleep score, stages, HRV, heart rate, respiratory rate, and temperatures. It lacks an explicit retrieval verb, but the intended purpose is still easy to infer. There are no sibling tools to differentiate from.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

It gives concrete usage guidance for both parameters: target_date is the wake-up day and defaults to today for last night, while history_days adds earlier-night lines. It does not provide explicit when-not-to-use guidance or alternatives, but no alternatives are present and the key interpretation rules are covered.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 1 tool updatev0.1.0
    • First observedget_night

TDQS

A4.2/5.0

Scored across 1 tool

Disambiguation5/5

There is only one tool, so there is nothing to confuse it with. Its purpose (retrieve one night's sleep report for a given wake-up date) is unmistakable from the description.

Naming Consistency5/5

Single tool uses a clear snake_case verb_noun name (get_night) with no competing conventions to clash with. Nothing inconsistent within the set.

Tool Count3/5

A single tool is on the thin side for a server surface, though it is well-scoped and parameterized (target_date, history_days) to cover the main query. The rubric treats 1-2 tools as borderline.

Completeness3/5

The nightly sleep report is thorough (score, stages, HRV, HR, respiratory rate, temperatures, short history), but the surface is read-only and limited to 14 days, with no access to other Eight Sleep capabilities like alarms, temperature control, or long-term trends.

Maintenance

ActivityMaintained
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    D
    maintenance
    Enables AI assistants to analyze sleep quality, compare nights, generate reports, and get personalized improvement tips using Sleepon sleep tracker data.
    MIT
  • F
    license
    Not graded
    quality
    A
    maintenance
    Enables users to query recovery, sleep, HRV, strain, workouts, and personal health analytics in natural language through supported AI assistants, using read-only tools for daily status, baselines, trends, and period comparisons.
    4 npm
    -
  • A
    license
    Not graded
    quality
    A
    maintenance
    Enables read-only access to WHOOP recovery, sleep, HRV, strain, workout, and personal health analytics from AI assistants such as Claude, Codex, and GitHub Copilot. Users can ask natural-language questions about trends, baselines, sleep debt, training load, and race readiness without exporting their data.
    4 npm
    MIT