SuperAPI AI Directory

google-calendar-mcp

Interface with the Google Calendar API.

Open website

About this tool

Purpose

Google Calendar MCP Server is an MCP (Model Context Protocol) server implementation used to establish an integration between Google Calendar and Claude Desktop. With this server, Claude can interact with the user's Google Calendar, displaying, creating, updating, and deleting calendar events through natural language. The project states that it follows the Model Context Protocol specification for AI assistant tool integration.

Main Capabilities

The server provides the following tools for interacting with Google Calendar:

  1. Query calendar events: Supports various filtering options. Parameters include calendarId (optional; uses the primary calendar when omitted), timeMin (optional, start time in ISO 8601 format), timeMax (optional, end time in ISO 8601 format), maxResults (optional, default 10), orderBy (optional, "startTime" or "updated", default "startTime"). Empty strings, null, or undefined values are ignored.

  2. Create calendar events: Parameters include calendarId (optional) and the event details object. event includes: summary (required, event title), description (optional), location (optional), start (start time object, containing dateTime in ISO 8601 format, date in YYYY-MM-DD all-day format, timeZone), end (same format as start), attendees (optional, array of participants containing email and optional displayName), colorId (optional, event color ID 1-11), recurrence (optional, array of recurrence rules in RFC5545 format, such as ["RRULE:FREQ=WEEKLY;BYDAY=MO,WE,FR"]).

  3. Update calendar events: eventId is required. The function first retrieves the existing event data, then merges it with the update data, preserving fields not included in the update request. Only explicitly provided fields are updated; fields not included retain their original values, thereby supporting partial updates without data loss. The recurrence parameter can be updated to modify the recurrence pattern of an event.

  4. Delete calendar events: eventId is required.

  5. Re-authenticate (authenticate): Switch between different Google accounts without restarting Claude.

Technical Architecture

The project uses the following technologies: TypeScript (type-safe development), MCP SDK (@modelcontextprotocol/server v2, protocol revision 2026-07-28, still providing the 2025 revision for legacy clients), Google API (googleapis to access the Google Calendar API), Hono (a lightweight and fast web framework, used for the authentication server), google-auth-library (drives the OAuth2 authorization code flow with PKCE (S256)), Zod (schema validation for request/response data), dotenv (environment-based configuration management), AES-256-GCM (token encryption using the Node.js crypto module), Open (automatically launches the browser during authentication), Readline (manual authentication input in server environments), Jest (unit testing and coverage), GitHub Actions (CI/CD).

Source directory structure: src/ is the source code directory; auth/ handles authentication (OAuth flow with PKCE, token storage); calendar/ is the Google Calendar API integration; config/ is configuration settings and validation; mcp/ is the MCP server implementation; tools/ is the Google Calendar tool handlers; utils/ is utility functions and helper tools.

Usage

Installation requirements: Node.js 20 or later. The package is published on npm as @takumi0706/google-calendar-mcp.

Setup steps: Create a Google Cloud project and enable the Google Calendar API; configure OAuth2 credentials in the Google Cloud Console; set environment variables; add the server in claude_desktop_config.json. If on localhost Running in an inaccessible environment requires setting the USE_MANUAL_AUTH environment variable to "true".

Security Considerations

  • OAuth tokens are stored only in memory (no file-based storage). They are lost after a restart, so re-authentication is required after each restart.
  • Sensitive credentials must be provided via environment variables.
  • Tokens are encrypted in memory using AES-256-GCM. The project states that the key and ciphertext are in the same process, so this prevents casual viewing of process memory, but does not prevent an attacker who can already read that process's memory.
  • The authorization code flow uses PKCE (S256), generating a code_verifier for each request that is never sent to the authorization endpoint.
  • The state parameter is validated for CSRF protection: 256-bit CSPRNG state, constant-time comparison, single use, expires after 10 minutes.
  • The redirect URI is taken from configuration rather than the request's Host header, and is fixed.
  • Input validation is performed using Zod schemas.
  • Every interpolation in the OAuth result page is HTML-escaped.

Version History Highlights

2.0.0: The OAuth authorization code flow implements PKCE (S256); the state parameter is changed to a 256-bit CSPRNG value with constant-time comparison, single use, and 10-minute expiration (previously generated with Math.random()); fixes reflected XSS in the OAuth error page; redirect_uri is fixed to the configured value; the local authorization server aborts when the port is occupied; TOKEN_ENCRYPTION_KEY must be exactly 64 hexadecimal characters, and invalid and all-zero keys are rejected at startup; resolves all known vulnerabilities in production dependencies; migrates to @modelcontextprotocol/server v2 and protocol revision 2026-07-28 (still serving the 2025 revision); tools/list now exposes the real schemas, so nested objects such as createEvent's event expose their properties; prompts/get is implemented; resources/read now returns the structure required by the specification; initialize no longer leaks Zod internals through capabilities; requires Node.js 20 or higher; the toolchain migrates to pnpm, upgrades googleapis,hono, and zod, and removes @hono/oauth-providers; removes any and type assertions from the published code, enforced by lint.

1.0.7: Enhances MCP tool parameter validation, correctly handling empty strings, null, and undefined values; fixes the MCP error -32602 when passing an empty string parameter to the getEvents tool; improves the preprocessArgs function to skip empty values so that Zod schema defaults are applied correctly; adds comprehensive test coverage for empty parameter handling.

1.0.6: Fixes an unwanted scope issue in this Google Calendar MCP server.

1.0.5: Adds support for recurring events through the recurrence parameter in the createEvent and updateEvent tools; allows recurring events to be created and modified directly without manual setup.

1.0.4: Maintenance release.

1.0.3: Adds an authenticate tool to re-authenticate without restarting Claude; allows switching between different Google accounts during a session; exposes authentication functionality through the MCP interface; adds a manual authentication option for environments where localhost is inaccessible; implements a readline interface for manually entering the authorization code; adds the USE_MANUAL_AUTH environment variable; updates the zod dependency; fixes the "Invalid state parameter" error during re-authentication; changes the OAuth server to start on demand and shut down after authentication; improves server lifecycle management to prevent port conflicts.

1.0.2: Fixes updateEvent (the material is truncated here).

Troubleshooting

The project provides the following troubleshooting guidance: confirm that the Google OAuth credentials are configured correctly; ensure there is sufficient Google Calendar API access; verify that the Claude Desktop configuration is correct. JSON parsing errors (such as Unexpected non-whitespace character after JSON at position 4) are usually caused by malformed JSON-RPC messages and have been fixed in version 0.6.7 and later. Authentication errors require verifying Google OAuth credentials. If an Invalid state parameter appears during re-authentication, update to 1.0.3 or later; older versions may need port 4153 closed and the application restarted. For connection errors, ensure only one server instance is running. For disconnection issues, ensure the server correctly handles MCP messages without using a custom TCP socket. When localhost is inaccessible (such as on a remote server or in a container), set USE_MANUAL_AUTH=true to enable manual authentication, and manually enter the authorization code shown after Google authorization. For MCP parameter validation error -32602 with empty string arguments, update to 1.0.7 or later.

Limitations and Notes

The materials do not provide information such as fees, pricing, platform support scope, effectiveness metrics, or specific usage step examples. The token is stored only in memory, so re-authentication is required after a restart; the authentication flow depends on a browser and localhost (or manual authentication mode); you need to create a Google Cloud project yourself and configure OAuth2 credentials.