# Google Calendar Setup Guide š
This guide will help you set up Google Calendar integration for the UofT Student Helper MCP server.
---
## šÆ What You'll Get
After setup, your MCP server will be able to:
- ā
Extract deadlines from course syllabi automatically
- ā
Add deadlines to your Google Calendar
- ā
Sync all course deadlines with one command
- ā
Set automatic reminders (1 day and 1 hour before)
---
## š Prerequisites
- Google account
- Access to Google Cloud Console
- 10-15 minutes
---
## Step 1: Create Google Cloud Project
### 1.1 Go to Google Cloud Console
Visit: https://console.cloud.google.com/
### 1.2 Create New Project
1. Click the project dropdown at the top
2. Click "NEW PROJECT"
3. Enter project name: `UofT Student Helper`
4. Click "CREATE"
### 1.3 Select Your Project
Make sure your new project is selected in the dropdown.
---
## Step 2: Enable Google Calendar API
### 2.1 Go to APIs & Services
1. Click the hamburger menu (ā°) in the top left
2. Navigate to: **APIs & Services** ā **Library**
### 2.2 Enable Calendar API
1. Search for "Google Calendar API"
2. Click on "Google Calendar API"
3. Click "ENABLE"
---
## Step 3: Create OAuth 2.0 Credentials
### 3.1 Go to Credentials
1. In the left sidebar, click **Credentials**
2. Click **+ CREATE CREDENTIALS**
3. Select **OAuth client ID**
### 3.2 Configure Consent Screen (if prompted)
1. Click "CONFIGURE CONSENT SCREEN"
2. Select **External** (unless you have a Google Workspace account)
3. Click "CREATE"
**Fill in the required fields**:
- App name: `UofT Student Helper`
- User support email: Your email
- Developer contact: Your email
- Click "SAVE AND CONTINUE"
**Scopes**:
- Click "ADD OR REMOVE SCOPES"
- Search for "Google Calendar API"
- Select: `.../auth/calendar` (full access to Google Calendar)
- Click "UPDATE"
- Click "SAVE AND CONTINUE"
**Test users**:
- Click "+ ADD USERS"
- Add your Google email
- Click "SAVE AND CONTINUE"
**Summary**:
- Review and click "BACK TO DASHBOARD"
### 3.3 Create OAuth Client ID
1. Go back to **Credentials**
2. Click **+ CREATE CREDENTIALS** ā **OAuth client ID**
3. Application type: **Desktop app**
4. Name: `UofT Student Helper Desktop`
5. Click "CREATE"
### 3.4 Download Credentials
1. You'll see a dialog with your client ID and secret
2. Click "DOWNLOAD JSON"
3. Save the file as `credentials.json`
---
## Step 4: Install Credentials
### 4.1 Move credentials.json
Move the downloaded `credentials.json` file to your project directory:
```bash
# Windows
move C:\Users\YourName\Downloads\credentials.json C:\Users\alice\Documents\uoft-student-helper-mcp\
# Mac/Linux
mv ~/Downloads/credentials.json ~/uoft-student-helper-mcp/
```
### 4.2 Verify File Location
Make sure `credentials.json` is in the same directory as `uoft_student_helper.py`:
```
uoft-student-helper-mcp/
āāā credentials.json ā Should be here
āāā uoft_student_helper.py
āāā google_calendar_client.py
āāā ...
```
---
## Step 5: Install Google API Libraries
### 5.1 Install Dependencies
```bash
pip install google-auth google-auth-oauthlib google-auth-httplib2 google-api-python-client
```
Or install all dependencies:
```bash
pip install -r requirements.txt
```
---
## Step 6: First-Time Authentication
### 6.1 Run the Server
```bash
python uoft_student_helper.py
```
### 6.2 Authenticate
When you run the server for the first time:
1. A browser window will open automatically
2. Sign in to your Google account
3. You'll see a warning: "Google hasn't verified this app"
- Click "Advanced"
- Click "Go to UofT Student Helper (unsafe)"
4. Click "Allow" to grant calendar access
5. You can close the browser window
### 6.3 Token Saved
A `token.json` file will be created automatically. This stores your authentication so you don't need to sign in again.
**Important**: Keep `token.json` private! It has access to your calendar.
---
## Step 7: Test the Integration
### 7.1 Test Adding a Deadline
Use the MCP tool to add a test deadline:
```bash
curl -X POST http://localhost:3002/call -H "Content-Type: application/json" -d '{
"tool": "add_deadline_to_calendar",
"arguments": {
"course_code": "CSC148H1",
"assignment_name": "Test Assignment",
"due_date": "2026-02-15T23:59:00",
"description": "This is a test"
}
}'
```
### 7.2 Check Your Calendar
1. Go to https://calendar.google.com/
2. You should see: **[CSC148H1] Test Assignment DUE**
3. Check that reminders are set (1 day and 1 hour before)
---
## š You're Done!
Your Google Calendar integration is now set up!
---
## š Using the Features
### Extract Deadlines from Syllabus
```bash
curl -X POST http://localhost:3002/call -H "Content-Type: application/json" -d '{
"tool": "extract_deadlines_from_syllabus",
"arguments": {
"course_code": "CSC148H1"
}
}'
```
### Add All Course Deadlines
```bash
curl -X POST http://localhost:3002/call -H "Content-Type: application/json" -d '{
"tool": "add_all_course_deadlines_to_calendar",
"arguments": {
"course_code": "CSC148H1"
}
}'
```
### Sync All Deadlines from All Courses
```bash
curl -X POST http://localhost:3002/call -H "Content-Type: application/json" -d '{
"tool": "sync_all_deadlines_to_calendar",
"arguments": {}
}'
```
---
## š§ Troubleshooting
### Problem: Browser doesn't open
**Solution**:
- Make sure you're running the server from a machine with a browser
- Or manually copy the URL shown in the terminal and paste it in a browser
### Problem: "credentials.json not found"
**Solution**:
- Make sure `credentials.json` is in the project directory
- Check the file name (it's case-sensitive)
### Problem: "Google Calendar authentication failed"
**Solution**:
1. Delete `token.json` if it exists
2. Run the server again
3. Complete the authentication flow
### Problem: "Access denied"
**Solution**:
- Make sure you clicked "Allow" during authentication
- Check that you added yourself as a test user in the OAuth consent screen
### Problem: Deadlines not showing in calendar
**Solution**:
- Check that the event was created successfully (look for `event_id` in response)
- Refresh your Google Calendar
- Check the correct calendar is selected (should be "Primary")
---
## š Security Notes
### Keep These Files Private
- `credentials.json` - OAuth client credentials
- `token.json` - Your access token
**Add to .gitignore**:
```
credentials.json
token.json
```
### Revoke Access
To revoke access:
1. Go to: https://myaccount.google.com/permissions
2. Find "UofT Student Helper"
3. Click "Remove Access"
---
## š Additional Resources
- [Google Calendar API Documentation](https://developers.google.com/calendar/api/v3/reference)
- [OAuth 2.0 for Desktop Apps](https://developers.google.com/identity/protocols/oauth2/native-app)
- [Python Quickstart](https://developers.google.com/calendar/api/quickstart/python)
---
## š” Tips
### Customize Reminders
Edit `google_calendar_client.py` to change default reminders:
```python
# Default: 1 day and 1 hour before
reminders = [1440, 60]
# Change to: 2 days, 1 day, and 30 minutes before
reminders = [2880, 1440, 30]
```
### Use Different Calendar
To use a different calendar instead of "Primary":
```python
# In google_calendar_client.py
self.calendar_id = 'your_calendar_id@group.calendar.google.com'
```
Find calendar ID:
1. Go to Google Calendar settings
2. Select your calendar
3. Scroll to "Integrate calendar"
4. Copy the "Calendar ID"
---
**Enjoy automated deadline management!** šāØ