MCP Toggl Server

MCP Toggl Server

Enables time tracking and reporting through Toggl Track integration with intelligent caching. Supports starting/stopping timers, generating daily/weekly reports, and managing projects with structured JSON output for automation workflows.

Category
访问服务器

README

MCP Toggl Server

A Model Context Protocol (MCP) server for Toggl Track integration, providing time tracking and reporting capabilities with intelligent caching for optimal performance.

Features

  • Time Tracking: Start/stop timers, get current and past time entries
  • Smart Reporting: Daily/weekly reports with project and workspace breakdowns
  • Performance Optimized: Intelligent caching system minimizes API calls
  • Data Hydration: Automatically enriches time entries with project/workspace/client names
  • Flexible Filtering: Query by date ranges, workspaces, or projects
  • Automation Ready: Structured JSON output perfect for Automation Hub workflows

Installation

npm install
npm run build

Configuration

  1. Get your Toggl API key from: https://track.toggl.com/profile

  2. Create a .env file:

TOGGL_API_KEY=your_api_key_here

# Optional configuration
TOGGL_DEFAULT_WORKSPACE_ID=123456  # Your default workspace
TOGGL_CACHE_TTL=3600000            # Cache TTL in ms (default: 1 hour)
TOGGL_CACHE_SIZE=1000              # Max cached entities (default: 1000)
  1. Add to your MCP configuration:

Claude Desktop

Edit ~/Library/Application Support/Claude/claude_desktop_config.json:

{
  "mcpServers": {
    "mcp-toggl": {
      "command": "node",
      "args": ["/path/to/mcp-toggl/dist/index.js"],
      "env": {
        "TOGGL_API_KEY": "your_api_key_here"
      }
    }
  }
}

Cursor

Edit .mcp.json in your project:

{
  "mcpServers": {
    "mcp-toggl": {
      "command": "node",
      "args": ["./mcp-servers/mcp-toggl/dist/index.js"],
      "env": {
        "TOGGL_API_KEY": "your_api_key_here"
      }
    }
  }
}

Available Tools

Time Tracking

toggl_get_time_entries

Get time entries with optional filters.

{
  "period": "today",  // or: yesterday, week, lastWeek, month, lastMonth
  "workspace_id": 123456,
  "project_id": 789012
}

toggl_get_current_entry

Get the currently running timer.

toggl_start_timer

Start a new time entry.

{
  "description": "Working on MCP server",
  "project_id": 123456,
  "tags": ["development", "mcp"]
}

toggl_stop_timer

Stop the currently running timer.

Reporting

toggl_daily_report

Generate a daily report with project/workspace breakdowns.

{
  "date": "2024-09-01",
  "format": "json"  // or "text" for formatted output
}

toggl_weekly_report

Generate a weekly report with daily breakdowns.

{
  "week_offset": 0,  // 0 = this week, -1 = last week
  "format": "json"
}

toggl_project_summary

Get total hours per project for a date range.

{
  "period": "month",
  "workspace_id": 123456
}

toggl_workspace_summary

Get total hours per workspace.

Management

toggl_list_workspaces

List all available workspaces.

toggl_list_projects

List projects in a workspace.

{
  "workspace_id": 123456
}

toggl_list_clients

List clients in a workspace.

Cache Management

toggl_warm_cache

Pre-fetch workspace/project/client data for better performance.

toggl_cache_stats

View cache performance metrics.

toggl_clear_cache

Clear all cached data.

Performance Optimization

The server uses an intelligent caching system to minimize API calls:

  1. First Run: Warms cache by fetching workspaces, projects, and clients
  2. Subsequent Calls: Uses cached names for hydration (95%+ cache hit rate)
  3. Smart Invalidation: TTL-based expiry with configurable duration
  4. Memory Efficient: LRU eviction keeps memory usage under 10MB

Typical Performance

  • First report: 2-3 API calls (warm cache + get entries)
  • Subsequent reports: 1 API call (just time entries)
  • Cache hit rate: >95% for typical usage

Usage Examples

Daily Standup Report

// Get today's time entries with full details
toggl_daily_report({ "format": "text" })

Weekly Summary for Automation Hub

// Get last week's data as JSON
toggl_weekly_report({ "week_offset": -1 })

Project Hours Tracking

// Get this month's hours by project
toggl_project_summary({ "period": "month" })

Integration with Automation Hub

The server returns structured JSON perfect for Automation Hub workflows:

// Example daily report output
{
  "date": "2024-09-01",
  "total_hours": 8.5,
  "by_project": [
    {
      "project_name": "MCP Development",
      "client_name": "Internal",
      "total_hours": 4.5,
      "billable_hours": 0
    }
  ],
  "by_workspace": [
    {
      "workspace_name": "Very Good Plugins",
      "total_hours": 8.5,
      "project_count": 3
    }
  ]
}

Troubleshooting

API Key Issues

  • Ensure your API key is correct (get from https://track.toggl.com/profile)
  • API key goes in the username field, "api_token" as password for basic auth

Rate Limiting

  • The server implements automatic retry with exponential backoff
  • Respects Toggl's rate limits (max 1 request per second)

Cache Issues

  • Run toggl_clear_cache if data seems stale
  • Adjust TOGGL_CACHE_TTL for your needs (default: 1 hour)

Development

# Run in development mode
npm run dev

# Build for production
npm run build

# Test the server
npm test

License

GPL-3.0

Support

For issues or questions, please open an issue on GitHub.


Built with 🧡 for the open source community by Very Good Plugins

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选