Daily Agenda from Google Calendar
A simple Go program that fetches and displays your daily agenda from Google Calendar.
Prerequisites
This project uses Task for task automation. Install it first:
# macOS
brew install go-task/tap/go-task
# Linux
sh -c "$(curl --location https://taskfile.dev/install.sh)" -- -d -b ~/.local/bin
# Windows
choco install go-task
# Or install via Go
go install github.com/go-task/task/v3/cmd/task@latest
Setup Instructions
1. Enable Google Calendar API
- Go to the Google Cloud Console
- Create a new project or select an existing one
- Enable the Google Calendar API:
- Go to "APIs & Services" > "Library"
- Search for "Google Calendar API"
- Click on it and press "Enable"
2. Create Credentials
- Go to "APIs & Services" > "Credentials"
- Click "Create Credentials" > "OAuth client ID"
- If prompted, configure the OAuth consent screen first:
- Choose "External" user type
- Fill in the required information (app name, user support email, developer contact)
- Add your email to test users
- For Application type, choose "Desktop application"
- Give it a name (e.g., "Daily Agenda App")
- Important: Add
http://localhost:8080
to the "Authorized redirect URIs" - Download the JSON file and save it as
credentials.json
in this directory
3. Install Dependencies
task mod-tidy
4. Build the Application
task build
Usage
The program supports 2 modes:
Text Mode (Display Calendar Agenda)
Display today's agenda:
task run-text
# or directly: ./agenda-mcp text
Display agenda for a specific date:
./agenda-mcp text 2024-12-25
The date must be in YYYY-MM-DD format. If no date is provided, today's agenda is displayed.
MCP Server Mode
task run-mcp
On first run (auth mode):
- The program will automatically open your browser (or show you a URL if it can't)
- Sign in with your Google account
- Grant permission to read your calendar
- The authorization will complete automatically - you'll see a success page
- Your credentials are saved for future runs
After authentication, you can use task run-test
to display your agenda or task run-mcp
to run as an MCP server.
Available Tasks
Run task --list
to see all available tasks:
task build
- Build the local binarytask clean
- Clean build artifactstask mod-tidy
- Tidy and verify go modulestask run-text
- Show today's agenda in the command linetask run-mcp
- Start MCP servertask inspector
- Run the npx MCP inspector
MCP Inspector
For debugging and testing the MCP server, you can use the MCP inspector:
task inspector
This will start the MCP inspector at http://localhost:8080 for testing the MCP server functionality.
Alternative: Direct Go Commands
If you prefer not to use Task, you can run the commands directly:
# Install dependencies
go mod tidy
# Run modes directly
go run main.go text # Show today's agenda
go run main.go text 2024-12-25 # Show agenda for specific date
go run main.go mcp # Start MCP server
Features
- ๐ Shows today's events in chronological order
- ๐ Displays event times (or "All day" for full-day events)
- ๐จ Shows event colors with your actual category names (Focus Time, Internal Group Meetings, External Meetings, Personal, etc.)
- ๐ Shows event locations if available
- ๐ Displays event descriptions (truncated to 100 characters)
- ๐ฅ Lists attendees with their response status (โ accepted, โ declined, โ tentative, โณ pending)
- ๐๏ธ Shows event visibility settings
- โฑ๏ธ Displays transparency settings (busy/free)
- ๐ Friendly message when no events are scheduled
- ๐ MCP Server: Exposes calendar data via Model Context Protocol for integration with LLM applications
MCP Server Mode
When run in MCP mode (task run-mcp
), the program acts as a Model Context Protocol server that can be integrated with LLM applications like Claude, providing two calendar tools:
Available MCP Tools
get_todays_agenda
- Get today's calendar agenda from Google Calendarget_agenda_for_date
- Get calendar agenda for a specific date (YYYY-MM-DD format)
MCP Integration
Add this to your MCP client configuration:
{
"mcpServers": {
"google-calendar": {
"command": "/path/to/your/agenda-mcp",
"args": ["mcp"],
"env": {
"client_id": "your-google-oauth-client-id",
"project_id": "your-google-project-id",
"client_secret": "your-google-oauth-client-secret"
}
}
}
}
Note: Replace /path/to/your/agenda-mcp
with the actual full path to your built binary, and set the environment variables with your Google OAuth credentials from the credentials.json
file.
This allows LLM applications to:
- Fetch your daily Google Calendar agenda using the
get_todays_agenda
tool - Get calendar events for any specific date using the
get_agenda_for_date
tool with a date parameter (e.g., "2024-12-25")
Security Notes
- Keep
credentials.json
andtoken.json
private - Don't commit these files to version control
- The program only requests read-only access to your calendar