Fire in da houseTop Tip:Paying $100+ per month for Perplexity, MidJourney, Runway, ChatGPT and other tools is crazy - get all your AI tools in one site starting at $15 per month with Galaxy AI Fire in da houseCheck it out free

mcp-gmail-gas

MCP.Pizza Chef: kazuph

The mcp-gmail-gas is an MCP server that integrates Gmail with the Model Context Protocol using Google Apps Script. It enables MCP clients like Claude Desktop to interact directly with a user's Gmail account, facilitating real-time email reading, sending, and management within AI workflows. This server requires Node.js 18+, a Gmail account, and deployment of a Google Apps Script web app. It streamlines email automation and AI-assisted email handling by exposing Gmail functionalities securely and efficiently to LLM-powered applications.

Use This MCP server To

Read and manage Gmail emails via AI workflows Send emails through Gmail using AI commands Automate email sorting and labeling Integrate Gmail data into AI-driven applications Enable real-time email interaction in MCP clients

README

MCP Gmail

Model Context Protocol server for Gmail integration. This allows Claude Desktop (or any MCP client) to interact with your Gmail account through Google Apps Script.

@kazuph/mcp-gmail-gas MCP server

Quick Start (For Users)

Prerequisites

  • Node.js 18+ (install via brew install node)
  • Gmail account
  • Google Apps Script deployment
  • Claude Desktop (install from https://claude.ai/desktop)

Configuration

  1. Deploy the Google Apps Script
  • Visit Google Apps Script and create a new project
  • Copy the entire contents of code.gs and paste it into the script editor
  • Click on "Deploy" > "New deployment"
  • Select "Web app" as the deployment type
  • Configure the following settings:
    • Execute as: Me
    • Who has access: Anyone
    • Click "Deploy"
  • When prompted, review and authorize the app to access your Gmail account
  • Copy the deployment URL and generate a random API key for security

Note: The script requires Gmail access permissions. When you first deploy and run the script, Google will ask you to review and grant these permissions. Make sure to:

  1. Click "Review Permissions"

  2. Select your Google account

  3. Click "Advanced" if you see a warning

  4. Click "Go to [Your Project Name] (unsafe)"

  5. Click "Allow" to grant the necessary Gmail permissions

  6. Open your Claude Desktop configuration file at: ~/Library/Application Support/Claude/claude_desktop_config.json

You can find this through the Claude Desktop menu:

  1. Open Claude Desktop

  2. Click Claude on the Mac menu bar

  3. Click "Settings"

  4. Click "Developer"

  5. Add the following to your configuration:

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

Note: Replace YOUR_DEPLOYMENT_URL and YOUR_API_KEY with your actual values.

For Developers

Prerequisites

  • Node.js 18+ (install via brew install node)
  • Gmail account
  • Google Apps Script
  • Claude Desktop (install from https://claude.ai/desktop)
  • tsx (install via npm install -g tsx)

Installation

git clone https://github.com/kazuph/mcp-gmail-gas.git
cd mcp-gmail-gas
npm install
npm run build

Development Configuration

  1. Make sure Claude Desktop is installed and running.

  2. Install tsx globally if you haven't:

npm install -g tsx
# or
pnpm add -g tsx
  1. Modify your Claude Desktop config located at: ~/Library/Application Support/Claude/claude_desktop_config.json

Add the following to your MCP client's configuration:

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

Available Tools

  • gmail_search_messages: Search for emails using Gmail search query syntax (e.g., "subject:Meeting newer_than:1d")
  • gmail_get_message: Get the full content and details of a specific email
  • gmail_download_attachment: Download an attachment from a specific email

Security Note

Always keep your VALID_API_KEY secret and never commit it to version control. This key helps ensure that only authorized clients can access your Gmail through the Google Apps Script deployment.

mcp-gmail-gas FAQ

How do I deploy the mcp-gmail-gas server?
Deploy the provided Google Apps Script as a web app with execution set to 'Me' and access to 'Anyone', then authorize it to access your Gmail account.
What are the prerequisites for using mcp-gmail-gas?
You need Node.js 18+, a Gmail account, Google Apps Script deployment, and an MCP client like Claude Desktop.
Is my Gmail data secure when using mcp-gmail-gas?
Yes, the server uses Google Apps Script's authorization model, ensuring secure OAuth-based access to your Gmail data.
Can I use mcp-gmail-gas with any MCP client?
Yes, it is designed to work with any MCP client that supports server integration, including Claude Desktop.
What permissions does the Google Apps Script require?
It requires permissions to read, send, and manage your Gmail messages to enable full email interaction.
Do I need to run a local server for mcp-gmail-gas?
No, the Google Apps Script web app acts as the server endpoint, so no local server is necessary.
How does mcp-gmail-gas handle authentication?
Authentication is handled via Google OAuth when you authorize the Google Apps Script deployment.
Can mcp-gmail-gas automate email workflows?
Yes, it enables AI-driven automation such as sorting, labeling, and responding to emails through MCP clients.