Google agents — setup & login

The Google Calendar and Gmail agents share one Google Cloud OAuth client and this one-time setup. Do it once, then see each agent's page for usage.

How it works (and why it just works)

Each agent talks to Google's hosted MCP server first (calendarmcp.googleapis.com, gmailmcp.googleapis.com). Those endpoints are currently access-gated — even with a valid, fully-scoped token they answer tool executions with PERMISSION_DENIED for projects that aren't on Google's allowlist. So Wactorz transparently falls back to the plain Google REST API (Calendar v3 / Gmail v1) using the same token:

agent request → hosted MCP → PERMISSION_DENIED → REST API (same token) → result

You get working agents today with no extra steps; if Google later allowlists your project for the hosted MCP, it takes over automatically.

Prerequisites

1. Create a Cloud project & enable APIs

In the API Library (or via gcloud), enable the APIs for the agents you want:

# Calendar
gcloud services enable calendar-json.googleapis.com calendarmcp.googleapis.com --project=PROJECT_ID
# Gmail
gcloud services enable gmail.googleapis.com gmailmcp.googleapis.com --project=PROJECT_ID

Enabling *mcp.googleapis.com is harmless if it's gated — the REST fallback covers it.

Under APIs & Services → OAuth consent screen:

3. Create the OAuth client

APIs & Services → Credentials → Create credentials → OAuth client ID → Web application. Add this exact Authorized redirect URI (both agents use it):

http://localhost:8765/oauth/callback

Copy the Client ID and Client secret — one client can serve both agents.

4. Configure .env

Fill in the Google section at the bottom of .env (see .env.template):

# Calendar
CALENDAR_MCP_CLIENT_ID=...apps.googleusercontent.com
CALENDAR_MCP_CLIENT_SECRET=GOCSPX-...

# Gmail (reuse the same client, or a separate one)
GMAIL_MCP_CLIENT_ID=...apps.googleusercontent.com
GMAIL_MCP_CLIENT_SECRET=GOCSPX-...

URL, redirect URI, scopes and token-file paths all have sensible defaults — override them via the commented keys in .env.template only if needed. Leaving a section blank disables that agent. Never commit .env or real secrets.

5. Log in once

Run the one-time login. It opens a browser for consent and stores the token under ~/.wactorz/ (reused on every run, refreshed silently):

wactorz-google-login          # both configured agents
wactorz-google-login calendar # just one
wactorz-google-login gmail

This mints a token with exactly the scopes Wactorz needs — notably without gmail.metadata, which would otherwise block free-text mail search.

Normal agent requests never pop a browser: they authenticate silently and, if a fresh consent were ever required, fail fast rather than block a server. That's why the initial login is this explicit one-time step.

Troubleshooting

Security notes