Gmail MCP Server

Gmail MCP Server

Enables sending emails through Gmail using Google's Gmail API. Requires OAuth authentication setup through Google Cloud Console.

Category
Visit Server

README

Gmail MCP Server

This MCP (Model Context Protocol) server provides tools for common operations with gmail.

Features

  • send_mail: Send new emails

Prerequisites

  1. Python 3.12+
  2. uv - Fast Python package installer and resolver
  3. Google Cloud Console Setup
  • Go to: Google Cloud Console
  • Create a new project for this MCP Server
  • Enable Gmail API
    • Go to: APIs and services > Library
    • Search: Gmail API
    • Click on: Gmail API tile in the results
    • Click on: Enable
  • Setup OAuth
    • Go to: APIs and services > Credentials
    • Click on": Create Credentials > OAuth client ID
    • Choose Application Type: Web application
    • Add: Authorised redirect URIs: http://localhost:4321/
    • Create client
    • Download the JSON and save it to credentials.json in this project root. This has the Client ID, Client Secret, etc.

Installation

  1. Clone this repository:

    git clone https://github.com/heuristech/gmail-mcp-server.git
    cd gmail-mcp-server
    
  2. Create a virtual environment and install the package in development mode:

    # Create a virtual environment
    uv venv
    
    # Activate the virtual environment
    # On macOS/Linux:
    source .venv/bin/activate
    # On Windows:
    .venv\Scripts\activate
    
    # Install dependencies
    uv sync
    

Get Refresh Token

python get_refresh_token.py

This will:

  1. Start a server on port: 4321 to receive tokens post Google OAuth
  2. Open your browser for Google OAuth
  3. On succeeful authentication it will save token.json with refresh_token along with client_id, and client_secret.
  4. It will also display the refresh_token on console.

Create .env

copy example.env .env

Setup the corresponding value using what you received in the previous step.

Inspect

Use MCP Inspector to test it in the development mode.

mcp dev server.py

Claude Desktop Integration

Once your server is ready, install it in Claude Desktop

mcp install server.py --with google-auth --with google-auth-oauthlib --with google-auth-httplib2 --with google-api-python-client -f .env

MCP server configuration:

{
  "mcpServers": {
    "gmail-mcp-server": {
      "command": "uv",
      "args": [
          "--directory",
          "/:your.path.to/gmail-mcp-server/server.py",
          "run",
          "server.py"
      ],
      "env": {
        "CLIENT_ID": "google.auth.app.client.id",
        "CLIENT_SECRET": "google.auth.app.client.secret",
        "REFRESH_TOKEN": "google.auth.app.refresh.token"
      }   
    }   
  }
}

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured