Gmail MCP Server

Gmail MCP Server

gmail-mcp-server-imsharad•byimsharad

An MCP server that exposes Gmail inbox, search, read, send, reply, and delete capabilities to LLMs through the Model Context Protocol.

License: Not specified•Runtime: Awaiting documentation review•Category: communication social

WHAT IT DOES

  • •Lists emails from the inbox, optionally filtered by label and capped by a maximum result count.
  • •Searches for emails matching a query and returns up to a specified number of results.
  • •Sends new emails and replies to existing emails with subject and body content.
  • •Deletes individual emails or multiple emails in a batch operation.

BEST FOR

  • •Letting LLM assistants read and search a Gmail inbox on the user's behalf.
  • •Composing and answering email through an MCP-capable assistant.
  • •Cleaning up mailboxes by deleting one or many emails via an assistant.

ABOUT GMAIL-MCP-SERVER-IMSHARAD

Gmail MCP Server is cataloged as an MCP server attributed to imsharad. An MCP server that exposes Gmail inbox, search, read, send, reply, and delete capabilities to LLMs through the Model Context Protocol. 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: Not specified. 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 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

How does the server authenticate with Gmail?

It uses Google OAuth 2.0 credentials; the first run opens a browser for authorization and saves tokens to token.json, which are reused and refreshed on later runs.

Can the server be configured to use a different port?

Yes; the server uses port 8000 by default, finds the next available port if it is busy, and the preferred host, port, and path can be set in the .env file.

Upstream README

View this exact version on GitHub

README.md · 4f7a9d65dff5 · Fetched 2026-11-13 11:46:38 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.

Gmail MCP Server

This MCP server provides access to Gmail functionality through the Model Context Protocol, allowing LLMs like Claude to interact with your email.

Features

  • List emails from your inbox
  • Search for specific emails
  • Read email content
  • Send new emails
  • Reply to existing emails
  • Delete individual emails
  • Batch delete multiple emails at once

Setup

  1. Install dependencies:

    python -m venv venv
    source venv/bin/activate  # On Windows: venv\Scripts\activate
    pip install -r requirements.txt
    
  2. Set up Google API credentials:

    • Go to the Google Cloud Console
    • Create a new project
    • Enable the Gmail API:
      • In the sidebar, navigate to "APIs & Services" > "Library"
      • Search for "Gmail API" and select it
      • Click "Enable"
    • Create OAuth 2.0 credentials:
      • In the sidebar, navigate to "APIs & Services" > "Credentials"
      • Click "Create Credentials" and select "OAuth client ID"
      • Select "Desktop application" as the application type
      • Enter a name for your OAuth client (e.g., "Gmail MCP Server")
      • Click "Create"
      • Download the credentials JSON file and save it as credentials.json in the project root
  3. Create a .env file by copying the example:

    cp .env.example .env
    
  4. Run the server:

    • The first time you run the server, it will open a browser window for authentication
    • Follow the prompts to authorize the application to access your Gmail account

Detailed Gmail API Setup

Understanding the Credentials Files

  1. credentials.json:

    • This file contains your OAuth 2.0 client credentials from Google Cloud
    • It's used to identify your application to Google's OAuth servers
    • Format example (values will be different for your application):
      {
        "installed": {
          "client_id": "YOUR_CLIENT_ID.apps.googleusercontent.com",
          "project_id": "your-project-id",
          "auth_uri": "https://accounts.google.com/o/oauth2/auth",
          "token_uri": "https://oauth2.googleapis.com/token",
          "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
          "client_secret": "YOUR_CLIENT_SECRET",
          "redirect_uris": ["http://localhost"]
        }
      }
      
    • You can use the provided credentials.json.example as a reference
  2. token.json:

    • This file is generated automatically during the first authentication
    • It contains the OAuth tokens needed to access your Gmail account
    • The file is created when you complete the authentication flow in your browser
    • Format example (tokens will be different for your account):
      {
        "token": "ya29.a0AfB_byC...",
        "refresh_token": "1//0eXxYz...",
        "token_uri": "https://oauth2.googleapis.com/token",
        "client_id": "YOUR_CLIENT_ID.apps.googleusercontent.com",
        "client_secret": "YOUR_CLIENT_SECRET",
        "scopes": [
          "https://www.googleapis.com/auth/gmail.readonly",
          "https://www.googleapis.com/auth/gmail.send",
          "https://www.googleapis.com/auth/gmail.compose",
          "https://www.googleapis.com/auth/gmail.modify"
        ],
        "expiry": "2025-03-05T14:30:00.000Z"
      }
      

Authentication Flow

  1. When you run the server for the first time:

    • The server will check for a token.json file
    • If not found, it will start the OAuth 2.0 authentication flow
    • A browser window will open asking you to sign in to your Google account
    • You'll be asked to grant permissions to the application
    • After granting permissions, the browser will show a success message
    • The server will automatically save the tokens to token.json
  2. For subsequent runs:

    • The server will use the existing token.json file
    • If the tokens are expired, they will be automatically refreshed
    • The refreshed tokens will be saved back to token.json

Security Considerations

  • Keep your credentials.json and token.json files secure
  • Do not commit these files to version control
  • The .gitignore file is configured to exclude these files
  • If you suspect your credentials have been compromised, revoke them in the Google Cloud Console and generate new ones

Usage

Run the server:

source venv/bin/activate  # On Windows: venv\Scripts\activate
python -m src.server

The server will automatically find an available port if the default one (8000) is already in use. You can configure the preferred host, port, and path in the .env file:

SERVER_HOST=0.0.0.0   # The host address to bind to
SERVER_PORT=8000      # The preferred port (will use next available if busy)
SERVER_PATH=/mcp      # The URL path for the MCP server

Configure Claude Desktop to use this server by adding it to your claude_desktop_config.json:

{
  "mcpServers": {
    "gmail": {
      "command": "python",
      "args": ["-m", "src.server"],
      "cwd": "/path/to/gmail-mcp-server"
    }
  }
}

Available Tool Functions

The Gmail MCP Server provides the following tool functions:

  1. list_emails - Lists emails from your Gmail inbox

    • Parameters:
      • max_results: Maximum number of emails to return (default: 10)
      • label: Gmail label to filter by (default: INBOX)
  2. get_email - Gets the full content of a specific email

    • Parameters:
      • email_id: The ID of the email to retrieve
  3. search_emails - Searches for emails matching a query

    • Parameters:
      • query: Search query to match against email fields
      • max_results: Maximum number of results to return (default: 5)
  4. send_email - Sends a new email

    • Parameters:
      • to: Recipient email address
      • subject: Email subject
      • body: Email body content
  5. reply_to_email - Replies to an existing email

    • Parameters:
      • email_id: ID of the email to reply to
      • body: Reply message content
  6. delete_email - Deletes a single email

    • Parameters:
      • email_id: ID of the email to delete
  7. delete_emails - Deletes multiple emails in a batch operation

    • Parameters:
      • email_ids: List of email IDs to delete

Design Philosophy

This project follows a lean, efficient design philosophy:

  1. Minimal code with no bloat
  2. Direct integration with Gmail API
  3. No mock data or unnecessary abstractions
  4. Focus on reliability and performance

Troubleshooting

Server Port Issues

If you encounter issues with the server port:

  1. The server will automatically try to find an available port if the default one (8000) is in use
  2. Check the console logs to see which port was actually used
  3. You can manually specify a different port in the .env file
  4. Make sure your Claude Desktop configuration points to the correct port

Authentication Issues

If you encounter authentication issues:

  1. Check that your credentials.json file is correctly placed in the project root
  2. Delete the token.json file if it exists to force re-authentication
  3. Ensure you have the correct scopes enabled for your OAuth client
  4. Check the console logs for specific error messages

Gmail API Rate Limits

The Gmail API has rate limits that may affect usage:

  • 1,000,000,000 quota units per day
  • Each API method consumes different quota units
  • For more information, see the Gmail API Quotas

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 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-server-imsharad)

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