This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
This is a Model Context Protocol (MCP) server for the Hevy fitness tracking API. It provides tools for AI assistants to interact with workouts, routines, exercise templates, folders, and webhook subscriptions through the Hevy API.
pnpm run dev- Start development server with hot reloadingpnpm run build- Build the project for productionpnpm start- Run the built project
pnpm run check- Run Biome formatter and linter (auto-fixes issues)pnpm run check:types- TypeScript type checking without emitting filespnpm test- Runs Vitest against all*.test.tsfiles (includingtests/integration/**). Integration tests will fail by design withoutHEVY_API_KEY. See the "Testing" section inREADME.mdfor CI requirements and secret configuration.
pnpm run export-specs- Export OpenAPI specificationpnpm run build:client- Generate API client using Kubb from OpenAPI spec
pnpm vitest run --exclude tests/integration/**- Unit tests onlypnpm vitest run tests/integration- Integration tests only (requires HEVY_API_KEY)pnpm vitest run --coverage- Tests with coverage report
- Entry Point:
src/index.ts- MCP server setup and tool registration - Tools:
src/tools/- MCP tool implementations organized by domain:workouts.ts- Workout CRUD operationsroutines.ts- Routine managementtemplates.ts- Exercise template accessfolders.ts- Routine folder organizationwebhooks.ts- Webhook subscription management
- Utils:
src/utils/- Shared utilities for HTTP client, formatting, and error handling - Generated Code:
src/generated/- Auto-generated API client from OpenAPI spec
The project uses a generated API client via Kubb that creates:
- TypeScript types in
src/generated/client/types/ - API methods in
src/generated/client/api/ - Zod schemas in
src/generated/client/schemas/ - Mock data in
src/generated/client/mocks/
kubb.config.ts- API client generation configurationbiome.json- Code formatting and linting rules (tabs, 80 char lines, double quotes)lefthook.yml- Git hooks for pre-commit formatting and commit message linting
- Uses Biome for formatting/linting with tabs, 80-character lines, double quotes
- Excludes generated code (
src/generated/) from linting - Pre-commit hooks auto-format staged files
- Unit tests for utilities and core logic
- Integration tests that require real Hevy API access
- Tests run conditionally based on HEVY_API_KEY presence
When API changes occur:
- Update
openapi-spec.jsonwithpnpm run export-specs - Regenerate client with
pnpm run build:client - Generated code is automatically formatted via Kubb hooks
Required environment variables:
HEVY_API_KEY- Hevy API key (required for server operation and integration tests)
Each MCP tool follows this pattern:
- Input validation using Zod schemas
- API call using generated client
- Response formatting for user consumption
- Error handling with descriptive messages
The tools are organized by domain and registered in the main server file.
- Context7: MUST use Context7 for any library and API documentation needs
- GitHub Integration: MUST use the GitHub MCP server for all GitHub interactions and only use
ghif there is a problem with the personal access token - AI Feedback: MUST ask Gemini for feedback (about a design, code review, etc.) but remember Gemini has no memory so everything must be provided in the prompt and you must refer to files using the @ syntax