home / mcp / gmail mcp server

Gmail MCP Server

Provides Gmail access via Google Apps Script to search, fetch, and download attachments from a Gmail account through MCP clients.

Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "kazuph-mcp-gmail-gas": {
      "command": "npx",
      "args": [
        "-y",
        "@kazuph/mcp-gmail-gas"
      ],
      "env": {
        "GAS_ENDPOINT": "YOUR_DEPLOYMENT_URL",
        "VALID_API_KEY": "YOUR_API_KEY"
      }
    }
  }
}

MCP Gmail lets you interact with your Gmail account through Google Apps Script using an MCP client. It provides a bridge between Claude Desktop (and other MCP clients) and your Gmail, enabling you to search messages, fetch content, and download attachments with secure, script-based access.

How to use

You can use the Gmail MCP to perform common email tasks from your MCP client, such as searching for messages with Gmail query syntax, retrieving a complete message, and downloading attachments. Start by configuring the MCP client to connect to the Gmail MCP server, then issue appropriate high-level actions from your client to perform those tasks. The following configuration and usage patterns describe how to connect and operate the Gmail MCP server.

How to install

Prerequisites you need before installing and using the Gmail MCP server:

  • Node.js 18+
  • A Gmail account
  • Google Apps Script deployment
  • Claude Desktop installed

Step 1. Deploy Google Apps Script

Step 2. Open Claude Desktop and configure the local settings as described in the deployment and configuration steps below.

Step 3. Add the MCP configuration to Claude Desktop to enable Gmail tools.

Additional configuration and usage notes

You’ll manage two kinds of configurations: a deployment-based configuration that points to your Google Apps Script Web App, and a development configuration that runs locally via tsx for testing. The configurations below show how to wire your client to the Gmail MCP server.

{
  "tools": {
    "gmail": {
      "command": "npx",
      "args": ["-y", "@kazuph/mcp-gmail-gas"],
      "env": {
        "GAS_ENDPOINT": "YOUR_DEPLOYMENT_URL",
        "VALID_API_KEY": "YOUR_API_KEY"
      }
    }
  }
}

Replace YOUR_DEPLOYMENT_URL with your Google Apps Script deployment URL and YOUR_API_KEY with the API key you generated for security.

{
  "tools": {
    "gmail": {
      "args": ["tsx", "/path/to/mcp-gmail-gas/index.ts"],
      "env": {
        "GAS_ENDPOINT": "YOUR_DEPLOYMENT_URL",
        "VALID_API_KEY": "YOUR_API_KEY"
      }
    }
  }
}

Security considerations

Keep your API key secure. Do not commit VALID_API_KEY to version control. This key ensures only authorized clients can access Gmail through the Google Apps Script deployment.

Available tools

gmail_search_messages

Search for emails using Gmail query syntax (e.g., subject:Meeting newer_than:1d)

gmail_get_message

Retrieve the full content and details of a specific email

gmail_download_attachment

Download an attachment from a specific email