gmail-mcp
Allows sending, reading, listing, and replying to emails via the Gmail API.
Click on "Install 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 installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/leadborg/gmail_mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server