hevy-mcp 1.3.1 → 1.4.0
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 +63 -8
- package/dist/index.js +10 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -65,9 +65,9 @@ Make sure to replace `your-api-key-here` with your actual Hevy API key.
|
|
|
65
65
|
|
|
66
66
|
## Configuration
|
|
67
67
|
|
|
68
|
-
Create a `.env` file in the project root with the following content:
|
|
68
|
+
Create a `.env` file in the project root (you can copy from [.env.sample](.env.sample)) with the following content:
|
|
69
69
|
|
|
70
|
-
```
|
|
70
|
+
```env
|
|
71
71
|
HEVY_API_KEY=your_hevy_api_key_here
|
|
72
72
|
```
|
|
73
73
|
|
|
@@ -92,7 +92,7 @@ npm start
|
|
|
92
92
|
|
|
93
93
|
## Available MCP Tools
|
|
94
94
|
|
|
95
|
-
The server implements the following MCP tools:
|
|
95
|
+
The server implements the following MCP tools for interacting with the Hevy API:
|
|
96
96
|
|
|
97
97
|
### Workout Tools
|
|
98
98
|
- `get-workouts`: Fetch and format workout data
|
|
@@ -119,7 +119,7 @@ The server implements the following MCP tools:
|
|
|
119
119
|
|
|
120
120
|
## Project Structure
|
|
121
121
|
|
|
122
|
-
```
|
|
122
|
+
```plaintext
|
|
123
123
|
hevy-mcp/
|
|
124
124
|
├── .env # Environment variables (API keys)
|
|
125
125
|
├── src/
|
|
@@ -136,9 +136,11 @@ hevy-mcp/
|
|
|
136
136
|
│ └── validators.ts # Input validation helpers
|
|
137
137
|
├── scripts/ # Build and utility scripts
|
|
138
138
|
└── tests/ # Test suite
|
|
139
|
+
├── integration/ # Integration tests with real API
|
|
140
|
+
│ └── hevy-mcp.integration.test.ts # MCP server integration tests
|
|
139
141
|
```
|
|
140
142
|
|
|
141
|
-
## Development
|
|
143
|
+
## Development Guide
|
|
142
144
|
|
|
143
145
|
### Code Style
|
|
144
146
|
|
|
@@ -148,9 +150,62 @@ This project uses Biome for code formatting and linting:
|
|
|
148
150
|
npm run check
|
|
149
151
|
```
|
|
150
152
|
|
|
153
|
+
### Testing
|
|
154
|
+
|
|
155
|
+
#### Run All Tests
|
|
156
|
+
|
|
157
|
+
To run all tests (unit and integration), use:
|
|
158
|
+
|
|
159
|
+
```bash
|
|
160
|
+
npm test
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
> **Note:** If the `HEVY_API_KEY` environment variable is set, integration tests will also run. If not, only unit tests will run.
|
|
164
|
+
|
|
165
|
+
#### Run Only Unit Tests
|
|
166
|
+
|
|
167
|
+
To run only unit tests (excluding integration tests):
|
|
168
|
+
|
|
169
|
+
```bash
|
|
170
|
+
npx vitest run --exclude tests/integration/**
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
Or with coverage:
|
|
174
|
+
|
|
175
|
+
```bash
|
|
176
|
+
npx vitest run --coverage --exclude tests/integration/**
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
#### Run Only Integration Tests
|
|
180
|
+
|
|
181
|
+
To run only the integration tests (requires a valid `HEVY_API_KEY`):
|
|
182
|
+
|
|
183
|
+
```bash
|
|
184
|
+
npx vitest run tests/integration
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
**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.
|
|
188
|
+
|
|
189
|
+
##### GitHub Actions Configuration
|
|
190
|
+
|
|
191
|
+
For GitHub Actions:
|
|
192
|
+
|
|
193
|
+
1. Unit tests will always run on every push and pull request
|
|
194
|
+
2. Integration tests will only run if the `HEVY_API_KEY` secret is set in the repository settings
|
|
195
|
+
|
|
196
|
+
To set up the `HEVY_API_KEY` secret:
|
|
197
|
+
|
|
198
|
+
1. Go to your GitHub repository
|
|
199
|
+
2. Click on "Settings" > "Secrets and variables" > "Actions"
|
|
200
|
+
3. Click on "New repository secret"
|
|
201
|
+
4. Set the name to `HEVY_API_KEY` and the value to your Hevy API key
|
|
202
|
+
5. Click "Add secret"
|
|
203
|
+
|
|
204
|
+
If the secret is not set, the integration tests step will be skipped with a message indicating that the API key is missing.
|
|
205
|
+
|
|
151
206
|
### Generating API Client
|
|
152
207
|
|
|
153
|
-
The API client is generated from the OpenAPI specification using Kiota:
|
|
208
|
+
The API client is generated from the OpenAPI specification using [Kiota](https://github.com/microsoft/kiota):
|
|
154
209
|
|
|
155
210
|
```bash
|
|
156
211
|
npm run export-specs
|
|
@@ -159,11 +214,11 @@ npm run build:client
|
|
|
159
214
|
|
|
160
215
|
## License
|
|
161
216
|
|
|
162
|
-
This project is licensed under the MIT License - see the LICENSE file for details.
|
|
217
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
163
218
|
|
|
164
219
|
## Contributing
|
|
165
220
|
|
|
166
|
-
Contributions are welcome! Please feel free to submit a Pull Request.
|
|
221
|
+
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.
|
|
167
222
|
|
|
168
223
|
## Acknowledgements
|
|
169
224
|
|
package/dist/index.js
CHANGED
|
@@ -652,7 +652,9 @@ function registerWorkoutTools(server2, hevyClient2) {
|
|
|
652
652
|
});
|
|
653
653
|
const workouts = data?.workouts?.map((workout) => formatWorkout(workout)) || [];
|
|
654
654
|
if (workouts.length === 0) {
|
|
655
|
-
return createEmptyResponse(
|
|
655
|
+
return createEmptyResponse(
|
|
656
|
+
"No workouts found for the specified parameters"
|
|
657
|
+
);
|
|
656
658
|
}
|
|
657
659
|
return createJsonResponse(workouts);
|
|
658
660
|
}, "get-workouts")
|
|
@@ -700,7 +702,9 @@ function registerWorkoutTools(server2, hevyClient2) {
|
|
|
700
702
|
});
|
|
701
703
|
const events = data?.events || [];
|
|
702
704
|
if (events.length === 0) {
|
|
703
|
-
return createEmptyResponse(
|
|
705
|
+
return createEmptyResponse(
|
|
706
|
+
`No workout events found for the specified parameters since ${since}`
|
|
707
|
+
);
|
|
704
708
|
}
|
|
705
709
|
return createJsonResponse(events);
|
|
706
710
|
}, "get-workout-events")
|
|
@@ -767,7 +771,9 @@ function registerWorkoutTools(server2, hevyClient2) {
|
|
|
767
771
|
};
|
|
768
772
|
const data = await hevyClient2.v1.workouts.post(requestBody);
|
|
769
773
|
if (!data) {
|
|
770
|
-
return createEmptyResponse(
|
|
774
|
+
return createEmptyResponse(
|
|
775
|
+
"Failed to create workout: Server returned no data"
|
|
776
|
+
);
|
|
771
777
|
}
|
|
772
778
|
const workout = formatWorkout(data);
|
|
773
779
|
return createJsonResponse(workout, {
|
|
@@ -2088,7 +2094,7 @@ function createClient(apiKey2, baseUrl) {
|
|
|
2088
2094
|
|
|
2089
2095
|
// package.json
|
|
2090
2096
|
var name = "hevy-mcp";
|
|
2091
|
-
var version = "1.
|
|
2097
|
+
var version = "1.3.1";
|
|
2092
2098
|
|
|
2093
2099
|
// src/index.ts
|
|
2094
2100
|
var HEVY_API_BASEURL = "https://api.hevyapp.com";
|