gmail-mcp-server
Enables reading unread emails and creating draft replies in Gmail via Claude Desktop.
README
Gmail MCP Server
An MCP server that allows Claude Desktop to read unread emails and create draft replies in Gmail.
Features
- get_unread_emails: Fetches unread emails with sender, subject, body, message ID, and thread ID
- create_draft_reply: Creates properly threaded draft replies
Requirements
- Python 3.14+
- Gmail account
- Google Cloud Console access
Setup
1. Install Dependencies
# Create virtual environment
python3 -m venv venv
# Activate it
source venv/bin/activate
# Install dependencies
pip install -r requirements.txt
2. Gmail API Configuration
- Go to Google Cloud Console
- Create a new project
- Enable Gmail API
- Go to "APIs and services" → "Credentials" → "Create Credentials" → "OAuth client ID"
- Choose "Desktop app" as application type
- Download the credentials and save as
credentials.jsonin the root directory - Add test user with your Gmail address under "Audience"
3. First Run - Authentication
python server.py
This will open a browser for OAuth authentication. token.json will be created in the root directory.
4. Configure Claude Desktop
Edit your Claude Desktop config file:
Mac: ~/Library/Application Support/Claude/claude_desktop_config.json
Add:
{
"mcpServers": {
"gmail": {
"command": "/absolute/path/to/python",
"args": ["/absolute/path/to/server.py"]
}
}
}
This configuration tells Claude Desktop how to connect to your Gmail MCP server:
- mcpServers - Root object containing all MCP server configurations
- gmail - Unique name for this server (you can choose any name)
- command - Path to the Python executable that will run the server
- args - Arguments passed to the command (the server script path)
What you need to replace:
/absolute/path/to/python- Full path to your Python interpreter/absolute/path/to/server.py- Full path to your server.py file
Restart Claude Desktop.
OAuth Scopes
gmail.readonly- Read emailsgmail.compose- Create drafts
Project Structure
server.py- MCP server implementationgmail_client.py- Gmail API wrappercredentials.json- OAuth credentials (not in git)token.json- OAuth token (auto-generated, not in git)
Troubleshooting
- Authentication fails: Delete
token.jsonand runpython server.pyagain - Claude can't connect: Check the absolute path in config file
Usage Examples
Get unread emails - Claude
<img width="500" height="280" src="https://github.com/user-attachments/assets/25120b4b-6ebe-48d9-bed8-c7a6d7773df5" /> <img width="450" height="360" src="https://github.com/user-attachments/assets/930b15c3-4689-4147-a25e-c06a1bf1f1e0" />
Unread emails - Gmail
<img width="400" src="https://github.com/user-attachments/assets/3e41587f-6337-4a10-b4df-1e6d6db8c770" />
Create draft email - Claude
<img width="450" height="315" src="https://github.com/user-attachments/assets/c7335ec9-4558-4f96-b491-5b51479c2f8d" /> <img width="851" height="380" alt="" src="https://github.com/user-attachments/assets/b3f75261-4a7e-4cea-8846-46b46be20c87" />
Draft email - Gmail
<img width="400" src="https://github.com/user-attachments/assets/a1a8027b-0533-409d-b639-ea59bba2f8dc" />
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。