Skip to main content

Overview

Build an autonomous agent that connects to Google Calendar, analyzes your schedule, and generates time-use reports — meeting load analysis, free slot summaries, and weekly schedule exports.
This example uses @cocal/google-calendar-mcp, a community-maintained MCP server — not an official Google product. Review the package source and permissions before granting access to your calendar data.

Prerequisites

  • A Google Cloud project with the Calendar API enabled
  • OAuth 2.0 credentials (Desktop app type) downloaded as a JSON file
  • Node.js installed (for npx)

Setup

1. Create OAuth Credentials

  1. Go to the Google Cloud Console
  2. Create a new project or select an existing one
  3. Enable the Google Calendar API
  4. Go to CredentialsCreate CredentialsOAuth client ID
  5. Select Desktop app as the application type
  6. Download the credentials JSON file
  7. Add your email as a test user under the Audience screen

2. Place the Credentials File

Save the downloaded OAuth credentials JSON file to a known path, for example:

3. Authenticate

Run the authentication flow to generate access tokens:
This opens a browser window where you log in to Google and grant calendar access. The resulting auth tokens are saved automatically.
If your Google Cloud app is in test mode (the default), OAuth tokens expire after 7 days. You will need to re-run the auth command weekly.

4. Environment Variables

Installation

Example: Weekly Time-Use Report

The agent fetches all events for the current week and generates a time-use breakdown report.

Example: Availability Finder

The agent analyzes your calendar and generates a free-slots document you can share with others for scheduling.

Available Tools

Google Calendar MCP servers typically expose tools including:

Security Notes

  • Use OAuth 2.0 with the minimum required scopes (calendar.events, calendar.readonly).
  • Never commit your OAuth credentials JSON or token files to version control.
  • Auth tokens grant access to your calendar — treat them like passwords.
  • If your app is in test mode, tokens expire after 7 days. Re-run npx @cocal/google-calendar-mcp auth to re-authenticate.