Content
# personal-health-mcp
Obtains body composition data (weight and body fat percentage) from the Tanita Health Planet API and provides it to AI agents such as Claude Desktop as an MCP tool.
## Setup
### 1. Installation
```bash
pip install -e .
```
### 2. Create .env
```bash
cp .env.example .env
```
Edit `.env` to set `HEALTH_PLANET_CLIENT_ID`, `HEALTH_PLANET_CLIENT_SECRET`, and `HEALTH_PLANET_REDIRECT_URI`.
### 3. Initial Authentication
```bash
python -m health_mcp.tanita.auth
```
Open the displayed URL in a browser, click "Allow Access", and then paste the redirect URL to save the token in `.env`.
### 4. Register MCP Server with Claude Desktop
Add the following to `claude_desktop_config.json`. Specify the full path to the Python executable in the venv for `command`.
**Windows:**
```json
{
"mcpServers": {
"personal-health": {
"command": "C:/Users/<username>/path/to/personal-health-mcp/venv/Scripts/python.exe",
"args": ["-m", "health_mcp.server"]
}
}
}
```
**macOS / Linux:**
```json
{
"mcpServers": {
"personal-health": {
"command": "/path/to/personal-health-mcp/venv/bin/python",
"args": ["-m", "health_mcp.server"]
}
}
}
```
> No `cwd` specification is needed. The server automatically resolves the project root based on `__file__`.
## MCP Tool List
| Tool | Description |
|---|---|
| `get_latest_body_composition` | Get the latest weight and body fat percentage (last 30 days) |
| `get_body_composition` | Get body composition data for a specified period (up to 92 days) |
| `get_measurements_range` | Check date range and number of data in cache |
| `get_profile` | Get birthdate, height, and gender |
| `list_available_metrics` | Display list of available metrics |
## Re-acquiring Profile
If profile information is changed in the Tanita app:
```bash
python -m health_mcp.tanita.auth --reset-profile
```
## Development
```bash
pip install -e ".[dev]"
pytest # Test
mypy src # Type check
ruff check src # Lint
```