Skip to main content

@wellpipe/whoop

The WHOOP provider package implements the HealthProvider interface for the WHOOP API. It handles API communication, data normalization, and provides MCP tools for AI assistants.

Installation

npm install @wellpipe/whoop

Features

  • Full WHOOP API v1 integration
  • Automatic token refresh
  • Rate limiting and retry logic
  • 21 MCP tools for AI assistants
  • Normalized data output matching @wellpipe/core types

Quick Start

import { WhoopClient } from '@wellpipe/whoop';
import { TokenProvider } from '@wellpipe/core';

// Create a token provider (implementation depends on your storage)
const tokenProvider: TokenProvider = {
async getAccessToken() { /* ... */ },
async getRefreshToken() { /* ... */ },
async updateTokens(access, refresh, expires) { /* ... */ },
async isExpired() { /* ... */ },
};

// Initialize the client
const client = new WhoopClient(tokenProvider);

// Fetch sleep data
const sleepData = await client.getSleep('2024-01-01', '2024-01-07');
console.log(sleepData);

Package Structure

@wellpipe/whoop/
├── src/
│ ├── index.ts # Package exports
│ ├── client.ts # WhoopClient class
│ ├── api/ # Raw API wrappers
│ │ ├── sleep.ts
│ │ ├── recovery.ts
│ │ ├── workout.ts
│ │ ├── cycle.ts
│ │ └── user.ts
│ ├── normalizers/ # Data transformation
│ │ ├── sleep.ts
│ │ ├── recovery.ts
│ │ └── workout.ts
│ └── tools/ # MCP tool definitions
│ ├── sleep-tools.ts
│ ├── recovery-tools.ts
│ ├── workout-tools.ts
│ ├── cycle-tools.ts
│ └── profile-tools.ts
├── docs/
│ └── TOOLS.md # Tool reference
└── package.json

Dependencies

PackagePurpose
@wellpipe/coreShared interfaces and types
zodRuntime validation

The package has minimal dependencies to keep bundle size small.

API Coverage

WHOOP EndpointSupported
SleepYes
RecoveryYes
WorkoutYes
CycleYes
User ProfileYes
Body MeasurementYes

Rate Limits

The WHOOP API has the following limits:

Limit TypeValue
Requests per minute100
Requests per day10,000

The client automatically handles rate limiting with exponential backoff.