Enhanced Gmail MCP Server

Enhanced Gmail MCP Server

gmail-mcp•bytheposch

A Python Model Context Protocol server that lets AI assistants manage Gmail through natural language, covering sending, reading, drafts, labels, folders, filters, and archiving.

License: GPL-3.0 License•Runtime: Awaiting documentation review•Category: communication social

WHAT IT DOES

  • •Sends and reads emails with customizable recipients, subject, and content, including full metadata retrieval.
  • •Manages drafts by creating, listing, and editing draft emails for later review.
  • •Manages Gmail labels and folders, including creating, renaming, deleting, and applying labels, and moving emails between folders.
  • •Searches emails using Gmail's advanced query syntax and creates, manages, and deletes email filters.

BEST FOR

  • •AI assistants like Claude that need to manage Gmail through natural language prompts.
  • •Users who want to archive, restore, and organize email in bulk by search criteria.
  • •Automating label and filter organization for incoming email.

ABOUT GMAIL-MCP

Enhanced Gmail MCP Server is cataloged as an MCP server attributed to theposch. A Python Model Context Protocol server that lets AI assistants manage Gmail through natural language, covering sending, reading, drafts, labels, folders, filters, and archiving. It is categorized under communication social. See the capability inspector for recorded interfaces and their independent review status; consult upstream documentation for the current interface.

HOW TO INSTALL

Installation configuration is not reviewed. No executable setup is offered for this entry; inspect the source repository before proceeding.

LICENSE

Catalog license label: GPL-3.0 License. Check the source repository's current license and terms before using, modifying or distributing this software.

Capability inspector

Capability definitions are not reviewed. Unreviewed imports are not exposed as trusted interfaces.

Tools (0)

No reviewed records to display. This does not establish that upstream lacks this capability.

Resources (0)

No reviewed records to display. This does not establish that upstream lacks this capability.

Prompts (0)

No reviewed records to display. This does not establish that upstream lacks this capability.

NEWSLETTER - COMING LATER

Newsletter subscriptions are not open yet

Email delivery is not connected. This page does not collect email addresses or create subscriptions.

Browse the registry for current listings instead.

Community Reviews

Coming later

Reviews for Enhanced Gmail MCP Server are not available yet

Review publishing and storage are not connected. This page does not collect or publish ratings or comments, including after sign-in.

FREQUENTLY ASKED QUESTIONS

What authentication method does the server use for Gmail?

It uses OAuth2 authentication with automatic token refresh, requiring a Google Cloud project with the Gmail API enabled and OAuth 2.0 credentials.

Does the server ask for confirmation before sensitive actions?

Yes, the server requests user confirmation before performing sensitive actions.

How are folders implemented in this Gmail server?

Folders are implemented as Gmail labels, allowing emails to be moved between them.

Upstream README

View this exact version on GitHub

README.md · f4c8affe8c08 · Fetched 2026-11-13 09:56:19 UTC

Original upstream text, without AI rewriting. Scripts, forms and unsafe links are filtered for safety.

Showing the last retrieved documentation snapshot; check the source for current changes.

Enhanced Gmail MCP Server

A powerful and feature-rich Model Context Protocol (MCP) server for Gmail integration, written in Python. This server enables AI assistants like Claude to interact with Gmail through natural language, providing comprehensive email management capabilities.

🌟 Key Features

📧 Complete Email Management

  • Send emails with customizable subject, content, and recipients
  • Read and retrieve email content with full metadata
  • Move emails to trash with confirmation
  • Mark emails as read/unread
  • Open emails directly in browser

📝 Draft Management

  • Create draft emails for later review
  • List all draft emails
  • Edit existing drafts

🏷️ Advanced Label Management

  • List all available labels
  • Create custom labels
  • Apply/remove labels from emails
  • Rename existing labels
  • Delete unused labels
  • Search emails by label

📁 Folder Organization

  • Create new folders (implemented as Gmail labels)
  • Move emails between folders
  • List all available folders

🔍 Powerful Search & Filtering

  • Search emails using Gmail's advanced query syntax
  • Create, manage, and delete email filters
  • Filter by sender, recipient, subject, content, and more
  • Customize search results with flexible parameters

🗄️ Archive Management

  • Archive emails (remove from inbox without deleting)
  • Batch archive multiple emails matching search criteria
  • List all archived emails
  • Restore archived emails to inbox

🚀 Getting Started

Prerequisites

  • Python 3.12+
  • Python MCP SDK >= 2.0
  • Google Cloud project with Gmail API enabled
  • OAuth 2.0 credentials

Installation

# Clone the repository
git clone https://github.com/theposch/gmail-mcp.git
cd gmail-mcp

# Set up a virtual environment
python -m venv .venv
source .venv/bin/activate  # On Windows: .venv\Scripts\activate

# Install the package
pip install -e .

Google Cloud Setup

  1. Create a new Google Cloud project
  2. Enable the Gmail API
  3. Configure the OAuth consent screen:
    • Select "External" user type
    • Add your email as a test user
    • Add the scope: https://www.googleapis.com/auth/gmail/modify
  4. Create OAuth 2.0 credentials:
    • Choose "Desktop app" as the application type
    • Download the JSON credentials file

Configuration

Store your credentials securely and specify their location when running the server:

# Example directory structure for credentials
mkdir -p ~/.gmail-mcp
# Move your downloaded credentials file
mv ~/Downloads/client_secret_*.json ~/.gmail-mcp/credentials.json

🔧 Usage

Running with Claude Desktop

Add the following to your Claude Desktop configuration file (typically at ~/Library/Application Support/Claude/claude_desktop_config.json):

{
  "mcpServers": {
    "gmail": {
      "command": "uv",
      "args": [
        "--directory",
        "/absolute/path/to/gmail-mcp",
        "run",
        "gmail",
        "--creds-file-path",
        "/absolute/path/to/credentials.json",
        "--token-path",
        "/absolute/path/to/tokens.json"
      ]
    }
  }
}

Testing with MCP Inspector

For testing and debugging, use the MCP Inspector:

npx @modelcontextprotocol/inspector uv run /path/to/gmail-mcp/src/gmail/server.py --creds-file-path /path/to/credentials.json --token-path /path/to/tokens.json

🔐 Security Considerations

  • Never commit credentials or token files to version control
  • Store credentials in a secure location with appropriate permissions
  • The server will request user confirmation before performing sensitive actions
  • Review Google Cloud Console regularly for unusual activity
  • Consider using environment variables for sensitive paths

🛠️ Architecture

This implementation features a comprehensive single-file architecture that handles all Gmail operations through the Google API client libraries. Key components include:

  • OAuth2 authentication with automatic token refresh
  • Comprehensive error handling and logging
  • Structured tool definitions with clear input schemas
  • Efficient email parsing and formatting

📚 Example Prompts

Try these prompts with Claude after connecting the Gmail MCP server:

  • "Show me my unread emails"
  • "Search for emails from example@domain.com with attachments"
  • "Create a new label called 'Important Projects'"
  • "Draft an email to john@example.com about the upcoming meeting"
  • "Archive all emails from newsletter@example.com"
  • "Create a filter to automatically label emails from my team"

🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

📄 License

This project is licensed under the GPL-3.0 License - see the LICENSE file for details.

🙏 Acknowledgments

  • Inspired by various MCP server implementations in the community
  • Built with the Model Context Protocol framework
  • Uses Google's official API client libraries

Install configuration

Are you the maintainer?

Claim this server with your GitHub account to request manual ownership verification.

README Embed Badge
Markdown

Link to the catalog listing for Enhanced Gmail MCP Server from your README. This badge does not certify ownership, compatibility or security.

[![MCP catalog listing](https://img.shields.io/badge/MCP-awesome--mcp-orange?style=flat-square)](https://awesome-mcp.com/servers/gmail-mcp)

REPOSITORY STATS

GitHub StarsUnavailable
ForksUnavailable

Public repository statistics could not be verified. Check the configured source address; unavailable counts are not zero.

Downloads and pulls

Separate sources, scopes and periods. Never combined or treated as installations, active users or security reviews.

No reviewed package or image identity; download statistics are not listed yet.

Related communication social MCP Servers

Alternative and complementary servers in the same category

View all in communication social →

An AI receptionist platform with an MCP server for accessing business calls, contacts and appointments from AI assistants.

52
Communication

Pidgeon provides an MCP server and an email inbox API that gives AI agents their own addresses for sending, awaiting, and replying to email.

Repository stats unavailable
Communication