TaskRabbit provider MCP server + API library for managing availability, rates, and calendar sync
Find a file
Brad 1b64d5af61 Initial commit: TR provider MCP server + API library
- taskrabbit.py: core REST API library (CDP session + Bearer auth)
- mcp_server.py: MCP server exposing 7 TR tools (stdio + SSE)
- tr_sync_from_hub.py: multi-mode sync (calendar/rates/sameday/refresh)
- tr_daily_sync.py: daily cron with GCal busy-block subtraction
- tr_gcal_poll.py: 5-min incremental GCal sync-token poller
- tr_gcal_watcher.py: daemon watcher, re-syncs TR on calendar changes
- tasker_adb.py: ADB UI automation for operations not reachable via API
- .env.example, README, .gitignore

All private IPs, tokens, and device IDs replaced with env vars.
2026-10-20 14:58:02 -07:00
.env.example Initial commit: TR provider MCP server + API library 2026-10-20 14:58:02 -07:00
.gitignore Initial commit: TR provider MCP server + API library 2026-10-20 14:58:02 -07:00
mcp_server.py Initial commit: TR provider MCP server + API library 2026-10-20 14:58:02 -07:00
README.md Initial commit: TR provider MCP server + API library 2026-10-20 14:58:02 -07:00
tasker_adb.py Initial commit: TR provider MCP server + API library 2026-10-20 14:58:02 -07:00
taskrabbit.py Initial commit: TR provider MCP server + API library 2026-10-20 14:58:02 -07:00
tr_daily_sync.py Initial commit: TR provider MCP server + API library 2026-10-20 14:58:02 -07:00
tr_gcal_poll.py Initial commit: TR provider MCP server + API library 2026-10-20 14:58:02 -07:00
tr_gcal_watcher.py Initial commit: TR provider MCP server + API library 2026-10-20 14:58:02 -07:00
tr_sync_from_hub.py Initial commit: TR provider MCP server + API library 2026-10-20 14:58:02 -07:00

tr-mcp - TaskRabbit Provider MCP Server

A Model Context Protocol server and Python library for managing a TaskRabbit provider account -- availability calendar, hourly rates, same-day settings, and on-duty status -- from any MCP-compatible AI agent.

Built by reverse-engineering the Tasker mobile app's Hermes JS bundle (v5.8.0) and the tasker-mobile-bff endpoints.


What's included

File Purpose
mcp_server.py MCP server (stdio or SSE) exposing 7 TR tools
taskrabbit.py Core REST API library (CDP session + Bearer token)
tr_sync_from_hub.py Multi-mode sync: calendar, rates, sameday, refresh
tr_daily_sync.py Daily cron: GCal busy-block subtraction + TR calendar push
tr_gcal_poll.py 5-min cron: incremental GCal sync-token poller
tr_gcal_watcher.py Daemon: watch GCal, re-sync TR on any change
tasker_adb.py ADB UI automation for the Tasker Android app (for operations not reachable via API)

MCP Tools

Tool What it does
tr_get_status Full provider state (on_duty, categories, calendar blocks)
tr_get_categories List categories with current rates and sameday flags
tr_set_on_duty Go online / offline
tr_set_sameday Enable/disable same-day on one or more categories
tr_push_rate Update hourly rate for a category (requires Bearer token)
tr_sync_calendar Write 14-day availability calendar (requires Bearer token)
tr_capture_bearer Capture Bearer token from MOC phone via ADB logcat

Setup

1. Install dependencies

pip install mcp requests pytz google-api-python-client google-auth-httplib2 google-auth-oauthlib

For SSE transport (optional):

pip install mcp[sse] uvicorn starlette

2. Configure environment

Copy .env.example to .env and fill in your values:

cp .env.example .env

Key variables:

COMMERCE_HUB_URL=http://localhost:8800    # Your Commerce Hub base URL
MOC_SSH_HOST=user@YOUR_MOC_HOST           # SSH target for MOC phone (Bearer capture)
CHROMIUM_TASKER_WS=ws://localhost:9505/devtools/page/YOUR_PAGE_ID
DISCORD_THREAD_ID=                        # Optional: Discord thread for notifications

3. Run the server

stdio (for Claude Desktop, Claude Code, etc.):

python3 mcp_server.py

SSE (for remote or networked agents):

python3 mcp_server.py --sse :8900

4. Claude Desktop config

Add to your claude_desktop_config.json:

{
  "mcpServers": {
    "tr-mcp": {
      "command": "python3",
      "args": ["/path/to/tr-mcp/mcp_server.py"],
      "env": {
        "COMMERCE_HUB_URL": "http://localhost:8800",
        "MOC_SSH_HOST": "user@YOUR_MOC_HOST",
        "CHROMIUM_TASKER_WS": "ws://localhost:9505/devtools/page/YOUR_PAGE_ID"
      }
    }
  }
}

Authentication

TaskRabbit uses two auth layers:

1. Web session cookies (for api.taskrabbit.com/api/v3/*)

  • Extracted from a running Chromium browser profile via CDP
  • Set CHROMIUM_TASKER_WS to the DevTools WebSocket URL of the tasker tab
  • Good for: on_duty toggle, same-day settings, reading state

2. Mobile Bearer token (for tasker-mobile-bff.taskrabbit.com/api/v1/*)

  • Required for: calendar writes, rate updates, experience pitches
  • Capture by running tr_capture_bearer while the TaskRabbit app is open on an Android device
  • Token is stored in the Commerce Hub and fetched automatically by tools that need it
  • Tokens typically last 30-60 days

Capturing a Bearer token (first-time setup)

  1. Open the TaskRabbit app on your Android device
  2. Navigate to Skills & Rates (this triggers API calls that emit the token in logcat)
  3. Call tr_capture_bearer from the MCP server (or run directly):
    python3 -c "import taskrabbit as tr; print(tr.capture_bearer_token_via_adb())"
    
  4. The token is stored in your Commerce Hub at /api/taskrabbit/record-bearer

Library usage (without MCP)

import taskrabbit as tr

# Read full state
with tr.TaskRabbitSession() as session:
    state = session.get_work_filter_state()
    print(state["on_duty"])
    for cat in state["categories"]:
        print(cat["category_name"], cat["charge_amount_cents"] / 100)

# Go on duty
with tr.TaskRabbitSession() as session:
    session.set_on_duty(True)

# Push a rate update (needs Bearer)
bearer = tr.fetch_bearer_from_hub()
tr.set_category_rate(category_id=33, rate_cents=5200, bearer_token=bearer)

# Sync calendar from schedule
tr.sync_calendar_blocks(days=14, bearer_token=bearer)

Daily sync cron

tr_daily_sync.py is designed to run at 4-6 AM daily:

0 6 * * * cd /path/to/tr-mcp && python3 tr_daily_sync.py --mode full

Modes: full, calendar, rates, sameday, refresh


ADB automation (tasker_adb.py)

For operations the REST API can't reach (e.g. reading the live UI state, interacting with calendar blocks visually), tasker_adb.py provides ADB-based automation:

import tasker_adb as tasker

tasker.ensure_tasker_set_availability()
tasker.goto_today()
blocks = tasker.get_blocks()
print(blocks)

Device layout constants (tuned for Ulefone Power Armor 13 1080x2400) are overridable via env vars: TASKER_DATE_STRIP_Y, TASKER_GRID_ORIGIN_Y, TASKER_PX_PER_HOUR, etc.


API notes

  • api.taskrabbit.com/api/v3/work_filter/calendar.json (PUT) only writes same-day blocks -- future day writes are accepted with HTTP 200 but silently discarded. Use the BFF endpoint for future-day writes.
  • The BFF base is tasker-mobile-bff.taskrabbit.com -- requires Bearer token.
  • api.taskrabbit.com/api/v1/categories/{id}/settings returns HTTP 426 (deprecated). Use BFF for rate updates.
  • The Authorization header value is OAuth <token>, NOT Bearer <token> -- pass the raw stored string as-is.

License

MIT