home / mcp / gmail mcp server

Gmail MCP Server

Allows Claude to search and retrieve emails from Gmail using an MCP server, enabling email queries and content access.

Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "vinayak-mehta-gmail-mcp": {
      "command": "/Users/username/.local/bin/uvx",
      "args": [
        "--from",
        "git+https://github.com/vinayak-mehta/gmail-mcp",
        "gmail-mcp"
      ],
      "env": {
        "GMAIL_CREDS_PATH": "/Users/username/path/to/gmail-mcp/credentials.json",
        "GMAIL_TOKEN_PATH": "/Users/username/path/to/gmail-mcp/token.json"
      }
    }
  }
}

This Gmail MCP server lets Claude search Gmail, list messages, and fetch full email content by using a local MCP runtime. It enables you to perform email queries and retrieve emails directly through Claude’s prompts, turning Gmail data into actionable insights.

How to use

You will interact with the Gmail MCP server through Claude by asking it to search emails, list recent messages, or fetch the content of a specific email. Use natural language prompts like “Search for all emails from [email protected],” “List my 5 most recent emails,” or “Show me the full content of the email with the subject 'Meeting Tomorrow'.” The MCP handles the underlying Gmail API calls and returns the results in a structured format.

How to install

Prerequisites: you need a local MCP runtime environment and access to edit your Claude configuration file.

{
  "mcpServers": {
    "gmail": {
      "args": [
        "--from",
        "git+https://github.com/vinayak-mehta/gmail-mcp",
        "gmail-mcp"
      ],
      "command": "/Users/username/.local/bin/uvx",
      "env": {
        "GMAIL_CREDS_PATH": "/Users/username/path/to/gmail-mcp/credentials.json",
        "GMAIL_TOKEN_PATH": "/Users/username/path/to/gmail-mcp/token.json"
      }
    }
  }
}

Configuration and usage notes

Environment variables control where your credentials and token files are stored. Create a .env file in your project root with these variables to simplify configuration.

Environment variables used by this server are: - GMAIL_CREDS_PATH: Path to your credentials.json file - GMAIL_TOKEN_PATH: Path to your token.json file

Security and maintenance

Keep your credentials.json and token.json files secure. Limit access to these files to trusted users only and rotate tokens if you notice unusual activity.

Available tools

Search Emails

Query Gmail to find emails matching your criteria (sender, subject, date, etc.). Returns matching emails with basic metadata.

Get Email Content

Retrieve the full content of a selected email, including body and attachments if available.

List Messages

List a set of recent messages from your Gmail inbox, with basic identifiers for quick reference.