Gmail MCP Server

Gmail MCP Server

Provides Gmail tools for sending emails, creating drafts, and reading labels through the MCP framework, enabling AI clients like Claude Desktop to manage Gmail directly.

Category
Visit Server

README

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

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.

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