A Model Context Protocol (MCP) server for Google Tasks, allowing AI assistants to interact with Google Tasks through the MCP protocol.
- List, create, update, and delete task lists
- List, search, create, update, delete, and move tasks
- Task organization with parent-child relationships
- View detailed task information
- Clear completed tasks
- OAuth2 authentication with automatic token refresh
- Parallel API requests for improved performance
- TypeScript interfaces for type safety
- Comprehensive error handling
- Integration with AI assistants through MCP
# Clone the repository
git clone https://github.com/overlay-one/google-tasks-mcp-server.git
cd google-tasks-mcp-server
# Install dependencies
pnpm install
# Build the project
pnpm build
- Create a project in the Google Cloud Console.
- Enable the Google Tasks API:
- Navigate to API Library
- Search for "Tasks API"
- Click "Enable"
- Create OAuth 2.0 credentials:
- Navigate to "Credentials"
- Click "Create Credentials" and select "OAuth client ID"
- Choose "Web application" as application type
- Add your redirect URI (e.g.,
http://localhost:3000/oauth2callback
) - After creation, note your Client ID and Client Secret
- Copy
.env.example
to.env
:
cp .env.example .env
- Edit the
.env
file with your Google API credentials:
# Required credentials
CLIENT_ID=your-client-id
CLIENT_SECRET=your-client-secret
REDIRECT_URI=http://localhost:3000/oauth2callback
# Optional tokens (if you already have them)
# ACCESS_TOKEN=your-access-token
# REFRESH_TOKEN=your-refresh-token
# Optional server configuration
# LOG_LEVEL=info # Options: error, warn, info, debug
The server supports two authentication methods:
- Environment Variables: Set ACCESS_TOKEN and REFRESH_TOKEN in your .env file
- Credentials File: The server can store tokens in a
.credentials.json
file
The server includes automatic token refresh handling. When access tokens expire, the server will:
- Automatically use the refresh token to obtain a new access token
- Update the credentials in memory
- Save the updated tokens to
.credentials.json
(if using file-based storage)
# Production mode
pnpm start
# Development mode (with auto-reloading)
pnpm dev
Claude Desktop can integrate with this MCP server to access Google Tasks directly. This integration allows you to manage your tasks through natural language conversations with Claude.
- Natural Language Task Management: Create, search, and organize tasks using everyday language
- Contextual Understanding: Claude understands what you mean when you say "tomorrow" or "next week" for due dates
- Task Prioritization Assistance: Ask Claude for help organizing and prioritizing your tasks
- Intelligent Search: Find tasks using context and meaning, not just exact keywords
- Bulk Operations: Ask Claude to help you create or modify multiple tasks at once
- Scheduling Assistance: Claude can suggest optimal due dates based on your existing tasks
- Task Summarization: Get concise summaries of your tasks across multiple lists
- Daily Planning: Ask Claude to help you plan your day based on your current tasks
Here's how to set up the integration:
-
Start the Google Tasks MCP server:
pnpm start
The server will run on standard input/output channels (stdio).
-
Launch Claude Desktop with MCP server connection:
claude mcp --command "node /path/to/google-tasks-mcp-server/dist/index.js"
Replace
/path/to/google-tasks-mcp-server
with the actual path to your installation. -
Alternative: Create a configuration file: Create a file named
claude.yaml
in your home directory or project directory:mcp: command: node /path/to/google-tasks-mcp-server/dist/index.js
Then simply run
claude
to use the configured MCP server. -
Inside Claude Desktop: Once connected, Claude will have access to your Google Tasks through custom MCP resources and tools. You can ask Claude to:
- "Show me my task lists"
- "Create a new task called 'Complete project report'"
- "Find all tasks related to meetings"
- "Mark my 'Review documents' task as completed"
Claude will use the MCP server to access your Google Tasks data according to your requests.
Here are some example conversations you can have with Claude once connected:
Listing Tasks:
You: Show me all my tasks
Claude: I'll retrieve your tasks from Google Tasks.
[Claude uses task.list tool]
Here are your current tasks:
- Complete project documentation (Due: 2025-05-10)
- Schedule team meeting (Due: Not set)
- Review quarterly report (Due: 2025-05-15)
Creating a Task:
You: Create a new task called "Send follow-up email" due tomorrow at 3 PM
Claude: I'll create that task for you.
[Claude uses task.create tool]
I've created a new task:
Title: Send follow-up email
Due: 2025-05-06T15:00:00Z
Status: needsAction
Searching Tasks:
You: Find all tasks related to "meeting"
Claude: I'll search for tasks containing "meeting".
[Claude uses task.search tool]
I found 2 tasks related to "meeting":
- Schedule team meeting (Due: Not set)
- Prepare meeting agenda (Due: 2025-05-08)
Managing Task Lists:
You: Create a new task list called "Personal Projects"
Claude: I'll create that task list for you.
[Claude uses tasklist.create tool]
I've created a new task list named "Personal Projects".
Would you like me to add any tasks to this list?
Here are some advanced ways to use Claude with your Google Tasks:
You: I need to plan a website launch. Can you help me create tasks for it?
Claude: I'd be happy to help plan your website launch. Let me create a task list and relevant tasks.
[Claude uses tasklist.create and task.create tools]
I've created a new task list "Website Launch" with the following tasks:
1. Finalize website content (Due: 1 week from now)
2. Complete design review (Due: 10 days from now)
3. Run final QA tests (Due: 2 weeks from now)
4. Prepare marketing materials (Due: 2 weeks from now)
5. Configure analytics (Due: 3 days before launch)
6. Launch website (Due: 3 weeks from now)
Would you like me to add more specific tasks?
You: I have too many tasks. Can you help me prioritize them?
Claude: I'll help you organize and prioritize your tasks.
[Claude uses task.list tool]
Based on your current tasks, here's a suggested prioritization:
High Priority (Complete today):
- Submit quarterly report (Due: Today)
- Call client about project delay (Due: Today)
Medium Priority (Complete this week):
- Prepare presentation (Due: In 3 days)
- Review team metrics (Due: In 5 days)
Low Priority (Can be scheduled later):
- Research new tools (Due: Next week)
- Update documentation (Due: In 2 weeks)
Would you like me to update the due dates to reflect these priorities?
You: What tasks should I focus on today?
Claude: Let me check your tasks due today or overdue.
[Claude uses task.list and task.search tools]
Here are the tasks you should focus on today:
Due Today:
- Prepare client meeting agenda
- Submit expense report
Overdue:
- Follow up on pending approvals (Due yesterday)
Upcoming Soon:
- Project proposal draft (Due tomorrow)
Should I mark any of these as completed?
If you encounter issues when connecting Claude Desktop to the Google Tasks MCP server:
-
Authentication Problems:
- Ensure your
.env
file has the correctCLIENT_ID
,CLIENT_SECRET
, andREDIRECT_URI
- Check that you have valid refresh tokens in
.env
or in.credentials.json
- If needed, regenerate your tokens through the Google OAuth process
- Ensure your
-
Connection Issues:
- Verify the server is running with
pnpm start
before connecting Claude - Check that the path in your
claude mcp --command
is correct - If using a configuration file, ensure the YAML syntax is valid
- Verify the server is running with
-
Command Not Found:
- Ensure Claude Desktop CLI is in your PATH
- Try using the full path to the Claude executable
-
MCP Protocol Errors:
- These typically appear if the server encounters an internal error
- Check server logs for details about the specific error
- Ensure you're using compatible versions of Claude Desktop and the MCP SDK
The server provides resources through custom URI schemes:
gtasklists:///
: Lists all task listsgtasklists:///{taskListId}
: Access a specific task list by ID
gtasks:///
: Lists all tasks across all task listsgtasks:///default
: Lists tasks in the default task listgtasks:///{taskId}
: Access a specific task by IDgtasks:///{taskListId}/tasks/{taskId}
: Access a specific task within a specific task list
The server supports the following operations through MCP tools:
Tool | Description | Required Parameters | Optional Parameters |
---|---|---|---|
tasklist.list |
List all task lists | None | maxResults |
tasklist.get |
Get a task list by ID | id |
None |
tasklist.create |
Create a new task list | title |
None |
tasklist.update |
Update a task list | id , title |
None |
tasklist.delete |
Delete a task list | id |
None |
Tool | Description | Required Parameters | Optional Parameters |
---|---|---|---|
task.search |
Search for tasks by title or notes | query |
taskListId |
task.list |
List all tasks | None | taskListId , cursor |
task.get |
Get a task by ID | id |
taskListId |
task.create |
Create a new task | title |
taskListId , notes , due , status , parent |
task.update |
Update an existing task | id |
taskListId , title , notes , status , due , parent |
task.move |
Move a task (change parent or position) | id |
taskListId , parent , previous |
task.delete |
Delete a task | id |
taskListId |
task.clear |
Clear completed tasks | None | taskListId |
{
"name": "task.create",
"arguments": {
"title": "Complete project documentation",
"notes": "Include API reference and setup instructions",
"due": "2025-05-10T00:00:00.000Z",
"status": "needsAction"
}
}
{
"name": "task.search",
"arguments": {
"query": "documentation",
"taskListId": "MTIzNDU2Nzg5MA"
}
}
src/index.ts
: Main server implementation and MCP protocol handlerssrc/Tasks.ts
: Implementation of task and task list resources and actionssrc/types.ts
: TypeScript interfaces for request/response handlingtest/
: Unit tests for server components
The project uses TypeScript interfaces for type safety. Key interfaces include:
- Request Parameter Types: TypeScript interfaces for all tool parameter types
TaskCreateParams
,TaskUpdateParams
,TaskSearchParams
, etc.
- Resource Types: Interfaces for resource representations
TaskResource
,TaskListResource
- Utility Types: Helper types for working with the Google Tasks API
These interfaces help ensure type safety when passing parameters to the Google Tasks API and handling responses.
The server implements a consistent error handling system that:
- Maps HTTP error codes to appropriate MCP error codes
- Provides detailed error messages with operation context
- Handles errors from parallel API calls appropriately
The server uses parallel API calls for operations involving multiple task lists:
- In
TaskResources.list()
andTaskActions._list()
, tasks from multiple lists are fetched in parallel - Results are combined properly, even if some task list requests fail
- This significantly improves performance for users with many task lists
The project includes a testing framework using Node.js built-in test runner:
# Run all tests (this will first build the TypeScript code)
pnpm test
# Run tests in watch mode for development
pnpm test:watch
Before running tests for the first time, you'll need to make sure dependencies are installed:
pnpm install
The test suite includes:
- Authentication tests: Verify token refresh handling
- Task operation tests: Validate task API functionality
- Error handling tests: Ensure errors are properly handled
Tests are written in JavaScript and run against the compiled TypeScript code, ensuring that the production code works as expected. The tests are designed to work with mocked dependencies, so no real Google API calls are made during testing.
pnpm build
pnpm dev
Apache-2.0