FatSecret MCP Server
FatSecret MCP Server
[!IMPORTANT] 这不是 FatSecret 的官方 MCP 服务器。 它使用了 FatSecret 平台 API,需要免费开发者账号。
这是一个 MCP(模型上下文协议)服务器,可将 Claude/Cursor 连接到 FatSecret 平台 API。您可以直接通过 AI 助手搜索食物、记录饮食、管理食谱和监测体重。
NPM 可用:npx fatsecret-mcp | Claude Desktop 扩展:fatsecret-mcp.mcpb
✨ 功能特性
🔐 身份验证 — 交互式凭据设置和 OAuth 授权
🔍 食物搜索 — 搜索 FatSecret 庞大的食物数据库,获取详细营养数据
📷 条形码查询 — 通过 GTIN-13 条形码查找食物
🍳 食谱搜索 — 按热量、宏量和准备时间浏览和筛选食谱
📝 饮食日记 — 添加、编辑、复制和删除饮食日记条目
🍽️ 已保存餐食 — 创建和管理可重复使用的餐食模板
⚖️ 体重追踪 — 记录和查看体重历史
🏃♂️ 运动追踪 — 查看运动项目和管理活动条目
⭐ 收藏夹 — 管理收藏的食物和食谱
Related MCP server: fatsecret-mcp-server
🚀 快速开始
添加到您的 MCP 客户端配置:
{
"mcpServers": {
"fatsecret": {
"command": "npx",
"args": ["-y", "fatsecret-mcp"]
}
}
}就这样!首次使用时,AI 将引导您完成设置:
check_auth_status— 检测缺失的凭据并告知您该怎么做setup_credentials— 您提供 API 密钥(保存到~/.fatsecret-mcp/config.json)start_auth→complete_auth— 授权您的 FatSecret 账户以使用日记/体重工具
或者,您也可以将凭据作为环境变量传递:
{
"mcpServers": {
"fatsecret": {
"command": "npx",
"args": ["-y", "fatsecret-mcp"],
"env": {
"FATSECRET_CLIENT_ID": "your_client_id",
"FATSECRET_CLIENT_SECRET": "your_client_secret",
"FATSECRET_CONSUMER_SECRET": "your_consumer_secret"
}
}
}
}🔑 如何获取凭据
在 platform.fatsecret.com 创建免费账户
导航至 我的账户 → API 密钥
您将看到三个值:
客户端 ID(用于 OAuth 2.0 和 OAuth 1.0)
客户端密钥(OAuth 2.0 - 用于公共食物/食谱搜索)
消费者密钥(OAuth 1.0 - 用于用户资料/日记访问)
📖 分步指南:FatSecret API 入门
Claude Desktop(扩展)
下载并使用 Claude Desktop 打开 fatsecret-mcp.mcpb。系统将提示您输入 FatSecret 凭据 — 密钥将安全存储在操作系统钥匙串中。
更多详情请参阅使用 MCPB 构建桌面扩展。
Claude Desktop(手动)
~/Library/Application Support/Claude/claude_desktop_config.json
Claude Code(CLI)
claude mcp add fatsecret -- npx -y fatsecret-mcp或使用环境变量:
claude mcp add fatsecret \
-e FATSECRET_CLIENT_ID=your_client_id \
-e FATSECRET_CLIENT_SECRET=your_client_secret \
-e FATSECRET_CONSUMER_SECRET=your_consumer_secret \
-- npx -y fatsecret-mcp使用 claude mcp list 验证。
Cursor
设置界面 —
设置 → MCP → + 添加新的 MCP 服务器,然后填写命令、参数和环境变量项目配置 — 在项目根目录的
.cursor/mcp.json中添加 JSON全局配置 — 在
~/.cursor/mcp.json中添加 JSON
🛠️ 可用工具
工具 | 描述 |
🔐 设置与身份验证 | |
| 检查凭据和资料身份验证是否已配置。请先调用此工具。 |
| 将 FatSecret API 凭据保存到持久配置 |
| 启动 OAuth 1.0 授权 — 返回用户需要访问的 URL |
| 使用授权页面中的验证器 PIN 完成 OAuth |
🔍 食物搜索 (公共) | |
| 搜索食物数据库 |
| 获取食物的详细营养信息 |
| 通过 GTIN-13 条形码查找食物 |
| 获取搜索自动补全建议 |
🍳 食谱 (公共) | |
| 使用筛选条件搜索食谱 |
| 获取食谱详情,包括食材和步骤 |
📚 参考数据 (公共) | |
| 获取食物类别 |
| 获取食物子类别 |
| 获取食物品牌 |
| 获取食谱类型 |
📝 饮食日记 (资料身份验证) | |
| 获取指定日期的饮食日记条目 |
| 获取月度营养摘要(每日热量和宏量营养素) |
| 添加饮食日记条目 |
| 编辑饮食日记条目 |
| 删除饮食日记条目 |
| 将条目从一个日期复制到另一个日期 |
| 将已保存餐食复制到指定日期 |
⭐ 收藏夹 (资料身份验证) | |
| 获取收藏的食物 |
| 从收藏夹中移除食物 |
| 获取最常吃的食物 |
| 获取最近吃过的食物 |
| 获取收藏的食谱 |
| 将食谱添加到收藏夹 |
| 从收藏夹中移除食谱 |
🍽️ 已保存餐食 (资料身份验证) | |
| 获取已保存的餐食 |
| 创建已保存的餐食 |
| 编辑已保存的餐食 |
| 删除已保存的餐食 |
| 获取已保存餐食中的项目 |
| 向已保存餐食添加食物 |
| 编辑已保存餐食中的项目 |
| 从已保存餐食中移除项目 |
⚖️ 体重 (资料身份验证) | |
| 记录指定日期的体重 |
| 获取指定月份的体重历史 |
🏃♂️ 运动 (资料身份验证) | |
| 获取运动类型 |
| 在活动之间调整运动时间 |
| 获取指定月份的运动数据 |
| 保存工作日的运动模板 |
👤 个人资料 (资料身份验证) | |
| 获取用户资料信息 |
| 创建自定义食物(Premier 版) |
API 参考:FatSecret Postman 集合
🧪 测试连接
npx fatsecret-mcp或使用环境变量:
FATSECRET_CLIENT_ID='...' FATSECRET_CLIENT_SECRET='...' FATSECRET_CONSUMER_SECRET='...' npx fatsecret-mcp📋 系统要求
Node.js 18+
FatSecret 平台 API 账户(platform.fatsecret.com)
兼容 MCP 的客户端(Claude Desktop、Cursor 等)
🔧 开发
克隆仓库
npm install将
.env.example复制为.env并填写您的凭据npm run dev以开发模式运行
使用 MCP Inspector 调试:
FATSECRET_CLIENT_ID=X FATSECRET_CLIENT_SECRET=X FATSECRET_CONSUMER_SECRET=X npx -y @modelcontextprotocol/inspector npx <local-path>/fatsecret-mcp📄 许可证
MIT 许可证 - 详情请参阅 LICENSE 文件。
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
- Flicense-qualityDmaintenanceProvides AI assistants with real-time access to nutrition data from USDA FoodData Central and FatSecret, enabling accurate answers with citations for nutrition queries.
- Alicense-qualityDmaintenanceEnables searching and retrieving nutrition data, recipes, and managing food diary entries through the FatSecret API.MIT
- Alicense-qualityDmaintenanceEnables AI assistants to read and write MyFitnessPal data, including food diary, exercises, body measurements, nutrition goals, and water intake.MIT
- Alicense-qualityDmaintenanceEnables AI assistants to read and log MyFitnessPal nutrition data, including tracking calories, macros, searching foods, and adding meals through natural conversation.17MIT
Related MCP Connectors
Spoonacular food API: recipes, nutrition, ingredients, meal plans. Free 150/day.
Barcode lookup, nutrition search, and product comparison for 3M+ crowd-sourced food products.
Personal nutrition tracking — log meals, track macros, review history, import from another app.
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/fliptheweb/fatsecret-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server