Provides tools for sending templated emails through Gmail API with secure OAuth authentication
Integrates with Google Calendar API for scheduling meetings, finding free time slots, creating and canceling events, along with Gmail integration for email confirmations
Utilizes Google Cloud platform services including Calendar API and Gmail API for comprehensive scheduling and email functionality
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Google MCP Routerschedule a 45-minute team sync with alex@example.com for tomorrow at 2pm"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Google MCP Router
A Google-only MCP (Model Context Protocol) Router for scheduling meetings and sending email confirmations.
Features
5 MCP Tools:
time.resolve,calendar.find_free_slots,calendar.create_event,calendar.cancel_event,email.sendPolicy Enforcement: Working hours, calendar allowlist, overlap prevention
OAuth Integration: Secure Google API authentication with PKCE
Idempotency: Prevents duplicate operations
Observability: Structured logging, Prometheus metrics, OpenTelemetry tracing
Quick Start
Prerequisites
Node.js ≥ 20
Redis (optional, falls back to in-memory store)
Google Cloud project with Calendar API and Gmail API enabled
Installation
Quick Setup (Recommended)
Windows:
setup.batLinux/Mac:
chmod +x setup.sh
./setup.shManual Setup
Clone the repository:
git clone <repository-url>
cd google-mcp-routerInstall dependencies:
npm installSet up environment variables:
cp .env.example .env
# Edit .env with your configurationBuild the project:
npm run buildStart the server:
npm startEnvironment Configuration
Create a .env file with the following variables:
NODE_ENV=staging
APP_PORT=8080
DEFAULT_TZ=America/Chicago
DEFAULT_MEETING_MIN=30
ALLOWLIST_CALENDAR_IDS=primary
WORK_HOURS_START=08:00
WORK_HOURS_END=18:00
WORK_DAYS=Mon,Tue,Wed,Thu,Fri
GOOGLE_CLIENT_ID=your_google_client_id_here
GOOGLE_CLIENT_SECRET=your_google_client_secret_here
GOOGLE_REDIRECT_URI=http://localhost:8080/oauth/google/callback
TOKEN_ENC_KEY=base64:your_base64_encryption_key_here
REDIS_URL=redis://localhost:6379
LOG_LEVEL=info
GMAIL_SENDER_EMAIL=assistant@yourdomain.com
GMAIL_SENDER_NAME=Thinh's AssistantGoogle Cloud Setup
Create a Google Cloud project
Enable Calendar API and Gmail API
Create OAuth 2.0 credentials (Web application)
Set redirect URI to
http://localhost:8080/oauth/google/callbackConfigure OAuth scopes:
https://www.googleapis.com/auth/calendar.eventshttps://www.googleapis.com/auth/gmail.send
API Usage
Authentication
Visit
/oauth/google/loginto start OAuth flowComplete Google authentication
You'll be redirected to
/oauth/google/callbackwith tokens stored
Tool Execution
Execute MCP tools via POST requests:
# Resolve time expression
curl -X POST http://localhost:8080/mcp/tools/time.resolve \
-H "Content-Type: application/json" \
-d '{"input": "next Tuesday 3pm"}'
# Find free slots
curl -X POST http://localhost:8080/mcp/tools/calendar.find_free_slots \
-H "Content-Type: application/json" \
-d '{
"window_start_iso": "2024-01-15T09:00:00-06:00",
"window_end_iso": "2024-01-15T17:00:00-06:00",
"duration_min": 30
}'
# Create event
curl -X POST http://localhost:8080/mcp/tools/calendar.create_event \
-H "Content-Type: application/json" \
-d '{
"title": "Team Meeting",
"start_iso": "2024-01-15T14:00:00-06:00",
"end_iso": "2024-01-15T15:00:00-06:00",
"attendees": [{"email": "colleague@example.com"}],
"idempotency_key": "unique-key-123"
}'Available Tools
time.resolve- Parse natural language time expressionscalendar.find_free_slots- Find available time slotscalendar.create_event- Create calendar eventscalendar.cancel_event- Cancel calendar eventsemail.send- Send templated emails
Development
Running in Development Mode
npm run devRunning Tests
npm test
npm run test:coverageLinting
npm run lintType Checking
npm run type-checkArchitecture
src/
├── server.ts # Fastify server
├── mcp/
│ ├── index.ts # MCP tool registry
│ ├── tools/ # Individual tool implementations
│ └── schemas/ # JSON schemas for validation
├── adapters/ # Google API adapters
├── policy/ # Business rule enforcement
├── auth/ # OAuth and token management
├── templates/ # Email templates
└── util/ # Shared utilitiesSecurity
OAuth 2.0 with PKCE for secure authentication
AES-256-GCM encryption for token storage
Policy enforcement for all operations
Input validation and sanitization
Rate limiting and idempotency
Monitoring
Health Check:
GET /healthMetrics:
GET /metrics(Prometheus format)Logs: Structured JSON logging with Pino
License
MIT License