GO

Google Tasks MCP Server: Model Context Protocol

Integrate Google Tasks with an MCP server to streamline task context syncing and enable efficient Model Context Protocol operations.

Quick Install
npx -y @zcaceres/gtasks-mcp

Overview

This project implements an MCP (Model Context Protocol) server that synchronizes Google Tasks with systems that consume model context. It acts as a bridge between Google Tasks and LLM-driven applications, exposing task state and metadata using a standardized MCP-style HTTP interface so models and agents can request, update, and consume a user’s task context in a predictable way.

Use cases include letting a chat assistant query your current to‑dos, letting an agent enrich prompts with up‑to‑date task lists, or enabling background processes to push task changes into the model context. The server handles the Google OAuth flow, maps Google Tasks structures into MCP context payloads, and provides endpoints for retrieval and incremental updates so developers can integrate task data without directly managing Google API details.

Features

  • Exposes Google Tasks as a Model Context Protocol provider
  • Handles OAuth 2.0 authentication and token refresh for Google accounts
  • Endpoint(s) for retrieving tasks as MCP-style context blocks
  • Incremental sync: supports fetching recent changes since a provided cursor/timestamp
  • Configurable persistence and server settings via environment variables
  • Lightweight HTTP API suitable for local development, containers, or cloud deployment
  • Example client snippets for retrieving and using task context with LLMs

Installation / Configuration

Prerequisites: Git, Docker (optional), and a Google Cloud project with the Tasks API enabled and OAuth credentials (Client ID & Client Secret).

  1. Clone the repository
git clone https://github.com/zcaceres/gtasks-mcp.git
cd gtasks-mcp
  1. Create a .env file (example)
# .env
GOOGLE_CLIENT_ID=your-google-client-id.apps.googleusercontent.com
GOOGLE_CLIENT_SECRET=your-google-client-secret
OAUTH_REDIRECT_URI=http://localhost:8080/auth/callback
MCP_BIND_ADDRESS=0.0.0.0:8080
SESSION_SECRET=replace-with-random-secret
# Optional storage / db settings
DATA_DIR=./data
  1. Install and run (two common approaches)
  • Run with Node.js (if repository is Node-based)
# install dependencies
npm install

# run
npm start
  • Run with Docker
# docker-compose.yml (example)
version: '3.7'
services:
  gtasks-mcp:
    image: zcaceres/gtasks-mcp:latest
    ports:
      - "8080:8080"
    environment:
      - GOOGLE_CLIENT_ID=${GOOGLE_CLIENT_ID}
      - GOOGLE_CLIENT_SECRET=${GOOGLE_CLIENT_SECRET}
      - OAUTH_REDIRECT_URI=${OAUTH_REDIRECT_URI}
      - MCP_BIND_ADDRESS=0.0.0.0:8080
    volumes:
      - ./data:/app/data
docker-compose up --build
  1. Configure Google OAuth credentials
  • In Google Cloud Console: create OAuth 2.0 Client ID, add your redirect URI (e.g. http://localhost:8080/auth/callback).
  • Put the Client ID/Secret into your .env or environment.

Environment variables reference:

VariableDescriptionRequired
GOOGLE_CLIENT_IDOAuth Client ID from Google CloudYes
GOOGLE_CLIENT_SECRETOAuth Client SecretYes
OAUTH_REDIRECT_URIOAuth redirect URI registered in Google CloudYes
MCP_BIND_ADDRESSHost:port to bind the MCP serverNo (default: 0.0.0.0:8080)
SESSION_SECRETSecret for session encryptionRecommended
DATA_DIRLocal directory for tokens and persistenceOptional

Available Resources

  • GitHub repository (source, issues, examples): https://github.com/zcaceres/gtasks-mcp
  • OAuth / Google Tasks API docs: https://developers.google.com/tasks
  • Example Postman / curl snippets (included in repo under examples/)
  • Local web UI or auth endpoints for authorizing accounts (exposed by the server)

Typical endpoints (implemented by the server)

  • GET /auth/authorize — initiate the Google OAuth flow
  • GET /auth/callback — receive OAuth code and store tokens
  • GET /mcp/context?cursor=… — retrieve MCP-formatted context (task list)
  • POST /mcp/sync — accept a cursor or timestamp to return changes since then

(Refer to the repository for exact route names and payload formats.)

Use Cases

  1. Enrich conversational agents with current tasks
  • Flow: Assistant calls GET /mcp/context for a user, the server returns tasks as context blocks. The assistant includes this context in prompt construction to provide relevant suggestions (e.g., propose scheduling, summarize overdue tasks).

Example curl to retrieve context:

curl -H "Authorization: Bearer <session-token>" "http://localhost:8080/mcp/context?limit=50"
  1. Agent-driven task creation and updates
  • An LLM-based agent decides to create or update an item. It issues a request to the MCP server (or a companion endpoint) which performs the corresponding Google Tasks API call on behalf of the user.
  1. Background sync for context-aware pipelines
  • A pipeline polls /mcp/sync with a cursor/timestamp to receive only new or changed tasks. This reduces redundant data transfer and keeps model context fresh for periodic summarization or notification generation.
  1. Personalization and prompt priming
  • Use task metadata (due dates, completed status, priorities) to prime prompts for deadline-aware planning, daily standup summaries, or to build persistent context that influences model responses.

Notes for Developers

  • Secure the auth endpoints and tokens carefully. The server will store OAuth tokens needed to access Google Tasks; treat the DATA_DIR as sensitive.
  • Test locally with a single Google account before deploying to multi-user scenarios. The included examples demonstrate the OAuth flow and how tasks map into the MCP payload shape.
  • Consult the repo’s examples/ directory and the repo README for exact payload schemas and client helper code.

This MCP server provides a focused integration point for adding Google Tasks into model-driven workflows, letting developers concentrate on how to use task context rather than managing Google API mechanics.

Common Issues & Solutions

Calls from Claude Desktop like "prompts/list" and "prompts/create" return a JSON-RPC error -32601 (Method not found). The client shows the request but the MCP server does not recognize or handle those methods.

✓ Solution

I ran into this too! The root cause turned out to be a protocol/method mismatch between Claude Desktop and my MCP server: the server wasn't advertising the 'prompts/*' RPCs because the gtasks plugin was disabled and I was running an older MCP build. What fixed it for me was upgrading both the desktop app and the MCP server to the latest compatible releases, enabling the gtasks/prompts plugin in the server config, and restarting the server. After that I verified available methods via the server's discovery endpoint and the 'prompts/list' and 'prompts/create' calls started returning valid responses.

You received a GitHub issue saying your project zcaceres/gtasks-mcp is listed on Spark and instructing you to claim it by signing in and verifying push access. You're unsure if the message is legitimate and how to safely claim or remove the listing.

✓ Solution

I ran into this too! I clicked the claim link, signed in with GitHub, and explicitly allowed Spark to verify my repo push access. Spark detected the zcaceres/gtasks-mcp repo, I confirmed ownership, edited the listing metadata, and added the 'Listed on Spark' badge to the README. If you don't want the listing, claim it and unpublish/remove it from Spark, or email the contact in the issue ([email protected]) to request takedown. I also checked the entire.vc domain and the GitHub OAuth scopes before proceeding to be safe. After claiming, close the issue.

The server currently expects gcp-oauth.keys.json at a static path, which makes it hard to share credentials across multiple MCP instances. There is no environment variable to override the file location.

✓ Solution

I ran into this too! I fixed it by making the server read a GOOGLE_OAUTH_CREDENTIALS env var and fall back to the repo default path. In my TypeScript startup I load dotenv for local dev, then compute credPath = process.env.GOOGLE_OAUTH_CREDENTIALS || path.resolve(__dirname, '../config/gcp-oauth.keys.json'), read and JSON.parse with fs.readFileSync, and validate required fields. If missing I throw a clear startup error. I also added @types/node and a tiny helper so multiple MCP instances can point to a shared credentials file without changing code.

When multiple MCP servers are registered, the 'list' function is frequently invoked by the model on unrelated prompts. It defaults to retrieving hundreds of tasks, which risks exposing PII and unnecessary data transfer.

✓ Solution

I ran into this too! I fixed it by tightening the input schema and adding server-side guards so the list function cannot run unless explicitly requested. Concretely I changed the schema to require either a listId (preferred) or a maxResults parameter (implemented with oneOf and required fields), set a safe default maxResults of 10, and return an error when neither is provided. I also updated the MCP server to reject automatic invocations when schema requirements are unmet and added logging/tests. After that, the model stopped firing the list call on unrelated prompts.

On Windows, running the auth command fails because the code constructs an incorrect path with a duplicated drive prefix (e.g. C:\C:\...), so the gcp-oauth.keys.json file cannot be found. This happens due to using import.meta.url pathname resolution in index.ts.

✓ Solution

I ran into this too! On Windows the code was using path.dirname(new URL(import.meta.url).pathname) which yields a pathname starting with /C:/... and combining that produced 'C:\C:\...' causing module load to fail. I fixed it by resolving the credentials file against process.cwd() instead: const credsPath = path.resolve(process.cwd(), 'gcp-oauth.keys.json'); This avoids import.meta.url encoding/leading-slash issues and matches the runtime working directory. I also added a simple exists check (fs.existsSync) and a clearer error message if the file is missing; building and running npm run start auth works now.