wger MCP服务器
 ](https://www.npmjs.com/package/@juxsta/wger-mcp) 
一个生产就绪的模型上下文协议(MCP)服务器,为Claude等人工智能助手提供对wger健身API的无缝访问。通过自然对话搜索400多种运动,创建锻炼计划,管理健身数据。
概述
wger MCP服务器使AI助手能够与 宇宙资源工作组,一个免费的开源健身和锻炼管理平台。使用此MCP服务器,Claude Desktop和其他AI应用程序可以:
- 按肌肉群、设备或关键字搜索和发现运动
- 检索详细的锻炼信息,包括表格说明
- 为经过身份验证的用户创建和管理锻炼程序
- 使用可定制的训练集、重复次数和重量将练习添加到日常训练中
此服务器实现 模型上下文协议,使其与任何支持MCP的AI应用程序兼容。
主要特点
- 12个强大的工具:全面的运动发现和锻炼管理功能
- 类型安全:在严格模式下使用TypeScript构建,具有完整的类型定义
- 智能高速缓存:自动缓存静态数据以最大限度地减少API调用
- 强健的身份验证:基于JWT的身份验证,具有自动令牌刷新功能
- 错误处理:用户友好的错误消息,具有优雅的回退
- 高测试覆盖率:单元和集成测试的代码覆盖率超过80%
- 生产就绪:全面的日志记录、重试逻辑和超时处理
- 零成本:从免费wger API访问400多个练习
快速开始
先决条件
- Node.js 18.0.0或更高
- 克劳德桌面版 (或其他MCP兼容应用程序)
- wger帐户 (可选,仅锻炼管理功能需要)
安装
选项1:使用Claude Code CLI(推荐)
claude mcp add wger -e WGER_API_KEY=your_key_here -- npx -y @juxsta/wger-mcp@1.1.3选项2:通过npm全局安装
npm install -g @juxsta/wger-mcp
claude mcp add wger -e WGER_API_KEY=your_key_here -- wger-mcp选项3:对于开发,克隆并在本地构建
git clone https://github.com/Juxsta/wger-mcp.git
cd wger-mcp
npm install
npm run build基本配置
- 获取wger API证书 (只读功能可选):
- 访问 wger.de 并创建一个帐户 - 从您的帐户设置生成API密钥 - 或者使用您的用户名和密码
- 配置Claude桌面:
打开您的Claude Desktop配置文件:
- macOS: ~/Library/Application Support/Claude/claude_desktop_config.json - 窗户: %APPDATA%\Claude\claude_desktop_config.json - Linux: ~/.config/Claude/claude_desktop_config.json
添加wger MCP服务器:
{
"mcpServers": {
"wger": {
"command": "node",
"args": ["/absolute/path/to/wger-mcp/dist/index.js"],
"env": {
"WGER_API_KEY": "your_api_key_here"
}
}
}
}- 重新启动克劳德桌面 开始使用这些工具!
有关详细的设置说明,请参阅 设置.md.
可用工具
运动发现
search_exercises-使用肌肉、设备、类别和关键字的过滤器搜索练习get_exercise_details-获取有关特定练习的全面信息list_categories-列出所有运动类别(力量、有氧运动、伸展运动等)list_muscles-列出所有用于过滤练习的肌肉群list_equipment-列出所有可用的设备类型
锻炼管理(需要身份验证)
create_workout-创建新的锻炼计划get_routine_details-获取完整的日常结构(天数、时段、练习)add_day_to_routine/update_day/delete_day-管理日程安排add_exercise_to_routine/update_exercise_in_routine-管理练习及其组合/重复delete_slot-从几天中删除练习get_user_routines-检索经过身份验证的用户的所有锻炼程序
有关完整的工具文档,请参阅 API毫米.
示例用法
配置后,只需与Claude聊天:
You: "Find me some chest exercises I can do with dumbbells"
Claude: [Uses search_exercises tool with muscle=chest, equipment=dumbbells]
"I found several dumbbell chest exercises:
1. Dumbbell Bench Press
2. Dumbbell Flyes
3. Incline Dumbbell Press
..."
You: "Tell me more about the dumbbell bench press"
Claude: [Uses get_exercise_details tool]
"The dumbbell bench press is a compound exercise that targets..."有关更详细的示例和场景,请参阅 示例.md.
认证
wger MCP服务器支持两种身份验证方法:
选项1:API密钥(推荐)
export WGER_API_KEY="your_api_key_here"选项2:用户名和密码
export WGER_USERNAME="your_username"
export WGER_PASSWORD="your_password"仅锻炼管理工具需要身份验证。练习发现工具无需身份验证即可工作。
发展
设置开发环境
# Clone the repository
git clone https://github.com/Juxsta/wger-mcp.git
cd wger-mcp
# Install dependencies
npm install
# Copy environment variables
cp .env.example .env
# Edit .env with your credentials构建和测试
# Build the project
npm run build
# Run tests
npm test
# Run tests with coverage
npm run test:coverage
# Lint code
npm run lint
# Format code
npm run format项目结构
wger-mcp/
├── src/
│ ├── tools/ # MCP tool implementations
│ ├── client/ # HTTP client and auth
│ ├── schemas/ # Zod validation schemas
│ ├── types/ # TypeScript type definitions
│ ├── utils/ # Error handling and logging
│ ├── config.ts # Configuration management
│ ├── server.ts # MCP server setup
│ └── index.ts # Entry point
├── tests/
│ ├── unit/ # Unit tests
│ ├── integration/ # Integration tests
│ └── fixtures/ # Test data
├── docs/ # Documentation
└── dist/ # Compiled JavaScriptAPI 参考
有关完整的API文档,包括所有8个工具的参数、返回值和示例,请参阅 API 参考.
贡献
我们欢迎捐款!请参阅 贡献.md 用于:
- 如何设置开发环境
- 代码风格指南
- 如何运行测试
- 拉取请求流程
- 如何报告错误和请求功能
资源
许可证
此项目根据MIT许可证获得许可-请参阅 许可证 文件以获取详细信息。
支持
- 问题:
- 讨论:
- wger社区:
致谢
- 与 模型上下文协议SDK
- 由...驱动 wger-锻炼管理器
- 为与人工智能助手无缝集成健身数据而创建
______________________________________________________________________
由...制作❤️ 面向人工智能和健身社区
