# gmail-mcp [Health: Active]

**Category:** 💬 Communication  
**Repository:** https://github.com/mkpoli/gmail-mcp  
**GitHub Stars:** 9  
**Views:** 4  
**Installs:** 0  
**Upvotes:** 0  
**Directory Page:** https://allmcps.com/mcp/gmail-mcp-2

## Description
Multi-account Gmail on a Cloudflare Worker you deploy yourself: read, send, reply, labels, threads

## Claude Desktop Quick Installation
Remote MCP endpoint (confidence: high). Install path detected from listing signals. Add as a URL/SSE server in your client:

```json
"mcpServers": {
  "gmail-mcp": {
    "url": "https://gmail-mcp.mkpo.li/mcp"
  }
}
```

## Documentation

## What gmail-mcp does

gmail-mcp exposes Gmail operations through the Model Context Protocol and runs as a remote Cloudflare Worker. It is designed for deployments where the operator controls the hosting environment and Google OAuth credentials. Multiple Gmail accounts can be connected to one deployment at the same time, with each MCP connection associated with a single Google account.

The server covers mailbox reading and message composition, including search, message and thread retrieval, sending, reply-all with quoted history, forwarding, drafts, labels, trash operations, and attachments. Outgoing messages can contain plain text, an HTML alternative, file attachments, and inline images referenced with `cid:` URLs.

## How it works

A client connects to the Worker over MCP at `/mcp` or at a single-segment path such as `/mcp/work`. The connection then signs in to one Google account through OAuth. This per-connection mailbox binding lets one deployment serve separate personal and work accounts without selecting an account in every tool call.

The Worker stores Google refresh tokens in the deployer's Cloudflare account. It can run on a `workers.dev` hostname or on a custom domain associated with Cloudflare. Clients that do not allow two MCP servers to share one URL can use distinct path segments for separate mailbox connections.

## Setup and configuration

Deployment requires a Cloudflare account, Bun, and a Google account. Create a Google Cloud project, enable the Gmail API, configure an external OAuth consent screen, publish the app, and create a web-application OAuth client. The callback URL follows the Worker host, using the form `https://<your-host>/callback`.

The repository supports deployment through Cloudflare's deploy button or locally with `bun install` followed by `bun run setup`. The setup command asks for the host, creates or reuses the `OAUTH_KV` namespace, accepts the OAuth client credentials, generates a cookie key, and deploys the Worker. A custom domain is optional; without one, Cloudflare provides a `workers.dev` address.

After deployment, add the MCP endpoint to a client. For Claude Code, connections can be registered with the HTTP transport, for example:

```sh
claude mcp add --transport http gmail-personal https://<your-host>/mcp
claude mcp add --transport http gmail-work https://<your-host>/mcp/work
```

In claude.ai, add the same endpoint under Settings, Connectors, and Add custom connector. The Worker also serves a setup guide at its root URL.

## Tools and capabilities

Available operations include:

- Identify the connected account with `whoami`.
- Search, read, and retrieve threads with `search_messages`, `get_message`, and `get_thread`.
- Retrieve files with `get_attachment`.
- Send, reply-all, forward, and manage drafts with `send_message`, `reply_all`, `forward_message`, `create_draft`, `update_draft`, `send_draft`, `delete_draft`, and `list_drafts`.
- Stage larger attachments with `stage_attachment_begin`, `stage_attachment_append`, and `stage_attachment_finish`.
- Create, update, delete, list, and apply labels using the label tools.
- Modify messages or threads in batches and move messages or threads to and from the trash.

Message encoding supports RFC 2047 subjects and display names, RFC 2231 filenames, multipart alternatives, file attachments, and inline images.

## Limitations and notes

The OAuth app should be published rather than left in Google's testing state: testing refresh tokens expire after seven days, while a published app can serve up to 100 accounts and displays an unverified-app warning during sign-in. Gmail mailbox settings such as filters and vacation responders are outside the server's scope. Each connection targets one account, so account separation is determined by the connection URL and OAuth session rather than by a per-call account parameter.

_Full upstream README: https://allmcps.com/mcp/gmail-mcp-2/readme_

