### List Calendar Events API Source: https://context7.com/am2rican5/mcp-google-calendar/llms.txt Fetches calendar events within a specified date range for a given calendar. Events are returned sorted by start time and support pagination. ```APIDOC ## GET /calendars/{calendarId}/events ### Description Fetches calendar events within a specified date range for a given calendar, returning events sorted by start time with support for pagination. ### Method GET ### Endpoint /calendars/{calendarId}/events ### Parameters #### Path Parameters - **calendarId** (string) - Required - The ID of the calendar to fetch events from. #### Query Parameters - **timeMin** (string) - Required - The start of the date/time range for events (RFC3339 format). - **timeMax** (string) - Required - The end of the date/time range for events (RFC3339 format). - **maxResults** (integer) - Optional - Maximum number of events to return. - **pageToken** (string) - Optional - Token for retrieving the next page of results. - **singleEvents** (boolean) - Optional - Whether to expand recurring events into instances. ### Request Example ``` GET /calendars/primary/events?timeMin=2026-01-01T00:00:00Z&timeMax=2026-01-31T23:59:59Z&maxResults=10 ``` ### Response #### Success Response (200) - **kind** (string) - Type of the resource. - **timeZone** (string) - The time zone of the calendar. - **items** (array) - List of events. - **id** (string) - The ID of the event. - **status** (string) - The status of the event (e.g., 'confirmed'). - **summary** (string) - The summary of the event. - **description** (string) - The description of the event. - **start** (object) - The start date/time of the event. - **end** (object) - The end date/time of the event. - **creator** (object) - The creator of the event. - **organizer** (object) - The organizer of the event. #### Response Example ```json { "kind": "calendar#events", "timeZone": "America/New_York", "items": [ { "id": "abc123xyz", "status": "confirmed", "summary": "Team Meeting", "description": "Weekly team sync", "start": { "date": "2026-01-15" }, "end": { "date": "2026-01-15" }, "creator": { "email": "user@example.com" }, "organizer": { "email": "user@example.com", "self": true } } ] } ``` ``` -------------------------------- ### Create Calendar Event API Source: https://context7.com/am2rican5/mcp-google-calendar/llms.txt Creates a new calendar event within a specified calendar. This includes details such as summary, description, start and end times, and optional properties. ```APIDOC ## POST /calendars/{calendarId}/events ### Description Creates a new calendar event with specified details including summary, description, start and end dates, and optional properties like color and guest permissions. ### Method POST ### Endpoint /calendars/{calendarId}/events ### Parameters #### Path Parameters - **calendarId** (string) - Required - The ID of the calendar to create the event in. #### Request Body - **summary** (string) - Required - The title of the event. - **description** (string) - Optional - A description of the event. - **start** (object or string) - Required - The start date or date-time of the event. - **date** (string) - Format YYYY-MM-DD for all-day events. - **dateTime** (string) - Format RFC3339 for timed events. - **end** (object or string) - Required - The end date or date-time of the event. - **date** (string) - Format YYYY-MM-DD for all-day events. - **dateTime** (string) - Format RFC3339 for timed events. - **anyoneCanAddSelf** (boolean) - Optional - Whether anyone can add themselves to the event. - **colorId** (string) - Optional - The color ID for the event. ### Request Example ```json { "summary": "Product Launch", "description": "Q1 Product Launch Meeting - Review final deliverables", "start": { "date": "2026-02-15" }, "end": { "date": "2026-02-15" }, "anyoneCanAddSelf": false, "colorId": "11" } ``` ### Response #### Success Response (200 or 201) - **kind** (string) - Type of the resource. - **id** (string) - The ID of the created event. - **status** (string) - The status of the event. - **htmlLink** (string) - An HTML link to the event. - **created** (string) - The creation time of the event. - **updated** (string) - The last update time of the event. - **summary** (string) - The summary of the event. - **description** (string) - The description of the event. - **creator** (object) - The creator of the event. - **organizer** (object) - The organizer of the event. - **start** (object) - The start date/time of the event. - **end** (object) - The end date/time of the event. - **colorId** (string) - The color ID of the event. - **anyoneCanAddSelf** (boolean) - Whether anyone can add themselves to the event. - **reminders** (object) - The reminder settings for the event. #### Response Example ```json { "kind": "calendar#event", "id": "xyz789abc", "status": "confirmed", "htmlLink": "https://www.google.com/calendar/event?eid=...", "created": "2026-01-10T15:30:00.000Z", "updated": "2026-01-10T15:30:00.000Z", "summary": "Product Launch", "description": "Q1 Product Launch Meeting - Review final deliverables", "creator": { "email": "user@example.com", "self": true }, "organizer": { "email": "user@example.com", "self": true }, "start": { "date": "2026-02-15" }, "end": { "date": "2026-02-15" }, "colorId": "11", "anyoneCanAddSelf": false, "reminders": { "useDefault": true } } ``` ``` -------------------------------- ### List Google Calendar Events with TypeScript Source: https://context7.com/am2rican5/mcp-google-calendar/llms.txt Fetches calendar events within a specified date range for a given calendar. Events are returned sorted by start time and support pagination. Requires the GoogleCalendarService to be initialized and authorized. ```typescript import { GoogleCalendarService } from './services/google-calendar'; const calendarService = GoogleCalendarService.getInstance(); await calendarService.authorize(); // Get events between two dates const events = await calendarService.getEvents( 'primary', '2026-01-01', '2026-01-31' ); // Response with events { "kind": "calendar#events", "timeZone": "America/New_York", "items": [ { "id": "abc123xyz", "status": "confirmed", "summary": "Team Meeting", "description": "Weekly team sync", "start": { "date": "2026-01-15" }, "end": { "date": "2026-01-15" }, "creator": { "email": "user@example.com" }, "organizer": { "email": "user@example.com", "self": true } } ] } ``` -------------------------------- ### Initialize MCP Server with stdio Transport Source: https://context7.com/am2rican5/mcp-google-calendar/llms.txt Sets up and launches an MCP server utilizing the stdio transport for direct inter-process communication. It initializes the Google Calendar service and connects the server to the transport. ```typescript import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"; import { createServer } from "./server.js"; import { GoogleCalendarService } from "./services/index.js"; async function startStdioServer() { // Initialize calendar service and authenticate const calendarService = GoogleCalendarService.getInstance(); await calendarService.authorize(); // Create transport and server const transport = new StdioServerTransport(); const server = createServer(); // Connect server to transport await server.connect(transport); } // Start the server startStdioServer().catch((error) => { console.error(error); process.exit(1); }); ``` -------------------------------- ### Claude Desktop Configuration for MCP Google Calendar (JSON) Source: https://context7.com/am2rican5/mcp-google-calendar/llms.txt Configuration file for integrating the MCP Google Calendar server with Claude Desktop. It specifies the command to run the server and environment variables, including the path to Google API credentials. ```json { "mcpServers": { "mcp-google-calendar": { "command": "npx", "args": ["-y", "mcp-google-calendar"], "env": { "CREDENTIALS_PATH": "/Users/username/.config/google-calendar/credentials.json" } } } } ``` -------------------------------- ### Create Google Calendar Event with TypeScript Source: https://context7.com/am2rican5/mcp-google-calendar/llms.txt Creates a new calendar event with specified details such as summary, description, start/end dates, and optional properties like color and guest permissions. The GoogleCalendarService must be initialized and authorized prior to use. ```typescript import { GoogleCalendarService } from './services/google-calendar'; const calendarService = GoogleCalendarService.getInstance(); await calendarService.authorize(); // Create a new event const newEvent = await calendarService.createEvent('primary', { summary: 'Product Launch', description: 'Q1 Product Launch Meeting - Review final deliverables', start: '2026-02-15', end: '2026-02-15', anyoneCanAddSelf: false, colorId: '11' }); // Response with created event details { "kind": "calendar#event", "id": "xyz789abc", "status": "confirmed", "htmlLink": "https://www.google.com/calendar/event?eid=...", "created": "2026-01-10T15:30:00.000Z", "updated": "2026-01-10T15:30:00.000Z", "summary": "Product Launch", "description": "Q1 Product Launch Meeting - Review final deliverables", "creator": { "email": "user@example.com", "self": true }, "organizer": { "email": "user@example.com", "self": true }, "start": { "date": "2026-02-15" }, "end": { "date": "2026-02-15" }, "colorId": "11", "anyoneCanAddSelf": false, "reminders": { "useDefault": true } } ``` -------------------------------- ### Initialize MCP Server with SSE Transport Source: https://context7.com/am2rican5/mcp-google-calendar/llms.txt Establishes an MCP server using Server-Sent Events (SSE) over HTTP, suitable for web-based integrations. It configures an Express server to handle SSE connections and message routing, alongside Google Calendar service authentication. ```typescript import express from "express"; import { SSEServerTransport } from "@modelcontextprotocol/sdk/server/sse.js"; import { createServer } from "./server.js"; import { GoogleCalendarService } from "./services/index.js"; async function startSSEServer() { const app = express(); const server = createServer(); let sseTransport = null; // SSE endpoint - establishes persistent connection app.get("/sse", async (req, res) => { sseTransport = new SSEServerTransport("/messages", res); await server.connect(sseTransport); }); // Message endpoint - receives client messages app.post("/messages", async (req, res) => { if (!sseTransport) { res.status(400).json({ error: "SSE connection not established" }); return; } await sseTransport.handlePostMessage(req, res); }); // Authenticate and start server const calendarService = GoogleCalendarService.getInstance(); await calendarService.authorize(); const PORT = process.env.PORT ? parseInt(process.env.PORT, 10) : 3420; app.listen(PORT); console.log(`SSE server listening on port ${PORT}`); } startSSEServer().catch((error) => { console.error("Server failed:", error); process.exit(1); }); ``` -------------------------------- ### List Google Calendars with TypeScript Source: https://context7.com/am2rican5/mcp-google-calendar/llms.txt Retrieves all calendars associated with the authenticated Google account. Requires initialization and authorization of the GoogleCalendarService. The response includes details for each calendar such as ID, summary, and time zone. ```typescript import { GoogleCalendarService } from './services/google-calendar'; // Initialize and authorize the service const calendarService = GoogleCalendarService.getInstance(); await calendarService.authorize(); // List all calendars const calendars = await calendarService.getCalendars(); // Response structure { "kind": "calendar#calendarList", "items": [ { "id": "primary", "summary": "user@example.com", "timeZone": "America/New_York", "colorId": "1", "backgroundColor": "#9fe1e7", "foregroundColor": "#000000", "selected": true, "accessRole": "owner", "primary": true }, { "id": "holiday@calendar.google.com", "summary": "Holidays in United States", "timeZone": "America/New_York", "colorId": "8", "selected": true, "accessRole": "reader" } ] } ``` -------------------------------- ### Google OAuth 2.0 Authentication with Token Persistence (TypeScript) Source: https://context7.com/am2rican5/mcp-google-calendar/llms.txt Handles Google OAuth 2.0 authentication for accessing Google Calendar. It automatically persists and refreshes tokens to avoid repeated user authentication. Dependencies include '@google-cloud/local-auth' and 'google-auth-library'. ```typescript import { authenticate } from "@google-cloud/local-auth"; import { OAuth2Client } from "google-auth-library"; import * as fs from "node:fs"; // Authentication with token persistence class GoogleCalendarService { private async authorize(): Promise { const CREDENTIALS_PATH = process.env.CREDENTIALS_PATH ?? "./credentials.json"; const TOKEN_PATH = "./mcp-google-calendar-token.json"; const SCOPES = [ "https://www.googleapis.com/auth/calendar.readonly", "https://www.googleapis.com/auth/calendar.events" ]; // Load credentials const credentials = JSON.parse(fs.readFileSync(CREDENTIALS_PATH, "utf-8")); const clientId = credentials.web?.client_id || credentials.installed?.client_id; const clientSecret = credentials.web?.client_secret || credentials.installed?.client_secret; const redirectUri = (credentials.web?.redirect_uris || credentials.installed?.redirect_uris)[0]; // Create OAuth2 client const authClient = new OAuth2Client(clientId, clientSecret, redirectUri); // Try to load saved token if (fs.existsSync(TOKEN_PATH)) { const savedToken = JSON.parse(fs.readFileSync(TOKEN_PATH, "utf8")); authClient.setCredentials(savedToken); return authClient; } // No saved token - start new auth flow const authenticatedClient = await authenticate({ scopes: SCOPES, keyfilePath: CREDENTIALS_PATH, }); // Save token for future use fs.writeFileSync(TOKEN_PATH, JSON.stringify(authenticatedClient.credentials)); return authenticatedClient; } } ``` -------------------------------- ### Retrieve Google Calendar Event Details Source: https://context7.com/am2rican5/mcp-google-calendar/llms.txt Fetches detailed information for a specific calendar event using its unique ID. Requires authorization with the Google Calendar service. Returns a comprehensive event object. ```typescript import { GoogleCalendarService } from './services/google-calendar'; const calendarService = GoogleCalendarService.getInstance(); await calendarService.authorize(); // Get specific event details const event = await calendarService.getEvent( 'primary', 'xyz789abc' ); // Response with full event details { "kind": "calendar#event", "id": "xyz789abc", "status": "confirmed", "htmlLink": "https://www.google.com/calendar/event?eid=...", "created": "2026-01-10T15:30:00.000Z", "updated": "2026-01-10T15:30:00.000Z", "summary": "Product Launch", "description": "Q1 Product Launch Meeting - Review final deliverables", "start": { "date": "2026-02-15" }, "end": { "date": "2026-02-15" }, "attendees": [], "reminders": { "useDefault": true } } ``` -------------------------------- ### List Calendars API Source: https://context7.com/am2rican5/mcp-google-calendar/llms.txt Retrieves a list of all calendars associated with the authenticated Google account. This includes the primary calendar and any shared or subscribed calendars. ```APIDOC ## GET /calendars ### Description Retrieves all available calendars associated with the authenticated Google account, including primary calendars and any shared or subscribed calendars. ### Method GET ### Endpoint /calendars ### Parameters #### Query Parameters - **maxResults** (integer) - Optional - Maximum number of calendars to return. - **pageToken** (string) - Optional - Token for retrieving the next page of results. ### Request Example ``` GET /calendars?maxResults=10 ``` ### Response #### Success Response (200) - **kind** (string) - Type of the resource. - **items** (array) - List of calendars. - **id** (string) - The ID of the calendar. - **summary** (string) - The summary of the calendar. - **timeZone** (string) - The time zone of the calendar. - **colorId** (string) - The color ID for the calendar. - **accessRole** (string) - The access role of the user to the calendar. - **primary** (boolean) - Whether this is the user's primary calendar. #### Response Example ```json { "kind": "calendar#calendarList", "items": [ { "id": "primary", "summary": "user@example.com", "timeZone": "America/New_York", "colorId": "1", "accessRole": "owner", "primary": true }, { "id": "holiday@calendar.google.com", "summary": "Holidays in United States", "timeZone": "America/New_York", "colorId": "8", "accessRole": "reader" } ] } ``` ``` -------------------------------- ### Update Google Calendar Event Details Source: https://context7.com/am2rican5/mcp-google-calendar/llms.txt Modifies an existing calendar event by updating specified fields. Requires the event ID and new details. Returns the updated event object upon successful modification. ```typescript import { GoogleCalendarService } from './services/google-calendar'; const calendarService = GoogleCalendarService.getInstance(); await calendarService.authorize(); // Update an existing event const updatedEvent = await calendarService.updateEvent( 'primary', 'xyz789abc', { summary: 'Product Launch - Postponed', description: 'Q1 Product Launch Meeting - POSTPONED to Q2', start: '2026-04-20', end: '2026-04-20', anyoneCanAddSelf: false, colorId: '6' } ); // Response with updated event { "kind": "calendar#event", "id": "xyz789abc", "status": "confirmed", "htmlLink": "https://www.google.com/calendar/event?eid=...", "created": "2026-01-10T15:30:00.000Z", "updated": "2026-01-10T16:45:00.000Z", "summary": "Product Launch - Postponed", "description": "Q1 Product Launch Meeting - POSTPONED to Q2", "start": { "date": "2026-04-20" }, "end": { "date": "2026-04-20" }, "colorId": "6", "reminders": { "useDefault": true } } ``` -------------------------------- ### Delete Google Calendar Event Source: https://context7.com/am2rican5/mcp-google-calendar/llms.txt Permanently removes a calendar event identified by its unique ID. This operation is irreversible. Successful deletion returns no content (HTTP 204). ```typescript import { GoogleCalendarService } from './services/google-calendar'; const calendarService = GoogleCalendarService.getInstance(); await calendarService.authorize(); // Delete an event await calendarService.deleteEvent('primary', 'xyz789abc'); // Returns void on success, throws error on failure // No response body - HTTP 204 No Content on success ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.