hevy-mcp
Access your Hevy workout data through natural language. Query workout history, exercise details, routines, and track progress.
README
Hevy MCP Server
A Model Context Protocol (MCP) server that provides access to workout data from the Hevy fitness tracking app. This server enables AI assistants to query workout history, exercise details, routines, and other fitness data through natural language conversations.
Features
- Workout History: Retrieve paginated workout history with detailed exercise and set information
- Exercise Templates: Access exercise definitions including muscle groups and exercise types
- Exercise History: Track progress for specific exercises over time with optional date filtering
- Workout Routines: View and analyze planned workout routines
- Comprehensive Error Handling: Clear error messages and robust API error handling
- Async Operations: Built with async/await for efficient I/O operations
- Multiple Transport Modes: Supports both stdio and HTTP/SSE (Server-Sent Events)
- Test Mode: Built-in mock data mode for testing without a real API key
Installation
Using uvx (Recommended)
The easiest way to use this MCP server is with uvx:
uvx hevy-mcp-server
Using pip
pip install hevy-mcp-server
Development Installation
Clone the repository and install in development mode:
git clone <repository-url>
cd hevy-mcp-server
pip install -e ".[dev]"
Configuration
Obtaining a Hevy API Key
- Visit https://hevyapp.com/api-key
- Log in with your Hevy account
- Generate an API key (UUID format)
- Copy the API key for use in configuration
Environment Variables
Create a .env file or set environment variables:
# Required
HEVY_API_KEY=your_api_key_here
# Optional (with defaults)
HEVY_API_BASE_URL=https://api.hevyapp.com
HEVY_REQUEST_TIMEOUT=30
LOG_LEVEL=INFO
See .env.example for a complete configuration template.
Test Mode
For testing without a real API key, use the special TEST_KEY value:
export HEVY_API_KEY="TEST_KEY"
This enables mock data mode, which returns realistic test data without making actual API calls. See README_TEST_MODE.md for details.
MCP Client Configuration
Option 1: stdio Mode (Default)
Add the server to your MCP client configuration (e.g., .kiro/settings/mcp.json):
{
"mcpServers": {
"hevy": {
"command": "uvx",
"args": ["hevy-mcp-server"],
"env": {
"HEVY_API_KEY": "your_api_key_here"
}
}
}
}
For local development:
{
"mcpServers": {
"hevy": {
"command": "python",
"args": ["-m", "hevy_mcp.server"],
"cwd": "/path/to/hevy-mcp-server",
"env": {
"HEVY_API_KEY": "your_api_key_here"
}
}
}
}
Option 2: HTTP/SSE Mode (Server)
Start the HTTP server:
# Start with TEST_KEY (mock data)
python start_http_server.py
# Or with real API key
export HEVY_API_KEY="your_api_key"
python start_http_server.py --port 8000
Then configure your MCP client to connect to the HTTP endpoint:
{
"mcpServers": {
"hevy-http": {
"url": "http://127.0.0.1:8000/sse",
"transport": "sse"
}
}
}
See HTTP_SERVER_GUIDE.md for detailed HTTP server documentation.
Available Tools
The server provides the following MCP tools:
1. get_workout_history
Retrieve paginated workout history.
Parameters:
page(optional, default: 1): Page numberpage_size(optional, default: 10, max: 10): Number of workouts per page
Example:
Get my last 5 workouts
2. get_workout_details
Get detailed information about a specific workout.
Parameters:
workout_id(required): The workout ID
Example:
Show me details for workout abc123
3. get_workout_count
Get the total number of workouts on the account.
Example:
How many workouts have I logged?
4. get_exercise_templates
Retrieve paginated list of exercise templates.
Parameters:
page(optional, default: 1): Page numberpage_size(optional, default: 100, max: 100): Number of templates per page
Example:
Show me available exercises
5. get_exercise_template_details
Get detailed information about a specific exercise template.
Parameters:
exercise_template_id(required): The exercise template ID
Example:
What muscles does exercise xyz789 work?
6. get_exercise_history
Get exercise history for a specific exercise template.
Parameters:
exercise_template_id(required): The exercise template IDstart_date(optional): Start date in ISO 8601 format (e.g., 2025-01-01)end_date(optional): End date in ISO 8601 format
Example:
Show my bench press progress over the last month
7. get_routines
Retrieve paginated list of workout routines.
Parameters:
page(optional, default: 1): Page numberpage_size(optional, default: 10, max: 10): Number of routines per page
Example:
What workout routines do I have?
8. get_routine_details
Get detailed information about a specific routine.
Parameters:
routine_id(required): The routine ID
Example:
Show me the details of my push day routine
Usage Examples
Once configured in your MCP client, you can interact with your Hevy data using natural language:
- "Show me my workout history from last week"
- "What exercises target the chest?"
- "How has my squat weight progressed over the last 3 months?"
- "What's in my leg day routine?"
- "How many total workouts have I completed?"
Development
Running Tests
pytest
Running the Server Locally
python -m hevy_mcp.server
Error Handling
The server provides clear error messages for common issues:
- Authentication errors: Invalid or missing API key
- Not found errors: Invalid workout/exercise/routine IDs
- Validation errors: Invalid parameters or date formats
- Network errors: Connectivity issues with Hevy API
- Rate limiting: API rate limit exceeded
Requirements
- Python 3.10 or higher
- Valid Hevy API key
- Internet connection to access Hevy API
License
[Add your license here]
Contributing
[Add contribution guidelines here]
Support
For issues related to:
- This MCP server: [Add issue tracker link]
- Hevy API: Contact Hevy support at https://hevyapp.com/support
- MCP Protocol: Visit https://modelcontextprotocol.io
Acknowledgments
推荐服务器
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 模型以安全和受控的方式获取实时的网络信息。