mcp-google-calendar
Enables LLMs to manage Google Calendar events and Google Tasks through a set of MCP tools.
README
mcp-google-calendar
A Google Calendar and Google Tasks (MCP) server to expose calendar and task operations as tools for LLM.
Table of Contents
- mcp-google-calendar
Important: Authentication Architecture
This MCP server is configured to use a single Google account for all operations. The authentication credentials (client ID, client secret, and refresh token) are stored in environment variables (.env file), meaning all users of this MCP server will interact with the same Google Calendar and Google Tasks account.
Current Implementation
- Single Account Mode: One Google account's credentials are configured in the
.envfile - All operations (create, read, update, delete events and tasks) are performed on this single account
- Best for: Personal use, single-user applications, or shared team calendars and task lists
Multi-User Scenarios
If you need each user to authenticate with their own Google account, this server would require modifications:
- Add user authentication layer: Implement a user authentication system (OAuth2, sessions, JWT, etc.)
- Pass user context: Modify the MCP tools to use the authenticated user's token instead of the
.envtoken - Token refresh logic: Implement per-user token refresh and management
Note: The current implementation prioritizes simplicity for personal use.
Setup
Prerequisites
- A Google account
- Access to Google Cloud Console
- Node.js installed
Step-by-step Configuration
1. Configure Google Cloud Console Project
- Go to Google Cloud Console
- Create a new project or select an existing one
- Enable the required APIs:
- Google Calendar API: Go to "APIs & Services" > "Library", search for "Google Calendar API" and click "Enable"
- Google Tasks API: Go to "APIs & Services" > "Library", search for "Google Tasks API" and click "Enable"
2. Create OAuth 2.0 Credentials
- Go to "APIs & Services" > "Credentials"
- Click "Create Credentials" > "OAuth 2.0 Client ID"
- If it's your first time, configure the OAuth consent screen:
- Select "External" (or "Internal" if you have Google Workspace)
- Complete the basic app information
- In "Scopes", don't add any scope (we'll do this programmatically)
- Add your email as a test user
- Create the OAuth 2.0 Client ID:
- Application type: "Web application"
- Name: "Google Calendar MCP Server"
- Authorized redirect URIs:
http://localhost:8080/oauth/callback
3. Configure the .env file
- Copy the credentials from Google Cloud Console
- Create a
.envfile in the project root:
# Google Cloud Console credentials
GOOGLE_CLIENT_ID=your_client_id_here.apps.googleusercontent.com
GOOGLE_CLIENT_SECRET=your_client_secret_here
# This will be generated in the next step
GOOGLE_REFRESH_TOKEN=
# Default timezone for calendar operations
DEFAULT_TIMEZONE=Atlantic/Canary
4. Get the refresh token
Run the setup script:
npm run setup:google
This script will:
- Start a temporary server on port 8080
- Show you a URL to authorize the application
- Open that URL in your browser
- After authorizing, give you a
refresh_token - Return token
GOOGLE_REFRESH_TOKEN
5. Test the configuration
npm run build
node dist/index.js
MCP Client Configuration
Add this to your MCP client configuration (e.g., Claude Desktop config):
{
"mcpServers": {
"google-calendar": {
"command": "npx",
//WIP: "args": ["mcp-google-calendar"],
"env": {
"GOOGLE_CLIENT_ID": "<your-client-id>",
"GOOGLE_CLIENT_SECRET": "<your-client-secret>",
"GOOGLE_REFRESH_TOKEN": "<your-refresh-token>",
"DEFAULT_TIMEZONE": "Atlantic/Canary"
}
}
}
}
Usage
- Compile TypeScript to JavaScript:
npm run build
- Run the MCP server:
node dist/index.js
Testing with MCP Inspector
You can test and debug this MCP server using the MCP Inspector:
- Make sure you have built the project:
npm run build
- Set up your environment variables in
.envfile:
GOOGLE_CLIENT_ID=your-client-id
GOOGLE_CLIENT_SECRET=your-client-secret
GOOGLE_REFRESH_TOKEN=your-refresh-token
DEFAULT_TIMEZONE=Atlantic/Canary
- Update
mcp-inspector-config.jsonwith your project path:
{
"mcpServers": {
"mcp-google-calendar": {
"command": "node",
"args": ["dist/index.js"],
"env": {
"GOOGLE_CLIENT_ID": "${GOOGLE_CLIENT_ID}",
"GOOGLE_CLIENT_SECRET": "${GOOGLE_CLIENT_SECRET}",
"GOOGLE_REFRESH_TOKEN": "${GOOGLE_REFRESH_TOKEN}",
"DEFAULT_TIMEZONE": "${DEFAULT_TIMEZONE}"
}
}
}
}
- Run the MCP Inspector:
npx @modelcontextprotocol/inspector --config mcp-inspector-config.json
- Open your browser to the URL shown in the terminal (default should be http://localhost:6277) to interact with the MCP server through the Inspector UI.
Timezone Configuration
This MCP server supports flexible timezone configuration:
- Default Timezone: Set
DEFAULT_TIMEZONEin your.envfile using IANA timezone format (e.g.,Atlantic/Canary,America/New_York,Asia/Tokyo) - Per-Operation Override: When creating or updating events, you can specify a different timezone for that specific operation
- Fallback: If no timezone is configured, the server defaults to
Atlantic/Canary
Timezone Priority:
- Timezone parameter passed to the tool (highest priority)
DEFAULT_TIMEZONEenvironment variable from.env- Hardcoded default:
Atlantic/Canary(lowest priority)
Common IANA Timezones:
- Europe:
Atlantic/Canary,Europe/London,Europe/Paris,Europe/Berlin - Americas:
America/New_York,America/Chicago,America/Los_Angeles,America/Mexico_City - Asia:
Asia/Tokyo,Asia/Shanghai,Asia/Dubai,Asia/Kolkata - Other:
Atlantic/Canary,Pacific/Auckland,Australia/Sydney
Security
- Never share your
client_secretorrefresh_token - Add
.envto your.gitignore(already included) - Tokens have limited permissions only for Google Calendar and Google Tasks
Additional Resources
- Google Calendar API Documentation
- Google Tasks API Documentation
- OAuth 2.0 for Web Server Applications
- Google Cloud Console
- Model Context Protocol Documentation
Available Tools
Calendar Tools
calendar-create-event
Creates a new calendar event in Google Calendar.
Parameters:
title: String - Event title/summarystart: DateTime string - Event start time (ISO 8601 format)end: DateTime string - Event end time (ISO 8601 format)description: String (optional) - Event descriptionlocation: String (optional) - Event locationattendees: Array of email strings (optional) - List of attendee email addressestimeZone: String (optional) - Timezone in IANA format (e.g., Atlantic/Canary, America/New_York). Defaults toDEFAULT_TIMEZONEfrom .env or 'Atlantic/Canary'calendarId: String (optional) - Calendar ID (defaults to 'primary')
Returns:
- The unique ID and details of the created event
calendar-update-event
Updates an existing event in Google Calendar.
Parameters:
eventId: String - The unique ID of the event to updatetitle: String (optional) - New event title/summarystart: DateTime string (optional) - New event start time (ISO 8601 format)end: DateTime string (optional) - New event end time (ISO 8601 format)description: String (optional) - New event descriptionlocation: String (optional) - New event locationattendees: Array of email strings (optional) - List of attendee email addressestimeZone: String (optional) - Timezone in IANA format (e.g., Atlantic/Canary, America/New_York). Defaults toDEFAULT_TIMEZONEfrom .env or 'Atlantic/Canary'calendarId: String (optional) - Calendar ID (defaults to 'primary')
Returns:
- The updated event details
calendar-list-events
Lists events within a specified timeframe from Google Calendar.
Parameters:
timeMin: DateTime string (optional) - Start of the timeframe (ISO 8601 format)timeMax: DateTime string (optional) - End of the timeframe (ISO 8601 format)calendarId: String (optional) - Calendar ID (defaults to 'primary')maxResults: Number (optional) - Maximum number of events to return (default: 10)
Returns:
- A list of events that fall within the given timeframe
calendar-search-events
Searches for events in Google Calendar by text query.
Parameters:
query: String - Search querycalendarId: String (optional) - Calendar ID (defaults to 'primary')maxResults: Number (optional) - Maximum number of events to return (default: 10)
Returns:
- A list of events matching the search query
calendar-delete-event
Deletes an event from Google Calendar.
Parameters:
eventId: String - The unique ID of the event to deletecalendarId: String (optional) - Calendar ID (defaults to 'primary')
Returns:
- Confirmation of deletion
calendar-list-calendars
Lists all calendars available to the user.
Returns:
- A list of calendars with their IDs and names
calendar-get-current-datetime
Gets the current date and time in ISO 8601 format. Useful for references when creating or searching for events.
Parameters:
timezone: String (optional) - Timezone in IANA format (e.g., Atlantic/Canary, America/New_York, Asia/Tokyo). Defaults toDEFAULT_TIMEZONEfrom .env or 'Atlantic/Canary'.
Returns:
- Current date and time information including ISO 8601 format, timestamp, local time, and timezone details
Tasks Tools
tasks-list-task-lists
Lists all task lists available in Google Tasks.
Parameters: None
Returns:
- A list of all task lists with their IDs and titles
Example use case:
- Get the list of all your task lists to find the
taskListIdfor creating or managing tasks
tasks-list-tasks
Lists all tasks in a specific task list.
Parameters:
taskListId: String - The ID of the task list (usetasks-list-task-liststo get this)showCompleted: Boolean (optional) - Whether to show completed tasks (default: true)maxResults: Number (optional) - Maximum number of tasks to return (default: 100)
Returns:
- A list of tasks with details including ID, title, notes, status, due date, and completion date
tasks-create-task
Creates a new task in Google Tasks.
Parameters:
taskListId: String - The ID of the task list where the task will be createdtitle: String - Task title/summarynotes: String (optional) - Task notes or descriptiondue: DateTime string (optional) - Due date in ISO 8601 format (e.g., "2024-12-31T23:59:59Z")
Returns:
- The created task details including ID, title, notes, status, and due date
tasks-update-task
Updates an existing task in Google Tasks.
Parameters:
taskListId: String - The ID of the task list containing the tasktaskId: String - The ID of the task to updatetitle: String (optional) - New task titlenotes: String (optional) - New task notes or descriptiondue: DateTime string (optional) - New due date in ISO 8601 formatstatus: String (optional) - Task status: either "needsAction" or "completed"
Returns:
- The updated task details
tasks-delete-task
Deletes a task from Google Tasks.
Parameters:
taskListId: String - The ID of the task list containing the tasktaskId: String - The ID of the task to delete
Returns:
- Confirmation message of deletion
License
MIT
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。