mcp-eightsleep
Summary: This read-only MCP server lets you retrieve a formatted summary of an Eight Sleep mattress night’s sleep data.
Get one night’s sleep report for the day you woke up, using optional
target_date(YYYY-MM-DD; default is today).View sleep fitness score and component scores, in-bed/asleep times, sleep duration, sleep need/debt, and sleep stages.
View HRV, heart rate, respiratory rate, and bed/room temperature, including personal and 7-day averages where available.
Add up to 13 earlier nights with
history_daysfor short historical context.Receive ready-to-quote text rather than raw JSON.
It cannot change anything: no temperature, alarm, base, or away-mode control.
Provides read-only access to Eight Sleep mattress-cover sleep data, returning nightly sleep scores, sleep and wake times, sleep stages, HRV, heart rate, respiratory rate, bed/room temperatures, snoring, and optional historical summaries for morning check-ins. It does not support changing device settings such as temperature, alarms, base, or away mode.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@mcp-eightsleep how did I sleep last night?"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
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 |
|
|
|
|
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 bpmTimes 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 or newer (the CI runs 3.10 and 3.14).
git clone https://github.com/StefanOOEOrg/mcp-eightsleep.git
cd mcp-eightsleep
cp .env.template .env # fill in EIGHTSLEEP_EMAIL / EIGHTSLEEP_PASSWORD
python3 -m venv .venv && .venv/bin/pip install .Environment variable | Meaning |
| your Eight Sleep login (required) |
| 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 a401.Data:
GET client-api.8slp.net/v1/users/{id}/trends(model versionv2) for the requested days - one record per night, filed under the day you woke up.Only the Python standard library plus the
mcpSDK; 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.
Project structure
mcp-eightsleep/
├── src/mcp_eightsleep/
│ ├── __init__.py
│ ├── __main__.py # python -m mcp_eightsleep
│ ├── client.py # login, token renewal, profile, per-night trends
│ ├── config.py # EIGHTSLEEP_* from the environment
│ ├── night.py # one night as pre-formatted lines
│ └── server.py # the MCP tool get_night + main()
├── tests/
│ ├── test_client.py # login once, renewal after 401, time zone order
│ ├── test_night.py # formatting, history, ToolError paths
│ └── test_server.py # start without credentials: one hint, still runs
├── .github/workflows/ci.yml # pytest + ruff on 3.10 and 3.14
├── .env.template # copy to .env, fill in the login
├── CHANGELOG.md
├── LICENSE
├── pyproject.toml
└── README.mdDevelopment
.venv/bin/pip install -e '.[dev]'
.venv/bin/python -m pytest -q
.venv/bin/python -m ruff check src tests # lint gate, must stay cleanThe tests use a fake HTTP layer and a fake client - no account or network needed.
Scope / Limitations
A single-user tool, not a service: it runs locally over stdio - no network port, no authentication, no multi-user support.
Read-only by design: it reads scores and metrics, nothing can be changed (no temperature, alarm, base or away-mode control).
It talks to the private Eight Sleep app API through reverse-engineered endpoints (see How it works); that API can change or break at any time.
Credentials are stored in plain text in your client config or
.env- keep them out of shared files and out of logs.Accounts that sign in with Apple or Google need a password set in the Eight Sleep app first.
EIGHTSLEEP_TIMEZONEis only needed when the account reports no device time zone; the fallback then isUTC.
License
Available Tools
1 toolget_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.
Inputs: target_date, history_days. Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 1 tool
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.
Single tool uses a clear snake_case verb_noun name (get_night) with no competing conventions to clash with. Nothing inconsistent within the set.
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.
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
Related MCP Connectors
Read-only health data: sleep, HRV recovery, macros, micros, workouts, lift trends, and plans.
Your WHOOP data in the assistant, read-only: recovery, sleep, strain, workouts, cycles and body meas
Ask your AI about your Airbnb and VRBO listings, bookings, guest messages and reviews. Read-only.
Read-only Apple Health data synced from your iPhone: sleep, heart rate, HRV, workouts and trends.
Related MCP Servers
AlicenseNot gradedqualityDmaintenanceEnables AI assistants to analyze sleep quality, compare nights, generate reports, and get personalized improvement tips using Sleepon sleep tracker data.MIT- AlicenseNot gradedqualityCmaintenanceGives LLM agents read-only access to your WHOOP data — recovery, sleep, strain, workouts, and profile.MIT
- FlicenseNot gradedqualityAmaintenanceEnables 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.14 npm-
- AlicenseBqualityBmaintenanceEnables private conversations about recovery, sleep, and recorded training by exposing official API data to MCP assistants, including period comparisons and daily evidence with explicit units and missing values.15MIT