Gmail-mcp-server logo

Gmail-mcp-server

by MaitreyaM

A resilient MCP server built with fastMCP for sending emails through Gmail's SMTP server using AI agents. It supports various methods for attaching files.

View on GitHub

Last updated: N/A

What is Gmail-mcp-server?

This is a resilient MCP server implementation using fastMCP, designed to send emails via Gmail's SMTP server. It provides multiple methods for attaching files, including direct file paths, URL-based attachments, and pre-staged attachments.

How to use Gmail-mcp-server?

  1. Clone the repository. 2. Set up environment variables for Gmail credentials in a .env file. 3. (Optional) Prepare attachment directories. 4. Run the server using python server.py. 5. Configure your MCP client to use the server at 127.0.0.1:5000. Use the send_email_tool with parameters like recipient, subject, body, and attachment details.

Key features of Gmail-mcp-server

  • Gmail SMTP Integration

  • Multiple Attachment Methods (File Path, URL, Pre-Staged)

  • Resilient Design (Increased Timeout, Graceful Shutdown)

  • Environment-Based Configuration

Use cases of Gmail-mcp-server

  • Sending automated emails with attachments from AI agents.

  • Integrating email functionality into applications using Gmail.

  • Sending reports or notifications via email.

  • Automating email campaigns with personalized attachments.

FAQ from Gmail-mcp-server

How do I set up Gmail SMTP?

You need to enable SMTP access in your Gmail account settings and generate an App Password if you have 2-Step Verification enabled.

What is fastMCP?

fastMCP is a framework used to build the MCP server. It needs to be installed using pip install mcp.

How do I attach files from a URL?

Provide the public URL of the file and the desired filename in the attachment_url and attachment_name parameters respectively.

Where should I place pre-staged attachments?

Create a directory named available_attachments in the root of the project and place your files there. Reference them by name in the attachment_name parameter.

What if I don't specify an attachment_name when using attachment_url?

The attachment_name parameter is required when using URL-based or pre-staged attachments.