gmail-modify-mcp
by portablestew
README.md
# gmail-modify-mcp
> **Work in progress.** Setup instructions are being refined and have only been tested on Windows 11. Feedback welcome.
A minimal MCP server that lets an AI agent modify Gmail message labels — and nothing else.
## The gap it fills
Gmail MCP integrations (including Anthropic's built-in claude.ai Gmail connector) are typically read-only: they can search and read messages but cannot mark them as read, archive them, or move them between labels. This server adds just that missing piece, enabling "zero inbox" agent workflows where the agent reads, evaluates, and then tidies up.
## When to use this
- You want an AI agent to automatically archive or mark emails as read after processing them
- No official, narrowly-scoped Gmail modify integration exists yet from Anthropic or Google
## When to reconsider
Google and Anthropic have both signaled investment in official Gmail MCP integrations. If a first-party option emerges that supports label modification, prefer it — it will have better security guarantees, no local credential management, and longer-term maintenance. Check [Google Workspace MCP](https://workspace.google.com) and Anthropic's connector catalog before using this.
## How credentials work
This tool has no central OAuth app and no shared credentials. Each user creates their own Google Cloud project and OAuth client. Your credentials never leave your machine — they are stored in `~/.gmail-modify-mcp/` and used only to make API calls directly to Google.
This means setup requires a one-time visit to Google Cloud Console to create an OAuth client. The guided setup script walks you through it.
## Security scope
This server requests exactly one OAuth scope: **`gmail.modify`**
That scope permits:
- ✅ Read all messages and metadata
- ✅ Add and remove labels (including moving to Trash or Spam)
- ❌ Send email
- ❌ Permanently delete messages
- ❌ Manage filters, forwarding, or account settings
You can audit or revoke access at any time at [myaccount.google.com/permissions](https://myaccount.google.com/permissions).
## Setup
### Windows 11 (guided)
Run this in PowerShell:
```powershell
irm https://raw.githubusercontent.com/portablestew/gmail-modify-mcp/main/setup.ps1 | iex
```
The script will install Git and uv if needed, walk you through creating an OAuth client in Google Cloud Console, authenticate, and print the MCP config snippet to add to your client.
> **Note:** this runs whatever is at that URL directly. You are trusting this GitHub repository. Review the [setup.ps1](setup.ps1) source first if you prefer.
If PowerShell blocks the script, your execution policy may be restricting scripts. You can allow them for your user account with:
```powershell
Set-ExecutionPolicy -Scope CurrentUser RemoteSigned
```
This is a user-level change and does not affect other accounts or system policy.
### Manual setup
**1. Create a Google Cloud OAuth client**
Go to [console.cloud.google.com/apis/dashboard](https://console.cloud.google.com/apis/dashboard):
1. Click **Enable APIs & Services**, search for **Gmail API**, enable it
2. In the left menu, click **Credentials**
3. Click **Create Credentials → OAuth client ID**
4. If prompted to configure a consent screen: choose **External**, set publishing status to **Testing**, and add your Gmail address as a test user via **OAuth consent screen → Audience → Add users**. Other fields can be left as defaults.
5. Application type: **Desktop app**. Click Create, then **Download JSON**
6. Save the downloaded file to `~/.gmail-modify-mcp/gcp-oauth.keys.json`
**2. Authenticate**
```bash
uvx --from git+https://github.com/portablestew/gmail-modify-mcp gmail-modify-mcp-auth
```
A browser window will open. You will see a **"Google hasn't verified this app"** warning — this is expected. Click **Advanced** then **Go to [app] (unsafe)** to continue.
To validate the scope, the consent screen should show something like **"Read, compose, and send emails from your Gmail account"** — Google's wording for `gmail.modify` sounds broader than it is. You should *not* see anything mentioning permanently deleting email or managing account settings. If you do, the OAuth client was configured with a wider scope than intended.
**3. Add to your MCP config**
```json
{
"mcpServers": {
"gmail-modify": {
"command": "uvx",
"args": ["--from", "git+https://github.com/portablestew/gmail-modify-mcp", "gmail-modify-mcp"]
}
}
}
```
The location of this config depends on your MCP client — see your client's documentation for where `mcpServers` should be placed.
## Tools exposed
| Tool | Parameters | Description |
|---|---|---|
| `gmail_modify` | `messageId`, `addLabelIds[]`, `removeLabelIds[]` | Add or remove labels on a message |
Common label operations:
- Mark as read: `removeLabelIds=["UNREAD"]`
- Archive: `removeLabelIds=["INBOX"]`
- Archive + mark read: `removeLabelIds=["UNREAD", "INBOX"]`
- Trash: `addLabelIds=["TRASH"], removeLabelIds=["INBOX"]`
This server cannot be deployed
Maintenance
ActivityInactive
ResponsivenessOutdated data