A Claude Code plugin that extends Gmail MCP with 5-category email classification, auto-tagging, search, and label management. Also includes a standalone CLI (main.py).
git clone https://github.com/axisrow/claude_code_gmail_plugin.git
cd claude_code_gmail_plugin
cp -r skills/* ~/.claude/skills/
mkdir -p ~/.claude/scripts/gmail-analyzer
cp scripts/*.py gmail_client.py ~/.claude/scripts/gmail-analyzer/pip install -r requirements.txt # Google API libsFor the standalone CLI (main.py):
pip install -r requirements-sdk.txt # + claude-agent-sdk, openpyxlThe client auto-selects an available backend: gcloud ADC → gws CLI → credentials.json.
-
Install gcloud CLI:
macOS (Apple Silicon):
curl -O https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-cli-darwin-arm.tar.gz tar -xf google-cloud-cli-darwin-arm.tar.gz ./google-cloud-sdk/install.sh
macOS (Intel):
curl -O https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-cli-darwin-x86_64.tar.gz tar -xf google-cloud-cli-darwin-x86_64.tar.gz ./google-cloud-sdk/install.sh
Open a new terminal after installation.
-
Initialize gcloud:
gcloud init
-
Create an OAuth Client ID in Google Cloud Console, download it as
client_secret.jsoninto the project root. -
Authenticate:
gcloud auth application-default login \ --client-id-file=client_secret.json \ --scopes=https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/gmail.modify
npm install -g @googleworkspace/cli
gws auth setup
gws auth login -s gmailVerify: gws gmail +triage --max 3
- Create an OAuth Client ID in Google Cloud Console
- Download
credentials.jsoninto the project root - A browser window will open for authorization on first run
Once installed, 4 skills are available:
| Skill | Command | Description |
|---|---|---|
| Email Analysis | /analyze-emails |
5-category classification (Personal, Newsletter, Important, Noise, Spam) |
| Search | /search-emails <query> |
Gmail query syntax search (from:, subject:, newer_than:) |
| Labels | /manage-labels |
List, create, delete labels |
| Auto-tag | /auto-tag |
Analyze + suggest tags + confirm + apply |
Skills use Gmail MCP for reading and scripts from scripts/ for writing (applying labels).
main.py runs independently from Claude Code via Claude Agent SDK:
python main.py # analysis only (INBOX)
python main.py --tag # analysis + auto-tagging
python main.py --tag --label CATEGORY_X # tag emails with a specific label
python main.py --label CATEGORY_UPDATES # analyze emails with a specific label
python main.py top [N] # top-N newsletter senders
python main.py mark <Label_ID> <emails> # label emails from specific senders
python main.py mark-query <Label_ID> <q># label emails by Gmail query
python main.py analyze-senders [N] # sender analysis by sector (Excel)
python main.py labels # show all labels
python main.py labels create Name # create a custom label
python main.py labels delete Label_XX # delete a custom labelImportant:
main.pycannot be run inside a Claude Code session (nested sessions are not allowed). Use a regular terminal.
Re-authorization: if you previously used the
gmail.readonlyscope, deletetoken.jsonand re-authorize withgmail.modify.