This is a Model Context Protocol (MCP) agent that integrates with the Google Calendar API. It allows users to:
- Retrieve upcoming events
- Create new calendar events
- Delete existing events
- Delay events by a given time
To install requirements, use the following command:
pip install -r requirements.txtGoogle API Credentials:
To set up authentication, you'll need to follow the instructions on https://developers.google.com/workspace/calendar/api/quickstart/python?hl=en.
When you've created your client (as a Desktop Application) a pop-up will appear summarising your client's details. Click 'Download to JSON' and download the file as credentials.json into the root repository of this project.
When you run the program for the first time (see 'Run the code' section), a window will appear asking you to login to your Google account. This happens only on the first run. Please follow the instructions on the pop-up.
Model accesses
To have access to a model, you'll need to create an environment variable file:
touch .envThen, you'll need to enter your API token as an environment variable:
echo AZURE_OPENAI_API_KEY=<your_key_here> >> .envpython src/main.pyUse this command to run the code. After that, you're all set to interact with the agent in the Terminal.
Here is a description of the provided tools.
Retrieves up to 10 upcoming events from the user's primary Google Calendar.
Returns:
- A list of upcoming events, or
- A message if no events are found, or
- An error dictionary if an API error occurs.
Creates a new event in the user's Google Calendar.
Parameters:
start_time(datetime.time): Event start time (required).title(str): Event title (required).start_date(datetime.date, optional): Start date, defaults to today.end_date(datetime.date, optional): End date, defaults to start_date if not provided.end_time(datetime.time, optional): End time, defaults to start_time + 1 hour if not provided.
Returns:
- Success message if created, or
- An error dictionary if an API error occurs.
Deletes events matching the given name and optionally date.
Parameters:
name(str): Name of the event to delete (required).date(datetime.date, optional): Date of the event to delete. If omitted, deletes all matching events by name.
Returns:
- Success message if deleted, or
- Message if no matching event found, or
- An error dictionary if an API error occurs.
Delays all events matching the given name by a specified time delta.
Parameters:
time(datetime.timedelta): Amount of time to delay the event(s) by (required).name(str): Name of the event(s) to delay (required).
Returns:
- Success message with delay duration, or
- An error dictionary if an API error occurs.
In case of any issues, you can create an issue report on the github.