Metadata-Version: 2.5
Name: polar-mcp
Version: 0.5.0
Summary: MCP server for the Polar AccessLink API: let Claude (or any MCP client) read your Polar workouts, sleep, Nightly Recharge, HRV and daily activity.
Project-URL: Homepage, https://github.com/kayaman/polar-mcp
Project-URL: Repository, https://github.com/kayaman/polar-mcp
Project-URL: Issues, https://github.com/kayaman/polar-mcp/issues
Project-URL: Changelog, https://github.com/kayaman/polar-mcp/blob/main/CHANGELOG.md
Author: Marco Antonio Gonzalez Junior
License-Expression: MIT
License-File: LICENSE
Keywords: accesslink,claude,fitness,hrv,mcp,model-context-protocol,polar,sleep,wearables
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Intended Audience :: End Users/Desktop
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Utilities
Classifier: Typing :: Typed
Requires-Python: >=3.11
Requires-Dist: httpx>=0.27
Requires-Dist: mcp<2,>=1.10
Description-Content-Type: text/markdown

# polar-mcp

[![PyPI](https://img.shields.io/pypi/v/polar-mcp)](https://pypi.org/project/polar-mcp/)
[![CI](https://github.com/kayaman/polar-mcp/actions/workflows/ci.yml/badge.svg)](https://github.com/kayaman/polar-mcp/actions/workflows/ci.yml)
[![License: MIT](https://img.shields.io/badge/license-MIT-blue)](LICENSE)

An [MCP](https://modelcontextprotocol.io) server that lets Claude, or any MCP client,
read your **Polar** watch data through the
[Polar AccessLink API](https://www.polar.com/accesslink-api/): workouts, sleep, Nightly
Recharge and HRV, cardio load, daily activity and 24/7 heart rate.

> Ask *"How did I sleep this week?"*, *"Am I recovered enough for intervals today?"* or
> *"Compare my training load to last month"*. The first time, Polar Flow opens in your
> browser; click **Approve** and you're linked.

Read-only. Unofficial: not affiliated with or endorsed by Polar Electro Oy.

<!-- mcp-name: io.github.kayaman/polar-mcp -->

## 1. Create your Polar API client (once, ~2 minutes)

Polar requires every app to have its own API client, so you create one for yourself:

1. Sign in at [admin.polaraccesslink.com](https://admin.polaraccesslink.com) with your
   Polar Flow account and create a client.
2. Set its **redirect URL** to exactly `http://localhost:8765/callback`.
3. Keep the **client ID** and **client secret** at hand for the next step.

## 2. Install

### Claude Desktop or Claude Code: plugin (recommended)

Add this repository as a plugin marketplace and install `polar`. In Claude Code:

```
/plugin marketplace add kayaman/polar-mcp
/plugin install polar --marketplace kayaman/polar-mcp
```

In Claude Desktop, add the `kayaman/polar-mcp` marketplace under **Settings → Plugins**,
or upload `polar-plugin.zip` from the [latest release](https://github.com/kayaman/polar-mcp/releases/latest).
Enter your client ID and secret when the plugin asks for them. If it doesn't, run
`uvx polar-mcp setup` once in a terminal. The plugin needs [uv](https://docs.astral.sh/uv/)
and runs on macOS and Linux; on Windows use the extension below.

### Claude Desktop: extension

Download `polar-mcp.mcpb` from the [latest release](https://github.com/kayaman/polar-mcp/releases/latest),
open it with Claude Desktop (**Settings → Extensions**), and enter your client ID and secret.

### Claude Code, or any MCP client

```sh
uvx polar-mcp setup                      # saves your client ID/secret, then links your account
claude mcp add polar -s user -- uvx polar-mcp
```

Other clients: run `uvx polar-mcp` as a stdio server. Credentials can also come from the
`POLAR_CLIENT_ID` and `POLAR_CLIENT_SECRET` environment variables.

## 3. Use it

Just ask. When a tool needs your account and it isn't linked yet (or the token, which
lasts about a year, has expired), Polar Flow opens in your browser. Approve, the tab
says *"Polar linked"*, and Claude carries on. If you take longer than ~45 seconds,
Claude asks you to try again; the link is saved in the background either way.

Polar only serves recent data, and this server keeps no copy of it:

| Data | Tools | How far back |
|---|---|---|
| Workouts | `polar_list_exercises`, `polar_get_exercise`, `polar_export_exercise` | 30 days, **uploaded after you linked** |
| Sleep | `polar_list_sleep`, `polar_get_sleep` | 28 nights |
| Nightly Recharge (HRV, overnight HR, breathing) | `polar_list_nightly_recharge`, `polar_get_nightly_recharge` | 28 days |
| Cardio load (strain, tolerance) | `polar_list_cardio_load` | 28 days |
| SleepWise (alertness, bedtime) | `polar_sleepwise_alertness`, `polar_sleepwise_circadian_bedtime` | 28 days |
| Daily activity (steps, calories, active time) | `polar_list_activities` | up to 365 days, any range |
| 24/7 heart rate | `polar_get_continuous_hr` (per-day summary or raw) | per date |
| Profile | `polar_get_user` | |

`polar_login_start` and `polar_login_finish` exist for re-linking on request, and for
the case where your client's redirect URL isn't on localhost. Then you paste the
address the browser ends on into the chat.

## Command line

```
polar-mcp            run the MCP server on stdio (what MCP clients launch)
polar-mcp setup      save your client ID/secret, then link your account
polar-mcp login      link or re-link in the browser (--redirected URL to finish by hand)
polar-mcp status     what's configured, whether you're linked, token expiry
polar-mcp logout     forget the token (keeps the client credentials)
```

## Privacy

- Data flows only between your machine and Polar. There's no server in between and no
  telemetry.
- Your client secret and Polar token are stored in `~/.config/polar-mcp/.env`, readable
  only by you. Workouts you export go to `~/Downloads/polar` (override with
  `POLAR_EXPORT_DIR`).
- What you ask about is sent to your AI client's model provider as part of the
  conversation, like any other tool result.

See [SECURITY.md](SECURITY.md) for details and how to report a vulnerability.

## Configuration

| Variable | Default | |
|---|---|---|
| `POLAR_CLIENT_ID`, `POLAR_CLIENT_SECRET` | from plugin settings or the env file | your API client |
| `POLAR_REDIRECT_PORT` | `8765` | must match the client's redirect URL |
| `POLAR_REDIRECT_URI` | unset | pin the redirect URI; unset lets Polar use the registered one |
| `POLAR_ENV_FILE` | `~/.config/polar-mcp/.env` | where credentials and the token live |
| `POLAR_EXPORT_DIR` | `~/Downloads/polar` | where exported workouts go |

## Development

See [CONTRIBUTING.md](CONTRIBUTING.md). Polar and AccessLink are trademarks of Polar
Electro Oy. Licensed under [MIT](LICENSE).
