简体中文 | English
Agent-friendly CLI and MCP server for TickTick international and Dida365 domestic APIs.
TickTick MCP CLI is designed for both human operators and AI agents:
- Humans get readable terminal commands for projects, tasks, completed tasks, exports, OAuth, and diagnostics.
- AI agents get stable JSON output, explicit safety checks, deterministic command shapes, and an MCP server exposing the same core capabilities.
If you paste this repository link into an agent, the agent should be able to install the project, check authentication, list projects/tasks, and use the MCP tools by following this README alone.
TickTick MCP CLI provides a shared Python core with two thin frontends:
- CLI:
ticktick-mcp-cli, legacyticktask, and short aliastt. - MCP server:
ticktick-mcpand legacyticktask-mcpfor agent runtimes that support Model Context Protocol.
Supported service profiles:
ticktick→https://api.ticktick.comdida365→https://api.dida365.com
Current capabilities:
- OAuth credential setup and login.
- Optional OS keyring storage for OAuth client secret, access token, and refresh token.
- OAuth state + PKCE hardened authorization flow.
- Automatic access-token refresh when
expires_atis near or past expiry. - Project list, project data retrieval, create, update, and delete, with project kind/view-mode validation.
- Task list/search/natural-query/create/get/update/complete/delete/move, with due-date convenience parsing (
today,tomorrow,next monday,YYYY-MM-DD). - Agent-safe task creation idempotency keys to avoid duplicate remote tasks when retrying after interruptions.
- Task reminder set/clear and repeat/RRULE set/clear helpers.
- Dry-run guarded batch complete/delete/move operations.
- Tag filtering, smart filters (
today,overdue,upcoming,high-priority,no-date), priority/status validation, and task tag add/remove. - Checklist item/subtask add/update/complete/delete for
CHECKLISTtasks. - Completed-task listing through the official
POST /open/v1/task/completedAPI. - Task analytics for open/completed/overdue counts, project throughput, tag distribution, and priority distribution.
- Progress reporting that combines tasks, habits, and focus sessions into one scorecard.
- Conflict-safe retries for read-only API calls, including
Retry-Afterhandling for rate limits and transient 5xx responses. - Structured error taxonomy for agents:
category,retryable, andremediationhints accompany every error payload. - Incremental sync/export state file for checkpointed task exports.
- Date/project backup files with Markdown, JSONL, CSV, or JSON outputs plus a manifest.
- Official habit list/get/create/update, habit check-in/history, and focus list/get/delete.
- Export tasks, completed tasks, or focus-session reports as
json,jsonl,csv, ormarkdown. - Redacted diagnostic bundles for support and agent handoff, with config/token secrets represented only as boolean
*_configuredflags. - Read-only real API smoke check gated by
TICKTASK_INTEGRATION=1. - MCP tools and read-only MCP resources over the same core behavior.
For a one-command setup with MCP server and keyring extras, run:
curl -fsSL https://raw.githubusercontent.com/GeekMai90/ticktick-mcp-cli/main/scripts/install.sh | shThe script installs from this GitHub repository by default (ticktick-mcp-cli[mcp,keyring] @ git+https://github.com/GeekMai90/ticktick-mcp-cli.git) because the PyPI package name is not published yet. It prefers uv tool install and falls back to pipx install, then prints the same verification commands used by the docs:
ticktick-mcp-cli --version
ticktick-mcp-cli doctor --json
ticktick-mcp-cli auth status --jsonAgent runtimes with Node.js can run the GitHub wrapper without a global npm registry package:
npx github:GeekMai90/ticktick-mcp-cli doctor --json
npx github:GeekMai90/ticktick-mcp-cli auth status --json
npx --package github:GeekMai90/ticktick-mcp-cli ticktick-mcpThe wrapper delegates to the Python package from this GitHub repository via uvx when available, with a python3 -m pipx run fallback. Default spec: ticktick-mcp-cli[mcp,keyring] @ git+https://github.com/GeekMai90/ticktick-mcp-cli.git. It does not store credentials.
Use the repository source until the ticktick-mcp-cli package is published on PyPI:
uv tool install 'ticktick-mcp-cli[mcp,keyring] @ git+https://github.com/GeekMai90/ticktick-mcp-cli.git'
# or
pipx install 'ticktick-mcp-cli[mcp,keyring] @ git+https://github.com/GeekMai90/ticktick-mcp-cli.git'If you do not need keyring support, use only the MCP extra:
uv tool install 'ticktick-mcp-cli[mcp] @ git+https://github.com/GeekMai90/ticktick-mcp-cli.git'
# or
pipx install 'ticktick-mcp-cli[mcp] @ git+https://github.com/GeekMai90/ticktick-mcp-cli.git'git clone https://github.com/GeekMai90/ticktick-mcp-cli.git
cd ticktick-mcp-cli
uv sync --all-extras --dev
uv run ticktask --help
uv run tt --helpThe project has release automation, but the ticktick-mcp-cli package is not available on PyPI until a maintainer publishes a release. After publication, these commands should work:
uv tool install ticktick-mcp-cli
# or
pipx install ticktick-mcp-cliThen verify:
ticktick-mcp-cli --version
ticktick-mcp-cli doctor --jsonConsole scripts:
ticktick-mcp-cli— main public CLI.ticktask— backward-compatible legacy CLI.tt— short CLI alias.ticktick-mcp— main public stdio MCP server.ticktask-mcp— backward-compatible legacy MCP server.
Create a TickTick or Dida365 developer OAuth app, then store its credentials locally:
ticktask auth init \
--service ticktick \
--client-id "$TICKTICK_CLIENT_ID" \
--client-secret "$TICKTICK_CLIENT_SECRET" \
--redirect-uri "http://localhost:8080/callback"For Dida365, use:
ticktask auth init \
--service dida365 \
--client-id "$DIDA365_CLIENT_ID" \
--client-secret "$DIDA365_CLIENT_SECRET" \
--redirect-uri "http://localhost:8080/callback"Local config path:
ticktask config pathDo not commit local config files, client secrets, access tokens, or refresh tokens. For OS-managed secret storage, initialize auth with --token-storage keyring after installing the optional extra (pipx install 'ticktick-mcp-cli[keyring]' or uv tool install 'ticktick-mcp-cli[keyring]'); the JSON config then keeps only non-secret metadata while client secret/access/refresh tokens are stored in the system keyring.
Start the local callback login flow:
ticktask auth login --service ticktick --local-server --jsonThis opens the browser and waits for one callback on the configured localhost redirect URI.
Manual browser flow:
ticktask auth login --service ticktick --no-browser --jsonOpen the returned authorization_url. After the provider redirects to your callback URL, complete login with either the full callback URL:
ticktask auth login \
--service ticktick \
--callback-url 'http://localhost:8080/callback?code=***&state=STATE' \
--jsonor with code + state:
ticktask auth login --service ticktick --code CALLBACK_CODE --state STATE --jsonCheck status:
ticktask auth status --jsonticktask project list
ticktask task list
ticktask today
ticktask add "Plan release" --project Inbox
ticktask task add "Plan release" --project Inbox --idempotency-key agent-run-123:create-plan-release --json
ticktask task search "release"
ticktask task query "high priority #agent release" --json
ticktask task list --tag agent --filter high-priority
ticktask task filter --tag agent --priority high
ticktask completed today
ticktask task analytics week --project Inbox --jsonMutating dangerous operations require exact IDs and explicit confirmation:
ticktask project update PROJECT_ID --name "Renamed" --json
ticktask project delete PROJECT_ID --yes --json
ticktask task complete TASK_ID --project-id PROJECT_ID --yes
ticktask task delete TASK_ID --project-id PROJECT_ID --yes
ticktask task move TASK_ID --from-project-id PROJECT_ID --to-project-id OTHER_PROJECT_ID
ticktask task reminder set TASK_ID --project-id PROJECT_ID --reminder TRIGGER:PT10M
ticktask task reminder clear TASK_ID --project-id PROJECT_ID
ticktask task repeat set TASK_ID --project-id PROJECT_ID --preset weekly
ticktask task repeat clear TASK_ID --project-id PROJECT_ID
ticktask task batch complete --task-id TASK_ID_1 --task-id TASK_ID_2 --project-id PROJECT_ID
ticktask task batch delete --task-id TASK_ID --project-id PROJECT_ID --execute --yes
ticktask task batch move --task-id TASK_ID --from-project-id PROJECT_ID --to-project-id OTHER_PROJECT_ID
ticktask task tag add TASK_ID agent --project-id PROJECT_ID
ticktask task tag remove TASK_ID agent --project-id PROJECT_ID
ticktask task item delete TASK_ID ITEM_ID --project-id PROJECT_ID --yesExport examples:
ticktask export tasks --format jsonl --status all
ticktask export tasks --format csv --project Inbox
ticktask export completed --format markdown --from 2026-05-01 --to 2026-05-17
ticktask export focus --format csv --from 2026-01-01 --to 2026-01-30 --type 0Analytics and progress examples:
ticktask task analytics today --json
ticktask task analytics week --project Inbox --json
ticktask task analytics --from 2026-05-01 --to 2026-05-17 --json
ticktask report progress week --project Inbox --json
ticktask report progress --from 2026-05-01 --to 2026-05-17 --focus-type 1 --jsonIncremental sync/export examples:
ticktask sync state --json
ticktask sync mark tasks:all --timestamp 2026-05-01T00:00:00Z --json
ticktask sync export tasks --format jsonl --state-key tasks:all --status all --save-state --jsonDiagnostic bundle example:
ticktask doctor bundle --output ./ticktask-diagnostics.zip --jsonThe diagnostic bundle is a ZIP containing diagnostics.json and report.md. It is designed for bug reports and agent handoff: config paths, active service, runtime, MCP buildability, and tool counts are included, while client secrets, access tokens, refresh tokens, OAuth state, and PKCE verifier values are never written.
Backup examples:
ticktask backup tasks --output-dir ~/ticktask-backups --format markdown,jsonl,csv --status all --json
ticktask backup tasks --output-dir ~/ticktask-backups --date 2026-05-17 --project Inbox --from 2026-05-01 --to 2026-05-17 --jsonBackups are written under OUTPUT_DIR/YYYY-MM-DD/project-slug/ with a date-level manifest.json.
When using ticktask from an agent:
- Prefer
--jsonfor all CLI commands that support it. - Branch on
okfirst, then onerror.codewhenokis false. - Never infer task/project IDs from names before mutations; list/search first, then use exact IDs.
- Pass
--yesonly after verifying the exact target ofcompleteordelete. - Treat
TICKTASK_INTEGRATION=1as permission to make read-only real API calls only. - Never print or commit OAuth client secrets, access tokens, refresh tokens, local config files, or
.envfiles.
Success:
{"ok": true, "data": {}, "meta": {}}Error:
{
"ok": false,
"error": {
"code": "VALIDATION_ERROR",
"message": "Human message",
"hint": "Next step",
"category": "validation",
"retryable": false,
"remediation": {
"action": "fix_arguments",
"command": "rerun with valid arguments",
"safe_to_retry": false
}
}
}Structured error categories include configuration, auth, api, lookup, validation, safety, and unexpected. Agents should branch on ok, then error.code; use retryable and remediation.safe_to_retry before retrying.
# Discover state
ticktask doctor --json
ticktask doctor bundle --output ./ticktask-diagnostics.zip --json
ticktask auth status --json
ticktask project list --json
ticktask project create "Focus" --json
ticktask project update PROJECT_ID --name "Renamed" --json
ticktask project delete PROJECT_ID --yes --json
# Read tasks
ticktask task list --json
ticktask task list --status completed --from 2026-05-01 --to 2026-05-17 --json
ticktask task search "release" --json
ticktask task list --tag agent --filter high-priority --json
ticktask task filter --tag agent --priority high --json
ticktask task analytics week --json
ticktask report progress week --json
ticktask sync export tasks --format jsonl --state-key tasks:all --status all --json
ticktask backup tasks --output-dir ~/ticktask-backups --format markdown,jsonl --status all --json
# Mutate only after exact IDs are known
# For task creation retries, reuse the same --idempotency-key only with the same payload.
ticktask task add "Plan release" --project Inbox --idempotency-key agent-run-123:create-plan-release --json
ticktask task update TASK_ID --project-id PROJECT_ID --title "New title" --json
ticktask task complete TASK_ID --project-id PROJECT_ID --yes --json
ticktask task delete TASK_ID --project-id PROJECT_ID --yes --json
ticktask task tag add TASK_ID agent --project-id PROJECT_ID --json
ticktask task tag remove TASK_ID agent --project-id PROJECT_ID --json
ticktask task item add TASK_ID "Checklist item" --project-id PROJECT_ID --json
ticktask task item update TASK_ID ITEM_ID --project-id PROJECT_ID --title "Renamed" --status completed --json
ticktask task item complete TASK_ID ITEM_ID --project-id PROJECT_ID --json
ticktask task item delete TASK_ID ITEM_ID --project-id PROJECT_ID --yes --json
# Habits and focus
ticktask habit list --json
ticktask habit create "Read" --goal 1 --unit time --json
ticktask habit checkin HABIT_ID 20260101 --value 1 --json
ticktask habit history HABIT_ID --from 20260101 --to 20260131 --json
ticktask focus list --from 2026-01-01 --to 2026-01-30 --type 0 --json
ticktask focus delete FOCUS_ID --type 0 --yes --json
# Safe real-API smoke: skipped unless explicitly enabled
ticktask integration smoke --json
TICKTASK_INTEGRATION=1 ticktask integration smoke --service dida365 --jsonInstall optional MCP dependencies when working from a clone:
uv sync --extra mcp
uv run ticktick-mcpIf installed as a tool, run:
ticktick-mcpThe MCP server uses stdio and exposes the same shared core behavior as the CLI. It also exposes read-only MCP resources for common agent planning context and reusable MCP prompt templates for common workflows.
For AI agents, start with ticktask_describe_tools to inspect descriptions, parameter enum hints, confirmation requirements, and examples. Use ticktask_cli_parity to map MCP tools back to CLI commands. Read ticktask://projects, ticktask://config, and ticktask://saved-views when you need project context, sanitized local configuration, or smart-filter presets without invoking a tool. Use the built-in prompt templates for daily planning, weekly reviews, safe cleanup, and exports.
When agents create tasks, pass idempotency_key to ticktask_create_task or --idempotency-key to ticktask task add. Reusing the same key with the same create arguments returns the cached task instead of creating a duplicate remote task; reusing the key with different arguments fails validation. Idempotency records are stored locally in idempotency.json next to the active config directory.
MCP tools:
ticktask_describe_toolsticktask_cli_parityticktask_doctorticktask_diagnostic_bundleticktask_auth_statusticktask_list_projectsticktask_create_projectticktask_update_projectticktask_delete_projectticktask_list_tasksticktask_filter_tasksticktask_search_tasksticktask_create_taskticktask_complete_taskticktask_todayticktask_get_taskticktask_update_taskticktask_delete_taskticktask_move_taskticktask_batch_complete_tasksticktask_batch_delete_tasksticktask_batch_move_tasksticktask_set_task_remindersticktask_clear_task_remindersticktask_set_task_repeatticktask_clear_task_repeatticktask_add_task_tagticktask_remove_task_tagticktask_add_checklist_itemticktask_update_checklist_itemticktask_complete_checklist_itemticktask_delete_checklist_itemticktask_completedticktask_task_analyticsticktask_progress_reportticktask_list_habitsticktask_get_habitticktask_create_habitticktask_update_habitticktask_checkin_habitticktask_habit_checkinsticktask_list_focusesticktask_get_focusticktask_delete_focusticktask_export_tasksticktask_sync_stateticktask_mark_sync_stateticktask_sync_export_tasksticktask_backup_tasksticktask_export_focuses
MCP resources:
ticktask://projects— read-only project list for planning and exact-ID lookup.ticktask://config— sanitized active service/profile configuration with secrets redacted.ticktask://saved-views— built-in smart-filter presets and equivalent MCP/CLI arguments.
MCP prompts:
ticktask_daily_planning— plan today using project context and saved views.ticktask_weekly_review— review progress with task analytics, completed tasks, habits, and focus.ticktask_cleanup— identify stale tasks with dry-run batch operations first.ticktask_export— export, backup, or incrementally sync task data.
The integration smoke command is safe by default:
ticktask integration smoke --jsonIt returns skipped: true unless explicitly enabled.
To run a read-only real API check:
TICKTASK_INTEGRATION=1 ticktask integration smoke --service dida365 --jsonThis only lists projects and returns project_count. It does not create, update, complete, move, or delete projects or tasks.
git clone https://github.com/GeekMai90/ticktick-mcp-cli.git
cd ticktick-mcp-cli
uv sync --all-extras --dev
uv run pytest -q
uv run ticktick-mcp-cli --help
uv run ticktick-mcp-cli doctor --json
uv run --with 'mcp>=1.0' python -c 'from ticktask.mcp.server import build_server; build_server(); print("mcp_build_ok")'Project notes:
- Keep CLI and MCP as thin frontends over
ticktask.core. - Preserve stable JSON envelopes for agent callers.
- Keep destructive actions explicit and ID-based.
- Do not commit OAuth secrets or local token files.
- Docs Index
- Agent-First Quickstart
- Installation
- OAuth
- CLI Usage
- MCP Usage
- MCP Integration Examples for Claude Desktop, Hermes, Cursor, Claude Code, and OpenClaw
- Agent Usage
- Release Checklist
- Roadmap: competitive parity and best-in-class agent workflows
- Original Implementation Plan
- Local configuration is stored outside the repository by default.
.env, token files, local config files,dist/, and build outputs are ignored by git.- OAuth login uses state and PKCE.
- API calls auto-refresh expired or near-expired tokens when a refresh token is available.
- Read-only API calls retry transient rate-limit/server failures; mutating writes do not blind-retry to avoid duplicate changes.
- Task creation supports local idempotency keys; same key + same payload reuses the result, while same key + different payload is rejected.
- Completed-task listing intentionally omits
projectIdsfor global queries to avoid missing Dida365 completed tasks.
MIT. See LICENSE.