List calendar events within a specified time range
Create a new calendar event
Update an existing calendar event
Delete a calendar event
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.
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.
Before setting up the Google Calendar MCP server, ensure you have:
https://www.googleapis.com/auth/calendar
https://www.googleapis.com/auth/calendar.events
You'll need to create a script to obtain a refresh token:
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);
npm install googleapis
Update the script with your OAuth credentials:
your-client-id
with your actual client IDyour-client-secret
with your actual client secretRun the script:
node getToken.js
git clone https://github.com/v-3/google-calendar.git
cd google-calendar
npm install
npm run build
For MacOS:
code ~/Library/Application\ Support/Claude/claude_desktop_config.json
For Windows:
code %AppData%\Claude\claude_desktop_config.json
{
"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"
}
}
}
}
Replace the placeholder values with your actual credentials:
/ABSOLUTE/PATH/TO/
with the absolute path to your cloned repositoryyour_client_id_here
with your Google client IDyour_client_secret_here
with your Google client secretyour_refresh_token_here
with the refresh token you obtainedSave the file and restart Claude Desktop
After setting up the MCP server, you can interact with your Google Calendar through natural language commands in Claude. Here are some examples:
Tools not appearing in Claude:
tail -f ~/Library/Logs/Claude/mcp*.log
(MacOS) or Get-Content -Path "$env:AppData\Claude\Logs\mcp*.log" -Wait -Tail 20
(Windows)Authentication Errors:
Server Connection Issues:
node /path/to/build/index.js