Skip to main content
Glama
fliptheweb

FatSecret MCP Server

by fliptheweb

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 将引导您完成设置:

  1. check_auth_status — 检测缺失的凭据并告知您该怎么做

  2. setup_credentials — 您提供 API 密钥(保存到 ~/.fatsecret-mcp/config.json

  3. start_authcomplete_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"
      }
    }
  }
}

🔑 如何获取凭据

  1. platform.fatsecret.com 创建免费账户

  2. 导航至 我的账户 → API 密钥

  3. 您将看到三个值:

    • 客户端 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

🛠️ 可用工具

工具

描述

🔐 设置与身份验证

check_auth_status

检查凭据和资料身份验证是否已配置。请先调用此工具。

setup_credentials

将 FatSecret API 凭据保存到持久配置

start_auth

启动 OAuth 1.0 授权 — 返回用户需要访问的 URL

complete_auth

使用授权页面中的验证器 PIN 完成 OAuth

🔍 食物搜索 (公共)

search_foods

搜索食物数据库

get_food

获取食物的详细营养信息

find_food_by_barcode

通过 GTIN-13 条形码查找食物

autocomplete_foods

获取搜索自动补全建议

🍳 食谱 (公共)

search_recipes

使用筛选条件搜索食谱

get_recipe

获取食谱详情,包括食材和步骤

📚 参考数据 (公共)

get_food_categories

获取食物类别

get_food_sub_categories

获取食物子类别

get_brands

获取食物品牌

get_recipe_types

获取食谱类型

📝 饮食日记 (资料身份验证)

get_food_entries

获取指定日期的饮食日记条目

get_food_entries_month

获取月度营养摘要(每日热量和宏量营养素)

create_food_entry

添加饮食日记条目

edit_food_entry

编辑饮食日记条目

delete_food_entry

删除饮食日记条目

copy_food_entries

将条目从一个日期复制到另一个日期

copy_saved_meal_entries

将已保存餐食复制到指定日期

⭐ 收藏夹 (资料身份验证)

get_favorite_foods

获取收藏的食物

delete_favorite_food

从收藏夹中移除食物

get_most_eaten_foods

获取最常吃的食物

get_recently_eaten_foods

获取最近吃过的食物

get_favorite_recipes

获取收藏的食谱

add_favorite_recipe

将食谱添加到收藏夹

delete_favorite_recipe

从收藏夹中移除食谱

🍽️ 已保存餐食 (资料身份验证)

get_saved_meals

获取已保存的餐食

create_saved_meal

创建已保存的餐食

edit_saved_meal

编辑已保存的餐食

delete_saved_meal

删除已保存的餐食

get_saved_meal_items

获取已保存餐食中的项目

add_saved_meal_item

向已保存餐食添加食物

edit_saved_meal_item

编辑已保存餐食中的项目

delete_saved_meal_item

从已保存餐食中移除项目

⚖️ 体重 (资料身份验证)

update_weight

记录指定日期的体重

get_weight_month

获取指定月份的体重历史

🏃♂️ 运动 (资料身份验证)

get_exercises

获取运动类型

edit_exercise_entries

在活动之间调整运动时间

get_exercise_entries_month

获取指定月份的运动数据

save_exercise_template

保存工作日的运动模板

👤 个人资料 (资料身份验证)

get_profile

获取用户资料信息

create_food

创建自定义食物(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 等)

🔧 开发

  1. 克隆仓库

  2. npm install

  3. .env.example 复制为 .env 并填写您的凭据

  4. 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 文件。

Install Server
A
license - permissive license
A
quality
B
maintenance

Maintenance

Maintainers
Response time
7wRelease cycle
4Releases (12mo)
Commit activity

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

View all related MCP servers

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.

View all MCP Connectors

Latest Blog Posts

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