Gmail-mcp-server
A resilient MCP server built with fastMCP for sending emails through Gmail's SMTP server using AI agents.
Overview
Gmail MCP Server is a resilient server built with fastMCP that allows users to send emails through Gmail's SMTP server using AI agents.
To use the Gmail MCP Server, clone the repository, set up your environment variables with your Gmail SMTP credentials, and run the server. You can then send emails using the provided API with various attachment methods.
- Gmail SMTP Integration: Sends emails using Gmail’s SMTP server with TLS. - Multiple Attachment Methods: Attach files directly from a file path, download from a URL, or use pre-staged attachments. - Resilient Design: Increased timeout and graceful shutdown handling. - Environment-Based Configuration: Securely manage Gmail credentials using environment variables.
- Sending automated emails with attachments.
- Integrating email functionality into AI applications.
- Managing email communications in server-based applications.
Add to your AI client
Use these steps to connect Gmail-mcp-server in Cursor, Claude, VS Code, and other MCP-compatible apps. The same JSON appears in the Use with menu above for one-click copy.
Cursor
Add this to your .cursor/mcp.json file in your project root, then restart Cursor.
.cursor/mcp.json
{
"mcpServers": {
"gmail-mcp-server-maitreyam": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-gmail-mcp-server-maitreyam"
]
}
}
}Claude Desktop
Add this server entry to the mcpServers object in your Claude Desktop config, then restart the app.
~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows)
{
"mcpServers": {
"gmail-mcp-server-maitreyam": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-gmail-mcp-server-maitreyam"
]
}
}
}Claude Code
Add this to your project's .mcp.json file. Claude Code will detect it automatically.
.mcp.json (project root)
{
"mcpServers": {
"gmail-mcp-server-maitreyam": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-gmail-mcp-server-maitreyam"
]
}
}
}VS Code (Copilot)
Add this to your .vscode/mcp.json file. Requires the GitHub Copilot extension with MCP support enabled.
.vscode/mcp.json
{
"servers": {
"gmail-mcp-server-maitreyam": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-gmail-mcp-server-maitreyam"
]
}
}
}Windsurf
Add this to your Windsurf MCP config file, then restart Windsurf.
~/.codeium/windsurf/mcp_config.json
{
"mcpServers": {
"gmail-mcp-server-maitreyam": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-gmail-mcp-server-maitreyam"
]
}
}
}Cline
Open Cline settings, navigate to MCP Servers, and add this server configuration.
Cline MCP Settings (via UI)
{
"mcpServers": {
"gmail-mcp-server-maitreyam": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-gmail-mcp-server-maitreyam"
]
}
}
}FAQ
Can I use my regular Gmail account?
Yes, but you need to set up Gmail SMTP and generate an App Password if you have 2-Step Verification enabled.
Is there a limit on the number of emails I can send?
Yes, Gmail has sending limits that you should be aware of.
How do I handle attachments?
You can attach files directly, download them from a URL, or use pre-staged files.7: