# Gmail MCP
**English** | [Русский](./README.ru.md)
[](https://www.npmjs.com/package/mcp-google-gmail)
[](https://glama.ai/mcp/servers/A1-x-Tech/mcp-google-gmail)
[](https://github.com/A1-x-Tech/mcp-google-gmail/actions/workflows/ci.yml)
[](./LICENSE)
**A1 Gmail MCP** lets an AI app work with your Gmail mailbox in plain language. Search and read mail, prepare replies as drafts, send them when you are ready, keep labels tidy and use the trash instead of permanent deletion.
It uses the Gmail API with your Google account. It distinguishes a draft you can still edit from a sent email that cannot be recalled, and makes the limits of the Gmail API explicit instead of implying that every mail task is reversible.
- **18 tools.** Search and read messages and threads, send email directly or through drafts, manage the draft lifecycle, labels and the trash.
- **Send deliberately.** The draft → review → send path is first-class; sending is marked destructive, and the server never re-sends after an ambiguous failure — an email cannot be unsent.
- **The trash is the safety net.** Removing mail goes through the reversible trash (about 30 days); there is deliberately no permanent message delete tool.
- **Bounded reading.** Decoded bodies are truncated at an explicit limit and attachments come back as metadata, so a long newsletter cannot silently flood the conversation.
- **Minimal Google scope.** It uses `gmail.modify` only — no permanent deletion and no access to Gmail settings.
Start with a read-only question:
> Show my unread emails from the last week and tell me which ones need a reply.
[Connect the server](#quick-start) · [Explore use cases](#what-you-can-ask-it-to-do) · [Open technical documentation](#technical-documentation)
---
## See it work in a minute
> **You:** What is unread in my inbox from this week about the Acme contract?
>
> **Assistant:** Searches with Gmail query syntax and shows senders, subjects, dates and snippets. Nothing changes.
>
> **You:** Draft a reply to the latest one: we send the signed copy on Friday.
>
> **Assistant:** Creates a draft in the same thread and shows it for review. Nothing is sent.
>
> **You:** Send it.
>
> **Assistant:** Sends the draft. Sending is a separate, explicitly destructive step, so your AI app can ask for confirmation first.
## Contents
- [Quick start](#quick-start)
- [What you can ask it to do](#what-you-can-ask-it-to-do)
- [How mail changes](#how-mail-changes)
- [What can change](#what-can-change)
- [Getting access](#getting-access)
- [Configuration](#configuration)
- [Data, limits and background work](#data-limits-and-background-work)
- [Technical documentation](#technical-documentation)
- [Support](#support)
## Quick start
You need Node.js 20+, a Google account and OAuth credentials from a Google Cloud project with the Gmail API enabled.
1. [Prepare Google OAuth access](#getting-access).
2. Add the server to your AI app.
3. Ask the read-only question above.
Codex
**In the app:** open **Settings → MCP servers**, select **Add server**, choose **STDIO**, enter the command `npx -y mcp-google-gmail@latest` and environment variables `GOOGLE_GMAIL_CLIENT_ID`, `GOOGLE_GMAIL_CLIENT_SECRET`, `GOOGLE_GMAIL_REFRESH_TOKEN`, then select **Save** and **Restart**.
**From the command line:**
```bash
codex mcp add google-gmail \
--env GOOGLE_GMAIL_CLIENT_ID=your_client_id \
--env GOOGLE_GMAIL_CLIENT_SECRET=your_client_secret \
--env GOOGLE_GMAIL_REFRESH_TOKEN=your_refresh_token \
-- npx -y mcp-google-gmail@latest
```
```bash
codex mcp list
```
[Codex MCP documentation](https://learn.chatgpt.com/docs/extend/mcp?surface=cli)
Claude Code
```bash
claude mcp add \
--env GOOGLE_GMAIL_CLIENT_ID=your_client_id \
--env GOOGLE_GMAIL_CLIENT_SECRET=your_client_secret \
--env GOOGLE_GMAIL_REFRESH_TOKEN=your_refresh_token \
--transport stdio --scope user google-gmail \
-- npx -y mcp-google-gmail@latest
```
```bash
claude mcp list
```
[Claude Code MCP documentation](https://code.claude.com/docs/en/mcp)
Claude Desktop
The current official path is **Settings → Extensions**. For a custom desktop extension, open **Advanced settings → Extension Developer → Install Extension…**, select a `.mcpb` file and follow the prompts.
This repository currently publishes an npm stdio package and does not contain a `.mcpb` bundle. For Claude Desktop builds that still support local configuration, use the following JSON stdio configuration as a fallback:
```json
{
"mcpServers": {
"google-gmail": {
"command": "npx",
"args": ["-y", "mcp-google-gmail@latest"],
"env": {
"GOOGLE_GMAIL_CLIENT_ID": "your_client_id",
"GOOGLE_GMAIL_CLIENT_SECRET": "your_client_secret",
"GOOGLE_GMAIL_REFRESH_TOKEN": "your_refresh_token"
}
}
}
}
```
In those builds, save it to `~/Library/Application Support/Claude/claude_desktop_config.json` on macOS or `%APPDATA%\Claude\claude_desktop_config.json` on Windows.
[Claude Desktop MCP documentation](https://support.claude.com/en/articles/10949351-getting-started-with-local-mcp-servers-on-claude-desktop)
Cursor
Add this to `~/.cursor/mcp.json` on macOS/Linux or `%USERPROFILE%\.cursor\mcp.json` on Windows:
```json
{
"mcpServers": {
"google-gmail": {
"type": "stdio",
"command": "npx",
"args": ["-y", "mcp-google-gmail@latest"],
"env": {
"GOOGLE_GMAIL_CLIENT_ID": "your_client_id",
"GOOGLE_GMAIL_CLIENT_SECRET": "your_client_secret",
"GOOGLE_GMAIL_REFRESH_TOKEN": "your_refresh_token"
}
}
}
}
```
[Cursor MCP documentation](https://cursor.com/docs/mcp)
VS Code
Run **MCP: Open User Configuration** and add:
```json
{
"servers": {
"google-gmail": {
"type": "stdio",
"command": "npx",
"args": ["-y", "mcp-google-gmail@latest"],
"env": {
"GOOGLE_GMAIL_CLIENT_ID": "${input:gmail_client_id}",
"GOOGLE_GMAIL_CLIENT_SECRET": "${input:gmail_client_secret}",
"GOOGLE_GMAIL_REFRESH_TOKEN": "${input:gmail_refresh_token}"
}
}
},
"inputs": [
{ "type": "promptString", "id": "gmail_client_id", "description": "Google OAuth client ID" },
{ "type": "promptString", "id": "gmail_client_secret", "description": "Google OAuth client secret", "password": true },
{ "type": "promptString", "id": "gmail_refresh_token", "description": "Google OAuth refresh token", "password": true }
]
}
```
Check it with **MCP: List Servers**.
[VS Code MCP documentation](https://code.visualstudio.com/docs/agent-customization/mcp-servers)
You made it to the end!