时间跟踪服务器

mite MCP Server 是一个用于团队时间跟踪的API服务器,支持时间条目管理、秒表功能以及客户、项目和服务的管理。

  • by MarceloEmmerich
  • TypeScript
  • 本地部署
  • 1 星标
  • 更新于
在 GitHub 查看 marceloemmerich/mite-mcp

使用说明

mite MCP服务器

用于mite时间跟踪API的模型上下文协议服务器。

螨虫 –为团队提供简单的时间跟踪

先决条件

  • Node.js 18+
  • 启用API访问权限的mite帐户
  • mite API密钥(推荐)或电子邮件/密码

安装

npm install -g @marceloemmerich/mite-mcp

或者直接与npx一起使用:

npx @marceloemmerich/mite-mcp

配置

为了发展

  1. 复制 .env.example 向 .env:

    cp .env.example .env
    
  2. 编辑 .env 并填写您的凭据:

    MITE_ACCOUNT_NAME=your-account-name
    MITE_API_KEY=your-api-key
    

用于生产

设置以下环境变量:

# Required
MITE_ACCOUNT_NAME=your-account-name

# Authentication (use one of these)
MITE_API_KEY=your-api-key  # Recommended

# OR
MITE_EMAIL=your-email@example.com
MITE_PASSWORD=your-password

获取您的mite API密钥

  1. 登录您的mite帐户
  2. 前往“设置”>“我的用户”
  3. 在“API密钥”下,点击“显示API密钥”
  4. 复制密钥并将其设置为 MITE_API_KEY

可用工具

时间条目

  • list_time_entries -使用可选筛选器列出时间条目
  • get_daily_time_entries -获取今天或特定日期的时间条目
  • get_time_entry -按ID获取特定时间条目
  • create_time_entry -创建新的时间条目
  • update_time_entry -更新现有时间条目
  • delete_time_entry -删除时间条目

秒表

  • get_stopwatch_status -获取当前秒表状态
  • start_stopwatch -开始跟踪条目的时间
  • stop_stopwatch -停止当前正在运行的秒表
  • quick_start_stopwatch -创建并开始跟踪新条目

客户

  • list_customers -列出活跃或已存档的客户
  • get_customer -获取特定客户
  • create_customer -创建新客户(仅限管理员)
  • update_customer -更新客户(仅限管理员)
  • delete_customer -删除客户(仅限管理员)

项目

  • list_projects -列出活动或存档项目
  • get_project -获取特定项目
  • create_project -创建新项目(仅限管理员)
  • update_project -更新项目(仅限管理员)
  • delete_project -删除项目(仅限管理员)

服务

  • list_services -列出活动或已存档的服务
  • get_service -获取特定服务
  • create_service -创建新服务(仅限管理员)
  • update_service -更新服务(仅限管理员)
  • delete_service -删除服务(仅限管理员)

用法

MCP服务器模式

mite MCP服务器支持两种模式:

1.标准模式(默认)

用于Claude Desktop和其他使用stdio传输的MCP客户端:

# Default stdio mode
npx @marceloemmerich/mite-mcp

# Explicitly specify stdio mode
npx @marceloemmerich/mite-mcp --stdio

2.HTTP/流模式

对于基于web的客户端或测试环境:

# HTTP/Streamable mode on default port 3000
npx @marceloemmerich/mite-mcp --http

# HTTP/Streamable mode on custom port and host
npx @marceloemmerich/mite-mcp --http --port 8080 --host 0.0.0.0

HTTP端点:

  • POST / -处理MCP JSON-RPC请求
  • GET / -建立SSE流(需要Mcp会话Id标头)
  • DELETE / -终止会话(需要Mcp会话Id标头)

CLI选项

mite-mcp [options]

Options:
  -V, --version      output the version number
  --stdio            Run in stdio mode (default)
  --http             Run in HTTP/Streamable mode
  -p, --port <port>  Port for HTTP server (default: 3000)
  -h, --host <host>  Host for HTTP server (default: localhost)
  --help             display help for command

Claude桌面配置

添加到您的Claude Desktop配置中:

{
  "mcpServers": {
    "mite": {
      "command": "npx",
      "args": ["@marceloemmerich/mite-mcp"],
      "env": {
        "MITE_ACCOUNT_NAME": "your-account-name",
        "MITE_API_KEY": "your-api-key"
      }
    }
  }
}

对于Claude Desktop的开发测试,您还可以使用:

{
  "mcpServers": {
    "mite-dev": {
      "command": "node",
      "args": ["dist/index.js"],
      "cwd": "/path/to/mite-mcp",
      "env": {
        "MITE_ACCOUNT_NAME": "your-account-name",
        "MITE_API_KEY": "your-api-key"
      }
    }
  }
}

您也可以直接从CLI运行,如下所示:

export MITE_ACCOUNT_NAME=<YOUR-ACCOUNT-NAME> && export MITE_API_KEY=<YOUR-API-KEY> && npx @marceloemmerich/mite-mcp --http --port 3000

发展

# Clone the repository
git clone https://github.com/marceloemmerich/mite-mcp.git
cd mite-mcp

# Install dependencies
npm install

# Run in development mode (stdio)
npm run dev

# Run in HTTP/Streamable mode for testing
npm run dev -- --http --port 3000

# Run tests
npm test

# Run tests with coverage
npm run test:coverage

# Build for production
npm run build

# Lint and format code
npm run lint:fix

测试HTTP/流模式

为了测试HTTP/Streamable服务器模式,您可以使用以下工具:

# Test initialization (this will return a session ID)
curl -X POST http://localhost:3000/ \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{"roots":{"listChanged":true},"sampling":{}}},"id":1}'

# Test with session ID (replace SESSION_ID with the actual session ID from initialization)
curl -X GET http://localhost:3000/ \
  -H "Mcp-Session-Id: SESSION_ID"

使用Claude Desktop进行开发

对于本地开发,请更新您的Claude Desktop配置:

{
  "mcpServers": {
    "mite-dev": {
      "command": "npm",
      "args": ["run", "dev"],
      "cwd": "/path/to/mite-mcp",
      "env": {
        "MITE_ACCOUNT_NAME": "your-account-name",
        "MITE_API_KEY": "your-api-key"
      }
    }
  }
}

API文档

有关mite API的详细文档,请访问:https://mite.de/api/

许可证

麻省理工学院