Skip to main content
Glama

Google Calendar MCP Server

google_auth.py1.09 kB
import os from typing import Optional from google.oauth2.credentials import Credentials from googleapiclient.discovery import build SCOPES = ['https://www.googleapis.com/auth/calendar.readonly'] def get_credentials_from_env() -> Optional[Credentials]: client_id = os.getenv('GOOGLE_CLIENT_ID') client_secret = os.getenv('GOOGLE_CLIENT_SECRET') project_id = os.getenv('GOOGLE_PROJECT_ID') refresh_token = os.getenv('GOOGLE_REFRESH_TOKEN') if not all([client_id, client_secret, project_id, refresh_token]): raise ValueError( "Missing required environment variables: " "GOOGLE_CLIENT_ID, GOOGLE_CLIENT_SECRET, GOOGLE_PROJECT_ID, GOOGLE_REFRESH_TOKEN" ) creds = Credentials( token=None, refresh_token=refresh_token, token_uri='https://oauth2.googleapis.com/token', client_id=client_id, client_secret=client_secret, scopes=SCOPES ) return creds def get_service(): creds = get_credentials_from_env() return build('calendar', 'v3', credentials=creds)

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/YusukeYoshiyama/google-calendar-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server