add-gmail
Skill194 starsChanged 8 months agoMITView on GitHub
Add Gmail integration to ClaudeClaw. Can be configured as a tool (agent reads/sends emails when triggered from WhatsApp) or as a full channel (emails can trigger the agent, schedule tasks, and receive replies). Guides through GCP OAuth setup and implements the integration.
- Reads credentials
- Installs packages
2 other projects use a version of this, 1 of them edited.
Adopted by
Most recently taken up by
- Runchuan-BU/BioClawtheir own version, first seen Aug 2, 2026
- DingyangLyu/MatClawedited, first seen Mar 17, 2026
Other versions2 projects use a version of this.
Word for word · 0
None found.
Edited · 1
- DingyangLyu/MatClaw★ 9467% same
Wrote their own version · 1
- Runchuan-BU/BioClaw★ 410same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository26 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- add-compactSkill
- add-discordSkill
- add-image-visionSkill
- add-ollama-toolSkill
- add-parallelSkill
- add-pdf-readerSkill
- add-qmdSkill
- add-reactionsSkill
- add-telegramSkill
- add-telegram-swarmSkill
- add-voice-transcriptionSkill
- add-whatsappSkill
- convert-to-apple-containerSkill
- customizeSkill
- debugSkill
- get-qodo-rulesSkill
- install-extensionSkill
- qodo-pr-resolverSkill
- setupSkill
- uninstall-extensionSkill
- uninstallSkill
- update-claudeclawSkill
- update-skillsSkill
- use-local-whisperSkill
- x-integrationSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
16 rules. About 0 are common, 4 are distinctive, and 12 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈4
Distinctive · estimate
This author's own choices. Worth a look.
12
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 14
Check if src/channels/gmail.ts exists.
- Very specific: line 33
If gmail is missing, add it:
- Distinctive: line 58
If the merge reports conflicts, resolve them by reading the conflicted files and understanding the intent of both sides.
- Very specific: line 62
If the user chose channel mode, append the following to groups/main/CLAUDE.md (before the formatting section):
- Distinctive: line 78
All tests must pass (including the new Gmail tests) and build must be clean before proceeding.
- Very specific: line 88
If credentials.json already exists, skip to "Build and restart" below.
- Distinctive: line 105
If user provides a path, copy it:
- Very specific: line 112
If user pastes JSON content, write it to ~/.gmail-mcp/gcp-oauth.keys.json.
- Very specific: line 126
If that fails (some versions don't have an auth subcommand), try timeout 60 npx -y @gongrzhe/server-gmail-autoauth-mcp || true.
- Very specific: line 195
Verify ~/.gmail-mcp is mounted: check src/orchestrator/container-runner.ts for the .gmail-mcp mount
- Very specific: line 196
Check container logs: cat groups/main/logs/container-*.log | tail -50
- Distinctive: line 201
Check logs for Gmail polling errors
- Very specific: line 207
Remove ~/.gmail-mcp mount from src/orchestrator/container-runner.ts
- Very specific: line 208
Remove gmail MCP server and mcp__gmail__* from agent/runner/src/index.ts
- Very specific: line 215
Delete src/channels/gmail.ts and src/channels/gmail.test.ts
- Very specific: line 216
Remove import './gmail.js' from src/channels/index.ts
≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Add Gmail Integration
This skill adds Gmail support to ClaudeClaw — either as a tool (read, send, search, draft) or as a full channel that polls the inbox.
Phase 1: Pre-flight
Check if already applied
Check if src/channels/gmail.ts exists. If it does, skip to Phase 3 (Setup). The code changes are already in place.
Ask the user
Use AskUserQuestion:
AskUserQuestion: Should incoming emails be able to trigger the agent?
- Yes — Full channel mode: the agent listens on Gmail and responds to incoming emails automatically
- No — Tool-only: the agent gets full Gmail tools (read, send, search, draft) but won't monitor the inbox. No channel code is added.
Phase 2: Apply Code Changes
Ensure channel remote
git remote -vIf gmail is missing, add it:
git remote add gmail https://github.com/qwibitai/claudeclaw-gmail.gitMerge the skill branch
git fetch gmail main
git merge gmail/main || {
git checkout --theirs package-lock.json
git add package-lock.json
git merge --continue
}This merges in:
src/channels/gmail.ts(GmailChannel class with self-registration viaregisterChannel)src/channels/gmail.test.ts(unit tests)import './gmail.js'appended to the channel barrel filesrc/channels/index.ts- Gmail credentials mount (
~/.gmail-mcp) insrc/orchestrator/container-runner.ts - Gmail MCP server (
@gongrzhe/server-gmail-autoauth-mcp) andmcp__gmail__*allowed tool inagent/runner/src/index.ts googleapisnpm dependency inpackage.json
If the merge reports conflicts, resolve them by reading the conflicted files and understanding the intent of both sides.
Add email handling instructions (Channel mode only)
If the user chose channel mode, append the following to groups/main/CLAUDE.md (before the formatting section):
## Email Notifications
When you receive an email notification (messages starting with `[Email from ...`), inform the user about it but do NOT reply to the email unless specifically asked. You have Gmail tools available — use them only when the user explicitly asks you to reply, forward, or take action on an email.Validate code changes
npm install
npm run build
npx vitest run src/channels/gmail.test.tsAll tests must pass (including the new Gmail tests) and build must be clean before proceeding.
Phase 3: Setup
Check existing Gmail credentials
ls -la ~/.gmail-mcp/ 2>/dev/null || echo "No Gmail config found"If credentials.json already exists, skip to "Build and restart" below.
GCP Project Setup
Tell the user:
I need you to set up Google Cloud OAuth credentials:
- Open https://console.cloud.google.com — create a new project or select existing
- Go to APIs & Services > Library, search "Gmail API", click Enable
- Go to APIs & Services > Credentials, click + CREATE CREDENTIALS > OAuth client ID
- If prompted for consent screen: choose "External", fill in app name and email, save
- Application type: Desktop app, name: anything (e.g., "ClaudeClaw Gmail")
- Click DOWNLOAD JSON and save as
gcp-oauth.keys.jsonWhere did you save the file? (Give me the full path, or paste the file contents here)
If user provides a path, copy it:
mkdir -p ~/.gmail-mcp
cp "/path/user/provided/gcp-oauth.keys.json" ~/.gmail-mcp/gcp-oauth.keys.jsonIf user pastes JSON content, write it to ~/.gmail-mcp/gcp-oauth.keys.json.
OAuth Authorization
Tell the user:
I'm going to run Gmail authorization. A browser window will open — sign in and grant access. If you see an "app isn't verified" warning, click "Advanced" then "Go to [app name] (unsafe)" — this is normal for personal OAuth apps.
Run the authorization:
npx -y @gongrzhe/server-gmail-autoauth-mcp authIf that fails (some versions don't have an auth subcommand), try timeout 60 npx -y @gongrzhe/server-gmail-autoauth-mcp || true. Verify with ls ~/.gmail-mcp/credentials.json.
Build and restart
Clear stale per-group agent-runner copies (they only get re-created if missing, so existing copies won't pick up the new Gmail server):
rm -r data/sessions/*/agent-runner-src 2>/dev/null || trueRebuild the container (agent-runner changed):
cd container && ./build.shService name: Derived from the directory name:
com.claudeclaw.<dirname>(macOS) /claudeclaw-<dirname>(Linux). For example, if cwd ismy-assistant, the service iscom.claudeclaw.my-assistant. Determine the correct service name before running service commands below.
Then compile and restart:
npm run build
launchctl kickstart -k gui/$(id -u)/com.claudeclaw # macOS
# Linux: systemctl --user restart claudeclawPhase 4: Verify
Test tool access (both modes)
Tell the user:
Gmail is connected! Send this in your main channel:
@Andy check my recent emailsor@Andy list my Gmail labels
Test channel mode (Channel mode only)
Tell the user to send themselves a test email. The agent should pick it up within a minute. Monitor: tail -f logs/claudeclaw.log | grep -iE "(gmail|email)".
Once verified, offer filter customization via AskUserQuestion — by default, only emails in the Primary inbox trigger the agent (Promotions, Social, Updates, and Forums are excluded). The user can keep this default or narrow further by sender, label, or keywords. No code changes needed for filters.
Check logs if needed
tail -f logs/claudeclaw.logTroubleshooting
Gmail connection not responding
Test directly:
npx -y @gongrzhe/server-gmail-autoauth-mcpOAuth token expired
Re-authorize:
rm ~/.gmail-mcp/credentials.json
npx -y @gongrzhe/server-gmail-autoauth-mcpContainer can't access Gmail
- Verify
~/.gmail-mcpis mounted: checksrc/orchestrator/container-runner.tsfor the.gmail-mcpmount - Check container logs:
cat groups/main/logs/container-*.log | tail -50
Emails not being detected (Channel mode only)
- By default, the channel polls unread Primary inbox emails (
is:unread category:primary) - Check logs for Gmail polling errors
Removal
Tool-only mode
- Remove
~/.gmail-mcpmount fromsrc/orchestrator/container-runner.ts - Remove
gmailMCP server andmcp__gmail__*fromagent/runner/src/index.ts - Rebuild and restart
- Clear stale agent-runner copies:
rm -r data/sessions/*/agent-runner-src 2>/dev/null || true - Rebuild:
cd container && ./build.sh && cd .. && npm run build && launchctl kickstart -k gui/$(id -u)/com.claudeclaw(macOS) orsystemctl --user restart claudeclaw(Linux)
Channel mode
- Delete
src/channels/gmail.tsandsrc/channels/gmail.test.ts - Remove
import './gmail.js'fromsrc/channels/index.ts - Remove
~/.gmail-mcpmount fromsrc/orchestrator/container-runner.ts - Remove
gmailMCP server andmcp__gmail__*fromagent/runner/src/index.ts - Uninstall:
npm uninstall googleapis - Rebuild and restart
- Clear stale agent-runner copies:
rm -r data/sessions/*/agent-runner-src 2>/dev/null || true - Rebuild:
cd container && ./build.sh && cd .. && npm run build && launchctl kickstart -k gui/$(id -u)/com.claudeclaw(macOS) orsystemctl --user restart claudeclaw(Linux)
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

