Skip to main content
Glama
AsifMarwat

Gmail MCP Server

by AsifMarwat

Gmail MCP Server

This project provides a set of Gmail tools built with the MCP (Model Context Protocol) framework, allowing AI clients like Claude Desktop to send emails, create drafts, and read Gmail labels through Google's Gmail API. Tools are registered with FastMCP and can be tested via the MCP Inspector or connected directly to Claude Desktop.

Features

  • πŸ“€ Send emails through Gmail

  • πŸ“ Create email drafts

  • 🏷️ Read Gmail labels

Related MCP server: gmail-mcp

Prerequisites

  • Python 3.10+

  • uv for dependency management

  • MCP CLI (mcp[cli])

  • Gmail API credentials (client_secret.json)

Enable Gmail API and Download Credentials

  1. Go to the Google Cloud Console

  2. Create a new project (or use an existing one)

  3. Enable the Gmail API

  4. Configure the OAuth consent screen and add yourself as a test user

  5. Create OAuth 2.0 Client ID credentials with application type Desktop app

  6. Download the client_secret.json file and place it in the project root

Setup

1. Clone the repository

git clone https://github.com/AsifMarwat/Gmail-mcp.git
cd Gmail-mcp

2. Install dependencies

uv sync

Note: If you're not using uv, you can also run:

pip install -r requirements.txt

3. Add your credentials

Place your downloaded client_secret.json in the project root. On first run, the app will open a browser window for you to sign in and authorize access β€” this generates a token.json file that stores your session so you don't need to log in again.

Running the Project

Development (MCP Inspector)

Use this to test your tools directly in the MCP Inspector:

uv run mcp dev main.py

Connect to Claude Desktop

Add the server to your claude_desktop_config.json:

{
  "mcpServers": {
    "gmail-mcp": {
      "command": "uv",
      "args": [
        "--directory",
        "/absolute/path/to/Gmail-mcp",
        "run",
        "python",
        "main.py"
      ]
    }
  }
}

Restart Claude Desktop after saving. The Gmail tools will then be available directly in your conversations.

Available Tools

Tool

Description

create_draft

Creates a draft email in Gmail

send_mail

Sends an email directly from Gmail

read_labels

Reads all Gmail label information

Project Structure

.
β”œβ”€β”€ main.py                # Script defining Gmail tools
β”œβ”€β”€ client_secret.json     # OAuth credentials (keep private, not committed)
β”œβ”€β”€ token.json             # Generated after first login (keep private, not committed)
β”œβ”€β”€ pyproject.toml         # Project dependencies
β”œβ”€β”€ uv.lock                # Locked dependency versions
└── README.md              # Project documentation

Notes

  • The script generates and uses token.json for storing OAuth tokens after your first authorization.

  • Do not commit client_secret.json or token.json to version control. Both are excluded via .gitignore.

  • This project was built as a learning exercise to understand how MCP servers integrate with the Gmail API and AI clients like Claude Desktop.

Related MCP Connectors

  • Manage Gmail end-to-end: search, read, send, draft, label, and organize threads. Automate workflow…

  • Email infrastructure for AI agents β€” send, receive, search, and reply to email over MCP.

  • Manage Gmail messages, threads, labels, drafts, and settings from your workflows. Send and organiz…

  • Your agent needs a mailbox of its own β€” to receive, thread, draft and send, with attachments, without borrowing your personal inbox or your company's SMTP. **What you can ask for** β€’ "Create an inbox for this agent and tell me its address." β€’ "Read the new messages in this thread and draft a reply." β€’ "Send this message with the attachment and wait for the response." β€’ "Search this inbox for everything from that domain." β€’ "Show delivery metrics and the events on this inbox." **How to use it** Point any MCP client at https://mcp.aisa.one/mail/mcp and sign in with OAuth β€” there is no key to create or paste. 49 tools: create and delete inboxes, list and read messages, raw message bodies, attachments, threads, drafts and draft attachments, send and reply, message search, inbox events, metrics, and list entries β€” reads and writes. **Why this rather than the source** A real inbox an agent owns, rather than an SMTP credential it borrows from a human. **It is also a door to the rest** The same login reaches 26 sources and 580+ operations. Find the contact elsewhere in the catalogue, then write to them from here β€” without adding a second server. **What it costs** Finding and inspecting an operation is free. Running one is billed per call at API prices, with no seat and no monthly minimum, and every call takes max_price_usd so an agent cannot overspend by accident. **Where else it reaches** https://mcp.aisa.one/sales/mcp finds the person to write to.

Related MCP Servers

  • A
    license
    Not graded
    quality
    C
    maintenance
    Provides a suite of 17 tools for searching, reading, sending, and managing Gmail messages and drafts through the Model Context Protocol. It enables comprehensive email management including label organization, archiving, and attachment handling directly within MCP-compatible clients like Claude.
    10 npm
    2
    Apache 2.0
  • F
    license
    Not graded
    quality
    D
    maintenance
    Full Gmail control for any MCP-compatible AI agent. Exposes ~40 tools for reading, composing, labeling, filtering, threading, and account management.
    -
  • A
    license
    Not graded
    quality
    C
    maintenance
    Enables interaction with Gmail through 11 tools for email management, including reading, sending, replying, searching, and labeling, with OAuth 2.1 authentication and support for various MCP clients.
    105 npm
    MIT
  • A
    license
    A
    quality
    C
    maintenance
    Connects multiple Gmail accounts to Claude Desktop via MCP, enabling email search, labeling, drafts, and confirmed sending through natural language.
    13
    98 npm
    MIT