google-calendar-mcp
by nspady
Google Calendar MCP Server
This is a Model Context Protocol (MCP) server that provides integration with Google Calendar. It allows LLMs to read, create, and manage calendar events through a standardized interface.
Features
- List available calendars
- List events from a calendar
- Create new calendar events
- Update existing events
- Delete events
- Process events from screenshots and images
Requirements
- Node.js 16 or higher
- TypeScript 5.3 or higher
- A Google Cloud project with the Calendar API enabled
- OAuth 2.0 credentials (Client ID and Client Secret)
Project Structure
Copy
google-calendar-mcp/
├── src/ # TypeScript source files
├── build/ # Compiled JavaScript output
├── llm/ # LLM-specific configurations and prompts
├── package.json # Project dependencies and scripts
└── tsconfig.json # TypeScript configuration
Google Cloud Setup
- Go to the Google Cloud Console
- Create a new project or select an existing one.
- Enable the Google Calendar API for your project. Ensure that the right project is selected from the top bar before enabling the API.
- Create OAuth 2.0 credentials:
- Go to Credentials
- Click "Create Credentials" > "OAuth client ID"
- Choose "User data" for the type of data that the app will be accessing
- Add your app name and contact information
- Add the following scopes (optional):
https://www.googleapis.com/auth/calendar.events
- Select "Desktop app" as the application type
- Add your email address as a test user under the OAuth Consent screen
- Note: it will take a few minutes for the test user to be added. The OAuth consent will not allow you to proceed until the test user has propogated.
Installation
- Clone the repository
- Install dependencies:Copynpm install
- Build the TypeScript code:Copynpm run build
- Download your Google OAuth credentials from the Google Cloud Console (under "Credentials") and rename the file to
gcp-oauth.keys.json
and place it in the root directory of the project.
Available Scripts
npm run build
- Build the TypeScript codenpm run build:watch
- Build TypeScript in watch mode for developmentnpm run dev
- Start the server in development mode using ts-nodenpm run auth
- Start the authentication server for Google OAuth flow
Authentication
Before using the server, you need to authenticate with Google Calendar and complete the OAuth flow:
- Place your Google OAuth credentials in a file named
gcp-oauth.keys.json
in the root directory of the project. This can be found in the Google Cloud Console under "Credentials". - Start the authentication server:Copynpm run auth
- The OAuth flow will open a browser window to complete the OAuth flow.
- Follow the Google OAuth flow to grant access to your calendars
- You will be warned that the app is not verified by Google. This is okay, just click "Continue".
- Grant access to view and edit your calendars
- Once complete, you can close the browser window.
The authentication tokens will be securely saved in .gcp-saved-tokens.json
in the project root directory with restricted permissions (600).
Usage
The server exposes the following tools:
list-calendars
: List all available calendarslist-events
: List events from a calendarcreate-event
: Create a new calendar eventupdate-event
: Update an existing calendar eventdelete-event
: Delete a calendar event
Using with Claude Desktop
- Add this configuration to your Claude Desktop config file. E.g.
/Users/<user>/Library/Application Support/Claude/claude_desktop_config.json
:Copy{ "mcpServers": { "google-calendar": { "command": "node", "args": ["path/to/build/index.js"] } } } - Restart Claude Desktop
Example Usage
Along with the normal capabilities you would expect for a calendar integration you can also do really dynamic things like add events from screenshots and images and much more.
- Add events from screenshots and images:Supported image formats: PNG, JPEG, GIF Images can contain event details like date, time, location, and descriptionCopyAdd this event to my calendar based on the attached screenshot.
- Check attendance:CopyWhich events tomorrow have attendees who have not accepted the invitation?
- Auto coordinate events:CopyHere's some available that was provided to me by someone I am interviewing. Take a look at the available times and create an event for me to interview them that is free on my work calendar.
- Provide your own availability:CopyPlease provide availability looking at both my personal and work calendar for this upcoming week. Choose times that work well for normal working hours on the East Coast. Meeting time is 1 hour
Development
Troubleshooting
Common issues and solutions:
- OAuth Token Errors
- Ensure your
gcp-oauth.keys.json
is correctly formatted - Try deleting
.gcp-saved-tokens.json
and re-authenticating
- Ensure your
- TypeScript Build Errors
- Make sure all dependencies are installed:
npm install
- Check your Node.js version matches prerequisites
- Clear the build directory:
rm -rf build/
- Make sure all dependencies are installed:
- Image Processing Issues
- Verify the image format is supported
- Ensure the image contains clear, readable text
Security Notes
- The server runs locally and requires OAuth authentication
- OAuth credentials should be stored in
gcp-oauth.keys.json
in the project root - Authentication tokens are stored in
.gcp-saved-tokens.json
with restricted file permissions - Tokens are automatically refreshed when expired
- Never commit your OAuth credentials or token files to version control
- For production use, get your OAuth application verified by Google
License
MIT
Lets LLMs read and manage Google Calendar events.