Fitbit MCP Server

Integrations

  • Retrieves health and fitness data from a user's Fitbit account, including weight measurements, sleep logs, and user profile information. Currently supports endpoints for weight data by period, sleep data by date range, and profile details, with planned support for steps, heart rate, and activity data.

Fitbit MCP 服务器

该项目实现了一个模型上下文协议 (MCP) 服务器,充当 LLM(如 Claude)和 Fitbit API 之间的桥梁。

它允许 LLM 通过定义的工具从用户的 Fitbit 帐户请求和检索健康和健身数据。

特征

  • **Fitbit API 集成:**使用 OAuth 2.0 安全地连接到 Fitbit API。
  • **MCP 合规性:**通过符合模型上下文协议的工具公开 Fitbit 数据。
  • **可扩展:**旨在轻松添加对更多 Fitbit API 端点的支持。

支持的端点

  • 重量:
    • get_weight :检索截至今日的指定时间段( 1d7d30d3m6m1y )的原始体重数据。需要一个period参数。
  • 睡觉:
    • get_sleep_by_date_range :检索特定日期范围内(最多 100 天)的原始睡眠日志数据。需要YYYY-MM-DD格式的startDateendDate参数。
  • 轮廓:
    • get_profile :检索用户的 Fitbit 个人资料信息,包括姓名、年龄、性别、身高、体重和帐户信息等个人信息。

计划的端点

  • 步骤
  • 心率
  • 活动

设置

  1. 克隆存储库:
    git clone https://github.com/TheDigitalNinja/mcp-fitbit cd MCP-Server
  2. 安装依赖项:
    npm install
  3. 创建环境文件:
    • 在项目根目录 ( mcp-fitbit/ ) 中创建一个名为.env的文件。
    • 添加您的 Fitbit 应用程序凭证:
      FITBIT_CLIENT_ID=YOUR_FITBIT_CLIENT_ID FITBIT_CLIENT_SECRET=YOUR_FITBIT_CLIENT_SECRET
    • 您可以通过在dev.fitbit.com注册应用程序来获取这些。确保OAuth 2.0 应用程序类型设置为Personal回调 URLhttp://localhost:3000/callback
  4. 构建项目:
    npm run build
    这会将 TypeScript 源文件( src/ )编译为 JavaScript 文件( build/ )。

与 Claude 桌面版集成

要将此 Fitbit MCP 服务器与 Claude for Desktop 一起使用:

  1. 找到 Claude 配置文件:
    • 在 Windows 上,打开文件资源管理器并导航到%AppData%\Claude\
    • 在文本编辑器中打开claude_desktop_config.json文件。
  2. 添加服务器配置:
    • 在 JSON 文件中找到mcpServers键(如果不存在,则可能需要添加它)。
    • 添加 Fitbit 服务器条目。将C:\PATH\TO\PARENT\FOLDER\mcp-fitbit替换为您克隆此存储库的目录的绝对路径
    { "mcpServers": { "fitbit": { "command": "node", "args": [ "C:\\PATH\\TO\\PARENT\\FOLDER\\mcp-fitbit\\build\\index.js" ] } // Add other servers here if you have them } // ... other Claude settings ... }
    • **重要提示:**确保在 Windows 上的 JSON 文件中,路径使用双反斜杠 ( \\ )。
  3. 保存并重新启动:
    • 保存claude_desktop_config.json文件。
    • 重新启动 Claude for Desktop 应用程序。
  4. 首次运行和授权:
    • Claude 第一次连接到服务器时(例如,当您询问需要 Fitbit 工具的问题时),服务器将启动 Fitbit OAuth 2.0 授权流程。
    • 服务器的控制台窗口可能会短暂出现。
    • 服务器将尝试在您的默认 Web 浏览器中打开http://localhost:3000/auth
    • 如果浏览器没有自动打开,请手动导航到该 URL。
    • 登录您的 Fitbit 帐户并授予应用程序请求范围(体重和睡眠)的权限。
    • 您将被重定向到http://localhost:3000/callback
    • 浏览器选项卡中将显示一条成功消息,然后可以关闭该选项卡。
    • 服务器现已通过身份验证,Claude 可以使用 Fitbit 工具。

可用工具

一旦服务器运行并获得授权,连接的 LLM 将可以使用以下工具:

  • get_weight :获取截至今天指定时间段的原始重量时间序列数据作为 JSON 字符串。
    • 参数: period (字符串,必需)- 指定持续时间。必须是以下之一: "1d""7d""30d""3m""6m""1y"
    • 示例用法(概念): get_weight(period="7d")
  • get_sleep_by_date_range :获取指定日期范围(最多 100 天)的原始睡眠日志数据作为 JSON 字符串。
    • 参数:
      • startDate (字符串,必需) - 以YYYY-MM-DD格式指定开始日期。
      • endDate (字符串,必需) - 以YYYY-MM-DD格式指定结束日期。
    • 示例用法(概念): get_sleep_by_date_range(startDate="2025-04-01", endDate="2025-04-30")
  • get_profile :以 JSON 字符串形式获取用户的 Fitbit 个人资料信息。
    • **参数:**无必需。
    • 示例用法(概念): get_profile()

发展

  • 源代码位于src/目录中。
  • 对 TypeScript 文件进行更改后运行npm run build
  • 如果服务器已经通过 Claude 运行,请重新启动 Claude for Desktop 以确保它获取最新版本。

You must be authenticated.

A
security – no known vulnerabilities
F
license - not found
A
quality - confirmed to work

local-only server

The server can only run on the client's local machine because it depends on local resources.

模型上下文协议服务器将 LLM(如 Claude)与 Fitbit API 连接起来,允许 LLM 通过定义的工具请求和检索用户健康和健身数据。

  1. 特征
    1. 支持的端点
    2. 计划的端点
  2. 设置
    1. 与 Claude 桌面版集成
      1. 可用工具
        1. 发展

          Related MCP Servers

          • -
            security
            F
            license
            -
            quality
            A Model Context Protocol server for tracking personal health and well-being, offering tools for workout logging, nutrition management, and daily journaling with AI-assisted analysis integration.
            Last updated -
            2
            Python
          • -
            security
            A
            license
            -
            quality
            A Model Context Protocol server that provides health data from the Senechal API to LLM applications, enabling AI assistants to access, analyze, and respond to personal health information.
            Last updated -
            Python
            GPL 3.0
            • Linux
            • Apple
          • -
            security
            F
            license
            -
            quality
            A Model Context Protocol server that provides language models with access to personal Whoop fitness data, allowing queries for cycles, recovery, strain, and workout information from the Whoop API.
            Last updated -
            2
            Python
            • Apple
          • A
            security
            A
            license
            A
            quality
            A Model Context Protocol server that provides basic mathematical and statistical functions to LLMs, enabling them to perform accurate numerical calculations through a simple API.
            Last updated -
            13
            2
            TypeScript
            MIT License

          View all related MCP servers

          ID: jcowqolhlh