timedoctor-mcp

timedoctor-mcp

MCP Server for extracting Time Doctor time tracking data via AI assistants.

Category
Visit Server

README

Time Doctor MCP

MCP Server for extracting Time Doctor time tracking data via AI assistants.

Buy Me A Coffee

What It Does

Fetches time tracking reports from Time Doctor and returns them as CSV data. Integrates with AI assistants via the Model Context Protocol (MCP).

Supports:

  • šŸ¤– Claude Desktop & Claude Code
  • šŸŽÆ Cursor IDE
  • ✨ Google Gemini CLI
  • šŸ’» VS Code with GitHub Copilot

Features:

  • šŸš€ Single-session scraping (login once, get multiple dates)
  • šŸ“… Works with any date range (1 day to 365+ days)
  • šŸ“Š Returns CSV data as text (no file system issues)
  • ā±ļø Parses Time Doctor's "3h 50m" format
  • šŸ“¦ Aggregates duplicate tasks
  • āœ… Includes TOTAL row

Installation Methods

Option A: Using uvx (Easiest - No Installation Required)

The simplest way to use Time Doctor MCP is with uvx, which automatically downloads the package from PyPI and runs it locally without manual installation:

Claude Desktop/Code:

{
  "mcpServers": {
    "timedoctor": {
      "command": "uvx",
      "args": ["timedoctor-mcp"],
      "env": {
        "TD_EMAIL": "your-email@example.com",
        "TD_PASSWORD": "your-password",
        "TD_BASE_URL": "https://2.timedoctor.com",
        "HEADLESS": "true"
      }
    }
  }
}

Prerequisites:

  1. Install uv: brew install uv (macOS) or see uv installation

  2. Install Playwright browsers (one-time setup):

    uvx --with playwright playwright install chromium
    

    This downloads the Chromium browser binaries needed for web scraping (~130MB). You only need to run this once.

That's it! No cloning, no virtual environments, no setup scripts. Just add the configuration and restart your AI assistant.

Option B: Clone & Install (For Development)

# Clone the repository
git clone https://github.com/frifster/timedoctor-mcp.git
cd timedoctor-mcp

# Install UV (fastest method)
brew install uv

# Run setup
./setup-with-uv.sh

2. Configure Credentials

Create .env in the project root:

nano .env

Add your Time Doctor credentials:

TD_EMAIL=your-email@example.com
TD_PASSWORD=your-password
TD_BASE_URL=https://2.timedoctor.com
HEADLESS=true

3. Add to Claude Desktop/Code

Edit your Claude MCP configuration:

macOS:

open ~/Library/Application\ Support/Claude/claude_desktop_config.json

Windows:

notepad %APPDATA%\Claude\claude_desktop_config.json

Linux:

nano ~/.config/Claude/claude_desktop_config.json

Add this configuration (replace <PATH_TO_REPO> with your actual path):

Option A: Credentials in JSON

{
  "mcpServers": {
    "timedoctor": {
      "command": "<PATH_TO_REPO>/.venv/bin/python",
      "args": ["<PATH_TO_REPO>/src/mcp_server.py"],
      "env": {
        "TD_EMAIL": "your-email@example.com",
        "TD_PASSWORD": "your-password",
        "TD_BASE_URL": "https://2.timedoctor.com",
        "HEADLESS": "true"
      }
    }
  }
}

Option B: Load from .env (Recommended)

{
  "mcpServers": {
    "timedoctor": {
      "command": "<PATH_TO_REPO>/.venv/bin/python",
      "args": ["<PATH_TO_REPO>/src/mcp_server.py"]
    }
  }
}

Example paths:

  • macOS: /Users/yourname/timedoctor-mcp/.venv/bin/python
  • Linux: /home/yourname/timedoctor-mcp/.venv/bin/python
  • Windows: C:\Users\yourname\timedoctor-mcp\.venv\Scripts\python.exe

4. Restart Claude

Completely quit and reopen Claude Desktop/Code.

Alternative MCP Clients

This MCP server also works with other AI assistants that support the Model Context Protocol:

Cursor IDE

Edit your Cursor MCP configuration file:

macOS/Linux:

nano ~/.cursor/mcp.json

Windows:

notepad %USERPROFILE%\.cursor\mcp.json

Using uvx (easiest):

{
  "mcpServers": {
    "timedoctor": {
      "command": "uvx",
      "args": ["timedoctor-mcp"],
      "env": {
        "TD_EMAIL": "your-email@example.com",
        "TD_PASSWORD": "your-password",
        "TD_BASE_URL": "https://2.timedoctor.com",
        "HEADLESS": "true"
      }
    }
  }
}

Using local installation (for development):

{
  "mcpServers": {
    "timedoctor": {
      "command": "<PATH_TO_REPO>/.venv/bin/python",
      "args": ["<PATH_TO_REPO>/src/mcp_server.py"],
      "env": {
        "TD_EMAIL": "your-email@example.com",
        "TD_PASSWORD": "your-password",
        "TD_BASE_URL": "https://2.timedoctor.com",
        "HEADLESS": "true"
      }
    }
  }
}

Note: You can also create a project-specific configuration at .cursor/mcp.json in your project root.

Restart Cursor after saving the configuration.

Google Gemini CLI

Edit your Gemini CLI settings:

macOS/Linux:

nano ~/.gemini/settings.json

Windows:

notepad %USERPROFILE%\.gemini\settings.json

Using uvx (easiest):

{
  "mcpServers": {
    "timedoctor": {
      "command": "uvx",
      "args": ["timedoctor-mcp"],
      "env": {
        "TD_EMAIL": "your-email@example.com",
        "TD_PASSWORD": "your-password",
        "TD_BASE_URL": "https://2.timedoctor.com",
        "HEADLESS": "true"
      },
      "timeout": 600000
    }
  }
}

Using local installation (for development):

{
  "mcpServers": {
    "timedoctor": {
      "command": "<PATH_TO_REPO>/.venv/bin/python",
      "args": ["<PATH_TO_REPO>/src/mcp_server.py"],
      "env": {
        "TD_EMAIL": "your-email@example.com",
        "TD_PASSWORD": "your-password",
        "TD_BASE_URL": "https://2.timedoctor.com",
        "HEADLESS": "true"
      },
      "timeout": 600000
    }
  }
}

Optional settings:

  • timeout: Request timeout in milliseconds (default: 600,000ms)
  • trust: Set to true to skip tool confirmations

Restart Gemini CLI after saving the configuration.

VS Code / GitHub Copilot

Create or edit the MCP configuration file:

Workspace-specific (recommended):

mkdir -p .vscode
nano .vscode/mcp.json

User-wide (all workspaces):

  • macOS: ~/Library/Application Support/Code/User/mcp.json
  • Linux: ~/.config/Code/User/mcp.json
  • Windows: %APPDATA%\Code\User\mcp.json

Using uvx (easiest):

{
  "servers": {
    "timedoctor": {
      "type": "stdio",
      "command": "uvx",
      "args": ["timedoctor-mcp"],
      "env": {
        "TD_EMAIL": "your-email@example.com",
        "TD_PASSWORD": "your-password",
        "TD_BASE_URL": "https://2.timedoctor.com",
        "HEADLESS": "true"
      }
    }
  }
}

Using local installation (for development):

{
  "servers": {
    "timedoctor": {
      "type": "stdio",
      "command": "<PATH_TO_REPO>/.venv/bin/python",
      "args": ["<PATH_TO_REPO>/src/mcp_server.py"],
      "env": {
        "TD_EMAIL": "your-email@example.com",
        "TD_PASSWORD": "your-password",
        "TD_BASE_URL": "https://2.timedoctor.com",
        "HEADLESS": "true"
      }
    }
  }
}

Using .env file with local installation:

{
  "servers": {
    "timedoctor": {
      "type": "stdio",
      "command": "<PATH_TO_REPO>/.venv/bin/python",
      "args": ["<PATH_TO_REPO>/src/mcp_server.py"],
      "envFile": "<PATH_TO_REPO>/.env"
    }
  }
}

Enable in GitHub Copilot:

  1. Open VS Code Command Palette (Cmd+Shift+P or Ctrl+Shift+P)
  2. Run MCP: Add Server to configure via UI
  3. Or manually edit .vscode/mcp.json as shown above
  4. In Copilot Chat, click the tools icon to see available MCP servers

Restart VS Code after saving the configuration.

Usage

Get data for date range:

Get my Time Doctor data from August 25 to September 5

Today's data:

Show me my Time Doctor hours for today

Last week:

Get my Time Doctor data for the last 7 days

Custom analysis:

Get my Time Doctor data from last month and tell me which project took the most time

Claude will receive CSV data like:

Date,Project,Task,Description,WORK HOUR
08/25/2025,Jira: AYR BMS,ABMS-606,Code Review,5.00
08/25/2025,Jira: AYR BMS,ABMS-700,Bug Fix,3.50
TOTAL,,,,8.50

You can then ask Claude to save it wherever you want!

MCP Tools

1. export_weekly_csv

Get time tracking data for any date range in CSV format.

Parameters:

  • start_date (required): YYYY-MM-DD format
  • end_date (required): YYYY-MM-DD format

Returns: CSV data as text with summary statistics

2. get_daily_report

Get detailed report for a specific date.

Parameters:

  • date (required): YYYY-MM-DD format or "today"

Returns: Formatted report with project breakdown

3. get_hours_summary

Quick hours breakdown by project.

Parameters:

  • date (required): YYYY-MM-DD format or "today"

Returns: Summary by project

4. export_today_csv

Quick access to today's data.

Parameters: None

Returns: Today's CSV data with summary

How It Works

  1. Login: Playwright automation logs into Time Doctor web interface
  2. Navigate: Goes to Projects & Tasks report
  3. Date Navigation: Uses arrow buttons to change dates
  4. Extract: Parses Angular Material tree structure for project/task data
  5. Parse: Converts "3h 50m" format to decimal hours
  6. Aggregate: Combines duplicate tasks
  7. Return: CSV data as text in MCP response

Architecture

Single-Session Efficiency:

  • Login once
  • Navigate through all dates in one session
  • Extract data for each date
  • Close browser once
  • Result: 2-3x faster than logging in for each date

CSV Data Format:

Date,Project,Task,Description,WORK HOUR
11/04/2025,Jira: AYR BMS,ABMS-606,Code Review - ABMS-606,0.25
11/04/2025,Jira: AYR BMS,ABMS-4979,Deal template update,2.47
TOTAL,,,,2.72
  • Date: MM/DD/YYYY format
  • WORK HOUR: Decimal hours (5.00, 1.50, 0.25)
  • TOTAL: Sum of all hours

Project Structure

timedoctor-mcp/
ā”œā”€ā”€ .env                    # Your credentials (git-ignored)
ā”œā”€ā”€ .env.example            # Example configuration
ā”œā”€ā”€ requirements.txt        # Python dependencies
ā”œā”€ā”€ setup-with-uv.sh       # Setup script
ā”œā”€ā”€ src/
│   ā”œā”€ā”€ scraper.py         # Browser automation & login
│   ā”œā”€ā”€ parser.py          # HTML parsing (Angular Material tree)
│   ā”œā”€ā”€ transformer.py     # CSV formatting
│   └── mcp_server.py      # MCP server with 4 tools
└── tests/
    ā”œā”€ā”€ debug_login.py     # Login debugging tool
    ā”œā”€ā”€ test_parser.py     # HTML parsing tests
    ā”œā”€ā”€ test_date_navigation.py  # Date navigation tests
    └── test_complete_flow.py    # End-to-end tests

Troubleshooting

MCP Server Won't Start

Check the log:

tail -f timedoctor_mcp.log

Common issues:

  • āŒ Missing credentials: Add to .env or MCP config
  • āŒ Wrong Python path: Use .venv/bin/python (or .venv/Scripts/python.exe on Windows)
  • āŒ Dependencies not installed: Run ./setup-with-uv.sh
  • āŒ Playwright browsers not installed: Run uvx --with playwright playwright install chromium

Playwright Browser Error

If you see:

Error: BrowserType.launch: Executable doesn't exist at .../chromium_headless_shell-1187/chrome-mac/headless_shell

Solution:

uvx --with playwright playwright install chromium

This is a one-time setup that downloads the browser binaries (~130MB). You only need to run this once per system.

Login Fails

Check log for:

Login failed - still on login page

Solutions:

  • Verify credentials in .env are correct
  • Check if Time Doctor requires 2FA (not supported)
  • Try logging in manually at https://2.timedoctor.com/login
  • Look for error messages in the log

The scraper logs which email it's using:

TimeDoctorScraper initialized with email: your-email@example.com

No Data Returned

Check log for:

Parsed 0 time entries

Solutions:

  • Verify you have time tracking data for those dates
  • Check that "Expand All" button appears on the report page
  • Try with today's date first to confirm it works
  • Check log for HTML parsing errors

Claude Not Seeing Tools

Solutions:

  1. Verify config path is correct
  2. Check JSON syntax is valid (use a JSON validator)
  3. Ensure Python path is absolute, not relative
  4. Completely quit and restart Claude
  5. Check Claude settings → MCP Servers

Path Issues

Make sure all paths in your MCP config are absolute paths, not relative:

āœ… Good:

  • macOS/Linux: /Users/name/timedoctor-mcp/.venv/bin/python
  • Windows: C:\Users\name\timedoctor-mcp\.venv\Scripts\python.exe

āŒ Bad:

  • ~/timedoctor-mcp/.venv/bin/python (tilde not expanded)
  • ./timedoctor-mcp/.venv/bin/python (relative path)
  • timedoctor-mcp/.venv/bin/python (relative path)

Requirements

  • Python: 3.12 or 3.13 (3.14 not supported yet)
  • Dependencies: Playwright, BeautifulSoup4, MCP SDK, python-dotenv
  • System: macOS, Linux, Windows
  • Time Doctor: Active account with login credentials

Performance

Single-session architecture:

  • 7 days: ~45 seconds (vs ~90 seconds with multiple logins)
  • 30 days: ~3 minutes
  • Login: 5 seconds (once)
  • Per date: 3-4 seconds (navigation + extraction)

Security

  • āœ… Credentials stored in .env (git-ignored)
  • āœ… Headless browser (no GUI)
  • āœ… Local execution only
  • āœ… No data sent to third parties
  • āš ļø Store .env securely (chmod 600 .env recommended)

Development

Test login:

source .venv/bin/activate  # or .venv\Scripts\activate on Windows
python tests/debug_login.py

Test parsing:

python tests/test_parser.py

Test complete flow:

python tests/test_complete_flow.py

View logs:

tail -f timedoctor_mcp.log

Why Web Scraping?

Time Doctor has an API, but this MCP server uses web automation because:

  • āœ… No API token setup needed
  • āœ… Same access as web interface
  • āœ… Works with all Time Doctor plans
  • āœ… More reliable for "Projects & Tasks" report

If you prefer API access, Time Doctor's API is available at: https://api2.timedoctor.com/api/1.0/

Alternative Installation Methods

Manual pip Installation

# Create virtual environment
python3.13 -m venv .venv
source .venv/bin/activate  # or .venv\Scripts\activate on Windows

# Install dependencies
pip install -r requirements.txt

# Install Playwright browsers
playwright install chromium

Using Python venv (without UV)

python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
playwright install chromium

Contributing

Contributions welcome! Please feel free to submit issues or pull requests.

License

MIT License - See LICENSE file for details.

Disclaimer

This tool is for personal use and automation of your own Time Doctor data. Ensure you comply with Time Doctor's Terms of Service and your organization's policies when using this scraper.

Support

If this tool saves you time, consider buying me a coffee! ā˜•

Buy Me A Coffee


Questions? Check the log file: timedoctor_mcp.log in the project directory

Working? Ask Claude: "Get my Time Doctor data for today"

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured