Logo Google Calendar MCP 服务器

Google Calendar MCP 服务器

Cộng đồng
takumi0706

Google Calendar MCP server for Claude Desktop integration

Nhà phát hànhtakumi0706
Kho mãgoogle-calendar-mcp
Ngôn ngữTypeScript
Bản fork
11
Sao
59
Công cụ có sẵn
0
Phương thức truyền tảistdio
Danh mục
Giấy phépMIT
Liên kết
  • Kết nối công cụ với quy trình làm việc AI

    Google Calendar MCP 服务器 cung cấp các chức năng MCP cho các ứng dụng khách AI và tác nhân AI tương thích.

  • 0 công cụ có sẵn

    Xem các thao tác có thể gọi bên dưới, kèm tên và mô tả nếu máy chủ cung cấp.

  • Mẫu cấu hình có thể sao chép ngay

    Dùng các đoạn cấu hình mẫu để thiết lập máy chủ này trong ứng dụng khách MCP bạn muốn dùng.

  • Mức độ quan tâm của cộng đồng đến kho mã

    59 sao và 11 bản fork từ kho mã được liên kết.

Google Calendar MCP Server

Apr-15-2025 12-17-08

🔔 VERSION UPDATE NOTICE 🔔
Version 2.0.0 moves to MCP protocol revision 2026-07-28 and implements PKCE on the OAuth flow. It requires Node.js 20 or newer. See the version history below for the full list of changes.

Version License

日本語 English

Project Overview

Google Calendar MCP Server is an MCP (Model Context Protocol) server implementation that enables integration between Google Calendar and Claude Desktop. This project enables Claude to interact with the user's Google Calendar, providing the ability to display, create, update, and delete calendar events through natural language interaction.

Core Features

  • Google Calendar integration: Provides a bridge between Claude Desktop and the Google Calendar API
  • MCP implementation: Follows the Model Context Protocol specification for AI assistant tool integration
  • OAuth2 authentication: Handles the Google API authentication flow securely
  • Event management: Supports comprehensive calendar event operations (get, create, update, delete)
  • Color support: Ability to set and update event colors using colorId parameter
  • STDIO transport: Uses standard input/output for communication with Claude Desktop

Technical Architecture

This project uses:

  • TypeScript: For type-safe code development
  • MCP SDK: Uses @modelcontextprotocol/server v2 (protocol revision 2026-07-28, with the 2025 revisions still served for older clients)
  • Google API: Uses googleapis for Google Calendar API access
  • Hono: Lightweight and fast web framework for the authentication server
  • google-auth-library: Drives the OAuth2 authorization code flow with PKCE (S256)
  • Zod: Implements schema validation for request/response data
  • Environment-based configuration: Uses dotenv for configuration management
  • AES-256-GCM: For token encryption using Node.js crypto module
  • Open: For automatic browser launching during authentication
  • Readline: For manual authentication input in server environments
  • Jest: For unit testing and coverage
  • GitHub Actions: For CI/CD

Main Components

  1. MCP Server: Core server implementation that handles communication with Claude Desktop
  2. Google Calendar Tools: Calendar operations (retrieval, creation, update, deletion)
  3. Authentication Handler: Management of OAuth2 flow with Google API
  4. Schema Validation: Ensuring data integrity in all operations
  5. Token Manager: Secure handling of authentication tokens

Available Tools

This MCP server provides the following tools for interacting with Google Calendar:

1. getEvents

Retrieves calendar events with various filtering options.

Parameters:

  • calendarId (optional): Calendar ID (uses primary calendar if omitted, empty string, null, or undefined)
  • timeMin (optional): Start time for event retrieval (ISO 8601 format, e.g., "2025-03-01T00:00:00Z"). Empty strings, null, or undefined values are ignored
  • timeMax (optional): End time for event retrieval (ISO 8601 format). Empty strings, null, or undefined values are ignored
  • maxResults (optional): Maximum number of events to retrieve (default: 10)
  • orderBy (optional): Sort order ("startTime" or "updated"). Defaults to "startTime" if empty string, null, or undefined

2. createEvent

Creates a new calendar event.

Parameters:

  • calendarId (optional): Calendar ID (uses primary calendar if omitted)
  • event: Event details object containing:
    • summary (required): Event title
    • description (optional): Event description
    • location (optional): Event location
    • start: Start time object with:
      • dateTime (optional): ISO 8601 format (e.g., "2025-03-15T09:00:00+09:00")
      • date (optional): YYYY-MM-DD format for all-day events
      • timeZone (optional): Time zone (e.g., "Asia/Tokyo")
    • end: End time object (same format as start)
    • attendees (optional): Array of attendees with email and optional displayName
    • colorId (optional): Event color ID (1-11)
    • recurrence (optional): Array of recurrence rules in RFC5545 format (e.g., ["RRULE:FREQ=WEEKLY;BYDAY=MO,WE,FR"])

3. updateEvent

Updates an existing calendar event. The function fetches the existing event data first and merges it with the update data, preserving fields that are not included in the update request.

Parameters:

  • calendarId (optional): Calendar ID (uses primary calendar if omitted)
  • eventId (required): ID of the event to update
  • event: Event details object containing fields to update (same structure as createEvent, all fields optional)
    • Only fields that are explicitly provided will be updated
    • Fields not included in the update request will retain their existing values
    • This allows for partial updates without losing data
    • recurrence parameter can be updated to modify recurring event patterns

4. deleteEvent

Deletes a calendar event.

Parameters:

  • calendarId (optional): Calendar ID (uses primary calendar if omitted)
  • eventId (required): ID of the event to delete

5. authenticate

Re-authenticates with Google Calendar. This is useful when you want to switch between different Google accounts without having to restart Claude.

Parameters:

  • None

Development Guidelines

When adding new functions, modifying code, or fixing bugs, please semantically increase the version for each change using npm version command. Also, please make sure that your coding is clear and follows all the necessary coding rules, such as OOP. The version script will automatically run npm install when the version is updated, but you should still build, run lint, and test your code before submitting it.

Code Structure

  • src/: Source code directory
    • auth/: Authentication handling (OAuth flow with PKCE, token storage)
    • calendar/: Google Calendar API integration
    • config/: Configuration settings and validation
    • mcp/: MCP server implementation
      • tools/: Google Calendar tool handlers
    • utils/: Utility functions and helpers

Best Practices

  • Proper typing according to TypeScript best practices
  • Maintaining comprehensive error handling
  • Ensure proper authentication flow
  • Keep dependencies up to date
  • Write clear documentation for all functions
  • Implement security best practices
  • Follow the OAuth 2.1 authentication standards
  • Use schema validation for all input/output data

Testing

  • Implement unit tests for core functionality
  • Thoroughly test authentication flow
  • Verify calendar manipulation against Google API
  • Run tests with coverage reports
  • Ensure security tests are included

Deployment

This package is published on npm as @takumi0706/google-calendar-mcp:

bash
npx @takumi0706/google-calendar-mcp@2.0.0

Prerequisites

  1. Node.js 20 or newer
  2. Create a Google Cloud Project and enable the Google Calendar API
  3. Configure OAuth2 credentials in the Google Cloud Console
  4. Set up environment variables:
bash
# Create a .env file with your Google OAuth credentials
GOOGLE_CLIENT_ID=your_client_id
GOOGLE_CLIENT_SECRET=your_client_secret
GOOGLE_REDIRECT_URI=http://localhost:4153/oauth2callback
# Optional: Token encryption key (auto-generated if not provided)
TOKEN_ENCRYPTION_KEY=32-byte-hex-key
# Optional: Auth server port and host (default port: 4153, host: localhost)
AUTH_PORT=4153
AUTH_HOST=localhost
# Optional: MCP server port and host (default port: 3000, host: localhost)
PORT=3000
HOST=localhost
# Optional: Enable manual authentication (useful when localhost is not accessible)
USE_MANUAL_AUTH=true

Claude Desktop Configuration

Add the server to your claude_desktop_config.json. If you're running in an environment where localhost is not accessible, add the USE_MANUAL_AUTH environment variable set to "true".

json
{
  "mcpServers": {
    "google-calendar": {
      "command": "npx",
      "args": [
        "-y",
        "@takumi0706/google-calendar-mcp"
      ],
      "env": {
        "GOOGLE_CLIENT_ID": "your_client_id",
        "GOOGLE_CLIENT_SECRET": "your_client_secret",
        "GOOGLE_REDIRECT_URI": "http://localhost:4153/oauth2callback"
      }
    }
  }
}

Security Considerations

  • OAuth tokens are stored in memory only (not stored in a file-based storage). They are lost on restart, which means re-authentication is required after every restart.
  • Sensitive credentials must be provided as environment variables
  • Token encryption using AES-256-GCM while tokens sit in memory. Note that the key lives in the same process as the ciphertext, so this protects against casual inspection of process memory, not against an attacker who can already read this process's memory.
  • PKCE (S256) on the authorization code flow, with a code_verifier generated per request and never sent to the authorization endpoint
  • State parameter validation for CSRF protection: 256-bit CSPRNG state, compared in constant time, single-use, and expiring after 10 minutes
  • Fixed redirect URI taken from configuration rather than from the request's Host header
  • Input validation with Zod schema
  • HTML escaping on every value interpolated into the OAuth result pages

For more details, see SECURITY.md.

Maintenance

  • Regular updates to maintain compatibility with the Google Calendar API
  • Version updates are documented in README.md

Troubleshooting

If you encounter any issues:

  1. Make sure your Google OAuth credentials are correctly configured
  2. Ensure you have sufficient permissions for Google Calendar API access
  3. Verify your Claude Desktop configuration is correct

Common Errors

  • JSON Parsing Errors: If you see errors like Unexpected non-whitespace character after JSON at position 4 (line 1 column 5), it's typically due to malformed JSON-RPC messages. This issue has been fixed in version 0.6.7 and later. If you're still experiencing these errors, please update to the latest version.
  • Authentication Errors: Verify your Google OAuth credentials
  • Invalid state parameter: If you see Authentication failed: Invalid state parameter when re-authenticating, update to version 1.0.3 or later which fixes the OAuth server lifecycle management. In older versions, you may need to close port 4153 and restart the application.
  • Connection Errors: Make sure only one instance of the server is running
  • Disconnection Issues: Ensure your server is properly handling MCP messages without custom TCP sockets
  • Cannot access localhost: If you're running the application in an environment where localhost is not accessible (like a remote server or container), enable manual authentication by setting USE_MANUAL_AUTH=true. This will allow you to manually enter the authorization code shown by Google after authorizing the application.
  • MCP Parameter Validation Errors: If you see error -32602 with empty string parameters, update to version 1.0.7 or later which handles empty strings, null, and undefined values properly.

Version History

Version 2.0.0 Changes

Security

  • Implemented PKCE (S256) on the OAuth authorization code flow. Earlier versions documented PKCE but never sent a code_challenge.
  • The state parameter is now a 256-bit CSPRNG value, compared in constant time, single-use, and expiring after 10 minutes. It was previously generated with Math.random().
  • Fixed a reflected XSS in the OAuth error page: error details are now logged instead of being interpolated into HTML, and every interpolated value is escaped.
  • redirect_uri is pinned to the configured value instead of being derived from the request's Host header.
  • The local authorization server now aborts when its port is already taken, instead of assuming another instance is serving the flow.
  • TOKEN_ENCRYPTION_KEY must now be exactly 64 hexadecimal characters; invalid and all-zero keys are rejected at startup.
  • Resolved all known vulnerabilities in production dependencies.

Protocol

  • Migrated to @modelcontextprotocol/server v2 and protocol revision 2026-07-28. The 2025 revisions are still served, so existing clients keep working.
  • tools/list now advertises the real schema, so nested objects such as createEvent's event argument expose their properties. They were previously opaque.
  • prompts/get is now implemented. The server advertised ten prompts that could not be fetched.
  • resources/read now returns the shape the specification requires.
  • initialize no longer leaks Zod internals through capabilities.

Breaking

  • Requires Node.js 20 or newer.

Other

  • Migrated the toolchain to pnpm, upgraded googleapis, hono and zod, and removed @hono/oauth-providers.
  • Removed any and type assertions from the shipped code, enforced by lint.

Version 1.0.7 Changes

  • Enhanced parameter validation for MCP tools to properly handle empty strings, null, and undefined values
  • Fixed MCP error -32602 when empty string parameters were passed to getEvents tool
  • Improved preprocessArgs function to skip empty values, allowing Zod schema defaults to be applied correctly
  • Added comprehensive test coverage for empty parameter handling

Version 1.0.6 Changes

  • Fixed the scope is not needed in this google calendar mcp server

Version 1.0.5 Changes

  • Added support for recurring events through the recurrence parameter in both createEvent and updateEvent tools
  • Allows creation and modification of recurring events directly without manual setup

Version 1.0.4 Changes

  • Maintenance release with version number update
  • No functional changes from version 1.0.3
  • Ensures compatibility with the latest dependencies

Version 1.0.3 Changes

  • Added new authenticate tool to allow re-authentication without restarting Claude
  • Made it possible to switch between different Google accounts during a session
  • Exposed authentication functionality through the MCP interface
  • Enhanced user experience by eliminating the need to restart for account switching
  • Added manual authentication option for environments where localhost is not accessible
  • Implemented readline interface for entering authorization codes manually
  • Added USE_MANUAL_AUTH environment variable to enable manual authentication
  • Updated zod dependency to the latest version (3.24.2)
  • Improved schema validation with the latest zod features
  • Enhanced code stability and security
  • Fixed "Invalid state parameter" error during re-authentication
  • Modified OAuth server to start on-demand and shut down after authentication
  • Improved server lifecycle management to prevent port conflicts
  • Enhanced error handling for authentication flow

Version 1.0.2 Changes

  • Fixed updateEvent function to preserve existing event data when performing partial updates
  • Added getEvent function to fetch existing event data before updating
  • Modified updateEvent to merge update data with existing data to prevent data loss
  • Updated schema validation to make all fields optional in update requests
  • Improved documentation for the updateEvent function

Version 1.0.1 Changes

  • Fixed compatibility issue with Node.js v20.9.0+ and the 'open' package (v10+)
  • Replaced static import with dynamic import for the ESM-only 'open' package
  • Improved error handling for browser opening during OAuth authentication
  • Enhanced code comments for better maintainability

Version 1.0.0 Changes

  • Major version release marking production readiness
  • Comprehensive code refactoring for improved maintainability
  • Internationalization of all messages and comments (translated Japanese to English)
  • Enhanced code consistency and readability
  • Improved error messages for better user experience
  • Updated documentation to reflect current state of the project
  • Standardized coding style throughout the codebase

Version 0.8.0 Changes

  • Enhanced OAuth authentication flow to handle refresh token issues
  • Added prompt: 'consent' parameter to force Google to show the consent screen and provide a new refresh token
  • Modified authentication flow to work with just an access token if a refresh token is not available
  • Improved token refresh logic to handle cases where there's no refresh token or if the refresh token is invalid
  • Updated token storage to save refreshed access tokens for better token management
  • Fixed potential infinite loop in token refresh logic

Installation

Quick Start (Recommended)

Install directly from npm:

bash
npm install -g @takumi0706/google-calendar-mcp

Manual Installation

For development or customization:

bash
# Clone the repository
git clone https://github.com/takumi0706/google-calendar-mcp.git
cd google-calendar-mcp

# Install dependencies
npm install

# Build the project
npm run build

# Run the server
npm start

Production Deployment

For production use, the server requires valid Google OAuth credentials. The server will fail to start without proper credentials, ensuring security compliance.

Testing

To run the tests:

bash
# Run all tests
npm test

# Run tests with coverage report
npm test -- --coverage

License

MIT

Cài đặt

TypingMind
{
  "mcpServers": {
    "takumi0706-google-calendar-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "@takumi0706/google-calendar-mcp"
      ],
      "env": {
        "GOOGLE_CLIENT_ID": "<GOOGLE_CLIENT_ID>",
        "GOOGLE_CLIENT_SECRET": "<GOOGLE_CLIENT_SECRET>",
        "GOOGLE_REDIRECT_URI": "<GOOGLE_REDIRECT_URI>"
      }
    }
  }
}

Dùng MCP Google Calendar MCP 服务器 với nhiều mô hình AI

TypingMind kết nối các công cụ MCP ở cấp không gian làm việc, nên sau khi kết nối Google Calendar MCP 服务器, bạn có thể dùng với nhiều mô hình AI khác nhau trong TypingMind thay vì phải thiết lập riêng cho từng mô hình. MCP này chạy cục bộ thông qua trình kết nối MCP của TypingMind trên thiết bị của bạn.

Hướng dẫn thiết lập để dùng trình kết nối cục bộ

Dùng cách này khi máy chủ MCP cần truy cập các tệp, ứng dụng hoặc tài nguyên riêng tư trên máy tính của bạn.

1

Mở cài đặt MCP

Trong TypingMind, vào Cài đặt, Cài đặt nâng cao, rồi đến Giao thức ngữ cảnh mô hình và chọn Thiết lập trình kết nối.

  1. Mở TypingMind trong trình duyệt của bạn.
  2. Nhấp vào biểu tượng Cài đặt.
  3. Vào Cài đặt nâng cao.
  4. Mở mục Giao thức ngữ cảnh mô hình.
  5. Nhấp vào Thiết lập trình kết nối rồi chọn Thiết bị này.
Màn hình thiết lập trình kết nối MCP của TypingMind với tùy chọn Thiết bị này được chọn
2

Chạy lệnh thiết lập trình kết nối

Chọn Thiết bị này, sao chép lệnh từ TypingMind và chạy trong Terminal. Để tiến trình tiếp tục chạy trong khi bạn dùng MCP.

  1. Sao chép lệnh thiết lập hiển thị trong TypingMind.
  2. Mở Terminal trên macOS hoặc Windows Terminal trên Windows.
  3. Dán và chạy lệnh.
  4. Xác nhận cài đặt gói nếu Terminal hỏi bạn có muốn tiếp tục không.
  5. Để tiến trình tiếp tục chạy trong cửa sổ Terminal khi bạn dùng các công cụ MCP.
3

Thêm Google Calendar MCP 服务器 làm máy chủ

Khi trạng thái trình kết nối là Sẵn sàng, nhấp vào Sửa máy chủ và dán cấu hình máy chủ MCP.

  1. Đợi đến khi trạng thái trình kết nối hiển thị Sẵn sàng.
  2. Nhấp vào Sửa máy chủ.
  3. Dán cấu hình máy chủ MCP của Google Calendar MCP 服务器.
  4. Lưu danh sách máy chủ.
  5. Làm mới nếu bạn muốn xác nhận trình kết nối vẫn sẵn sàng.
Cài đặt MCP của TypingMind hiển thị máy chủ đang hoạt động và nút Sửa máy chủ
{
  "mcpServers": {
    "takumi0706-google-calendar-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "@takumi0706/google-calendar-mcp"
      ]
    }
  }
}
4

Dùng kết nối với nhiều mô hình

Lưu danh sách máy chủ, mở Plugin, bật các công cụ MCP của Google Calendar MCP 服务器, sau đó chọn bất kỳ mô hình AI nào được hỗ trợ trong TypingMind và dùng các công cụ trong cuộc trò chuyện hoặc gán chúng cho một tác nhân AI.

  1. Mở trang Plugin trong TypingMind.
  2. Bật các công cụ MCP của Google Calendar MCP 服务器.
  3. Bắt đầu cuộc trò chuyện và chọn mô hình AI bạn muốn dùng.
  4. Dùng các công cụ MCP trong cuộc trò chuyện hoặc gán chúng cho một tác nhân AI.
  5. Chuyển sang mô hình AI khác bất cứ khi nào cần mà không phải kết nối lại MCP.
Cuộc trò chuyện trên TypingMind dùng các công cụ MCP đã bật với mô hình AI đã chọn
Bạn có thể dùng Google Calendar MCP 服务器 giúp tôi làm việc này không?
Google Calendar MCP 服务器
Được. Tôi đọc rồi.
Đây là kết quả tôi tìm được bằng Google Calendar MCP 服务器.

Câu hỏi thường gặp

Máy chủ MCP Google Calendar MCP 服务器 dùng để làm gì?

Google Calendar MCP 服务器 là máy chủ MCP cho phép các ứng dụng AI tương thích kết nối với công cụ và ngữ cảnh bên ngoài. Trong TypingMind, bạn chỉ cần thêm máy chủ MCP này một lần để các công cụ của nó có sẵn trong không gian làm việc AI của bạn.

Bạn có thể dùng MCP Google Calendar MCP 服务器 với nhiều mô hình AI trong TypingMind không?

Có. TypingMind kết nối các công cụ MCP ở cấp không gian làm việc, nên bạn có thể dùng Google Calendar MCP 服务器 với nhiều mô hình AI như Claude, ChatGPT, Gemini hoặc các mô hình khác đã cấu hình trong TypingMind mà không cần thiết lập máy chủ MCP riêng cho từng mô hình.

Vì sao nên dùng MCP Google Calendar MCP 服务器 với TypingMind?

TypingMind là một trong những giao diện trò chuyện với LLM tốt nhất vì tập hợp nhiều mô hình AI, prompt, plugin, tác nhân AI, khóa API và công cụ MCP vào một không gian làm việc. Khi kết nối Google Calendar MCP 服务器, bạn có thể dùng các công cụ MCP của dịch vụ này với những mô hình ưa thích, đồng thời giữ quy trình trò chuyện gọn gàng trong TypingMind.

Làm cách nào để kết nối MCP Google Calendar MCP 服务器 với TypingMind?

Google Calendar MCP 服务器 hoạt động thông qua trình kết nối MCP cục bộ của TypingMind. Đây là lựa chọn phù hợp nhất khi máy chủ MCP cần truy cập tệp cục bộ, ứng dụng máy tính, công cụ dòng lệnh hoặc tài nguyên riêng trên máy tính của bạn.

MCP Google Calendar MCP 服务器 cung cấp những công cụ nào trong TypingMind?

Google Calendar MCP 服务器 cung cấp các chức năng MCP mà bạn có thể bật từ trang Plugin của TypingMind để dùng trong trò chuyện hoặc gán cho tác nhân AI.

Bạn có cần chia sẻ khóa API với TypingMind để dùng MCP Google Calendar MCP 服务器 không?

Không. TypingMind ưu tiên xử lý cục bộ và cho phép bạn kiểm soát nhà cung cấp mô hình, khóa API, prompt và cấu hình MCP. Nếu Google Calendar MCP 服务器 yêu cầu xác thực, hãy thêm các header, cài đặt OAuth hoặc cấu hình cục bộ cần thiết cho máy chủ MCP đó khi tạo kết nối.

Máy chủ MCP liên quan

Xem tất cả

Tạo ngay không gian làm việc AI riêng

Đăng ký bản tin của chúng tôi để nhận thông báo về tính năng mới và các đợt tặng quà sắp tới 👇