使用说明
FatSecret MCP服务器
遥控器 模型上下文协议 服务器 FatSecret 营养API,部署在Cloudflare Workers上。
MCP工具
| 工具 | 说明 |
|---|---|
search_foods |
搜索FatSecret食品数据库 |
get_food |
获取食物的详细营养信息 |
search_recipes |
搜索食谱 |
get_recipe |
获取食谱详细信息、配料和说明 |
get_user_profile |
获取经过身份验证的用户的个人资料 |
get_user_food_entries |
获取日期的食物日记条目 |
add_food_entry |
将食物条目记录到用户的日记中 |
get_weight_month |
获取一个月的体重条目 |
check_auth_status |
检查当前身份验证状态 |
自我寄宿
先决条件
- A. FatSecret开发者账号 具有API证书
- 牧马人CLI 安装
部署
# Clone and install
git clone https://github.com/fcoury/fatsecret-mcp.git
cd fatsecret-mcp
npm install
# Create KV namespace and note the ID
npx wrangler kv namespace create OAUTH_KV
# Update wrangler.jsonc with your KV namespace ID
# Set the encryption secret (generate with: openssl rand -hex 32)
npx wrangler secret put COOKIE_ENCRYPTION_KEY
# Deploy
npm run deploy
用法
- 访问您部署的服务器URL(例如。
https://fatsecret-mcp-server.<you>.workers.dev) - 点击 设置您的帐户
- 输入您的FatSecret客户端ID、客户端密码和消费者密码
- 通过OAuth连接您的FatSecret帐户
- 将设置页面上显示的MCP配置复制到您的MCP客户端中
配置如下:
{
"mcpServers": {
"fatsecret": {
"url": "https://fatsecret-mcp-server.<you>.workers.dev/mcp",
"transport": {
"type": "http",
"headers": {
"Authorization": "Bearer <your-session-token>"
}
}
}
}
}
发展
npm run dev # Local dev server on port 8787
npm run test # Run tests (vitest)
npm run test:run # Run tests once
npm run type-check # TypeScript type checking
npm run format # Format with Biome
npm run lint:fix # Lint and auto-fix with Biome
许可证
麻省理工学院