hevy-mcp 1.10.16 → 1.12.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +42 -142
- package/dist/index.d.ts +45 -1
- package/dist/index.js +436 -562
- package/dist/index.js.map +1 -1
- package/package.json +41 -37
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# hevy-mcp: Model Context Protocol Server for Hevy Fitness API
|
|
2
2
|
|
|
3
|
-
[](https://opensource.org/licenses/MIT)
|
|
4
3
|
[](https://smithery.ai/server/@chrisdoc/hevy-mcp)
|
|
4
|
+
[](https://opensource.org/licenses/MIT)
|
|
5
5
|
|
|
6
6
|
A Model Context Protocol (MCP) server implementation that interfaces with the [Hevy fitness tracking app](https://www.hevyapp.com/) and its [API](https://api.hevyapp.com/docs/). This server enables AI assistants to access and manage workout data, routines, exercise templates, and more through the Hevy API (requires PRO subscription).
|
|
7
7
|
|
|
@@ -13,20 +13,22 @@ A Model Context Protocol (MCP) server implementation that interfaces with the [H
|
|
|
13
13
|
- **Folder Organization**: Manage routine folders
|
|
14
14
|
- **Webhook Subscriptions**: Create, view, and delete webhook subscriptions for workout events
|
|
15
15
|
|
|
16
|
+
> **Note:** HTTP transport and Docker images remain deprecated. Smithery deployment now uses the official TypeScript runtime flow (no Docker required), or you can run the server locally via stdio (e.g., `npx hevy-mcp`). Existing GHCR images remain available but are no longer updated.
|
|
17
|
+
|
|
16
18
|
## Prerequisites
|
|
17
19
|
|
|
18
20
|
- Node.js (v20 or higher)
|
|
19
|
-
-
|
|
21
|
+
- pnpm (via Corepack)
|
|
20
22
|
- A Hevy API key
|
|
21
23
|
|
|
22
24
|
## Installation
|
|
23
25
|
|
|
24
|
-
###
|
|
26
|
+
### Run via npx (recommended)
|
|
25
27
|
|
|
26
|
-
|
|
28
|
+
You can launch the server directly without cloning:
|
|
27
29
|
|
|
28
30
|
```bash
|
|
29
|
-
npx -y
|
|
31
|
+
HEVY_API_KEY=your_hevy_api_key_here npx -y hevy-mcp
|
|
30
32
|
```
|
|
31
33
|
|
|
32
34
|
### Manual Installation
|
|
@@ -36,9 +38,7 @@ git clone https://github.com/chrisdoc/hevy-mcp.git
|
|
|
36
38
|
cd hevy-mcp
|
|
37
39
|
|
|
38
40
|
# Install dependencies
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
# Create .env file from sample
|
|
41
|
+
corepack use pnpm@10.22.0
|
|
42
42
|
cp .env.sample .env
|
|
43
43
|
# Edit .env and add your Hevy API key
|
|
44
44
|
```
|
|
@@ -67,7 +67,7 @@ Make sure to replace `your-api-key-here` with your actual Hevy API key.
|
|
|
67
67
|
You can supply your Hevy API key in two ways:
|
|
68
68
|
|
|
69
69
|
1. Environment variable (`HEVY_API_KEY`)
|
|
70
|
-
2. Command-line argument (`--hevy-api-key=your_key` or `hevy-api-key=your_key` after `--` when using
|
|
70
|
+
2. Command-line argument (`--hevy-api-key=your_key` or `hevy-api-key=your_key` after `--` when using pnpm scripts)
|
|
71
71
|
|
|
72
72
|
Create a `.env` file in the project root (you can copy from [.env.sample](.env.sample)) with the following content if using the environment variable approach:
|
|
73
73
|
|
|
@@ -78,81 +78,40 @@ HEVY_API_KEY=your_hevy_api_key_here
|
|
|
78
78
|
Replace `your_hevy_api_key_here` with your actual Hevy API key. If you prefer the command argument approach you can skip setting the environment variable and start the server with for example:
|
|
79
79
|
|
|
80
80
|
```bash
|
|
81
|
-
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
Or in HTTP mode:
|
|
85
|
-
|
|
86
|
-
```bash
|
|
87
|
-
npm start -- --http --hevy-api-key=your_hevy_api_key_here
|
|
81
|
+
pnpm start -- --hevy-api-key=your_hevy_api_key_here
|
|
88
82
|
```
|
|
89
83
|
|
|
90
|
-
## Transport
|
|
84
|
+
## Transport
|
|
91
85
|
|
|
92
|
-
|
|
86
|
+
### Deploy via Smithery (TypeScript runtime)
|
|
93
87
|
|
|
94
|
-
|
|
88
|
+
Smithery can bundle and host `hevy-mcp` without Docker by importing the exported `createServer` and `configSchema` from `src/index.ts`.
|
|
95
89
|
|
|
96
|
-
|
|
90
|
+
1. Ensure dependencies are installed: `pnpm install`
|
|
91
|
+
2. Launch the Smithery playground locally:
|
|
97
92
|
|
|
98
|
-
```bash
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
node dist/index.js
|
|
102
|
-
```
|
|
93
|
+
```bash
|
|
94
|
+
pnpm run smithery:dev
|
|
95
|
+
```
|
|
103
96
|
|
|
104
|
-
|
|
97
|
+
The CLI will prompt for `HEVY_API_KEY`, invoke `createServer({ config })`, and open the Smithery MCP playground.
|
|
105
98
|
|
|
106
|
-
|
|
99
|
+
3. Build the deployable bundle:
|
|
107
100
|
|
|
108
|
-
```bash
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
# Start in HTTP mode (CLI arg)
|
|
112
|
-
npm start -- --http --hevy-api-key=your_hevy_api_key_here
|
|
113
|
-
# Or using node directly
|
|
114
|
-
node dist/index.js --http --hevy-api-key=your_hevy_api_key_here
|
|
115
|
-
|
|
116
|
-
# Using environment variable
|
|
117
|
-
MCP_TRANSPORT=http npm start
|
|
118
|
-
```
|
|
119
|
-
|
|
120
|
-
#### HTTP Configuration
|
|
121
|
-
|
|
122
|
-
The HTTP transport can be configured using environment variables:
|
|
123
|
-
|
|
124
|
-
```env
|
|
125
|
-
# Transport mode
|
|
126
|
-
MCP_TRANSPORT=http
|
|
127
|
-
|
|
128
|
-
# HTTP server configuration
|
|
129
|
-
MCP_HTTP_HOST=127.0.0.1
|
|
130
|
-
PORT=3000
|
|
131
|
-
|
|
132
|
-
# DNS rebinding protection (recommended for production)
|
|
133
|
-
MCP_DNS_REBINDING_PROTECTION=true
|
|
134
|
-
MCP_ALLOWED_HOSTS=127.0.0.1,localhost
|
|
135
|
-
```
|
|
101
|
+
```bash
|
|
102
|
+
pnpm run smithery:build
|
|
103
|
+
```
|
|
136
104
|
|
|
137
|
-
|
|
105
|
+
4. Connect the repository to Smithery and trigger a deployment from their dashboard. Configuration is handled entirely through the exported Zod schema, so no additional `smithery.yaml` env mapping is required.
|
|
138
106
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
- `POST /mcp` - MCP client-to-server communication
|
|
142
|
-
- `GET /mcp` - Server-to-client notifications (SSE)
|
|
143
|
-
- `DELETE /mcp` - Session termination
|
|
144
|
-
- `GET /health` - Health check endpoint
|
|
145
|
-
|
|
146
|
-
#### Session Management
|
|
147
|
-
|
|
148
|
-
The 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.
|
|
107
|
+
hevy-mcp now runs exclusively over stdio, which works seamlessly with MCP-aware clients like Claude Desktop and Cursor. HTTP transport has been removed to simplify deployment.
|
|
149
108
|
|
|
150
109
|
## Usage
|
|
151
110
|
|
|
152
111
|
### Development
|
|
153
112
|
|
|
154
113
|
```bash
|
|
155
|
-
|
|
114
|
+
pnpm run dev
|
|
156
115
|
```
|
|
157
116
|
|
|
158
117
|
This starts the MCP server in development mode with hot reloading.
|
|
@@ -160,76 +119,13 @@ This starts the MCP server in development mode with hot reloading.
|
|
|
160
119
|
### Production
|
|
161
120
|
|
|
162
121
|
```bash
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
```
|
|
166
|
-
|
|
167
|
-
### Docker
|
|
168
|
-
|
|
169
|
-
The project includes a Dockerfile for containerized deployments. Docker images are automatically built and pushed to GitHub Container Registry (GHCR) during the CI/CD process.
|
|
170
|
-
|
|
171
|
-
#### Using Pre-built Images
|
|
172
|
-
|
|
173
|
-
Pull and run the latest image:
|
|
174
|
-
|
|
175
|
-
```bash
|
|
176
|
-
docker run -d \
|
|
177
|
-
--name hevy-mcp \
|
|
178
|
-
-e HEVY_API_KEY=your_api_key_here \
|
|
179
|
-
-p 3000:3000 \
|
|
180
|
-
ghcr.io/chrisdoc/hevy-mcp:latest
|
|
181
|
-
|
|
182
|
-
# Or using CLI argument for the key (omit env var)
|
|
183
|
-
docker run -d \
|
|
184
|
-
--name hevy-mcp \
|
|
185
|
-
-p 3000:3000 \
|
|
186
|
-
ghcr.io/chrisdoc/hevy-mcp:latest \
|
|
187
|
-
hevy-api-key=your_api_key_here
|
|
122
|
+
pnpm run build
|
|
123
|
+
pnpm start
|
|
188
124
|
```
|
|
189
125
|
|
|
190
|
-
|
|
126
|
+
### Docker (deprecated)
|
|
191
127
|
|
|
192
|
-
|
|
193
|
-
# Build the image
|
|
194
|
-
docker build -t hevy-mcp .
|
|
195
|
-
|
|
196
|
-
# Run the container
|
|
197
|
-
docker run -d \
|
|
198
|
-
--name hevy-mcp \
|
|
199
|
-
-e HEVY_API_KEY=your_api_key_here \
|
|
200
|
-
-p 3000:3000 \
|
|
201
|
-
hevy-mcp
|
|
202
|
-
|
|
203
|
-
# Or with CLI argument
|
|
204
|
-
docker run -d \
|
|
205
|
-
--name hevy-mcp \
|
|
206
|
-
-p 3000:3000 \
|
|
207
|
-
hevy-mcp \
|
|
208
|
-
hevy-api-key=your_api_key_here
|
|
209
|
-
```
|
|
210
|
-
|
|
211
|
-
#### Docker Compose Example
|
|
212
|
-
|
|
213
|
-
```yaml
|
|
214
|
-
version: '3.8'
|
|
215
|
-
services:
|
|
216
|
-
hevy-mcp:
|
|
217
|
-
image: ghcr.io/chrisdoc/hevy-mcp:latest
|
|
218
|
-
environment:
|
|
219
|
-
- HEVY_API_KEY=your_api_key_here
|
|
220
|
-
- MCP_TRANSPORT=http
|
|
221
|
-
- MCP_HTTP_HOST=0.0.0.0
|
|
222
|
-
- PORT=3000
|
|
223
|
-
ports:
|
|
224
|
-
- "3000:3000"
|
|
225
|
-
restart: unless-stopped
|
|
226
|
-
```
|
|
227
|
-
|
|
228
|
-
#### Available Image Tags
|
|
229
|
-
|
|
230
|
-
- `latest` - Latest stable release
|
|
231
|
-
- `main` - Latest development build from main branch
|
|
232
|
-
- `v1.8.8`, `v1.8`, `v1` - Semantic version tags for releases
|
|
128
|
+
Docker-based workflows have been retired so we can focus on the stdio-native experience. The bundled `Dockerfile` now exits with a clear message to prevent accidental builds, and `.dockerignore` simply documents the deprecation. Previously published images remain available on GHCR (for example `ghcr.io/chrisdoc/hevy-mcp:latest`), but they are **no longer updated**. For the best experience, run the server locally via `npx hevy-mcp` or your own Node.js runtime.
|
|
233
129
|
|
|
234
130
|
## Available MCP Tools
|
|
235
131
|
|
|
@@ -298,7 +194,7 @@ hevy-mcp/
|
|
|
298
194
|
This project uses Biome for code formatting and linting:
|
|
299
195
|
|
|
300
196
|
```bash
|
|
301
|
-
|
|
197
|
+
pnpm run check
|
|
302
198
|
```
|
|
303
199
|
|
|
304
200
|
### Testing
|
|
@@ -308,7 +204,7 @@ npm run check
|
|
|
308
204
|
To run all tests (unit and integration), use:
|
|
309
205
|
|
|
310
206
|
```bash
|
|
311
|
-
|
|
207
|
+
pnpm test
|
|
312
208
|
```
|
|
313
209
|
|
|
314
210
|
> **Note:** If the `HEVY_API_KEY` environment variable is set, integration tests will also run. If not, only unit tests will run.
|
|
@@ -318,13 +214,13 @@ npm test
|
|
|
318
214
|
To run only unit tests (excluding integration tests):
|
|
319
215
|
|
|
320
216
|
```bash
|
|
321
|
-
|
|
217
|
+
pnpm vitest run --exclude tests/integration/**
|
|
322
218
|
```
|
|
323
219
|
|
|
324
220
|
Or with coverage:
|
|
325
221
|
|
|
326
222
|
```bash
|
|
327
|
-
|
|
223
|
+
pnpm vitest run --coverage --exclude tests/integration/**
|
|
328
224
|
```
|
|
329
225
|
|
|
330
226
|
#### Run Only Integration Tests
|
|
@@ -332,7 +228,7 @@ npx vitest run --coverage --exclude tests/integration/**
|
|
|
332
228
|
To run only the integration tests (requires a valid `HEVY_API_KEY`):
|
|
333
229
|
|
|
334
230
|
```bash
|
|
335
|
-
|
|
231
|
+
pnpm vitest run tests/integration
|
|
336
232
|
```
|
|
337
233
|
|
|
338
234
|
**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.
|
|
@@ -359,12 +255,16 @@ If the secret is not set, the integration tests step will be skipped with a mess
|
|
|
359
255
|
The API client is generated from the OpenAPI specification using [Kubb](https://kubb.dev/):
|
|
360
256
|
|
|
361
257
|
```bash
|
|
362
|
-
|
|
363
|
-
|
|
258
|
+
pnpm run export-specs
|
|
259
|
+
pnpm run build:client
|
|
364
260
|
```
|
|
365
261
|
|
|
366
262
|
Kubb generates TypeScript types, API clients, Zod schemas, and mock data from the OpenAPI specification.
|
|
367
263
|
|
|
264
|
+
### Troubleshooting
|
|
265
|
+
|
|
266
|
+
- **Rollup optional dependency missing**: If you see an error similar to `Cannot find module @rollup/rollup-linux-x64-gnu`, set the environment variable `ROLLUP_SKIP_NODEJS_NATIVE_BUILD=true` before running `pnpm run build`. This forces Rollup to use the pure JavaScript fallback and avoids the npm optional dependency bug on some Linux runners.
|
|
267
|
+
|
|
368
268
|
## License
|
|
369
269
|
|
|
370
270
|
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
@@ -376,4 +276,4 @@ Contributions are welcome! Please feel free to submit a Pull Request. For major
|
|
|
376
276
|
## Acknowledgements
|
|
377
277
|
|
|
378
278
|
- [Model Context Protocol](https://github.com/modelcontextprotocol) for the MCP SDK
|
|
379
|
-
- [Hevy](https://www.hevyapp.com/) for their fitness tracking platform and API
|
|
279
|
+
- [Hevy](https://www.hevyapp.com/) for their fitness tracking platform and API
|
package/dist/index.d.ts
CHANGED
|
@@ -1 +1,45 @@
|
|
|
1
|
-
|
|
1
|
+
import * as _modelcontextprotocol_sdk_server from '@modelcontextprotocol/sdk/server';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
|
|
4
|
+
declare const serverConfigSchema: z.ZodObject<{
|
|
5
|
+
apiKey: z.ZodString;
|
|
6
|
+
}, "strip", z.ZodTypeAny, {
|
|
7
|
+
apiKey: string;
|
|
8
|
+
}, {
|
|
9
|
+
apiKey: string;
|
|
10
|
+
}>;
|
|
11
|
+
declare const configSchema: z.ZodObject<{
|
|
12
|
+
apiKey: z.ZodString;
|
|
13
|
+
}, "strip", z.ZodTypeAny, {
|
|
14
|
+
apiKey: string;
|
|
15
|
+
}, {
|
|
16
|
+
apiKey: string;
|
|
17
|
+
}>;
|
|
18
|
+
type ServerConfig = z.infer<typeof serverConfigSchema>;
|
|
19
|
+
declare function createServer({ config }: {
|
|
20
|
+
config: ServerConfig;
|
|
21
|
+
}): _modelcontextprotocol_sdk_server.Server<{
|
|
22
|
+
method: string;
|
|
23
|
+
params?: {
|
|
24
|
+
[x: string]: unknown;
|
|
25
|
+
_meta?: {
|
|
26
|
+
[x: string]: unknown;
|
|
27
|
+
progressToken?: string | number | undefined;
|
|
28
|
+
} | undefined;
|
|
29
|
+
} | undefined;
|
|
30
|
+
}, {
|
|
31
|
+
method: string;
|
|
32
|
+
params?: {
|
|
33
|
+
[x: string]: unknown;
|
|
34
|
+
_meta?: {
|
|
35
|
+
[x: string]: unknown;
|
|
36
|
+
} | undefined;
|
|
37
|
+
} | undefined;
|
|
38
|
+
}, {
|
|
39
|
+
[x: string]: unknown;
|
|
40
|
+
_meta?: {
|
|
41
|
+
[x: string]: unknown;
|
|
42
|
+
} | undefined;
|
|
43
|
+
}>;
|
|
44
|
+
|
|
45
|
+
export { configSchema, createServer as default };
|