Skip to main content

MCP server for Gmail — read, triage, draft, and send across multiple accounts

Project description

PyPI License: MIT Python 3.10+

gmail-mcp

MCP server for Gmail, built on gmail-sdk. Gives Claude Code (or any MCP client) full access to read, send, triage, draft, and manage email across multiple Gmail accounts through a single server instance.

Install

pip install gmail-mcp-ldraney

Run

gmail-mcp-ldraney
# or
python -m gmail_mcp

Claude Code config

Add to your .mcp.json:

{
  "mcpServers": {
    "gmail": {
      "command": "uvx",
      "args": ["gmail-mcp-ldraney"],
      "env": {
        "SECRETS_DIR": "~/secrets/google-oauth"
      }
    }
  }
}

Or register via CLI:

claude mcp add gmail -- uvx gmail-mcp-ldraney

Prerequisites

Google OAuth credentials must be set up at ~/secrets/google-oauth/ (or the path in SECRETS_DIR):

  • credentials.json -- OAuth client credentials (Desktop type)
  • gmail-{alias}.json -- per-account token files (created automatically on first auth)

On first use the server opens your browser for Google sign-in. After that, tokens refresh automatically.

See the Gmail API Setup Guide for full details including scopes, multi-account configuration, and security.

Multi-account support

A single server instance handles multiple Gmail accounts. Every tool accepts an optional account parameter (alias or full email). If only one account is configured, it is selected automatically.

Token files are stored per-account: gmail-draneylucas.json, gmail-lucastoddraney.json, etc.

Available tools

Messages

  • gmail_get_profile -- Get authenticated user's Gmail profile
  • gmail_messages_list -- List messages matching a search query
  • gmail_message_get -- Get a single message by ID
  • gmail_message_send -- Send a new email
  • gmail_message_reply -- Reply to a message (preserves thread)
  • gmail_message_reply_all -- Reply-all to a message
  • gmail_message_forward -- Forward a message
  • gmail_message_modify -- Add/remove labels on a message
  • gmail_message_archive -- Archive a message (remove INBOX label)
  • gmail_mark_as_read -- Mark a message as read
  • gmail_mark_as_unread -- Mark a message as unread
  • gmail_message_trash -- Move a message to trash
  • gmail_message_untrash -- Remove a message from trash
  • gmail_message_delete -- Permanently delete a message
  • gmail_messages_batch_modify -- Batch modify labels on multiple messages
  • gmail_messages_batch_delete -- Permanently delete multiple messages

Threads

  • gmail_threads_list -- List threads matching a search query
  • gmail_thread_get -- Get a thread with all its messages
  • gmail_thread_modify -- Modify labels on all messages in a thread
  • gmail_thread_trash -- Move a thread to trash
  • gmail_thread_untrash -- Remove a thread from trash
  • gmail_thread_delete -- Permanently delete a thread

Drafts

  • gmail_drafts_list -- List drafts
  • gmail_draft_get -- Get a single draft by ID
  • gmail_draft_create -- Create a new draft
  • gmail_draft_update -- Update an existing draft
  • gmail_draft_send -- Send a draft
  • gmail_draft_delete -- Delete a draft

Labels

  • gmail_labels_list -- List all labels (system and user-created)
  • gmail_label_get -- Get label details with message/thread counts
  • gmail_label_create -- Create a new label
  • gmail_label_update -- Update a label's name or visibility
  • gmail_label_delete -- Delete a user label

Attachments

  • gmail_attachment_get -- Get attachment data from a message

Filters

  • gmail_filters_list -- List all filters
  • gmail_filter_get -- Get a single filter by ID
  • gmail_filter_create -- Create a new filter with criteria and actions
  • gmail_filter_delete -- Delete a filter

History

  • gmail_history_list -- List mailbox changes since a history ID (incremental sync)

Settings

  • gmail_vacation_get -- Get vacation auto-reply settings
  • gmail_vacation_set -- Set vacation auto-reply settings

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gmail_mcp_ldraney-0.1.3.tar.gz (17.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gmail_mcp_ldraney-0.1.3-py3-none-any.whl (15.9 kB view details)

Uploaded Python 3

File details

Details for the file gmail_mcp_ldraney-0.1.3.tar.gz.

File metadata

  • Download URL: gmail_mcp_ldraney-0.1.3.tar.gz
  • Upload date:
  • Size: 17.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for gmail_mcp_ldraney-0.1.3.tar.gz
Algorithm Hash digest
SHA256 869e6978f34a278987d99f87e9bab0fb6cebbb2c35890a843cb4b5576aae8c3e
MD5 533568d72ae84e4d8179f935cc3167bd
BLAKE2b-256 0dd1ca48411da61f4f1ff39f6234cec15eee1a0c21e61fe03eb111f4f43ed248

See more details on using hashes here.

Provenance

The following attestation bundles were made for gmail_mcp_ldraney-0.1.3.tar.gz:

Publisher: publish.yml on ldraney/gmail-mcp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file gmail_mcp_ldraney-0.1.3-py3-none-any.whl.

File metadata

File hashes

Hashes for gmail_mcp_ldraney-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 e53787ed310f3abb4fa2d66146da8ce86812c3b8517086a37abefec57ace7da2
MD5 c98442e97541e7dbd5bf9f032758a4fa
BLAKE2b-256 0301901cae59364c7153ace5258ab237ae3f25657b016088f6085eac5d748f01

See more details on using hashes here.

Provenance

The following attestation bundles were made for gmail_mcp_ldraney-0.1.3-py3-none-any.whl:

Publisher: publish.yml on ldraney/gmail-mcp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page