gmail mcp
Manage your emails effortlessly with 60+ tools for drafting, sending, retrieving, and organizing messages. Streamline your email workflow with complete Gmail API coverage, including label and thread management.
Manage your emails effortlessly with 60+ tools for drafting, sending, retrieving, and organizing messages. Streamline your email workflow with complete Gmail API coverage, including label and thread management.
A Model Context Protocol (MCP) implementation for the Gmail API, providing a standardized interface for email management, sending, and retrieval.
⚠️ NOTE: Due to the large number of endpoints available on this server, it is recommended that you install and setup Heimdall to limit the number of endpoints exposed to your client applications.
To use this MCP, you'll need to set up authentication with Gmail:
~/.gmail-mcp/gcp-oauth.keys.json
Add the following to your MCP client config.json
(~/.heimdall/config.json
if using Heimdall):
{
"mcpServers": {
"gmail": {
"command": "npx",
"args": [
"@shinzolabs/gmail-mcp"
]
}
}
}
Download the repo:
git clone https://github.com/shinzo-labs/gmail-mcp.git
Install packages and build (inside cloned repo):
pnpm i && pnpm run build
Add the following to your MCP client config.json
(~/.heimdall/config.json
if using Heimdall):
{
"mcpServers": {
"gmail": {
"command": "node",
"args": [
"/path/to/gmail-mcp/dist/index.js"
]
}
}
}
To install for Claude Desktop automatically via Smithery:
npx -y @smithery/cli install @shinzo-labs/gmail-mcp --client claude
This MCP provides an automated authentication flow:
First, acquire OAuth credentials and download the JSON file.
Rename the JSON file to gcp-oauth.keys.json
and copy it to $HOME/.gmail-mcp/
, or wherever you've set it in MCP_CONFIG_DIR
.
Run the authentication command:
# If using npx
npx @shinzolabs/gmail-mcp auth
# If in the project directory
pnpm i && pnpm run build && pnpm run auth
A browser window will automatically open to the Google OAuth consent screen
$HOME/.gmail-mcp/credentials.json
The MCP will automatically: - Manage token refresh - Save credentials to disk - Handle the OAuth callback - Open the authentication URL in your default browser
Note: by default this server uses port 3000
to listen for the OAuth response. You can set AUTH_SERVER_PORT
to something else if you are running another service on 3000
.
You can customize the config location by setting MCP_CONFIG_DIR
before running the command (optional):
export MCP_CONFIG_DIR=/custom/path/to/directory/
If you wish, you may also provide credentials directly through the environment variables:
export CLIENT_ID=your-id
export CLIENT_SECRET=your-secret
export REFRESH_TOKEN=your-refresh-token
get_profile
: Get the current user's Gmail profilestop_mail_watch
: Stop receiving push notificationswatch_mailbox
: Set up push notifications for mailbox changeslist_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 messageslist_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 labellist_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 threadlist_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 draftget_auto_forwarding
: Get auto-forwarding settingsupdate_auto_forwarding
: Update auto-forwarding settingsget_imap
: Get IMAP settingsupdate_imap
: Update IMAP settingsget_pop
: Get POP settingsupdate_pop
: Update POP settingsget_vacation
: Get vacation responder settingsupdate_vacation
: Update vacation responderget_language
: Get language settingsupdate_language
: Update language settingslist_delegates
: List account delegatesget_delegate
: Get a specific delegateadd_delegate
: Add a delegateremove_delegate
: Remove a delegatelist_filters
: List email filtersget_filter
: Get a specific filtercreate_filter
: Create a new filterdelete_filter
: Delete a filterlist_forwarding_addresses
: List forwarding addressesget_forwarding_address
: Get a specific forwarding addresscreate_forwarding_address
: Create a forwarding addressdelete_forwarding_address
: Delete a forwarding addresslist_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 aliaslist_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 configContributions are welcomed and encouraged. Contact [email protected] with any questions, comments or concerns.