Send, search, and manage Gmail — directly from your AI workflows.
A Model Context Protocol (MCP) server that exposes Gmail's API for reading, sending, organizing, and managing email messages, threads, labels, and drafts.
Overview
The Gmail MCP Server provides full programmatic access to Gmail through a stateless, multi-tenant interface:
Send, reply to, and draft emails with optional attachments
Search and retrieve messages and threads using Gmail's native query syntax
Organize your inbox with label management and read/unread state control
Perfect for:
Automating email workflows and notifications from AI agents
Building assistants that can read, respond to, and triage email
Integrating Gmail actions into LLM-powered pipelines
Tools
Returns the authenticated user's Gmail profile including email address and mailbox statistics.
Moves a message to the trash folder. The message can be recovered until the trash is emptied.
Inputs:
- `message_id` (string, required) — Gmail message ID
output:
{ "message": "Message moved to trash successfully", "id": "18b1c2d3e4f5"}
Restores a message from the trash back to the inbox.
Inputs:
- `message_id` (string, required) — Gmail message ID
output:
{ "message": "Message removed from trash successfully", "id": "18b1c2d3e4f5"}
Applies or removes one or more labels from a message in a single operation.
Inputs:
- `message_id` (string, required) — Gmail message ID- `add_labels` (list of strings, optional) — Label IDs to add to the message- `remove_labels` (list of strings, optional) — Label IDs to remove from the message
Searches messages using Gmail's native query syntax and returns matching message stubs.
Inputs:
- `query` (string, required) — Gmail search query e.g. `from:example@gmail.com`, `is:unread`, `subject:invoice`- `max_results` (integer, optional) — Maximum number of results to return, capped at 500. Default: `10`
{ "message": "Draft created successfully", "id": "r123456"}
API Parameters Reference
message_id — Unique Gmail message identifier. Obtain from search_messages, list_drafts, or any message response.
thread_id — Unique Gmail thread identifier. Present in every message object as threadId.
label_id — Label identifier. Obtain from list_labels. System labels use names like INBOX, SENT, TRASH, UNREAD, .
Message format values:
full — Full message payload with body decoded (default)minimal — Only message IDs and labels, no payloadraw — Full message as RFC 2822 base64url-encoded stringmetadata — Headers only, no body
gmail Search Query Syntax:
from:user@example.com — Messages from a senderto:user@example.com — Messages to a recipientsubject:invoice — Messages with word in subjectis:unread — Unread messagesis:starred — Starred messages
Troubleshooting
Cause: API key not provided in request headers or incorrect format
Solution:
Verify Authorization: Bearer YOUR_API_KEY and X-Mewcp-Credential-Id: CREDENTIAL-ID headers are present
Check API key is active in your MewCP account
Cause: API calls have exceeded your request limits
Solution:
Check credit usage in your Curious Layer dashboard
Upgrade to a paid plan or add credits for higher limits
Contact support for credit adjustments
Cause: No Gmail credential linked to your account
Solution:
Go to Credentials in your MewCP dashboard
Connect your Google account via OAuth
Retry the request with the correct X-Mewcp-Credential-Id header
Cause: JSON payload is invalid or missing required fields