FatSecret营养API服务器

FatSecret MCP Server是一个部署在Cloudflare Workers上的远程模型上下文协议服务器,用于访问FatSecret营养API,提供食物搜索、食谱查询、用户饮食记录等功能。

  • by thaynam
  • TypeScript
  • 本地部署
  • 更新于
在 GitHub 查看 thaynam/fatsecret-mcp-server

使用说明

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 检查当前身份验证状态

自我寄宿

先决条件

部署

# 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

用法

  1. 访问您部署的服务器URL(例如。 https://fatsecret-mcp-server.<you>.workers.dev)
  2. 点击 设置您的帐户
  3. 输入您的FatSecret客户端ID、客户端密码和消费者密码
  4. 通过OAuth连接您的FatSecret帐户
  5. 将设置页面上显示的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

许可证

麻省理工学院