ActivityWatch MCP Server

ActivityWatch MCP Server

site icon
2025.03.29 8
TypeScript时间追踪数据分析开发效率
ActivityWatch MCP Server 是一个模型上下文协议(MCP)服务器,用于连接 ActivityWatch 时间追踪工具,使像 Claude 这样的 LLM 能够与用户的时间追踪数据进行交互。它提供了查看 ActivityWatch 存储桶、执行查询、获取原始事件和访问设置等功能。
View on GitHub

Overview

基本能力

产品定位

ActivityWatch MCP Server 是一个模型上下文协议(MCP)服务器,用于连接 ActivityWatch 时间追踪工具,使像 Claude 这样的 LLM 能够与用户的时间追踪数据进行交互。

核心功能

  • List Buckets: 查看所有可用的 ActivityWatch 存储桶
  • Run Queries: 执行强大的 AQL(ActivityWatch 查询语言)查询
  • Get Raw Events: 直接从任何存储桶中检索事件
  • Get Settings: 访问 ActivityWatch 配置设置

适用场景

  • 查看应用程序使用情况
  • 分析浏览历史
  • 检查生产力
  • 访问和修改 ActivityWatch 设置

工具列表

  1. list-buckets: 列出所有可用的 ActivityWatch 存储桶,支持按类型过滤。
  2. run-query: 运行 ActivityWatch 查询语言(AQL)查询。
  3. get-events: 从 ActivityWatch 存储桶中获取原始事件。
  4. get-settings: 获取 ActivityWatch 服务器设置。

常见问题解答

  • ActivityWatch 未运行: 确保 ActivityWatch 正在运行并可访问 http://localhost:5600。
  • 查询错误: 检查查询语法、存储桶 ID 和时间段是否正确。
  • Claude/MCP 查询格式问题: 确保查询遵循正确的格式,所有查询语句应在一个字符串中。

使用教程

使用依赖

  • ActivityWatch 已安装并运行
  • Node.js(v14 或更高版本)
  • Claude for Desktop(或任何其他 MCP 客户端)

安装教程

从 npm 安装(即将推出)

# 全局安装
npm install -g activitywatch-mcp-server

# 或本地安装
npm install activitywatch-mcp-server

从源代码构建

  1. 克隆仓库: bash git clone https://github.com/8bitgentleman/activitywatch-mcp-server.git cd activitywatch-mcp-server

  2. 安装依赖: bash npm install

  3. 构建项目: bash npm run build

调试方式

  1. 打开 Claude for Desktop 配置文件:
  2. Windows: %APPDATA%\Claude\claude_desktop_config.json
  3. macOS: ~/Library/Application Support/Claude/claude_desktop_config.json

  4. 添加 MCP 服务器配置:

{
  "mcpServers": {
    "activitywatch": {
      "command": "activitywatch-mcp-server",
      "args": []
    }
  }
}

如果从源代码构建,使用:

{
  "mcpServers": {
    "activitywatch": {
      "command": "node",
      "args": ["/path/to/activitywatch-mcp-server/dist/index.js"]
    }
  }
}
  1. 重启 Claude for Desktop
  2. 在 Claude 界面中查找 MCP 图标以确认其正常工作

许可证

该项目遵循 MIT 开源许可条款,请参阅 MIT 了解完整条款。