eufylife-mcp
README.md
# eufylife-mcp
An MCP (Model Context Protocol) server for EufyLife smart scale body composition data. Exposes your weight, BMI, body fat, muscle mass, and 20+ other measurements as tools that AI assistants can use.
Built by reverse-engineering the EufyLife cloud API, based on the work done by [@m4ary](https://github.com/m4ary) in [eufylife-api-hacs](https://github.com/m4ary/eufylife-api-hacs).
## Features
- Authenticate with your EufyLife cloud account
- Retrieve latest and historical body composition measurements
- Multi-user support — list family member profiles sharing the same scale
- List connected devices and their configuration
- 20+ body composition measurements (weight, BMI, body fat, muscle mass, bone mass, BMR, body age, water percentage, protein ratio, visceral fat, and more)
- Auto-login via environment variables
- Token auto-refresh (tokens valid ~30 days)
## Prerequisites
- [Bun](https://bun.sh) runtime (v1.0+)
- A EufyLife account with a connected smart scale
## Installation
### From npm (recommended)
```bash
bunx eufylife-mcp
```
### From source
```bash
git clone https://github.com/MatthewHallCom/eufylife-mcp.git
cd eufylife-mcp
bun install
bun run src/index.ts
```
## Configuration
### Environment Variables
| Variable | Description |
|---|---|
| `EUFYLIFE_EMAIL` | Your EufyLife account email |
| `EUFYLIFE_PASSWORD` | Your EufyLife account password |
When both are set, the server auto-authenticates on startup. Alternatively, use the `login` tool at runtime.
### Claude Code
Add to your project's `.mcp.json` file:
```json
{
"mcpServers": {
"eufylife": {
"command": "bunx",
"args": ["eufylife-mcp"],
"env": {
"EUFYLIFE_EMAIL": "your@email.com",
"EUFYLIFE_PASSWORD": "your-password"
}
}
}
}
```
Or add to `.claude/settings.local.json`:
```json
{
"mcpServers": {
"eufylife": {
"command": "bun",
"args": ["run", "src/index.ts"],
"cwd": "/path/to/eufylife-mcp",
"env": {
"EUFYLIFE_EMAIL": "your@email.com",
"EUFYLIFE_PASSWORD": "your-password"
}
}
}
}
```
### Other MCP Clients
This server uses stdio transport and works with any MCP-compatible client. Point your client at:
```bash
bunx eufylife-mcp
```
Set `EUFYLIFE_EMAIL` and `EUFYLIFE_PASSWORD` as environment variables.
## Available Tools
### `login`
Authenticate with EufyLife cloud.
| Parameter | Type | Required | Description |
|---|---|---|---|
| `email` | string | yes | EufyLife account email |
| `password` | string | yes | EufyLife account password |
Returns user ID, customer profiles, and connected devices.
### `get_measurements`
Get the most recent body composition measurement for each user/family member.
| Parameter | Type | Required | Description |
|---|---|---|---|
| `customer_id` | string | no | Filter by specific customer/family member |
### `get_measurement_history`
Get historical measurements since a given date.
| Parameter | Type | Required | Description |
|---|---|---|---|
| `since` | string | no | ISO 8601 date (e.g. `2024-01-01`) |
| `customer_id` | string | no | Filter by specific customer/family member |
Returns all measurements after the given date. Omit `since` to get full history.
### `list_users`
List all customer/family member profiles associated with the account. Returns name, sex, height, birthday, target weight, and member type for each user. No parameters.
### `get_device_info`
List all connected EufyLife devices with model info, product code, BLE MAC, weight unit setting, and room assignment. No parameters.
## Available Resources
| URI | Description |
|---|---|
| `eufylife://users` | JSON list of customer/family member profiles |
| `eufylife://measurements/{customer_id}` | Latest measurements for a specific customer |
## Supported Measurements
All measurements from the EufyLife smart scale `scale_data` response:
| Measurement | Unit | Field |
|---|---|---|
| Weight | kg | `weight_kg` |
| BMI | kg/m² | `bmi` |
| Body Fat | % | `body_fat_pct` |
| Subcutaneous Fat Rate | % | `subcutaneous_fat_rate_pct` |
| Visceral Fat Index | index | `visceral_fat_index` |
| Muscle | % | `muscle_pct` |
| Muscle Mass | kg | `muscle_mass_kg` |
| Skeletal Muscle Mass | kg | `skeletal_muscle_mass_kg` |
| BMR (Basal Metabolic Rate) | kcal/day | `bmr_kcal` |
| Bone | kg | `bone_kg` |
| Bone Mass | kg | `bone_mass_kg` |
| Water | % | `water_pct` |
| Body Age | years | `body_age_years` |
| Protein Ratio | % | `protein_ratio_pct` |
| Visceral Fat | level | `visceral_fat_level` |
| Fat Free Weight | kg | `fat_free_weight_kg` |
| Body Fat Mass | kg | `body_fat_mass_kg` |
| Heart Rate | bpm | `heart_rate_bpm` |
| Body Type | type | `body_type` |
| Height | cm | `height_cm` |
Not all scales report every measurement. Fields that are unavailable or zero from the API are returned as `null`.
## Supported Devices
This server works with EufyLife smart scales that use the EufyLife cloud API, including:
| Model | Product Code |
|---|---|
| Smart Scale P1 | T9147 |
| Smart Scale P2 Pro | T9149 |
| Smart Scale P3 | T9150 |
| Smart Scale C1 | T9146 |
| Smart Scale A1 | T9960 |
| Smart Scale | T9140 |
Other EufyLife/Anker smart scales that sync to the EufyLife app should also work.
## Local Development
```bash
# Install dependencies
bun install
# Run the server
bun run src/index.ts
# Type check
bun x tsc --noEmit
# Explore the raw API (requires .env with credentials)
bun run scripts/explore-api.ts
```
## How It Works
This server communicates with the undocumented EufyLife cloud API (`api.eufylife.com`) used by the official EufyLife iOS/Android app. The API interaction patterns were derived from the [eufylife-api-hacs](https://github.com/m4ary/eufylife-api-hacs) Home Assistant integration.
Key API endpoints:
- `POST /v1/user/v2/email/login` — authenticate and get user/device/customer data
- `GET /v1/device/data` — fetch scale measurements (supports `?after={timestamp}` for incremental)
- `GET /v1/customer/target/{id}` — fetch per-customer target weight and goals
## Limitations
- **Unofficial API** — Uses the undocumented EufyLife cloud API. It may break if EufyLife changes their API.
- **Cloud-only** — Requires internet access to fetch data from EufyLife servers. No local/BLE support.
- **Read-only** — This server only reads data. It cannot modify settings, delete measurements, or control devices.
- **Token expiry** — Tokens are valid for ~30 days. The server auto-refreshes when credentials are stored.
## Credits
- [eufylife-api-hacs](https://github.com/m4ary/eufylife-api-hacs) by [@m4ary](https://github.com/m4ary) — the Home Assistant integration that this project's API implementation is based on.
- [Model Context Protocol](https://modelcontextprotocol.io/) — the protocol that enables AI assistants to use this server.
## License
MIT
This server cannot be deployed
Maintenance
ActivityInactive
ResponsivenessNo issues