Gmail MCP Server
Provides comprehensive Gmail API integration for email management, including sending and retrieving messages, managing threads and labels, handling drafts, configuring settings (vacation responder, IMAP/POP, filters, delegates), and tracking mailbox changes.
Uses Google Cloud Console for OAuth2 authentication setup, enabling secure access to Gmail API through Google Cloud credentials.
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 Server send an email to john@example.com about the meeting tomorrow"
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.
A Model Context Protocol (MCP) server implementation for the Gmail API, providing a standardized interface for email management, sending, and retrieval.
Features
Complete Gmail API coverage including messages, threads, labels, drafts, and settings
Support for sending, drafting, and managing emails
Label management with customizable colors and visibility settings
Thread operations for conversation management
Settings management including vacation responder, IMAP/POP, and language settings
History tracking for mailbox changes
Secure OAuth2 authentication using Google Cloud credentials
Related MCP server: Gmail MCP Server
Prerequisites
Dependencies
For simplest installation, install Node.js 18+. If you would like to build locally, you will also need to install pnpm.
Google Workspace Setup
To run this MCP server, you will need to set up a Google API Client for your organization, with each user running a script to retrieve their own OAuth refresh token.
Google API Client Setup (once per organization)
Go to the Google Cloud Console.
Create a new project or select an existing one.
Enable the Gmail API for your project.
Go to Credentials and create an OAuth 2.0 Client ID. Choose "Desktop app" for the client type.
Download and save the OAuth keys JSON as
~/.gmail-mcp/gcp-oauth.keys.json. ⚠️ NOTE: to create~/.gmail-mcp/through MacOS's Finder app you need to enable hidden files first.(Optional) For remote server installation (ex. using Smithery CLI), note the
CLIENT_IDandCLIENT_SECRETfrom this file.
Client OAuth (once per user)
Have the user copy
~/.gmail-mcp/gcp-oauth.keys.jsonto their computer at the same path.Run
npx @shinzolabs/gmail-mcp auth.A browser window will open where the user may select a profile, review the requested scopes, and approve.
(Optional) For remote server installation, note the file path mentioned in the success message (
~/.gmail-mcp/credentials.jsonby default). The user'sREFRESH_TOKENwill be found here.
Client Configuration
There are several options to configure your MCP client with the server. For hosted/remote server setup, use Smithery's CLI with a Smithery API Key. For local installation, use npx or build from source. Each of these options is explained below.
Smithery Remote Server (Recommended)
To add a remote server to your MCP client config.json, run the following command from Smithery CLI:
npx -y @smithery/cli install @shinzo-labs/gmail-mcpEnter your CLIENT_ID, CLIENT_SECRET, and REFRESH_TOKEN when prompted.
Smithery SDK
If you are developing your own agent application, you can use the boilerplate code here.
NPX Local Install
To install the server locally with npx, add the following to your MCP client config.json:
{
"mcpServers": {
"gmail": {
"command": "npx",
"args": [
"@shinzolabs/gmail-mcp"
]
}
}
}Build from Source
Download the repo:
git clone https://github.com/shinzo-labs/gmail-mcp.gitInstall packages and build with
pnpm(inside cloned repo):
pnpm i && pnpm buildAdd the following to your MCP client
config.json:
{
"mcpServers": {
"gmail": {
"command": "node",
"args": [
"/path/to/gmail-mcp/dist/index.js"
]
}
}
}Config Variables
Variable | Description | Required? | Default |
| Port for the temporary OAuth authentication server | No |
|
| Google API client ID (found in | Yes if remote server connection |
|
| Google API client secret (found in | Yes if remote server connection |
|
| Path to the user credentials file | No |
|
| Path to the Google API Client file | No |
|
| Directory for storing configuration files | No |
|
| OAuth refresh token (found in | Yes if remote server connection |
|
| Port for Streamable HTTP transport method | No |
|
| Enable telemetry | No |
|
Supported Endpoints
User Management
get_profile: Get the current user's Gmail profilestop_mail_watch: Stop receiving push notificationswatch_mailbox: Set up push notifications for mailbox changes
Message Management
Managing Messages
list_messages: List messages with optional filteringget_message: Get a specific messageget_attachment: Get a message attachmentmodify_message: Modify message labelssend_message: Send an email message to specified recipientsdelete_message: Permanently delete a messagetrash_message: Move message to trashuntrash_message: Remove message from trashbatch_modify_messages: Modify multiple messagesbatch_delete_messages: Delete multiple messages
Label Management
list_labels: List all labelsget_label: Get a specific labelcreate_label: Create a new labelupdate_label: Update a labelpatch_label: Partial update of a labeldelete_label: Delete a label
Thread Management
list_threads: List email threadsget_thread: Get a specific threadmodify_thread: Modify thread labelstrash_thread: Move thread to trashuntrash_thread: Remove thread from trashdelete_thread: Delete a thread
Draft Management
list_drafts: List drafts in the user's mailboxget_draft: Get a specific draft by IDcreate_draft: Create a draft email in Gmailupdate_draft: Replace a draft's contentdelete_draft: Delete a draftsend_draft: Send an existing draft
Settings Management
Auto-Forwarding
get_auto_forwarding: Get auto-forwarding settingsupdate_auto_forwarding: Update auto-forwarding settings
IMAP Settings
get_imap: Get IMAP settingsupdate_imap: Update IMAP settings
POP Settings
get_pop: Get POP settingsupdate_pop: Update POP settings
Vacation Responder
get_vacation: Get vacation responder settingsupdate_vacation: Update vacation responder
Language Settings
get_language: Get language settingsupdate_language: Update language settings
Delegates
list_delegates: List account delegatesget_delegate: Get a specific delegateadd_delegate: Add a delegateremove_delegate: Remove a delegate
Filters
list_filters: List email filtersget_filter: Get a specific filtercreate_filter: Create a new filterdelete_filter: Delete a filter
Forwarding Addresses
list_forwarding_addresses: List forwarding addressesget_forwarding_address: Get a specific forwarding addresscreate_forwarding_address: Create a forwarding addressdelete_forwarding_address: Delete a forwarding address
Send-As Settings
list_send_as: List send-as aliasesget_send_as: Get a specific send-as aliascreate_send_as: Create a send-as aliasupdate_send_as: Update a send-as aliaspatch_send_as: Partial update of a send-as aliasverify_send_as: Send verification emaildelete_send_as: Delete a send-as alias
S/MIME Settings
list_smime_info: List S/MIME configurationsget_smime_info: Get a specific S/MIME configinsert_smime_info: Upload a new S/MIME configset_default_smime_info: Set default S/MIME configdelete_smime_info: Delete an S/MIME config
Contributing
Contributions are welcomed and encouraged! Please read CONTRIBUTING.md for guidelines on issues, contributions, and contact information.
Data Collection and Privacy
Shinzo Labs collects limited anonymous telemetry from this server to help improve our products and services. No personally identifiable information is collected as part of this process. Please review the Privacy Policy for more details on the types of data collected and how to opt-out of this telemetry.
License
MIT
Available Tools
64 toolsadd_delegateCInspect
Adds a delegate to the specified account
Inputs: delegateEmail (required).
batch_delete_messagesBInspect
Delete multiple messages
Inputs: ids (required).
batch_modify_messagesBInspect
Modify the labels on multiple messages
Inputs: ids (required), addLabelIds, removeLabelIds.
create_draftBInspect
Create a draft email in Gmail. Note the mechanics of the raw parameter.
Inputs: raw, threadId, to, cc, +4 more.
create_filterDInspect
Creates a filter
Inputs: criteria (required), action (required).
create_forwarding_addressBInspect
Creates a forwarding address
Inputs: forwardingEmail (required).
create_labelCInspect
Create a new label
Inputs: name (required), messageListVisibility, labelListVisibility, color.
create_send_asBInspect
Creates a custom send-as alias
Inputs: sendAsEmail (required), displayName, replyToAddress, signature, +2 more.
delete_draftCInspect
Delete a draft
Inputs: id (required).
delete_filterBInspect
Deletes a filter
Inputs: id (required).
delete_forwarding_addressBInspect
Deletes the specified forwarding address
Inputs: forwardingEmail (required).
delete_labelCInspect
Delete a label
Inputs: id (required).
delete_messageAInspect
Immediately and permanently delete a message
Inputs: id (required).
delete_send_asBInspect
Deletes the specified send-as alias
Inputs: sendAsEmail (required).
delete_smime_infoBInspect
Deletes the specified S/MIME config for the specified send-as alias
Inputs: sendAsEmail (required), id (required).
delete_threadBInspect
Delete a thread
Inputs: id (required).
get_attachmentCInspect
Get a message attachment
Inputs: messageId (required), id (required).
get_auto_forwardingAInspect
Gets auto-forwarding settings
Inputs: no named parameters.
get_delegateAInspect
Gets the specified delegate
Inputs: delegateEmail (required).
get_filterCInspect
Gets a filter
Inputs: id (required).
get_forwarding_addressCInspect
Gets the specified forwarding address
Inputs: forwardingEmail (required).
get_languageBInspect
Gets language settings
Inputs: no named parameters.
get_messageAInspect
Get a specific message by ID with format options
Inputs: id (required), includeBodyHtml.
get_profileAInspect
Get the current user's Gmail profile
Inputs: no named parameters.
get_send_asAInspect
Gets the specified send-as alias
Inputs: sendAsEmail (required).
get_smime_infoBInspect
Gets the specified S/MIME config for the specified send-as alias
Inputs: sendAsEmail (required), id (required).
get_threadBInspect
Get a specific thread by ID
Inputs: id (required), includeBodyHtml.
get_vacationBInspect
Get vacation responder settings
Inputs: no named parameters.
insert_smime_infoBInspect
Insert (upload) the given S/MIME config for the specified send-as alias
Inputs: sendAsEmail (required), encryptedKeyPassword (required), pkcs12 (required).
list_delegatesAInspect
Lists the delegates for the specified account
Inputs: no named parameters.
list_draftsCInspect
List drafts in the user's mailbox
Inputs: maxResults, q, includeSpamTrash, includeBodyHtml.
list_filtersAInspect
Lists the message filters of a Gmail user
Inputs: no named parameters.
list_forwarding_addressesBInspect
Lists the forwarding addresses for the specified account
Inputs: no named parameters.
list_labelsBInspect
List all labels in the user's mailbox
Inputs: no named parameters.
list_messagesCInspect
List messages in the user's mailbox with optional filtering
Inputs: maxResults, pageToken, q, labelIds, +2 more.
list_send_asBInspect
Lists the send-as aliases for the specified account
Inputs: no named parameters.
list_smime_infoBInspect
Lists S/MIME configs for the specified send-as alias
Inputs: sendAsEmail (required).
list_threadsBInspect
List threads in the user's mailbox
Inputs: maxResults, pageToken, q, labelIds, +2 more.
modify_messageBInspect
Modify the labels on a message
Inputs: id (required), addLabelIds, removeLabelIds.
modify_threadBInspect
Modify the labels applied to a thread
Inputs: id (required), addLabelIds, removeLabelIds.
patch_labelBInspect
Patch an existing label (partial update)
Inputs: id (required), name, messageListVisibility, labelListVisibility, +1 more.
patch_send_asCInspect
Patches the specified send-as alias
Inputs: sendAsEmail (required), displayName, replyToAddress, signature, +2 more.
remove_delegateCInspect
Removes the specified delegate
Inputs: delegateEmail (required).
send_draftCInspect
Send an existing draft
Inputs: id (required).
send_messageCInspect
Send an email message to specified recipients. Note the mechanics of the raw parameter.
Inputs: raw, threadId, to, cc, +4 more.
set_default_smime_infoCInspect
Sets the default S/MIME config for the specified send-as alias
Inputs: sendAsEmail (required), id (required).
stop_mail_watchBInspect
Stop receiving push notifications for the given user mailbox
Inputs: no named parameters.
trash_messageAInspect
Move a message to the trash
Inputs: id (required).
trash_threadBInspect
Move a thread to the trash
Inputs: id (required).
untrash_messageBInspect
Remove a message from the trash
Inputs: id (required).
untrash_threadAInspect
Remove a thread from the trash
Inputs: id (required).
update_auto_forwardingCInspect
Updates automatic forwarding settings
Inputs: enabled (required), emailAddress (required), disposition (required).
update_imapCInspect
Updates IMAP settings
Inputs: enabled (required), expungeBehavior, maxFolderSize.
update_labelCInspect
Update an existing label
Inputs: id (required), name, messageListVisibility, labelListVisibility, +1 more.
update_languageCInspect
Updates language settings
Inputs: displayLanguage (required).
update_popCInspect
Updates POP settings
Inputs: accessWindow (required), disposition (required).
update_send_asCInspect
Updates a send-as alias
Inputs: sendAsEmail (required), displayName, replyToAddress, signature, +2 more.
update_vacationCInspect
Update vacation responder settings
Inputs: enableAutoReply (required), responseBodyPlainText (required), responseSubject, restrictToContacts, +3 more.
verify_send_asBInspect
Sends a verification email to the specified send-as alias
Inputs: sendAsEmail (required).
watch_mailboxCInspect
Watch for changes to the user's mailbox
Inputs: topicName (required), labelIds, labelFilterAction.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 64 tools
Every tool has a clearly distinct purpose targeting specific Gmail resources and actions. The tools are well-organized by resource type (messages, threads, labels, delegates, etc.) with no ambiguous overlaps. For example, delete_message vs. trash_message have clear distinctions in permanent vs. temporary deletion.
The tool names follow a perfectly consistent verb_noun pattern throughout (e.g., create_draft, delete_label, get_profile, update_vacation). All tools use snake_case with clear action verbs followed by specific nouns, making the naming highly predictable and readable.
With 64 tools, this is an extremely large set that feels overwhelming for a single server. While Gmail has many features, this count suggests over-fragmentation of operations that could have been grouped more efficiently. The number exceeds typical well-scoped MCP servers (3-15 tools) by a significant margin.
The tool surface provides comprehensive coverage of Gmail's functionality including message/thread management, label operations, delegation, filters, forwarding, send-as aliases, S/MIME configuration, settings management, and mailbox watching. There are no obvious gaps for core Gmail workflows.
Maintenance
Related MCP Connectors
Manage Gmail end-to-end: search, read, send, draft, label, and organize threads. Automate workflow…
Gmail for agents: create inboxes, read and reply to mail, send email, manage domains. OAuth sign-in.
Permissioned access to Gmail, Drive and Calendar via the user's own Google account
Gmail, Outlook, Drive, OneDrive and calendars for AI agents. Many accounts, one endpoint, audit log.
Related MCP Servers
- AlicenseCqualityDmaintenanceEnables comprehensive Gmail management through the Gmail API, including sending/receiving emails, organizing labels and threads, managing drafts, and configuring account settings with secure OAuth2 authentication.641MIT
- AlicenseCqualityDmaintenanceProvides complete Gmail API integration for email management, including sending/receiving messages, managing labels and threads, creating drafts, and configuring settings through OAuth2 authentication.64MIT
- FlicenseNot gradedqualityNot gradedmaintenanceEnables comprehensive Gmail management with 17 tools for searching, sending, and organizing emails, managing labels, threads, drafts, and attachments through the Gmail API.-
- 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.-