gmail-mcp
Allows sending, reading, listing, and replying to emails via the Gmail API.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@gmail-mcplist my unread emails from today"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
gmail-mcp
A Model Context Protocol (MCP) server that exposes Gmail actions as tools, allowing AI assistants like Claude to send, read, list, and reply to emails on your behalf.
Tools
Tool | Description |
| Send an email to a recipient |
| List emails matching a Gmail search query |
| Read a specific email by message ID |
| Fetch recent emails from a specific sender |
| Reply to an email, preserving thread headers |
| Forward recent Gmail replies to a signed LeadBorg email webhook |
Related MCP server: gmail-mcp
Requirements
Python 3.13+
A Google Cloud project with the Gmail API enabled
OAuth 2.0 credentials (
google_creds.json)
Setup
1. Get Google OAuth credentials
Go to the Google Cloud Console.
Create a project (or select an existing one).
Enable the Gmail API.
Under APIs & Services > Credentials, create an OAuth 2.0 Client ID (Application type: Desktop app).
Download the JSON file and save it as
google_creds.jsonin the project root.
2. Install dependencies
# Using uv (recommended)
uv sync
# Or pip
pip install -e .3. Authenticate
Run the server once manually to trigger the OAuth browser flow:
python gmail_mcp.pyThis creates a token.json file at ~/.config/gmail-mcp/token.json. Subsequent runs reuse and auto-refresh this token.
Running the server
The transport is controlled by the MCP_TRANSPORT environment variable (default: stdio).
stdio (default — for Claude Desktop / MCP clients)
python gmail_mcp.pyStreamable HTTP
MCP_TRANSPORT=streamable-http MCP_PORT=8001 python gmail_mcp.py
# or alias:
MCP_TRANSPORT=http python gmail_mcp.pySSE
MCP_TRANSPORT=sse python gmail_mcp.pyEnvironment variables
Variable | Default | Description |
|
| Transport mode: |
|
| Host for HTTP/SSE transports |
|
| Port for HTTP/SSE transports |
|
| Path to OAuth client credentials file |
|
| Path to cached OAuth token file |
Claude Desktop configuration
Add the following to your claude_desktop_config.json:
{
"mcpServers": {
"gmail": {
"command": "python",
"args": ["/absolute/path/to/gmail_mcp.py"]
}
}
}Running tests
python -m pytest tests/
# or
python -m unittest discover tests/Project structure
gmail-mcp/
├── gmail_mcp.py # MCP server and tool definitions
├── main.py # Alternate entry point (HTTP transport)
├── pyproject.toml
└── tests/
└── test_gmail_mcp.py
~/.config/gmail-mcp/
├── google_creds.json # OAuth client credentials (not committed)
└── token.json # Cached OAuth token (generated at runtime)Permissions
The server requests two OAuth scopes:
https://www.googleapis.com/auth/gmail.readonly— read access to emailshttps://www.googleapis.com/auth/gmail.send— permission to send email
This does not grant access to delete messages permanently.
LeadBorg integration notes
When using this server from LeadBorg, configure the email MCP endpoint as:
http://localhost:8001/mcp/Set the provider to gmail-mcp. LeadBorg will pass a signed reply_to alias to
send_email; Gmail-MCP writes it as the Reply-To header so inbound replies can
be correlated back to the lead.
For local reply ingestion, run the forward_recent_replies_to_webhook tool with
the LeadBorg webhook URL (/api/webhooks/email/mcp) and the same signing secret
configured as EMAIL_WEBHOOK_SIGNING_SECRET.
This server cannot be deployed
Maintenance
Related MCP Connectors
Manage Gmail end-to-end: search, read, send, draft, label, and organize threads. Automate workflow…
Manage Gmail messages, threads, labels, drafts, and settings from your workflows. Send and organiz…
Email infrastructure for AI agents — send, receive, search, and reply to email over MCP.
Email inboxes and calendars for AI agents: send, receive, search, draft and schedule.
Related MCP Servers
- AlicenseNot gradedqualityNot gradedmaintenanceEnables AI assistants to interact with Gmail through natural language, supporting email sending/reading, searching, draft management, label organization, and batch operations with secure OAuth authentication.-
- AlicenseNot gradedqualityCmaintenanceEnables AI assistants to manage Gmail emails, including sending, searching, and organizing with labels and attachments via OAuth2.54 npm1MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to manage Gmail through natural language interactions, including sending, reading, searching emails, and managing labels with auto authentication support.13,749 npm1MIT
- AlicenseNot gradedqualityCmaintenanceEnables AI assistants to manage Gmail accounts programmatically, including sending emails, managing labels, creating filters, and handling attachments via OAuth2 authentication.54 npm4MIT