WHOOP MCP Server
Enables LLMs to retrieve and analyze sleep, recovery, and physiological cycle data from the WHOOP API. It provides tools for accessing detailed metrics such as strain, HRV, and readiness scores through secure OAuth 2.0 authentication.
README
WHOOP MCP Server
A Model Context Protocol (MCP) server that provides tools for interacting with the WHOOP API. This server enables LLMs to retrieve sleep, recovery, and physiological cycle data from WHOOP.
Features
- 🔐 OAuth 2.0 Authentication with automatic token refresh
- 😴 Sleep Data: Retrieve detailed sleep metrics by ID or cycle
- 🔄 Cycle Data: Access physiological cycles with strain and heart rate data
- 💪 Recovery Data: Get recovery scores, HRV, and readiness metrics
- 🚀 Built with xmcp: Fast, type-safe MCP implementation
Prerequisites
- Node.js 20 or higher
- A WHOOP account
- WHOOP API credentials (Client ID and Secret)
Getting WHOOP API Credentials
- Visit the WHOOP Developer Dashboard
- Create a new OAuth application
- Set the redirect URI to:
http://localhost:3000/auth/whoop/callback - Note your Client ID and Client Secret
Installation
# Clone the repository
git clone https://github.com/yourusername/whoop-mcp.git
cd whoop-mcp
# Install dependencies
pnpm install
# or npm install
# Build the project
pnpm build
# or npm run build
Configuration
- Copy the environment template:
cp .env.example .env
- Add your WHOOP credentials to
.env:
WHOOP_CLIENT_ID=your_client_id_here
WHOOP_CLIENT_SECRET=your_client_secret_here
Authentication
Before using the MCP server, you need to authenticate with WHOOP:
pnpm auth
This will:
- Open a browser window for WHOOP OAuth login
- Save your access and refresh tokens locally
- Automatically refresh tokens when they expire
Usage
Using with Claude Desktop - STDIO Mode (Recommended)
STDIO mode is recommended for better performance and reliability.
- Get the full path to your installation:
pwd # Copy this path, e.g., /Users/yourname/projects/whoop-mcp
- Add the server to your Claude Desktop configuration (
~/Library/Application Support/Claude/claude_desktop_config.json):
{
"mcpServers": {
"whoop": {
"command": "node",
"args": ["/Users/yourname/projects/whoop-mcp/dist/stdio.js"],
"env": {
"WHOOP_CLIENT_ID": "your-client-id",
"WHOOP_CLIENT_SECRET": "your-client-secret"
}
}
}
}
Replace /Users/yourname/projects/whoop-mcp with your actual installation path.
Using via HTTP Mode
For HTTP mode, start the server:
pnpm start
# or
node dist/http.js
The server will run on http://localhost:3002/mcp
For Claude Desktop HTTP configuration:
{
"mcpServers": {
"whoop": {
"url": "http://localhost:3002/mcp"
}
}
}
Important: When using STDIO mode with Claude Desktop, you MUST include the env section with your WHOOP credentials, as shown above. The server cannot read your .env file when launched by Claude Desktop.
See xmcp HTTP transport documentation for more details.
Development Mode
pnpm dev
Available Tools
get-recent-cycles
Retrieves recent physiological cycles (days) with strain and heart rate data.
Parameters:
limit(number, optional): Number of cycles to retrieve (1-25, default: 10)days(number, optional): Number of days to look back (1-30)
Example:
Get my last 7 days of WHOOP cycles
get-sleep-by-id
Gets detailed sleep data for a specific sleep ID.
Parameters:
sleepId(string): UUID of the sleep activity
Example:
Get sleep data for ID ecfc6a15-4661-442f-a9a4-f160dd7afae8
get-sleep-for-cycle
Retrieves sleep data associated with a specific cycle.
Parameters:
cycleId(number): ID of the cycle
Example:
Get sleep data for cycle 12345
get-recovery-for-cycle
Gets recovery metrics for a specific cycle, including HRV and readiness scores.
Parameters:
cycleId(number): ID of the cycle
Example:
Get recovery data for cycle 12345
Data Interpretation
Recovery Scores
- Green (67-100%): Ready for high strain
- Yellow (34-66%): Moderate readiness
- Red (0-33%): Focus on recovery
Strain Scale
- WHOOP Strain is measured on a scale from 0 to 21
- Higher values indicate greater cardiovascular load
Project Structure
whoop-mcp/
├── src/
│ ├── api/ # WHOOP API client and types
│ ├── auth/ # Authentication and token management
│ └── tools/ # MCP tool implementations
├── scripts/
│ ├── auth.ts # OAuth authentication script
│ └── refresh-token.ts # Manual token refresh
└── dist/ # Compiled output
Token Management
- Tokens are stored in
.whoop-tokens.jsonin the project root - Access tokens expire after 1 hour
- Refresh tokens are automatically used to obtain new access tokens
- Run
pnpm refresh-tokento manually refresh tokens
Troubleshooting
"Not authenticated" error
Run pnpm auth to authenticate with WHOOP.
"Resource not found" error
Ensure your WHOOP app has the required scopes:
read:cyclesread:sleepread:recoveryread:profileoffline(for refresh tokens)
Rate limiting
WHOOP API has rate limits. If you encounter 429 errors, wait before making more requests.
Development
# Build the project
pnpm build
# Run in development mode
pnpm dev
# Manually refresh tokens
pnpm refresh-token
Security Notes
- Never commit
.envor.whoop-tokens.jsonfiles - Keep your Client Secret secure
- Tokens are stored in the project root as
.whoop-tokens.json - Tokens are never transmitted except to WHOOP
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
MIT - See LICENSE file for details
Acknowledgments
- Built with xmcp - Fast MCP implementation
- Uses the WHOOP API v2
Additional Resources
Support
For WHOOP API issues, visit the WHOOP Developer Documentation.
For MCP-related questions, see the Model Context Protocol documentation.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。