Enables management of multiple Google Calendar accounts with tools for searching, creating, updating, and deleting events on primary calendars, plus account resolution and listing capabilities.
Uses Google Cloud OAuth clients for authentication to access Google Calendar API with configurable scopes and consent flows.
Runs as a Node.js application (requires Node.js >= 18.17) providing both MCP server and CLI functionality.
Utilizes OpenID Connect along with email and profile scopes to capture and manage Google account identity information.
Stores OAuth tokens and account information in a local SQLite database with optional AES-GCM encryption for refresh tokens at rest.
@ideadesignmedia/gcal-mcp
Private MCP server (stdio) and CLI for linking and operating multiple Google Calendar accounts. It stores tokens in a local SQLite database and can encrypt refresh tokens at rest with a user password.
The server speaks MCP over stdio and keeps stdout clean (JSON‑RPC only); all human‑readable logs go to stderr.
Requirements
Node.js >= 18.17
A Google Cloud OAuth client (Web application) with Calendar API enabled
You will need
GOOGLE_CLIENT_IDandGOOGLE_CLIENT_SECRET
One‑liner (npx)
Use npx to run without installing globally. The package name is @ideadesignmedia/gcal-mcp and the binary is gcal-mcp.
Database
Default location:
~/.idm/gcal-mcp/db.sqliteOverride with
--db <path>on any commandWhen locked, refresh tokens are encrypted with AES‑GCM using a DEK derived from your password via scrypt
Global Flags
--db <path>: SQLite database path (defaults above)--pass <pass>: Database password (where applicable). Forstart, considerGMAIL_MCP_DB_PASSinstead.--read-only: Start server with write tools disabled (create/update/delete)
Environment variables:
GMAIL_MCP_DB_PASS: Password used bystart(and as a fallback elsewhere)GOOGLE_CLIENT_ID,GOOGLE_CLIENT_SECRET: OAuth credentials (used byaddif flags not supplied)
Commands
startStarts the MCP server over stdio
Respects
--read-onlyStdout: JSON‑RPC messages only; logs to stderr
Examples:
GMAIL_MCP_DB_PASS='...' npx -y @ideadesignmedia/gcal-mcp start
addLinks a Google account and stores its refresh token
Options:
--client-id <id>/--client-secret <secret>(or use env vars)--devicefor Device Code flow (headless), otherwise uses loopback redirect and prints a URL to visit (default port 43112; change with--listen-port <port>)--scopes <list>to provide custom scopes (comma or space separated)--choose-scopesto interactively select calendar access (read-only vs read/write) and optionally add extra scopes
Example:
npx -y @ideadesignmedia/gcal-mcp add --client-id $GOOGLE_CLIENT_ID --client-secret $GOOGLE_CLIENT_SECRETnpx -y @ideadesignmedia/gcal-mcp add --choose-scopes --client-id $GOOGLE_CLIENT_ID --client-secret $GOOGLE_CLIENT_SECRET
listLists linked accounts (id, email, display name, created)
remove <key>Removes an account and its tokens by id or email
passwdLocks the database or rotates an existing password
Options:
--pass <pass>: Password to set when locking, or new password when rotating--rotate: Rotate the existing password (requires--old-pass)--old-pass <old>: Old password for rotation--hint <text>: Optional password hint stored alongside the KDF parameters
MCP Server Integration
Any MCP‑capable client can launch this server as a stdio process. A generic config entry looks like:
Notes:
The
startcommand writes only JSON‑RPC to stdout as required by MCP stdio.Use your client’s secret storage for
GMAIL_MCP_DB_PASSwhere available.
Provided Tools
The server exposes the following tools. Names and parameter schemas follow the Chat Completions function tool shape.
Primary calendar only:
All operations target the account’s primary calendar automatically; there is no
calendarIdparameter.This removes confusion between account vs calendar. The server passes
primaryinternally.
Account resolution rules (applies wherever account is accepted):
Accepts exact
emailorid.Also accepts a partial, case-insensitive match on email or display name.
If
accountis omitted and exactly one account is linked, that account is used.If multiple accounts would match or are linked with no
accountprovided, the tool throws a helpful error. Usegcal-list_accountsto choose deterministically.gcal-list_accountsParameters: none
Returns:
{ accounts: Array<{ id: string, email: string, displayName: string | null }> }
gcal-resolve_accountParameters:
query(string; optional; email/id or partial). If omitted or blank, returns all accounts.
Returns:
{ query: string, matches: Array<{ id: string, email: string, displayName: string | null }>, exact: boolean, ambiguous: boolean, count: number }
gcal-search_eventsParameters:
account(string; optional)q(string, optional)timeMin(ISO string, optional)timeMax(ISO string, optional)maxResults(integer 1..250, optional)
Returns:
{ events: GoogleCalendarEvent[] }(verbatim event objects)
gcal-get_eventParameters:
account(string; optional)eventId(string)
Returns:
GoogleCalendarEvent
gcal-create_eventParameters:
account(string; optional)summary(string)description(string, optional)location(string, optional)start(object:{ dateTime?: string, date?: string, timeZone?: string })end(object:{ dateTime?: string, date?: string, timeZone?: string })attendees(array of{ email: string }, optional)
Returns:
GoogleCalendarEvent
gcal-update_eventParameters:
account(string; optional)eventId(string)patch(object; partial event resource)
Returns:
GoogleCalendarEvent
gcal-delete_eventParameters:
account(string; optional)eventId(string)
Returns:
{ ok: true }on success
Read‑only mode:
Start with
--read-onlyto disablegcal-create_event,gcal-update_event, andgcal-delete_event.
OAuth Flows
Default: Loopback flow. The CLI opens your browser to grant access and listens on
127.0.0.1:43112for the redirect (customizable via--listen-port).Headless: Device Code flow with
--device. The CLI prints a code and verification URL to the terminal.Scopes used:
https://www.googleapis.com/auth/calendar, plusopenid email profileto capture account identity.
Security Notes
When locked, refresh tokens are encrypted at rest (AES‑GCM). The key is derived with scrypt using per‑DB salt and stored KDF parameters.
The MCP
startcommand emits no human‑readable output on stdout.Prefer setting
GMAIL_MCP_DB_PASSvia your MCP client’s secret system; avoid committing secrets in configs.
Troubleshooting
Database is locked
Set
GMAIL_MCP_DB_PASSor pass--passwhen needed. Forstart, use the env var.
OAuth did not return a refresh_token
Ensure you used the provided
addcommand (it requests offline access with consent). If you previously granted access without offline permission, remove prior consent in your Google Account or create a new OAuth client.
Loopback callback failed
Check firewall or try
--devicefor Device Code flow.
MCP client shows parse errors
Verify you are launching the server with
startand not another command. STDOUT must remain clean JSON‑RPC.
MIT © Idea Design Media