gmail-mcp
Provides tools for interacting with Gmail: listing labels and inbox messages, searching and reading emails, creating new and reply drafts, sending reviewed drafts, managing message labels, and moving or permanently deleting messages.
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-mcp show me my unread inbox emails"
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
MCP server for Gmail operations.
Tools
Tool | Description |
| List system and user Gmail labels |
| List messages from a label (optionally unread only) |
| Search emails with Gmail query syntax |
| Read a full email by message ID |
| Compose a new email draft |
| Compose a reply draft for a message/thread |
| Send an existing draft after review with its confirmation token |
| Add or remove labels on a message |
| Add or remove labels on multiple messages |
| Move message to trash or permanently delete |
Related MCP server: Moist
Setup
Prerequisites
Python 3.10+
Gmail account with API access
OAuth desktop client credentials from Google Cloud Console
Installation
git clone https://github.com/<your-user>/gmail-mcp.git
cd gmail-mcp
"$(uv python find --system --managed-python 3.13.15)" -m venv --copies venv
venv/bin/python -m pip install -e .Authentication
Save OAuth credentials outside the repository at
~/.config/gmail-mcp/gmail_credentials.jsonand restrict the file to your user:
mkdir -p ~/.config/gmail-mcp
chmod 700 ~/.config/gmail-mcp
chmod 600 ~/.config/gmail-mcp/gmail_credentials.jsonRun initial authentication once:
venv/bin/python -c "from src import gmail_client; gmail_client.authenticate()"Complete browser consent. The token cache is written to
~/.config/gmail-mcp/gmail_token.picklewith mode0600.
Set GMAIL_CONFIG_DIR to relocate both defaults, or use
GMAIL_CREDENTIALS_FILE and GMAIL_TOKEN_FILE for per-process overrides.
Claude Code Configuration
Add to ~/.claude.json:
{
"mcpServers": {
"gmail-mcp": {
"type": "stdio",
"command": "/path/to/gmail-mcp/venv/bin/python",
"args": ["/path/to/gmail-mcp/run_server.py"]
}
}
}Development
venv/bin/python -c "from src.server import mcp; print([t.name for t in mcp._tool_manager._tools.values()])"
venv/bin/python run_server.pyLicense
MIT
Available Tools
15 toolsgmail_create_draftA
Compose a new email draft without sending it.
Discovery: run gmail_list_inbox first to obtain to values.
Args: to: Recipient email address(es), comma-separated for multiple subject: Email subject line body: Email body text (plain text) cc: CC recipients, comma-separated (optional) bcc: BCC recipients, comma-separated (optional)
Use this for: starting a new email conversation safely as a draft.
NOT for: sending an already-created draft -> see gmail_send_draft.
NOT for: replying in an existing thread with a message ID -> see gmail_create_reply_draft.
NOT for: finding messages or message IDs before acting → see gmail_search_emails.
NOT for: reading existing email content without sending → see gmail_read_email.
Inputs: to (required), body (required), subject (required), cc, +1 more. Returns: result
gmail_create_filterA
Create an idempotent Gmail filter from criteria and label actions.
Label names in add_labels and remove_labels are comma-separated. Missing add labels are created after validation; remove labels must already exist.
Sibling tools: use gmail_create_label to configure label visibility first, gmail_list_filters to inspect definitions, and gmail_delete_filter to remove one.
Inputs: star, query, subject, mark_read, +10 more.
gmail_create_labelA
Idempotently create a Gmail label, including nested names such as Parent/Child.
Visibility is applied only when a new label is created. Allowed message_list_visibility values are show and hide; allowed label_list_visibility values are labelShow, labelShowIfUnread, and labelHide.
Discovery: use gmail_list_labels to inspect names before supplying required name.
Sibling tools: use gmail_create_filter to apply the label automatically, or gmail_list_labels to inspect existing labels.
Inputs: name (required), label_list_visibility, message_list_visibility.
gmail_create_reply_draftA
Create a draft reply in an existing email thread without sending it.
Discovery: run gmail_list_inbox first to obtain message_id values.
Args: message_id: The ID of the message to reply to body: Reply body text (plain text) reply_all: If True, reply to all recipients (default: False, reply only to sender)
Use this for: safely composing a reply draft within an existing Gmail thread.
NOT for: sending an already-created draft -> see gmail_send_draft.
NOT for: composing a new standalone email with explicit recipients and subject -> see gmail_create_draft.
NOT for: finding candidate messages or message IDs → see gmail_search_emails.
NOT for: reading message content without replying → see gmail_read_email.
Inputs: body (required), message_id (required), reply_all. Returns: result
gmail_delete_emailA
Delete an email (move to trash or permanently delete).
Args: message_id: The ID of the message to delete permanent: If True, permanently delete (cannot be undone). If False, move to trash (default)
Discovery: use gmail_list_inbox, gmail_search_email, or gmail_read_email first to verify the message_id before deleting.
Sibling tool: gmail_delete_filter deletes a filter definition, not a message.
Inputs: message_id (required), permanent. Returns: result
gmail_delete_filterA
Preview or delete a Gmail filter while preserving its raw restore recipe.
Discovery: use gmail_list_filters to find and verify the required filter_id.
The restore recipe must be mapped to gmail_create_filter arguments; raw keys such as from and addLabelIds are not accepted directly. Sibling destructive tool gmail_delete_email deletes messages, not filter definitions.
Inputs: filter_id (required), dry_run.
gmail_list_filtersA
List Gmail filters and annotate their action label IDs with label names.
Sibling tools: use gmail_create_filter to add a definition and gmail_delete_filter to preview or delete a discovered filter. Use gmail_list_labels for label names and gmail_list_inbox for matching messages.
Inputs: no named parameters.
gmail_list_inboxA
List recent messages from inbox or a specific label.
Args: max_results: Maximum number of messages to return (default: 20) label: Label/folder to list from (default: INBOX). Examples: "INBOX", "SENT", "STARRED", or custom labels unread_only: If True, only show unread messages
Discovery: use gmail_list_labels to find valid label names before passing a custom label.
Sibling tools: use gmail_read_email with a returned message_id to inspect a message, or gmail_search_email when label browsing is too broad.
Inputs: label, max_results, unread_only. Returns: result
gmail_list_labelsA
List all Gmail labels (folders) in the mailbox. Returns both system labels (INBOX, SENT, etc.) and user-created labels.
Sibling tools: use gmail_list_inbox to list messages from a discovered label, and gmail_manage_labels/gmail_manage_labels_bulk to change labels.
Inputs: no named parameters. Returns: result
gmail_manage_labelsA
Add or remove labels from an email.
Args: message_id: The ID of the message to modify add_labels: Comma-separated labels to add (e.g., "STARRED,IMPORTANT" or "Work,Urgent") remove_labels: Comma-separated labels to remove (e.g., "INBOX,UNREAD")
Common labels: - STARRED: Star the message - IMPORTANT: Mark as important - UNREAD: Mark as unread (remove to mark as read) - INBOX: In inbox (remove to archive) - TRASH: In trash - SPAM: In spam
Discovery: use gmail_list_inbox or gmail_search_email first to find the message_id, and gmail_list_labels to verify custom label names.
Sibling tools: use gmail_manage_labels_bulk for multiple messages.
Inputs: message_id (required), add_labels, remove_labels. Returns: result
gmail_manage_labels_bulkA
Add or remove labels on multiple emails with per-message results.
Each item accepts message_id, add_labels, and remove_labels using the same label syntax as gmail_manage_labels. Successful items include their own restore_token for gmail_restore_email.
Inputs: items (required).
gmail_read_emailA
Read the full content of an email by its message ID.
Args: message_id: The ID of the message to read (from list or search results)
Discovery: use gmail_list_inbox or gmail_search_email first and pass the returned message_id.
Inputs: message_id (required). Returns: result
gmail_restore_emailA
Undo gmail_delete_email trash moves or gmail_manage_labels changes.
Args: restore_token: Token returned by gmail_delete_email or gmail_manage_labels
Inputs: restore_token (required).
gmail_search_emailsA
Search emails using Gmail query syntax.
Args: query: Gmail search query. Examples: - "from:someone@example.com" - "subject:meeting" - "is:unread" - "has:attachment" - "after:2024/01/01" - "label:work" - "in:sent" - Combine: "from:boss@company.com is:unread after:2024/01/01" max_results: Maximum number of results to return (default: 20)
Inputs: query (required), max_results. Returns: result
gmail_send_draftA
Send an existing Gmail draft by draft ID.
Discovery: create or identify a draft first with gmail_create_draft or gmail_create_reply_draft;
those tools return the required confirm_token.
Args:
draft_id: Gmail draft ID to send
confirm_token: Confirmation token returned by gmail_create_draft or gmail_create_reply_draft
Use this for: the final irreversible send step after draft review.
NOT for: composing new message content -> see gmail_create_draft.
NOT for: composing a reply draft -> see gmail_create_reply_draft.
Inputs: draft_id (required), confirm_token. Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 15 tools
Most tools have crisply distinct scopes, and the descriptions explicitly cross-reference siblings and call out anti-patterns (e.g. create_draft vs create_reply_draft vs send_draft). The only real overlap is between gmail_list_inbox (browse a label) and gmail_search_emails (query), which both return message lists, though the docs steer agents toward the right one. Manage_labels vs manage_labels_bulk and delete_email vs delete_filter are clearly delineated.
All names use snake_case with a consistent gmail_ prefix and verb_noun structure (list/create/read/delete/manage). Minor deviations only: gmail_list_inbox names a mailbox section rather than a resource, and pluralization is inconsistent (read_email vs search_emails, list_labels). Nothing that impedes comprehension.
15 tools sits at the top of the well-scoped range and each one maps to a concrete operation (message browse/read/search/delete/restore, label apply, label/filter CRUD, draft compose/send). No redundant or filler tools; bulk label management is justified separately from single-message management.
Message lifecycle (list, search, read, label, delete, restore) and filter lifecycle (list, create, delete) are fully covered, with a safe draft-then-send flow. Gaps remain in label lifecycle (no delete or rename label despite gmail_create_label) and draft lifecycle (no list/update/delete draft). These are workable around but are notable absences.
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…
Permissioned access to Gmail, Drive and Calendar via the user's own Google account
Gmail for agents: create inboxes, read and reply to mail, send email, manage domains. OAuth sign-in.
Related MCP Servers
- AlicenseBqualityDmaintenanceEnables comprehensive Gmail management including sending, reading, and organizing emails, managing labels, drafts, threads, and configuring account settings through the Gmail API with secure OAuth2 authentication.64MIT
- AlicenseNot gradedqualityDmaintenanceEnables Gmail operations such as reading, sending, searching, and managing emails, threads, labels, and drafts via MCP tools.1MIT
- FlicenseNot gradedqualityDmaintenanceEnables searching contacts, drafting, and sending emails via the Gmail API with explicit user approval required before sending.-
- AlicenseAqualityBmaintenanceEnables AI assistants to search, read, draft, and send Gmail messages, as well as manage labels and trash using natural language.24127 npmMIT