eduruesta/google-calendar-mcp-server
If you are the rightful owner of google-calendar-mcp-server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to dayong@mcphub.com.
A Model Context Protocol (MCP) server for Google Calendar integration, providing CRUD operations for calendar events.
Google Calendar MCP Server
A Model Context Protocol (MCP) server for Google Calendar integration, providing CRUD operations for calendar events.
Features
- List Events: Retrieve calendar events with optional filters
- Create Events: Create new calendar events with title, time, location, and attendees
- Update Events: Modify existing calendar events
- Delete Events: Remove calendar events
Prerequisites
- Java 17 or higher
- Google Cloud Platform account with Calendar API enabled
- Service account credentials for Google Calendar API
Setup
1. Google Cloud Setup
- Go to the Google Cloud Console
- Create a new project or select an existing one
- Enable the Google Calendar API:
- Navigate to "APIs & Services" > "Library"
- Search for "Google Calendar API"
- Click "Enable"
2. Service Account Setup
- In Google Cloud Console, go to "APIs & Services" > "Credentials"
- Click "Create Credentials" > "Service Account"
- Fill in the service account details and create
- Click on the created service account
- Go to the "Keys" tab
- Click "Add Key" > "Create New Key" > "JSON"
- Download the JSON file and save it securely
3. Calendar Permissions
To allow the service account to access your calendar:
- Open Google Calendar
- Go to your calendar settings
- Under "Share with specific people", add the service account email (found in the JSON file)
- Give it "Make changes to events" permission
4. Environment Setup
Set the environment variable pointing to your credentials file:
export GOOGLE_CREDENTIALS_PATH="/Users/eduardoruesta/Workplace/google-calendar-mcp-server/credentials.json"
5. Build and Run
# Build the project
./gradlew build
# Run the server
./gradlew run
MCP Tools
list_events
List calendar events from Google Calendar.
Parameters:
calendar_id(optional): Calendar ID, defaults to "primary"max_results(optional): Maximum number of events to return, defaults to 10time_min(optional): Lower bound for event start time (ISO 8601 format)time_max(optional): Upper bound for event start time (ISO 8601 format)
Example:
{
"name": "list_events",
"arguments": {
"max_results": 5,
"time_min": "2024-01-01T00:00:00Z"
}
}
create_event
Create a new calendar event.
Required Parameters:
summary: Event titlestart_time: Start time (ISO 8601 format)end_time: End time (ISO 8601 format)
Optional Parameters:
description: Event descriptionlocation: Event locationattendees: Array of email addressescalendar_id: Calendar ID (defaults to "primary")
Example:
{
"name": "create_event",
"arguments": {
"summary": "Team Meeting",
"description": "Weekly team sync",
"start_time": "2024-01-15T10:00:00Z",
"end_time": "2024-01-15T11:00:00Z",
"location": "Conference Room A",
"attendees": ["team@company.com"]
}
}
update_event
Update an existing calendar event.
Required Parameters:
event_id: ID of the event to update
Optional Parameters:
summary: New event titledescription: New event descriptionstart_time: New start time (ISO 8601 format)end_time: New end time (ISO 8601 format)location: New event locationattendees: New array of email addressescalendar_id: Calendar ID (defaults to "primary")
Example:
{
"name": "update_event",
"arguments": {
"event_id": "abc123def456",
"summary": "Updated Team Meeting",
"location": "Conference Room B"
}
}
delete_event
Delete a calendar event.
Required Parameters:
event_id: ID of the event to delete
Optional Parameters:
calendar_id: Calendar ID (defaults to "primary")
Example:
{
"name": "delete_event",
"arguments": {
"event_id": "abc123def456"
}
}
Time Format
All time parameters should be in ISO 8601 format. Examples:
2024-01-15T10:00:00Z(UTC)2024-01-15T10:00:00-05:00(with timezone offset)
Error Handling
The server provides detailed error messages for common issues:
- Missing required parameters
- Invalid time formats
- Authentication failures
- Calendar access permission issues
Development
Running Tests
./gradlew test
Building Distribution
./gradlew shadowJar
The built JAR will be available in build/libs/.
Security Notes
- Store your Google service account credentials securely
- Never commit credentials to version control
- Use environment variables for credential paths
- Ensure your service account has minimal required permissions
Troubleshooting
Common Issues
- Authentication Error: Verify that
GOOGLE_CREDENTIALS_PATHpoints to a valid service account JSON file - Permission Denied: Ensure the service account email is added to your calendar with appropriate permissions
- Event Not Found: Check that the event ID is correct and the event exists in the specified calendar
- Time Format Error: Ensure all datetime parameters are in ISO 8601 format
License
This project is licensed under the MIT License.