# Google Tasks MCP (`gtasks` v2.0.0) > Manage Google Tasks lists, tasks, and subtasks from AI agents or your terminal. Lightweight, agent-friendly MCP server (`gtasks-mcp`, supporting `stdio` and `2025-11-25` Streamable HTTP) and local CLI (`gtasks`) over a shared domain core and minimal Google Tasks API v1 REST client—with safe scoped defaults, calendar due dates, 1-level subtasks, O(1) MCP Task Resources, and defense-in-depth read-only mode. Supports Node.js `>= 22` LTS and Bun. - Site: https://gtasks.zach.dev - Source: https://github.com/zcaceres/gtasks-mcp - Package: https://www.npmjs.com/package/gtasks - Author: https://zach.dev | X: https://x.com/zachcaceres | GitHub: https://github.com/zcaceres - Requirements & Invariants: https://github.com/zcaceres/gtasks-mcp/blob/main/REQUIREMENTS.md - README: https://github.com/zcaceres/gtasks-mcp/blob/main/README.md ## Quickstart ### 1. Authenticate Once (`gtasks auth login`) Save your Google Cloud Desktop OAuth client keys file to `~/.config/gtasks-mcp/gcp-oauth.keys.json` (macOS/Linux) or `%APPDATA%\gtasks-mcp\gcp-oauth.keys.json` (Windows), or set `GTASKS_OAUTH_KEYS_PATH` or inline `GTASKS_CLIENT_ID` + `GTASKS_CLIENT_SECRET`, then run: ```bash npx gtasks auth login # Headless / remote terminal: npx gtasks auth login --no-browser # Least-privilege read-only scope (https://www.googleapis.com/auth/tasks.readonly): npx gtasks auth login --read-only ``` Credentials are stored with `0600` permissions in `~/.config/gtasks-mcp/credentials.json` (or `GTASKS_CREDENTIALS_PATH`). Headless MCP runs proactively refresh tokens without clobbering `refresh_token` and never launch a browser. ### 2. MCP Server (`stdio`) ```json { "mcpServers": { "gtasks": { "command": "npx", "args": ["-y", "-p", "gtasks", "gtasks-mcp"] } } } ``` ### 3. MCP Server (Streamable HTTP — `2025-11-25`) ```bash npx -y -p gtasks gtasks-mcp --http --host 127.0.0.1 --port 3000 ``` - Endpoint: `POST /mcp` (stateless per-request handling; defaults to `127.0.0.1:3000`). - Flags: `--http`, `--host ` (requires `--http`), `--port <1..65535>` (requires `--http`), `--read-only`. - Guards: Validates `Host` and `Origin` headers (`403` on mismatch to block DNS rebinding). Unknown paths (including legacy `/sse`) return `404`; non-`POST` methods on `/mcp` return `405` (`Allow: POST`). Non-loopback binds honor `GTASKS_ALLOWED_HOSTS` and `GTASKS_ALLOWED_ORIGINS`. ### 4. Local CLI (`gtasks`) ```bash npm install -g gtasks gtasks auth status gtasks lists list gtasks tasks list --all-lists gtasks tasks create "Ship v2.0" --due 2026-06-01 --notes "Publish npm package" gtasks tasks list --json ``` ## MCP Tools (13) All 13 tools conform to MCP `2025-11-25` (Claude, Gemini, OpenAI compatible), enforce `additionalProperties: false`, carry accurate `readOnlyHint`/`destructiveHint`/`idempotentHint`/`openWorldHint` annotations, and map typed errors to `isError: true`. ### Task Lists (5) - `tasklists_list` (read-only): List Google Task Lists (`maxResults` 1–100 default 20, `pageToken`). - `tasklists_get` (read-only): Fetch a Task List by `taskListId` (supports `@default`). - `tasklists_create`: Create a Task List (`title` 1–1,024 chars). - `tasklists_update`: Rename a Task List (`taskListId`, `title`). - `tasklists_delete` (destructive): Delete a Task List (`@default` is refused locally). ### Tasks (8) - `tasks_list` (read-only): List tasks (defaults to `@default`, `includeCompleted: false`, `maxResults: 20`; supports `taskListId`, `allLists`, `includeCompleted`, `showDeleted`, `showAssigned`, `dueMin`, `dueMax`, `completedMin`, `completedMax`, `updatedMin`, `pageToken`). - `tasks_get` (read-only): Fetch a single Task (`taskId`, optional `taskListId`), surfacing `webViewLink` and `assignmentInfo`. - `tasks_search` (read-only): Case-insensitive substring search across `title` and `notes` (`query`, optional `taskListId` or `allLists`, `includeCompleted`, `maxResults`; caps per-list scan at 20 pages / 2,000 tasks with a truncation note if additional pages remain). - `tasks_create`: Create a task or 1-level subtask (`title`, optional `taskListId`, `notes`, calendar `due` `YYYY-MM-DD`, `parent`, `previous`). - `tasks_update`: Partial patch update (`taskId`, optional `taskListId`, `title`, `notes`, `due`, `status`; pass `""` or `null` to clear `notes`/`due`; `status: "needsAction"` clears `completed`). - `tasks_move`: Reorder a task, nest under `parent`, position after `previous`, or move across lists (`destinationTasklist`). - `tasks_delete` (destructive): Permanently delete a task (`taskId`, optional `taskListId`). - `tasks_clear` (destructive): Clear completed tasks from a Task List (optional `taskListId`, default `@default`). ## MCP Resources - URI: `gtasks:///lists//tasks/` - Resource Template: `gtasks:///lists/{taskListId}/tasks/{taskId}` - `resources/list`: Active tasks across all task lists (default page size `20`), opaque base64url composite cursor, omits `nextCursor` on final page (never `null`). - `resources/read`: O(1) single-call fetch of the addressed task. ## Read-Only Mode (Defense-in-Depth) Activated by `--read-only`, `GTASKS_READ_ONLY=true` (`true`/`1`/`false`/`0`, strict fail-fast), or stored `tasks.readonly`-only OAuth credentials (`gtasks auth login --read-only`): - When `gtasks-mcp` is started with `--read-only` or `GTASKS_READ_ONLY=true`, `tools/list` advertises only the 5 read-only tools (`tasklists_list`, `tasklists_get`, `tasks_list`, `tasks_get`, `tasks_search`) plus MCP Resources. - Whenever effective Access Mode is `read-only` (including stored `tasks.readonly`-only credentials), all 8 mutating operations are refused locally before calling Google Tasks API across MCP `stdio`, Streamable HTTP, and the `gtasks` CLI. ## Environment Variables - `GTASKS_CLIENT_ID` & `GTASKS_CLIENT_SECRET`: Inline Desktop OAuth credentials (highest precedence; both must be non-empty). - `GTASKS_OAUTH_KEYS_PATH`: Explicit path to `gcp-oauth.keys.json` (fails explicitly if missing/malformed). - `GTASKS_CREDENTIALS_PATH`: Explicit path to `credentials.json` (overrides OS user config dir). - `GTASKS_READ_ONLY`: Strict boolean (`true`/`1`/`false`/`0`) enabling read-only mode. - `GTASKS_ALLOWED_HOSTS` / `GTASKS_ALLOWED_ORIGINS`: Comma-separated allowlists for non-loopback `--http` deployments. - `GTASKS_API_BASE_URL`: Optional API base URL override (`https://` or loopback `http://127.0.0.1` / `http://localhost` only). ## Security Invariants - **I1 (Read-Only Guard):** Whenever effective Access Mode is `read-only`, all 8 mutations are refused locally before calling Google Tasks API across CLI, MCP `stdio`, and Streamable HTTP. - **I2 (Credential Persistence):** Credentials are written with `0600` permissions, and token refresh never clobbers an existing `refreshToken`. - **I3 (Headless MCP Hygiene):** Headless MCP servers never launch a browser and emit strictly valid JSON-RPC on `stdout` in `stdio` mode. - **I4 (`@default` Protection):** Deleting the `@default` task list is refused locally before calling Google Tasks API. - **I5 (Streamable HTTP Guards):** Disallowed `Host`/`Origin` headers return `403`; unknown paths (including `/sse`) return `404`; non-`POST` methods return `405`. - **I6 (Secret Redaction):** Client secrets, access/refresh tokens, and Bearer tokens are never leaked into errors, CLI output, or MCP tool results. ## Breaking Changes in v2.0.0 - Published on npm as `gtasks` (`gtasks` CLI + `gtasks-mcp` MCP binaries); runtime floor bumped to Node.js `>= 22` LTS or Bun. - 13 namespaced tools (`tasklists_*`, `tasks_*`) replace legacy `list`/`search`/`create`/`update`/`delete`/`clear`; unused `uri` removed from updates. - `tasks_list` and `tasks_search` default to `@default`, hide completed tasks (`includeCompleted: false`), and default to `maxResults: 20`. - Resource URIs changed to `gtasks:///lists//tasks/` with Resource Template and O(1) reads. - Keys & credentials moved to OS user config directory with `0600` permissions and explicit `gtasks auth login`. ## More Projects by zach.dev - [fetch-mcp](https://fetch.zach.dev): SSRF-hardened MCP server and CLI for fetching public web pages and YouTube transcripts. - [markdownify-mcp](https://markdownify.zach.dev): Convert PDFs, Office docs, images, audio, web pages, and Git repositories into clean Markdown over MCP. - [spotify-cli](https://spotify-cli.zach.dev): Control Spotify playback, search tracks, and manage playlists from your AI agent or terminal. - [builtwith-mcp](https://builtwith.zach.dev): Query website technology stacks via BuiltWith over MCP or the CLI.