Gmail
Search and delete emails in your Gmail account.
Gmail MCP Server
一个基于Model Context Protocol (MCP)的服务器,提供Gmail邮件删除功能。
功能
- 通过MCP协议暴露Gmail邮件删除工具
- 支持通过邮件ID删除指定用户的邮件
- 提供邮件搜索功能,支持按条件查询邮件
- 支持批量删除指定用户的多个邮件
环境要求
- Java 17或更高版本
- Maven 3.6+或Gradle 7.0+
- Gmail API credentials.json文件
快速开始
1. 准备Gmail API凭据
- 前往Google Cloud Console
- 创建新项目并启用Gmail API
- 创建OAuth 2.0客户端ID凭据
- 下载credentials.json文件并保存到
src/main/resources/目录
2. 构建项目
./mvnw clean install
3. 运行服务器
./mvnw spring-boot:run
配置
配置文件位于src/main/resources/application.properties,可修改以下参数:
server.port: 服务器端口,默认8080spring.ai.mcp.server.enabled: 是否启用MCP服务器,默认truegmail.credentials.path: Gmail凭据文件路径,默认classpath:credentials.json
使用方法
通过MCP客户端连接服务器后,可调用以下工具:
deleteEmail: 删除指定ID的邮件- 参数: userId(用户邮箱), messageId(邮件ID)
searchEmails: 搜索符合条件的邮件- 参数: userId(用户邮箱), query(搜索条件), maxResults(最大结果数)
- 返回值: 邮件列表,包含邮件ID和基本信息
batchDeleteEmails: 批量删除邮件- 参数: userId(用户邮箱), messageIds(邮件ID列表)
- 返回值: 操作结果状态
MCP server 配置
{
"mcpServers": {
"gmail-mcp-server": {
"command": "java",
"args": [
"-Dspring.ai.mcp.server.stdio=true",
"-Dspring.main.web-application-type=none",
"-Dlogging.pattern.console=",
"-jar",
"/Users/arthur/.m2/repository/arthur/mcp/gmail-mcp-server/0.0.1-SNAPSHOT/gmail-mcp-server-0.0.1-SNAPSHOT.jar"
]
}
}
}
Related Servers
Perplexity Chat
An MCP server for the Perplexity API to query responses and manage conversations.
Twitter MCP
Interact with Twitter to post and search for tweets.
Damien Email Wrestler
An AI-powered email intelligence platform that integrates with Gmail and OpenAI. It can be run as a CLI tool or deployed on AWS Lambda for enhanced capabilities.
Fastmail MCP Server
Integrate your Fastmail account with AI assistants using the Model Context Protocol.
any-chat-completions-mcp
Chat with any other OpenAI SDK Compatible Chat Completions API, like Perplexity, Groq, xAI and more
Unichat
A unified interface for various chat AI models including OpenAI, MistralAI, Anthropic, and Google AI, requiring vendor API keys.
Brainstorm MCP
Slack for AI agents - a local service where agents can join projects, message each other, and share resources in a structured workspace
MCP Email Server
Provides IMAP and SMTP access for sending and receiving emails.
AllVoiceLab
An AI voice toolkit with TTS, voice cloning, and video translation, now available as an MCP server for smarter agent integration.
Claude Assist MCP
Enables communication between Claude Code and Claude Desktop for code reviews.