Get the FREE Ultimate OpenClaw Setup Guide →

mcp-google-gmail

A powerful Model Context Protocol (MCP) server providing comprehensive Gmail integration with LLM processing capabilities.

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio cablate-mcp-google-gmail npx -y @cablate/mcp-gmail \
  --env GMAIL_CLIENT_ID="your_client_id" \
  --env GMAIL_CLIENT_SECRET="your_client_secret" \
  --env GMAIL_REFRESH_TOKEN="your_refresh_token"

How to use

The Gmail MCP server integrates Gmail into your Model Context Protocol (MCP) environment, enabling Large Language Models (LLMs) to read, search, and process Gmail messages with support for attachments and various content formats. Once the server is configured, you can start interacting with Gmail through the MCP layer, allowing your agents to fetch emails, filter results, and perform actions based on natural language requests. The server exposes capabilities to read emails, search by query, filter by labels or metadata, and handle attachments, making it useful for user support bots, CRM assistants, and productivity tools.

To use the server via Dive Desktop or directly through the CLI, install the MCP server and provide Gmail API credentials. With the CLI, you can run the server using the provided command (map-gmail) after installation. In Dive Desktop, add the Gmail MCP server by supplying the mcpServers configuration shown in the installation guide, which includes your OAuth credentials, ensuring the agent can access your Gmail data securely. The server will then respond to LLM-driven prompts by querying Gmail and returning structured results (emails, snippets, attachments) suitable for downstream processing.

How to install

Prerequisites:

  • Node.js and npm installed on your system
  • Access to npm and the ability to install global npm packages

Manual installation steps:

  1. Install the MCP Gmail server globally using npm:

    npm install -g @cablate/mcp-gmail
    
  2. Verify installation:

    map-gmail --help
    
  3. Configure Gmail API credentials:

    • Create a Google Cloud project and enable Gmail API
    • Create OAuth 2.0 credentials and obtain client ID, client secret, and refresh token
    • Export or provide these values in your MCP configuration (as shown in the usage example)
  4. Run the MCP server variant you need (via CLI or via your MCP manager like Dive Desktop):

    • CLI example (if a wrapper script is installed):
      map-gmail
      
    • Dive Desktop or other MCP managers: add a server with the provided configuration, ensuring the env vars are supplied as in the example.

Additional notes

Tips and common issues:

  • Ensure Gmail API credentials are valid and have the necessary scopes (e.g., https://www.googleapis.com/auth/gmail.readonly).
  • When using Dive Desktop, keep credentials secure and avoid exposing them in logs or UI exports.
  • If you rotate credentials, update the environment variables in your MCP configuration accordingly.
  • The server supports reading, searching, and filtering emails; for large mailboxes consider pagination or incremental fetch strategies.
  • If you encounter authentication errors, re-authenticate with a fresh access token or refresh token from the Google Cloud Console.
  • For attachments, verify file size limits and MIME type handling based on your downstream processing requirements.

Related MCP Servers

Sponsor this space

Reach thousands of developers