mcp-server-harvest-time-tracking

mcp-server-harvest-time-tracking

为Harvest实现的模型上下文协议(MCP)服务器,能够与MCP客户端无缝集成。该项目提供了一种标准化的方式通过模型上下文协议与Harvest交互。这本质上是以MCP格式封装了Harvest API。

概述

mcp-server-harvest-time-tracking 是一个为 Harvest 时间跟踪服务实现的模型上下文协议(MCP)服务器,允许 MCP 客户端(如 Claude Desktop)以标准方式与 Harvest API 交互。

功能

  • ✅ 时间条目管理:创建、读取、更新、删除、启动/停止
  • ✅ 客户管理:列出、获取、创建、更新、删除
  • ✅ 项目管理:列出、获取、创建、更新、删除
  • ✅ 报告:客户、项目、任务和团队时间报告

快速设置

1. 安装

git clone https://github.com/your-username/mcp-server-harvest-time-tracking.git
cd mcp-server-harvest-time-tracking
make setup

2. 配置凭据

设置环境变量或创建 .env 文件:

HARVEST_ACCOUNT_ID=<您的Harvest账户ID>
HARVEST_ACCESS_TOKEN=<您的Harvest访问令牌>

3. 与 Claude Desktop 集成

编辑 claude_desktop_config.json

{
  "mcpServers": {
    "mcp-server-harvest-time-tracking": {
      "command": "python",
      "args": ["-m", "src.server"],
      "cwd": "/path/to/mcp-server-harvest-time-tracking",
      "env": {
        "HARVEST_ACCOUNT_ID": "your-harvest-account-id",
        "HARVEST_ACCESS_TOKEN": "your-harvest-access-token"
      }
    }
  }
}

4. 手动运行 (可选)

make run

使用示例

时间条目

# 列出时间条目
time_entries = list_time_entries(user_id=123, from_date="2023-01-01")

# 创建时间条目
entry = create_time_entry_duration(
    project_id=456,
    task_id=789,
    spent_date="2023-01-15",
    hours=2.5,
    notes="Working on documentation"
)

# 停止计时器
result = stop_time_entry(time_entry_id=12345)

项目管理

# 列出项目
projects = list_projects(is_active=True)

# 创建项目
new_project = create_project(
    client_id=123,
    name="New Website Development",
    code="NWD-2023",
    is_billable=True
)

报告

# 获取项目时间报告
report = get_projects_time_report(
    from_date="2023-01-01",
    to_date="2023-01-31"
)

其他信息

  • 依赖项:mcp, requests, python-dotenv
  • 更多命令:make test, make clean
  • 许可证:MIT

欢迎贡献!请查看完整文档了解更多细节。