home / mcp / gmail mcp server

Gmail MCP Server

Reads unread Gmail messages, classifies them, creates draft replies, and saves drafts to Gmail via MCP.

Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "jbr90-gmail-mcp-server": {
      "command": "node",
      "args": [
        "/absolute/path/to/gmail-mcp-server/dist/index.js"
      ]
    }
  }
}

Gmail MCP Server lets AI assistants read unread Gmail messages, classify them automatically, draft replies, and save those drafts back to Gmail. It brings Gmail-aware automation to your MCP-enabled tools so you can manage email more efficiently from your assistant workflows.

How to use

You interact with this server through MCP clients. Use the available tools to fetch unread messages, generate suggested replies, and save drafts back to Gmail. Each operation is designed to be called from your AI assistant workflow.

How to install

# Prerequisites
- Node.js v18 or higher
- A Google Cloud Project with the Gmail API enabled
- OAuth 2.0 credentials from Google Cloud Console

# 1. Clone the project
git clone https://github.com/jbr90/gmail-mcp-server.git
cd gmail-mcp-server

# 2. Install dependencies
npm install

# 3. Build the project
npm run build

# 4. Create a secrets directory and place your credentials
mkdir -p secrets
# Move your Google OAuth credentials file into the secrets directory
# Example: secrets/google-credentials.json

# 5. Start the server (in development mode or as part of your runtime flow)
npm run dev

Configuration and usage notes

The server is configured to run as a local MCP service via a stdio interface. You point a client to the local process and issue the available tools.

{
  "mcpServers": {
    "gmail": {
      "command": "node",
      "args": ["/absolute/path/to/gmail-mcp-server/dist/index.js"]
    }
  }
}

Gmail authorization flow

When you start the server for the first time, it will guide you through OAuth authorization. Your browser will open to Google’s authorization page. Sign in with your Google account and approve access. The server saves the token automatically and will reuse it until you revoke access or delete the token file.

Notes on clients and sampling support

This MCP server uses sampling for the create_suggested_draft_reply tool. Full sampling support is available in clients like GitHub Copilot. Claude Desktop provides limited support where get_unread_emails and save_draft_reply_to_gmail work, but create_suggested_draft_reply may not function without sampling.

Available tools

get_unread_emails

Retrieves the latest unread emails from your Gmail inbox and classifies each email into urgent, newsletter, work, personal, or unknown.

create_suggested_draft_reply

Generates an AI-powered draft reply to a specified email, using provided instructions to shape the response.

save_draft_reply_to_gmail

Saves a drafted reply to Gmail as a threaded response aligned with the original email thread.