Gmail MCP Server
A high-performance MCP server that enables AI assistants to interact with Gmail securely via OAuth 2.0, supporting smart email retrieval and thread-aware drafting.
README
Gmail MCP Server š§
A high-performance Model Context Protocol (MCP) server that enables AI assistants to interact with Gmail securely.
⨠Features
- Smart Email Retrieval: Fetch unread messages with rich metadata.
- Thread-Aware Drafting: Create replies that maintain conversation context.
- Secure Authentication: Robust OAuth 2.0 implementation with token management.
- Enterprise Ready: Structured for scalability and maintainability.
šļø Architecture
System Data Flow
graph TD
User(["š¤ User"]) <-->|"Natural Language"| Claude(["š¤ Claude Desktop"])
subgraph "MCP Server (Local Machine)"
Claude <-->|"JSON-RPC (stdio)"| Main["src/main.py"]
Main -->|Dispatch| Handler["src/handlers.py"]
Handler -->|Call| Client["src/client.py"]
end
Client <-->|"HTTPS / OAuth 2.0"| Gmail(["āļø Google Gmail API"])
style User fill:#f9f,stroke:#333
style Claude fill:#e1f5fe,stroke:#01579b
style Gmail fill:#fce4ec,stroke:#880e4f
The project follows standard engineering practices:
MLI/
āāā src/
ā āāā main.py # Application Entry Point
ā āāā client.py # Gmail API Client
ā āāā handlers.py # Request Handlers
āāā config/ # Configuration & Credentials
āāā tests/ # Unit Tests
āāā requirements.txt # Dependencies
š Quick Start
1. Prerequisite
- Python 3.8+
- Google Cloud Project with Gmail API enabled
2. Installation
# Clone and setup environment
python -m venv .venv
.venv\Scripts\activate
# Install dependencies
pip install -r requirements.txt
3. Configuration
- Place your Google Cloud
credentials.jsoninconfig/. - Copy the environment config:
copy .env.example .env
4. Claude Integration
Add to your Claude Desktop config (%APPDATA%\Claude\claude_desktop_config.json):
{
"mcpServers": {
"gmail": {
"command": "C:\\Path\\To\\MLI\\.venv\\Scripts\\python.exe",
"args": ["-m", "src.main"],
"cwd": "C:\\Path\\To\\MLI",
"env": {
"CREDENTIALS_PATH": "config/credentials.json",
"TOKEN_PATH": "config/token.json"
}
}
}
}
š ļø Usage
Check Emails:
"Check my unread emails"
Draft Reply:
"Draft a reply to the email from [Name]"
š”ļø Security
- Credentials are never committed to version control.
- Tokens are stored locally in
config/. - Communication happens directly between your machine and Google API.
Recommended Servers
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.
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.
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.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
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.
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.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
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.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.