Skip to main content
Glama
anitalklausen

gmail-multi-mcp

README.md
# gmail-multi-mcp

An open-source [MCP](https://modelcontextprotocol.io) server that connects **any number of Gmail accounts** to Claude (or any MCP client) in one place. Everything runs locally, and your tokens never leave your machine.

## Tools

| Tool | What it does |
|---|---|
| `list_accounts` | Lists the connected accounts, with alias and read-only status |
| `search_emails` | Runs a Gmail search query on **one account or all of them at once** |
| `read_email` / `read_thread` | Reads one message or a whole conversation as plain text, with a list of attachments |
| `list_labels` | Lists the labels for an account |
| `list_send_as` | Lists the addresses an account can send from (Gmail's "Send mail as") |
| `send_email` | Sends mail from a chosen account, including threaded replies. `from_address` picks one of the account's "Send mail as" addresses |
| `create_draft` | Saves a draft instead of sending |
| `modify_labels` | Marks mail read or unread, archives, stars, or adds and removes labels |
| `trash_email` | Moves a message to Trash (recoverable) |

Every tool takes an `account` argument, which can be the full email address or an alias such as `work`.

**Sender addresses:** if an account has extra addresses under Gmail's *Settings → Accounts → Send mail as*, `send_email` and `create_draft` can send from any of them with `from_address`. Without it, a reply goes out from the address the original was sent to, and a new mail goes out from Gmail's default sender.

## 1. Create a Google OAuth client (once)

1. Open <https://console.cloud.google.com/> and create a project.
2. **APIs & Services → Library** → enable the **Gmail API**.
3. **APIs & Services → OAuth consent screen**: choose *External* and fill in the app name and your email. Under **Test users**, add every Gmail address you want to connect.
4. **APIs & Services → Credentials → Create credentials → OAuth client ID** → *Desktop app*. Download the JSON file.
5. Save the file as `~/.config/gmail-multi-mcp/credentials.json`.

> **Tip:** while the app is in *Testing* status, Google expires refresh tokens after 7 days. For personal use you can click **Publish app** on the consent screen. It stays unverified, so you'll see an "unverified app" warning when you sign in, but the tokens stop expiring.

One OAuth client works for all your accounts.

## 2. Install

Install [uv](https://docs.astral.sh/uv/). It also installs Python for you:

```bash
curl -LsSf https://astral.sh/uv/install.sh | sh
```

Then install the server straight from GitHub:

```bash
uv tool install https://github.com/anitalklausen/gmail-multi-mcp/archive/refs/heads/main.zip
```

To install from a local clone instead, run `uv tool install .` in the project folder.

This puts `gmail-multi-mcp` in `~/.local/bin`.

## 3. Connect accounts

Run this once per account. A browser opens where you choose the Google account:

```bash
gmail-multi-mcp add --alias private
gmail-multi-mcp add --alias work
gmail-multi-mcp add --alias shop --read-only
gmail-multi-mcp list
```

Remove an account with `gmail-multi-mcp remove work`. New accounts are picked up by the running server without a restart.

## 4. Add it to Claude

**Claude Desktop:** go to *Settings → Developer → Edit Config* and add the server to `claude_desktop_config.json`:

```json
{
  "mcpServers": {
    "gmail": {
      "command": "/Users/YOUR_USERNAME/.local/bin/gmail-multi-mcp"
    }
  }
}
```

Use the absolute path, because Claude Desktop does not read your shell's `PATH`. Restart Claude Desktop afterwards.

**Claude Code:**

```bash
claude mcp add gmail --scope user -- ~/.local/bin/gmail-multi-mcp
```

## Configuration

| Environment variable | Effect |
|---|---|
| `GMAIL_MCP_HOME` | Config/token folder. The default is `~/.config/gmail-multi-mcp`. |
| `GMAIL_MCP_CREDENTIALS` | Path to the OAuth client JSON |
| `GMAIL_MCP_READ_ONLY=1` | Hides every write tool (send, draft, labels, trash) for all accounts |

## Security

- Tokens are stored in `tokens/<email>.json` with `600` permissions. Treat them like passwords.
- The default scope is `gmail.modify`: read, send, and change labels, but never permanent deletion. Accounts added with `--read-only` get `gmail.readonly`.
- The server tells the model to confirm with you before sending, and Claude also asks for approval on every tool call.

See also the [privacy policy](PRIVACY.md).

## License

MIT

TDQS

B3.4/5.0

Scored across 9 tools

Disambiguation4/5

Each tool has a fairly distinct purpose: reading, searching, sending, drafting, trashing, and label management are all clearly separated. The only mild overlap is between modify_labels (which can apply TRASH/UNREAD labels) and trash_email, plus list_labels vs modify_labels, but descriptions make the intended use clear.

Naming Consistency5/5

All nine tools follow a strict verb_noun snake_case pattern (list_accounts, search_emails, read_email, read_thread, list_labels, modify_labels, trash_email, send_email, create_draft). No camelCase or vague verbs mixed in.

Tool Count5/5

Nine tools is a well-scoped surface for a multi-account Gmail server, covering the core mailbox operations without bloat. Every tool maps to a distinct mailbox workflow.

Completeness4/5

Core lifecycle is well covered: list/search/read/read thread, send, draft, trash, and label management across accounts. Minor gaps remain — no attachment download, no permanent delete (only trash), and no explicit forward or mark-spam/unspam tool, though these can be approximated with existing tools.

Maintenance

ActivityMaintained
ResponsivenessNo issues