Provides an MCP interface to read unread Gmail messages and create threaded draft replies via the Gmail API.
Configuration
View docs{
"mcpServers": {
"charlesad-gmail-mcp-server-claude": {
"command": "/path/to/gmail-mcp-server/.venv/bin/python",
"args": [
"/path/to/gmail-mcp-server/server.py"
],
"env": {
"GMAIL_CREDENTIALS_PATH": "/path/to/gmail-mcp-server/credentials.json"
}
}
}
}You run an MCP server that reads unread Gmail messages and creates properly threaded draft replies in Gmail. This enables an AI assistant to fetch emails you haven’t read yet, then propose and draft in-context responses you can review and send from Gmail.
Use a client that supports MCP over stdio to connect to this Gmail MCP Server. You will fetch unread emails, inspect them, and then create draft replies that stay in Gmail for you to review and send.
Typical workflows you can perform:
To create a draft reply, fetch an unread email to obtain its threadId, then call create_draft_reply with that threadId and your reply body. The server will return the draftId and thread details. Open Gmail Drafts to review the draft in the correct thread.
Prerequisites you need before installation: Python 3.10+,Claude Desktop installed, and a Google account with Gmail access.
git clone <path-to-repo> gmail-mcp-server
cd Gmail-mCP-server
python3 -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\Activate.ps1
pip install -r requirements.txtCreate a Google Cloud project and enable Gmail API. Then create OAuth credentials for a Desktop app and download credentials.json. Save it at the project root as credentials.json.
# Place credentials.json into the project root
# The following only verifies Gmail setup once you have credentials
source .venv/bin/activate
python debug_gmail.pyConfigure Claude Desktop to launch the MCP server. Update claude_desktop_config.json with the following entry, replacing paths with your actual project paths.
{
"mcpServers": {
"gmail_mcp": {
"command": "/path/to/venv/bin/python",
"args": [
"/path/to/gmail-mcp-server/server.py"
],
"env": {
"GMAIL_CREDENTIALS_PATH": "/path/to/gmail-mcp-server/credentials.json"
}
}
}
}After editing, quit and restart Claude Desktop so it picks up the new MCP server configuration.
This server runs locally and stores credentials and tokens on your machine. It is intended for personal use and learning.
Environment variables shown in the configuration example must be kept secure and not shared.
If you encounter authentication prompts, ensure credentials.json is valid and the Gmail API is enabled for your Google Cloud project.
If drafts do not appear in Gmail, verify the threadId is correct and that the draft was created in the intended Gmail thread.
Fetch unread emails from your Gmail inbox and return a structured JSON with message metadata including id, threadId, from, subject, snippet, and internalDate.
Create a draft reply in a specified Gmail thread, properly threaded with In-Reply-To and References headers, and leave the draft in Gmail Drafts for review.