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
- Go to the Google Cloud Console
- Create a new project or select an existing one
- Enable the Google Calendar API
- Go to Credentials → Create Credentials → OAuth client ID
- Select Desktop app as the application type
- Download the credentials JSON file
- 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: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 authto re-authenticate.

