Gmail
A resilient MCP server built with fastMCP for sending emails through Gmail's SMTP server using AI agents.
claude mcp add --transport stdio maitreyam-gmail-mcp-server python gmail_mcp.py \ --env SMTP_PASSWORD="your-app-password" \ --env SMTP_USERNAME="your-email@gmail.com"
How to use
This Gmail MCP server provides capabilities to send emails through Gmail's SMTP server and to fetch recent emails from configured Gmail folders, including handling attachments. It is built on fastMCP and is designed to operate behind Smithery.ai's deployment flow with a health check endpoint at /health for monitoring. To use it, ensure your Gmail credentials are supplied via environment variables (SMTP_USERNAME and SMTP_PASSWORD). The server exposes its MCP endpoints through the configured port (default 5000) and can be integrated into the MCP ecosystem to issue email-related commands or queries. You can trigger email sends, retrieve recent messages, and manage attachments using the MCP interface, with the server handling SMTP communication securely under the configured credentials.
How to install
Prerequisites:
- Python 3.8+
- pip (Python package manager)
Installation steps:
- Clone or download the repository containing gmail_mcp.py and requirements.txt.
- Create a Python virtual environment (optional but recommended):
- python3 -m venv venv
- source venv/bin/activate (Linux/macOS) or venv\Scripts\activate (Windows)
- Install dependencies:
- pip install -r requirements.txt
- Configure environment variables (see notes below) or create a .env file if you use a loader.
- Run the server:
- python gmail_mcp.py
- (Optional) If using Docker, prepare a Dockerfile allowing SMTP env vars and expose port 5000, then run the container.
Environment variables:
- SMTP_USERNAME: Your Gmail email address (e.g., user@gmail.com)
- SMTP_PASSWORD: Your Gmail app password (not the regular password)
Notes:
- The server binds to 0.0.0.0:5000 by default for container deployment.
- If integrating with Smithery.ai, ensure the deployment configuration points to the correct health check endpoint and port.
Additional notes
Tips and common considerations:
- Use a Gmail App Password instead of your main Gmail password for SMTP access.
- Ensure less secure apps access is not required if using App Passwords with OAuth2 flows handled by the server.
- The server exposes a /health endpoint for deployment monitoring; use it to verify readiness in your environment.
- If running behind a proxy or in a container orchestrator, confirm port mappings and network access to 0.0.0.0:5000.
- For development, you can override SMTP credentials via environment variables or a secure secret manager in production.
- When using Docker, pass SMTP_USERNAME and SMTP_PASSWORD as environment variables in docker run or via a compose file.
Related MCP Servers
mcp-vegalite
MCP server from isaacwasserman/mcp-vegalite-server
github-chat
A Model Context Protocol (MCP) for analyzing and querying GitHub repositories using the GitHub Chat API.
nautex
MCP server for guiding Coding Agents via end-to-end requirements to implementation plan pipeline
pagerduty
PagerDuty's official local MCP (Model Context Protocol) server which provides tools to interact with your PagerDuty account directly from your MCP-enabled client.
futu-stock
mcp server for futuniuniu stock
mcp -boilerplate
Boilerplate using one of the 'better' ways to build MCP Servers. Written using FastMCP