Lifestyle MCP Gym
Lifestyle MCP Gym
Lifestyle MCP Gym 是一个面向智能体的健身房与私人教练数据层:人类用户通过响应式仪表板和受限的 JSON-RPC MCP 工具,管理营养、用户录入的食物、训练、身体指标以及确定性的健康估算。
功能
人类用户注册与登录,支持密码哈希、安全的仅 HTTP 会话 Cookie、目标、经验、时区与同意。
智能体注册,支持受限能力、可选的 HTTPS Webhook、所有者元数据,以及一次性密钥响应。仅存储哈希值。
训练追踪:练习、组数、次数、重量、时长、备注和近期活动。
身体指标:体重、体脂率、腰围、日期和备注。
营养档案与有界食物日志。营养值始终由用户录入,绝不虚构。
确定性的 Mifflin-St Jeor BMR、活动系数中性的维持热量、明确的目标调整热量,以及基于体重的宏观估算,包含版本化假设、符号不匹配警告、缺失输入提示、安全下限和健康免责声明。
一键获取教练上下文,包含营养档案、计算目标、今日营养摄入、近期训练统计、最新身体指标和明确的下一步行动。
位于
/api/mcp的 MCP JSON-RPC 端点,支持initialize、tools/list和tools/call。针对训练、指标、营养、教练上下文、智能体注册和仪表盘访问链接的受限 MCP 工具。
Related MCP server: wger MCP Server
本地运行
要求:Node.js 20+ 和 npm。
npm install
cp .env.example .env.local
npm run dev打开 http://localhost:3000。
默认的本地存储驱动是位于 .data/lifestyle-gym.json 的 JSON 文件。它适用于本地开发,并被 git 忽略。若要改用显式演示存储:
LIFESTYLE_STORAGE_DRIVER=memory npm run dev内存存储在服务器进程重启时会重置。
环境变量
参见 .env.example:
SUPABASE_URL:来自 Supabase API 设置的项目 URL。SUPABASE_SERVICE_ROLE_KEY:来自 Supabase API 设置的服务角色密钥。LIFESTYLE_STORAGE_DRIVER:本地回退,可以是file或memory。LIFESTYLE_DATA_FILE:本地 JSON 存储的可选路径。
当两个 Supabase 变量都存在时,服务器会自动选择 SupabaseStorage;否则保持现有的文件/内存行为。在 Vercel 上,除非显式选择文件驱动,否则回退为进程本地内存。
安全: SUPABASE_SERVICE_ROLE_KEY 仅限服务器端使用。切勿为其添加 NEXT_PUBLIC_ 前缀、将存储适配器导入客户端代码、打印该密钥或将其提交到仓库。应用存储密码哈希、会话令牌哈希和智能体密钥哈希;原始智能体密钥仅返回一次。
Supabase 设置
创建一个 Supabase 项目。
将 Supabase CLI 关联到项目并应用已提交的迁移:
npx supabase@latest link --project-ref YOUR_PROJECT_REF npx supabase@latest db push已提交的迁移是幂等的,可以安全地重复运行。
将项目 URL 和服务角色密钥复制到
.env.local,用于本地 Supabase 后端服务器。重启 Next.js 服务器,并确认
/api/status报告存储模式为supabase。
迁移会创建规范化的 humans、sessions、agents、workouts、workout exercises/sets、body metrics、nutrition profiles 和 nutrition entries 表。每张表都启用了行级安全(Row Level Security)。有意不设置任何公共策略:所有数据访问均使用服务器端服务角色客户端。
MCP 快速入门
在仪表盘中注册一个人类用户,然后创建一个智能体。智能体密钥仅显示一次。将其作为 Bearer 令牌发送:
curl -s https://YOUR_DEPLOYMENT/api/mcp \
-H 'content-type: application/json' \
-H 'authorization: Bearer YOUR_AGENT_SECRET' \
--data '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{}}'
curl -s https://YOUR_DEPLOYMENT/api/mcp \
-H 'content-type: application/json' \
-H 'authorization: Bearer YOUR_AGENT_SECRET' \
--data '{"jsonrpc":"2.0","id":2,"method":"tools/list","params":{}}'人类浏览器会话可以从同一源调用该端点。智能体工具调用需要相应的作用域。现有的训练和指标作用域保持不变。营养工具使用 nutrition:read 或 nutrition:write;get_coaching_context 仅使用 coaching:read,该作用域授权聚合读取,而无需单独授予营养、训练或指标工具。
面向 LLM 的教练上下文
拥有 coaching:read 的智能体可以通过一次调用获取所有有依据的教练输入:
curl -s https://YOUR_DEPLOYMENT/api/mcp \
-H 'content-type: application/json' \
-H 'authorization: Bearer YOUR_AGENT_SECRET' \
--data '{
"jsonrpc":"2.0",
"id":"coach-context",
"method":"tools/call",
"params":{"name":"get_coaching_context","arguments":{}}
}'响应在 result.content 中包含简洁文本,在 result.structuredContent 中包含机器可读的 JSON。计算目标包括公式版本、精确输入和假设、缺失输入、钳制说明、安全提示,以及以下显式目标字段:
字段 | 含义 |
| 任何目标调整之前的 TDEE 中性基线。 |
| 应用所选减重、维持或增重目标后的热量目标。 |
|
|
| 所选方向: |
| 说明方向和调整的可读句子。 |
| 针对特定目标的教练和下一步建议。 |
|
|
lose 默认低于维持热量,gain 默认高于维持热量,maintain 等于维持热量。自定义 targetRateKgPerWeek 是带符号的:负值表示减重,正值表示增重。如果其符号与所选目标矛盾,计算会规范化符号、报告该假设,并使用规范化后的速率。教练上下文会在其可读文本中同时重复中性基线和目标调整后的目标。
记录用户录入的食物
log_food 绝不查找或虚构营养值。提供完整日志条目的总计值,包括所有份数:
curl -s https://YOUR_DEPLOYMENT/api/mcp \
-H 'content-type: application/json' \
-H 'authorization: Bearer YOUR_AGENT_SECRET' \
--data '{
"jsonrpc":"2.0",
"id":"food-1",
"method":"tools/call",
"params":{
"name":"log_food",
"arguments":{
"eatenAt":"2026-08-20T12:30:00Z",
"mealType":"lunch",
"foodName":"Tofu rice bowl",
"servingSize":"1 bowl",
"servings":1,
"caloriesKcal":640,
"proteinG":31,
"carbohydratesG":82,
"fatG":19,
"fiberG":11,
"notes":"Totals entered from the recipe"
}
}
}'验证
npm test
npm run lint
npm run build部署到 Vercel
为每个应使用持久存储的环境设置以下 Vercel 环境变量:
SUPABASE_URLSUPABASE_SERVICE_ROLE_KEY
使用 Vercel 仪表盘或 vercel env add;确保服务角色值不进入命令历史或部署日志。不要创建 NEXT_PUBLIC_ 副本。
然后部署预览:
npx vercel@latest --token "$VERCEL_TOKEN" --yes仅在进行有意的生产部署时使用 --prod。使用 npx vercel@latest inspect <deployment-url> --token "$VERCEL_TOKEN" 验证返回的部署。
架构
src/components/:客户端仪表盘、认证、表单和 API 指南。src/app/api/:用于认证、训练、指标、统计、智能体、状态和 MCP 的 Next.js 路由处理器。src/lib/domain.ts:经过验证的领域输入模式和统计计算。src/lib/service.ts:认证、授权和应用操作。src/lib/storage/:存储接口以及 Supabase、本地 JSON 和内存适配器。src/lib/mcp.ts:JSON-RPC/MCP 请求验证、工具、认证和作用域强制。
LifestyleStorage 使领域、服务、UI 和 MCP 行为独立于所选的持久化适配器。
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- FlicenseNot gradedqualityBmaintenanceConnect Pelaris to any MCP-compatible AI assistant for personalised fitness coaching. Plan training programs, log workouts, track benchmarks, manage goals, and get data-driven coaching insights. Supports science-based methodologies including 5/3/1, Pfitzinger, polarised training, and more. OAuth 2.0 authentication with Streamable HTTP transport. Documentation: https://pelaris.io/integrations Web
- FlicenseNot gradedqualityBmaintenanceMCP server that wraps wger fitness/nutrition management platform, providing 15 tools for exercise search, ingredient nutrition lookup, weight tracking, and more, accessible to any MCP-compatible AI agent.
- FlicenseAqualityBmaintenancePersonal workout coach MCP server that logs exercises in natural language, tracks progress with SQLite, and provides coaching signals like estimated 1RM and volume trends.6
- FlicenseNot gradedqualityCmaintenanceA personal health and fitness MCP server that provides tools for managing profile data, goals, body measurements, nutrition, workouts, sleep, check-ins, life events, analytics, and coach memories via Supabase Postgres.1
Related MCP Connectors
A paid remote MCP for AI SDK benchmark dashboard, built to return verdicts, receipts, usage logs, an
A paid remote MCP for AI SDK eval dashboard, built to return verdicts, receipts, usage logs, and aud
A paid remote MCP for AI SDK data query MCP, built to return verdicts, receipts, usage logs, and aud
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/YingsHermes/lifestyle-mcp-gym'
If you have feedback or need assistance with the MCP directory API, please join our Discord server