Back to MCP Catalog

Google Calendar MCP Server

Cloud PlatformsTypeScript
Interact with Google Calendar to manage events and schedules
Available Tools

list_events

List calendar events within a specified time range

create_event

Create a new calendar event

update_event

Update an existing calendar event

delete_event

Delete a calendar event

find_free_time

Find available time slots in the calendar

The Google Calendar integration enables Claude to directly interact with your Google Calendar account, providing a seamless way to manage your schedule through natural language. This MCP server allows you to list upcoming events, create new meetings, find available time slots, update existing appointments, and delete events without leaving your conversation with Claude. With this integration, you can efficiently organize your calendar by simply asking Claude to perform calendar operations. The server handles all the authentication and API interactions with Google Calendar, making it easy to keep track of your schedule and make changes on the fly.

Overview

The Google Calendar MCP server connects Claude to your Google Calendar, enabling you to manage your schedule through natural language conversations. This integration streamlines calendar management by allowing you to view, create, update, and delete events directly through Claude.

Prerequisites

Before setting up the Google Calendar MCP server, ensure you have:

  • Node.js v16 or higher installed
  • Claude Desktop App
  • A Google Cloud Project with Google Calendar API enabled
  • OAuth 2.0 credentials for Google Calendar

Setup Instructions

1. Create a Google Cloud Project

  1. Navigate to the Google Cloud Console
  2. Create a new project or select an existing one
  3. Enable the Google Calendar API:
    • Go to "APIs & Services" > "Library"
    • Search for "Google Calendar API"
    • Click "Enable"

2. Configure OAuth Consent Screen

  1. Go to "APIs & Services" > "OAuth consent screen"
  2. Select "External" user type (unless you have a Google Workspace organization)
  3. Fill in the required information:
    • App name
    • User support email
    • Developer contact information
  4. Add the following scopes:
    • https://www.googleapis.com/auth/calendar
    • https://www.googleapis.com/auth/calendar.events
  5. Add your email address as a test user

3. Create OAuth 2.0 Credentials

  1. Go to "APIs & Services" > "Credentials"
  2. Click "Create Credentials" > "OAuth client ID"
  3. Select "Desktop app" as the application type
  4. Name your client (e.g., "MCP Calendar Client")
  5. Click "Create"
  6. Download the client configuration file (you'll need the client ID and client secret)

4. Get Refresh Token

You'll need to create a script to obtain a refresh token:

  1. Create a new file named getToken.js with the following content:
const { google } = require('googleapis');
const http = require('http');
const url = require('url');

// Replace these with your OAuth 2.0 credentials
const CLIENT_ID = 'your-client-id';
const CLIENT_SECRET = 'your-client-secret';
const REDIRECT_URI = 'http://localhost:3000/oauth2callback';

// Configure OAuth2 client
const oauth2Client = new google.auth.OAuth2(
  CLIENT_ID,
  CLIENT_SECRET,
  REDIRECT_URI
);

// Define scopes
const scopes = [
  'https://www.googleapis.com/auth/calendar',
  'https://www.googleapis.com/auth/calendar.events'
];

async function getRefreshToken() {
  return new Promise((resolve, reject) => {
    try {
      // Create server to handle OAuth callback
      const server = http.createServer(async (req, res) => {
        try {
          const queryParams = url.parse(req.url, true).query;

          if (queryParams.code) {
            // Get tokens from code
            const { tokens } = await oauth2Client.getToken(queryParams.code);
            console.log('\n=================');
            console.log('Refresh Token:', tokens.refresh_token);
            console.log('=================\n');
            console.log('Save this refresh token in your configuration!');

            // Send success response
            res.end('Authentication successful! You can close this window.');

            // Close server
            server.close();
            resolve(tokens);
          }
        } catch (error) {
          console.error('Error getting tokens:', error);
          res.end('Authentication failed! Please check console for errors.');
          reject(error);
        }
      }).listen(3000, () => {
        // Generate auth url
        const authUrl = oauth2Client.generateAuthUrl({
          access_type: 'offline',
          scope: scopes,
          prompt: 'consent'  // Force consent screen to ensure refresh token
        });

        console.log('1. Copy this URL and paste it in your browser:');
        console.log('\n', authUrl, '\n');
        console.log('2. Follow the Google authentication process');
        console.log('3. Wait for the refresh token to appear here');
      });

    } catch (error) {
      console.error('Server creation error:', error);
      reject(error);
    }
  });
}

// Run the token retrieval
getRefreshToken().catch(console.error);
  1. Install the required dependency:
npm install googleapis
  1. Update the script with your OAuth credentials:

    • Replace your-client-id with your actual client ID
    • Replace your-client-secret with your actual client secret
  2. Run the script:

node getToken.js
  1. Follow the instructions in the console:
    • Copy the provided URL
    • Paste it into your browser
    • Complete the Google authentication process
    • Copy the refresh token that appears in the console

5. Install the MCP Server

  1. Clone the repository:
git clone https://github.com/v-3/google-calendar.git
cd google-calendar
  1. Install dependencies:
npm install
  1. Build the server:
npm run build

6. Configure Claude Desktop

  1. Open your Claude Desktop configuration file:

For MacOS:

code ~/Library/Application\ Support/Claude/claude_desktop_config.json

For Windows:

code %AppData%\Claude\claude_desktop_config.json
  1. Add the Google Calendar MCP server configuration:
{
  "mcpServers": {
    "google-calendar": {
      "command": "node",
      "args": [
        "/ABSOLUTE/PATH/TO/google-calendar/build/index.js"
      ],
      "env": {
        "GOOGLE_CLIENT_ID": "your_client_id_here",
        "GOOGLE_CLIENT_SECRET": "your_client_secret_here",
        "GOOGLE_REDIRECT_URI": "http://localhost",
        "GOOGLE_REFRESH_TOKEN": "your_refresh_token_here"
      }
    }
  }
}
  1. Replace the placeholder values with your actual credentials:

    • Replace /ABSOLUTE/PATH/TO/ with the absolute path to your cloned repository
    • Replace your_client_id_here with your Google client ID
    • Replace your_client_secret_here with your Google client secret
    • Replace your_refresh_token_here with the refresh token you obtained
  2. Save the file and restart Claude Desktop

Using Google Calendar with Claude

After setting up the MCP server, you can interact with your Google Calendar through natural language commands in Claude. Here are some examples:

  • "Show me my calendar events for next week"
  • "Schedule a meeting with john@example.com tomorrow at 2 PM for 1 hour"
  • "Find a free 30-minute slot this afternoon"
  • "Update my 3 PM meeting to 4 PM"
  • "Cancel my meeting with ID abc123"

Troubleshooting

Common Issues

  1. Tools not appearing in Claude:

    • Check Claude Desktop logs: tail -f ~/Library/Logs/Claude/mcp*.log (MacOS) or Get-Content -Path "$env:AppData\Claude\Logs\mcp*.log" -Wait -Tail 20 (Windows)
    • Verify all environment variables are set correctly
    • Ensure the path to index.js is absolute and correct
  2. Authentication Errors:

    • Verify your OAuth credentials are correct
    • Check if refresh token is valid
    • Ensure required scopes are enabled
  3. Server Connection Issues:

    • Check if the server built successfully
    • Verify file permissions on build/index.js (should be 755)
    • Try running the server directly: node /path/to/build/index.js

Security Considerations

  • Keep your client ID, client secret, and refresh token secure
  • Do not share your configuration file or tokens with others
  • Consider using environment variables for sensitive information
  • Regularly review the permissions granted to your Google Cloud Project

Related MCPs

AWS CLI
Cloud PlatformsPython

Execute AWS CLI commands securely through AI assistants

Kubernetes
Cloud PlatformsGo

Connect to and manage Kubernetes clusters through natural language

Cloudflare
Cloud PlatformsTypeScript

A Model Context Protocol server for Cloudflare services

About Model Context Protocol

Model Context Protocol (MCP) allows AI models to access external tools and services, extending their capabilities beyond their training data.

Generate Cursor Documentation

Save time on coding by generating custom documentation and prompts for Cursor IDE.