What It Does
The Add Gmail skill:- Installs Gmail MCP server with read, send, search, draft tools
- Sets up GCP OAuth credentials
- Optionally installs Gmail channel for inbox monitoring
- Configures email handling instructions
Prerequisites
- NanoClaw base installation complete
- Google account
- Access to Google Cloud Console
How to Apply
Choose mode
- Tool-only: Agent can read/send emails but won’t monitor inbox
- Channel mode: Emails trigger the agent (get forwarded to main channel)
Set up GCP OAuth
- Open https://console.cloud.google.com
- Create new project or select existing
- Go to APIs & Services > Library, enable Gmail API
- Go to APIs & Services > Credentials, create OAuth client ID
- Application type: Desktop app
- Download JSON and save as
gcp-oauth.keys.json
Apply code changes
Tool-only:
- Mounts
~/.gmail-mcpin container - Adds Gmail MCP server to agent-runner
- Adds
src/channels/gmail.ts - Adds unit tests
- Installs
googleapisdependency - Appends email handling instructions to
CLAUDE.md
Authorize Gmail access
Run OAuth flow:Sign in and grant access. If you see “app isn’t verified” warning, click Advanced → Go to [app name] (unsafe).
What Changes
Files Created
~/.gmail-mcp/gcp-oauth.keys.json- GCP OAuth credentials~/.gmail-mcp/credentials.json- Gmail access tokensrc/channels/gmail.ts- Gmail channel (channel mode only)src/channels/gmail.test.ts- Unit tests (channel mode only)
Files Modified
src/container-runner.ts- Mounts~/.gmail-mcpin containercontainer/agent-runner/src/index.ts- Adds Gmail MCP servergroups/main/CLAUDE.md- Email handling instructions (channel mode)package.json- Addsgoogleapis(channel mode only).nanoclaw/state.yaml- Records skill application
Usage
Tool-Only Mode
Ask the agent to interact with Gmail:Channel Mode
Incoming emails automatically trigger the agent:- Email arrives in Primary inbox
- Agent receives notification:
[Email from John: Subject line] - Agent informs you in main channel
- You can ask agent to reply, forward, or take action
In channel mode, the agent is instructed to inform you about emails but NOT reply unless specifically asked. This prevents unwanted auto-replies.
Troubleshooting
Gmail Connection Not Responding
Test directly:OAuth Token Expired
Re-authorize:Container Can’t Access Gmail
- Verify
~/.gmail-mcpmount insrc/container-runner.ts - Check container logs:
cat groups/main/logs/container-*.log | tail -50
Emails Not Being Detected (Channel Mode)
Channel polls foris:unread category:primary by default. Check:
- Logs for Gmail polling errors
- Email is in Primary inbox (not Promotions/Social)
- OAuth token is valid
Removal
Tool-Only Mode
- Remove
~/.gmail-mcpmount fromsrc/container-runner.ts - Remove Gmail MCP server from
container/agent-runner/src/index.ts - Clear agent-runner copies and rebuild
Channel Mode
- Delete
src/channels/gmail.tsandsrc/channels/gmail.test.ts - Remove
import './gmail.js'fromsrc/channels/index.ts - Remove
~/.gmail-mcpmount fromsrc/container-runner.ts - Remove Gmail MCP server from
container/agent-runner/src/index.ts - Uninstall:
npm uninstall googleapis - Clear agent-runner copies and rebuild