FitnessMCP

FitnessMCP

A unified MCP server that connects AI assistants to multiple fitness services (Hevy, Strava, Cronometer, Intervals.icu) through a single secure endpoint, enabling workout, nutrition, and activity data access.

Category
访问服务器

README

FitnessMCP

FitnessMCP is a production-ready remote Model Context Protocol server that lets AI assistants work with fitness data from multiple services through one secure endpoint.

One server. One /mcp URL. Multiple fitness integrations.

What It Connects

FitnessMCP currently includes tool groups for:

  • Hevy: workouts, routines, exercise templates, routine folders, and workout events
  • Strava: athlete profile, recent activities, and segment starring
  • Cronometer: diary entries, daily nutrition, food search, food details, custom foods, macro targets, fasting history, and day completion
  • Intervals.icu: athlete profile, activities, wellness, events, gear, reminders, and sport settings

It also includes high-level utility tools:

  • fitness_get_connected_services
  • fitness_get_integration_plan

Why Use FitnessMCP

  • One MCP connection instead of separate servers for each fitness app
  • Cloudflare Worker deployment for a low-maintenance hosted endpoint
  • OAuth-ready MCP transport for remote MCP clients
  • Encrypted credential storage for user-supplied keys
  • No checked-in secrets: all real credentials are supplied through Worker secrets or local-only files
  • Typed TypeScript codebase with validation, tests, and CI

Important Security Note

This repository intentionally does not include real API keys, tokens, passwords, KV namespace IDs, or personal credentials.

You will see placeholders such as:

replace_with_hevy_api_key
REPLACE_WITH_YOUR_PRODUCTION_KV_NAMESPACE_ID

That is expected. Replace those only in your own local .dev.vars file or in Cloudflare Worker secrets. Never commit real credentials.

How The Pieces Fit Together

flowchart LR
	A["AI assistant"] --> B["FitnessMCP /mcp endpoint"]
	B --> C["Hevy client"]
	B --> D["Strava client"]
	B --> E["Cronometer client"]
	B --> F["Intervals.icu client"]
	B --> G["Cloudflare KV encrypted storage"]

Beginner-Friendly Setup

This section assumes you are comfortable copying and pasting commands, but you do not need to be a professional developer.

Step 1: Install The Required Apps

Install these first:

  1. Node.js from nodejs.org
  2. Git from git-scm.com
  3. A Cloudflare account from cloudflare.com
  4. A GitHub account from github.com

To check that Node.js and Git are installed, open Terminal and run:

node --version
git --version

If both commands print version numbers, you are ready.

Step 2: Download The Project

Clone the repository:

git clone https://github.com/senojjones/FitnessMCP.git
cd FitnessMCP

Install the project dependencies:

npm install

Step 3: Log In To Cloudflare From Terminal

Run:

npx wrangler login

Your browser will open. Sign in to Cloudflare and approve Wrangler.

Step 4: Create Cloudflare KV Storage

FitnessMCP uses Cloudflare KV to store OAuth sessions and encrypted user credentials.

Run:

npx wrangler kv namespace create OAUTH_KV

Cloudflare will print something like:

{ binding = "OAUTH_KV", id = "abc123..." }

Copy the id value.

Open wrangler.jsonc and replace:

REPLACE_WITH_YOUR_PRODUCTION_KV_NAMESPACE_ID

with the KV namespace ID Cloudflare gave you.

For local development, you can use the same ID for:

REPLACE_WITH_YOUR_DEV_KV_NAMESPACE_ID

or create a second namespace:

npx wrangler kv namespace create OAUTH_KV --env dev

Step 5: Create A GitHub OAuth App

FitnessMCP uses GitHub sign-in to identify users.

  1. Go to GitHub Developer Settings
  2. Click New OAuth App
  3. Use this for local development:
Application name: FitnessMCP Local
Homepage URL: http://localhost:8787
Authorization callback URL: http://localhost:8787/callback
  1. Click Register application
  2. Copy the Client ID
  3. Click Generate a new client secret
  4. Copy the Client Secret

Keep these private.

Step 6: Create Your Local Secret File

Copy the example file:

cp .dev.vars.example .dev.vars

Open .dev.vars in a text editor.

Replace:

GITHUB_CLIENT_ID=replace_with_your_github_oauth_client_id
GITHUB_CLIENT_SECRET=replace_with_your_github_oauth_client_secret

with your GitHub OAuth values.

Generate an encryption key:

openssl rand -hex 32

Copy the output and put it into:

COOKIE_ENCRYPTION_KEY=replace_with_64_character_hex_string

Step 7: Add Fitness Service Credentials

You do not need every service. Configure only the apps you use.

Hevy

Get your API key from Hevy developer settings, then set:

HEVY_API_KEY=replace_with_hevy_api_key

Strava

Create a Strava app at strava.com/settings/api, then set:

STRAVA_CLIENT_ID=replace_with_strava_client_id
STRAVA_CLIENT_SECRET=replace_with_strava_client_secret
STRAVA_ACCESS_TOKEN=replace_with_strava_access_token
STRAVA_REFRESH_TOKEN=replace_with_strava_refresh_token

Cronometer

Set:

CRONOMETER_USERNAME=replace_with_cronometer_email
CRONOMETER_PASSWORD=replace_with_cronometer_password

Cronometer access can be sensitive because it may involve account credentials. Use a strong unique password and keep .dev.vars private.

Intervals.icu

Create an API key in Intervals.icu, then set:

INTERVALS_ICU_API_KEY=replace_with_intervals_icu_api_key
INTERVALS_ICU_ATHLETE_ID=replace_with_intervals_icu_athlete_id

Step 8: Run FitnessMCP Locally

Start the server:

npm run dev

Open:

http://localhost:8787

Check health:

http://localhost:8787/health

The MCP endpoint is:

http://localhost:8787/mcp

Step 9: Deploy To Cloudflare

Before deploying, add secrets to Cloudflare. Run these one at a time:

npx wrangler secret put GITHUB_CLIENT_ID
npx wrangler secret put GITHUB_CLIENT_SECRET
npx wrangler secret put COOKIE_ENCRYPTION_KEY

Then add whichever fitness services you use:

npx wrangler secret put HEVY_API_KEY
npx wrangler secret put STRAVA_CLIENT_ID
npx wrangler secret put STRAVA_CLIENT_SECRET
npx wrangler secret put STRAVA_ACCESS_TOKEN
npx wrangler secret put STRAVA_REFRESH_TOKEN
npx wrangler secret put CRONOMETER_USERNAME
npx wrangler secret put CRONOMETER_PASSWORD
npx wrangler secret put INTERVALS_ICU_API_KEY
npx wrangler secret put INTERVALS_ICU_ATHLETE_ID

Deploy:

npm run deploy

Cloudflare will print your Worker URL. It will look similar to:

https://fitnessmcp.YOUR_SUBDOMAIN.workers.dev

Your production MCP endpoint is:

https://fitnessmcp.YOUR_SUBDOMAIN.workers.dev/mcp

Step 10: Connect An MCP Client

For an MCP client that supports remote MCP through mcp-remote, use:

{
  "mcpServers": {
    "fitnessmcp": {
      "command": "npx",
      "args": [
        "mcp-remote",
        "https://fitnessmcp.YOUR_SUBDOMAIN.workers.dev/mcp"
      ]
    }
  }
}

Restart your MCP client after saving the config.

Tool Naming

Tools are namespaced by service:

fitness_get_connected_services
strava_get_athlete
strava_get_recent_activities
cronometer_get_daily_nutrition
intervals_get_wellness
get_workouts
get_routines

The Hevy tools keep their original concise names for compatibility.

Local Development Commands

npm run dev
npm run type-check
npm run test:run
npm run lint
npm run format
npm run check

Project Structure

FitnessMCP/
  src/
    app.ts                    # Hono app and route mounting
    mcp-agent.ts              # MCP server and tool registration
    routes/                   # MCP and utility routes
    middleware/               # bearer auth middleware
    lib/
      client.ts               # Hevy API client
      strava-client.ts        # Strava API client
      cronometer-client.ts    # Cronometer API client
      intervals-client.ts     # Intervals.icu API client
      key-storage.ts          # encrypted KV credential helpers
      service-registry.ts     # connected service status
      schemas.ts              # Zod schemas
      transforms.ts           # validation and API transforms
  test/                       # unit and integration tests
  wrangler.jsonc              # Cloudflare Worker config
  .dev.vars.example           # local secret template

Production Checklist

Before sharing your Worker URL:

  • wrangler.jsonc has your own KV namespace IDs
  • .dev.vars is not committed
  • All Cloudflare secrets are set with wrangler secret put
  • npm run check passes
  • /health returns status: healthy
  • Your MCP client can call fitness_get_connected_services

Security

Read SECURITY.md before deploying.

Contributing

Issues and pull requests are welcome. Read CONTRIBUTING.md first.

License

MIT

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选