Skip to main content
Glama
Google Tasks MCP Server

Google Tasks MCP Server

Google Tasks MCP 服务器

此模型上下文协议 (MCP) 服务器在 MCP 客户端与 Google Tasks 之间提供桥梁,允许您直接从 Claude Desktop、Cursor 和 Codex 等客户端管理您的任务列表和任务。

[!NOTE] 本项目中的所有代码(除部分编辑外)均为 “vibe coded” —— 即在我的指令下由 Claude/Copilot 生成。

功能

此 MCP 服务器提供以下功能:

任务列表管理

  • list-tasklists - 列出您所有的任务列表

  • get-tasklist - 获取特定任务列表的详细信息

  • create-tasklist - 创建新的任务列表

  • update-tasklist - 更新现有的任务列表

  • delete-tasklist - 删除任务列表

任务管理

  • list-tasks - 列出任务列表中的所有任务,包括分页结果

  • get-task - 获取特定任务的详细信息

  • create-task - 创建新任务

  • update-task - 更新现有任务

  • delete-task - 删除任务

  • complete-task - 将任务标记为已完成

  • move-task - 移动任务(重新排序、更改父级或跨任务列表移动)

  • clear-completed-tasks - 清除列表中的所有已完成任务

Related MCP server: Google Tasks MCP Server

设置说明

1. 创建 Google Cloud 项目并启用 API

  1. 前往 Google Cloud Console

  2. 创建一个新项目

  3. 导航至“API 和服务” > “库”

  4. 搜索“Google Tasks API”并启用它

  5. 前往“API 和服务” > “凭据”

  6. 点击“创建凭据” > “OAuth 客户端 ID”

  7. 配置 OAuth 同意屏幕(个人使用选择“外部”即可)

  8. 在应用程序类型中,选择“Web 应用程序”

  9. 添加 http://localhost:3000/oauth2callback 作为授权重定向 URI

  10. 创建客户端 ID 和密钥

2. 配置环境变量

在此项目目录中创建一个 .env 文件:

GOOGLE_CLIENT_ID=your_client_id_here
GOOGLE_CLIENT_SECRET=your_client_secret_here
GOOGLE_REDIRECT_URI=http://localhost:3000/oauth2callback

环境变量:

  • GOOGLE_CLIENT_ID(必需)- 您的 Google OAuth 客户端 ID

  • GOOGLE_CLIENT_SECRET(必需)- 您的 Google OAuth 客户端密钥

  • GOOGLE_REDIRECT_URI(可选)- OAuth 重定向 URI(默认为 http://localhost:3000/oauth2callback)

注意: 服务器会在启动时验证是否设置了 GOOGLE_CLIENT_ID 和 GOOGLE_CLIENT_SECRET,如果缺失或无效,将显示清晰的错误消息并停止运行。

3. 构建服务器

  1. 安装依赖项:

npm install
  1. 构建服务器:

npm run build

4. 配置 MCP 客户端

Codex

将服务器添加到 ~/.codex/config.toml:

[mcp_servers.google-tasks]
command = "zsh"
args = ["-lc", "cd /path/to/google-tasks-mcp && exec node build/index.js"]

将 /path/to/google-tasks-mcp 替换为此项目的路径,然后重启 Codex。

验证服务器是否已注册:

codex mcp list
codex mcp get google-tasks

Claude for Desktop

  1. 安装 Claude for Desktop

  2. 打开 Claude 配置文件:

    • MacOS: ~/Library/Application Support/Claude/claude_desktop_config.json

    • Windows: %APPDATA%\Claude\claude_desktop_config.json

  3. 添加 Google Tasks MCP 服务器配置:

{
  "mcpServers": {
    "google-tasks": {
      "command": "node",
      "args": ["/path/to/google-tasks-mcp/build/index.js"]
    }
  }
}

将路径替换为您自己的值,然后重启 Claude for Desktop。

身份验证流程

首次使用 Google Tasks MCP 服务器时:

  1. 使用 authenticate 工具获取授权 URL

  2. 在浏览器中访问该 URL 并登录您的 Google 账号

  3. 授权后,您将在浏览器页面上收到一个代码

  4. 使用 set-auth-code 工具输入此代码以完成身份验证

  5. 现在您可以使用所有其他工具与 Google Tasks 进行交互

注意: 您的身份验证令牌(包括刷新令牌)会自动保存到磁盘 ~/.config/google-tasks-mcp/credentials.json 中,并具有受限权限 (600)。这意味着:

  • 您只需验证一次 - 凭据在服务器重启后依然有效

  • 自动令牌刷新 - 访问令牌会在过期时(通常为 1 小时后)使用保存的刷新令牌自动刷新

  • 无需重新验证 - 初始设置后,除非您撤销访问权限或删除凭据文件,否则无需再次验证

要求

  • Node.js 20+(请参阅 package.json 中的 engines)

  • 支持 MCP 的客户端

  • 已启用 Tasks API 的 Google Cloud 项目

实现特性

此 MCP 服务器包含以下改进:

  • 持久化令牌存储 - 身份验证凭据以受限权限保存到磁盘 (~/.config/google-tasks-mcp/credentials.json),因此您只需验证一次

  • 环境变量验证 - 启动时验证确保已配置必需的凭据,并提供清晰的错误消息

  • 自动令牌刷新 - OAuth 令牌在过期时自动刷新,无需在会话期间或重启后重新验证

  • 增强的输入验证 - 对所有输入进行全面验证,包括 ID 格式、字符串长度和 RFC 3339 日期格式

  • HTML 清理 - 对 OAuth 回调响应进行清理,以防止 XSS 漏洞

  • 优雅关闭 - 在收到 SIGINT/SIGTERM 信号时正确清理资源

  • 类型安全 - 整个代码库具有完整的 TypeScript 类型安全,并带有适当的接口

  • 可配置的重定向 URI - 可通过 GOOGLE_REDIRECT_URI 环境变量自定义 OAuth 重定向 URI

截图

Claude Desktop

Claude Desktop 截图

Cursor

Cursor 截图

许可证

本项目仅供演示使用。使用风险自负。

Available Tools

15 tools
authenticateB

Get URL to authenticate with Google Tasks

Inputs: no named parameters.

clear-completed-tasksC

Clear all completed tasks from a task list

Inputs: tasklist (required).

complete-taskC

Mark a task as completed

Inputs: tasklist (required), task (required).

create-taskC

Create a new task in a task list

Inputs: tasklist (required), title (required), notes, due.

create-tasklistC

Create a new task list

Inputs: title (required).

delete-taskC

Delete a task

Inputs: tasklist (required), task (required).

delete-tasklistC

Delete a task list

Inputs: tasklist (required).

get-taskC

Get a specific task by ID

Inputs: tasklist (required), task (required).

get-tasklistC

Get a task list by ID

Inputs: tasklist (required).

list-tasklistsB

List all task lists

Inputs: no named parameters.

list-tasksC

List all tasks in a task list

Inputs: tasklist (required), showCompleted, showHidden, showDeleted.

move-taskC

Move a task to another position

Inputs: tasklist (required), task (required), parent, previous.

set-auth-codeC

Set the authentication code received from Google OAuth flow

Inputs: code (required).

update-taskC

Update an existing task

Inputs: tasklist (required), task (required), title, notes, +2 more.

update-tasklistC

Update an existing task list

Inputs: tasklist (required), title (required).

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.5/5.0

    Scored across 15 tools

    Disambiguation5/5

    Every tool has a clearly distinct purpose with no ambiguity. Each tool targets specific resources (tasks or tasklists) and actions (create, get, list, update, delete, complete, clear, move), making it easy for an agent to select the right tool. The separation between task operations and tasklist operations is particularly clear.

    Naming Consistency5/5

    The naming follows a perfectly consistent verb-noun pattern throughout all 15 tools. Every tool uses snake_case with clear action verbs (create, get, list, update, delete, etc.) followed by the resource name (task, tasklist), and multi-word resources use hyphens consistently (e.g., clear-completed-tasks).

    Tool Count5/5

    With 15 tools, this server is well-scoped for managing Google Tasks. Each tool earns its place by covering essential CRUD operations for both tasks and tasklists, plus additional workflow actions like moving tasks and clearing completed ones. The count is appropriate for the domain without being overwhelming.

    Completeness5/5

    The tool surface provides complete coverage for the Google Tasks domain. It includes full CRUD operations for both tasks and tasklists, plus lifecycle actions like completing tasks, moving tasks, and clearing completed tasks. Authentication tools are also included, ensuring no dead ends for agents.

    Maintenance

    ActivityNo data
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers

    Appeared in Searches