
Hevy Fitness
STDIOMCP server for accessing and managing Hevy fitness data through API integration.
MCP server for accessing and managing Hevy fitness data through API integration.
A Model Context Protocol (MCP) server implementation that interfaces with the Hevy fitness tracking app and its API. This server enables AI assistants to access and manage workout data, routines, exercise templates, and more through the Hevy API (requires PRO subscription).
To install hevy-mcp for Claude Desktop automatically via Smithery:
npx -y @smithery/cli install @chrisdoc/hevy-mcp --client claude
# Clone the repository git clone https://github.com/chrisdoc/hevy-mcp.git cd hevy-mcp # Install dependencies npm install # Create .env file from sample cp .env.sample .env # Edit .env and add your Hevy API key
To use this MCP server with Cursor, you need to update your ~/.cursor/mcp.json
file by adding the following configuration:
{ "hevy-mcp-server": { "command": "npx", "args": ["-y", "hevy-mcp"], "env": { "HEVY_API_KEY": "your-api-key-here" } } }
Make sure to replace your-api-key-here
with your actual Hevy API key.
Create a .env
file in the project root (you can copy from .env.sample) with the following content:
HEVY_API_KEY=your_hevy_api_key_here
Replace your_hevy_api_key_here
with your actual Hevy API key.
The MCP server supports two transport modes:
The default mode uses stdio transport, which is suitable for integration with MCP clients like Claude Desktop and Cursor:
npm start # or node dist/index.js
The server can also run in HTTP mode for remote access or web-based integrations:
# Start in HTTP mode npm start -- --http # or node dist/index.js --http # Using environment variable MCP_TRANSPORT=http npm start
The HTTP transport can be configured using environment variables:
# Transport mode MCP_TRANSPORT=http # HTTP server configuration MCP_HTTP_HOST=127.0.0.1 MCP_HTTP_PORT=3000 # DNS rebinding protection (recommended for production) MCP_DNS_REBINDING_PROTECTION=true MCP_ALLOWED_HOSTS=127.0.0.1,localhost
When running in HTTP mode, the following endpoints are available:
POST /mcp
- MCP client-to-server communicationGET /mcp
- Server-to-client notifications (SSE)DELETE /mcp
- Session terminationGET /health
- Health check endpointThe HTTP transport includes session management for stateful connections. Each client session is identified by a unique session ID that must be included in the mcp-session-id
header for subsequent requests.
npm run dev
This starts the MCP server in development mode with hot reloading.
npm run build npm start
The server implements the following MCP tools for interacting with the Hevy API:
get-workouts
: Fetch and format workout dataget-workout
: Get a single workout by IDcreate-workout
: Create a new workoutupdate-workout
: Update an existing workoutget-workout-count
: Get the total count of workoutsget-workout-events
: Get workout update/delete eventsget-routines
: Fetch and format routine datacreate-routine
: Create a new routineupdate-routine
: Update an existing routineget-routine-by-id
: Get a single routine by ID using direct endpointget-exercise-templates
: Fetch exercise templatesget-exercise-template
: Get a template by IDget-routine-folders
: Fetch routine folderscreate-routine-folder
: Create a new folderget-routine-folder
: Get a folder by IDget-webhook-subscription
: Get the current webhook subscriptioncreate-webhook-subscription
: Create a new webhook subscriptiondelete-webhook-subscription
: Delete the current webhook subscriptionhevy-mcp/ ├── .env # Environment variables (API keys) ├── src/ │ ├── index.ts # Main entry point │ ├── tools/ # Directory for MCP tool implementations │ │ ├── workouts.ts # Workout-related tools │ │ ├── routines.ts # Routine-related tools │ │ ├── templates.ts # Exercise template tools │ │ ├── folders.ts # Routine folder tools │ │ └── webhooks.ts # Webhook subscription tools │ ├── generated/ # API client (generated code) │ │ ├── client/ # Kubb-generated client │ │ │ ├── api/ # API client methods │ │ │ ├── types/ # TypeScript types │ │ │ ├── schemas/ # Zod schemas │ │ │ └── mocks/ # Mock data │ └── utils/ # Helper utilities │ ├── formatters.ts # Data formatting helpers │ └── validators.ts # Input validation helpers ├── scripts/ # Build and utility scripts └── tests/ # Test suite ├── integration/ # Integration tests with real API │ └── hevy-mcp.integration.test.ts # MCP server integration tests
This project uses Biome for code formatting and linting:
npm run check
To run all tests (unit and integration), use:
npm test
Note: If the
HEVY_API_KEY
environment variable is set, integration tests will also run. If not, only unit tests will run.
To run only unit tests (excluding integration tests):
npx vitest run --exclude tests/integration/**
Or with coverage:
npx vitest run --coverage --exclude tests/integration/**
To run only the integration tests (requires a valid HEVY_API_KEY
):
npx vitest run tests/integration
Note: The integration tests will fail if the HEVY_API_KEY
environment variable is not set. This is by design to ensure that the tests are always run with a valid API key.
For GitHub Actions:
HEVY_API_KEY
secret is set in the repository settingsTo set up the HEVY_API_KEY
secret:
HEVY_API_KEY
and the value to your Hevy API keyIf the secret is not set, the integration tests step will be skipped with a message indicating that the API key is missing.
The API client is generated from the OpenAPI specification using Kubb:
npm run export-specs npm run build:client
Kubb generates TypeScript types, API clients, Zod schemas, and mock data from the OpenAPI specification.
This project is licensed under the MIT License - see the LICENSE file for details.
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.