# gmail-agent MCP server

> Enables AI agents to search, read, manage drafts, and handle email attachments directly through the Gmail API.

- Repository: https://github.com/dremok/gmail-agent
- Page: https://hostedmcp.org/servers/dremok/gmail-agent
- Transport: stdio
- Stars: 1
- License: MIT
- Latest version: 0.3.1

## Install

### Claude Code

```sh
claude mcp add gmail-agent -- uvx gmail-agent
```

### Cursor (`~/.cursor/mcp.json`)

```json
{
  "mcpServers": {
    "gmail-agent": {
      "command": "uvx",
      "args": [
        "gmail-agent"
      ]
    }
  }
}
```

### VS Code (`.vscode/mcp.json`)

```json
{
  "servers": {
    "gmail-agent": {
      "type": "stdio",
      "command": "uvx",
      "args": [
        "gmail-agent"
      ]
    }
  }
}
```

### VS Code CLI

```sh
code --add-mcp '{"name":"gmail-agent","type":"stdio","command":"uvx","args":["gmail-agent"]}'
```

### Claude Desktop (`claude_desktop_config.json`)

```json
{
  "mcpServers": {
    "gmail-agent": {
      "command": "uvx",
      "args": [
        "gmail-agent"
      ]
    }
  }
}
```

### Codex

```sh
codex mcp add gmail-agent -- uvx gmail-agent
```

### Codex config.toml (`~/.codex/config.toml`)

```toml
[mcp_servers.gmail-agent]
command = "uvx"
args = ["gmail-agent"]
```

### Gemini CLI

```sh
gemini mcp add -s user gmail-agent uvx -- gmail-agent
```

### Gemini settings.json (`~/.gemini/settings.json`)

```json
{
  "mcpServers": {
    "gmail-agent": {
      "command": "uvx",
      "args": [
        "gmail-agent"
      ]
    }
  }
}
```

## Environment variables

| Name | Required | Secret | Description |
|---|---|---|---|
| `GMAIL_AGENT_ALLOWED_DIRS` | no | no | Extra folders, besides ~/Downloads, the tools may save attachments to and attach files from (separated by :) |
| `GMAIL_AGENT_CONFIG_DIR` | no | no | Config dir with credentials.json and token (default ~/.config/gmail-agent) |

## FAQ

### Can this server save attachments to my local disk?

Yes, it can download attachments from specific messages or all messages matching a query, and it ensures files are never overwritten by renaming duplicates.

### How does it handle security and privacy?

It uses your own Google Cloud OAuth client to talk directly to the Gmail API from your machine, meaning there is no third-party server involved.

### Can I test write operations before they happen?

Yes, every write command supports a dry-run mode that prints the exact API request and the MIME message without making changes.
