- Home
- MCP servers
- Gmail
Gmail
- python
10
GitHub Stars
python
Language
6 months ago
First Indexed
2 months ago
Catalog Refreshed
Documentation & install
Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.
You deploy this MCP server to send emails via Gmail's SMTP using AI agents, fetch recent Gmail messages, handle attachments, and monitor health. It exposes an HTTP MCP endpoint you can reach to send actions and manage mail-related tasks in your workflow.
How to use
You will interact with the Gmail MCP Server through an MCP client by connecting to its MCP endpoint. Use the http-based MCP URL to send commands such as sending emails, listing recent messages, and handling attachments. The server provides a health check endpoint at /health to confirm deployment health.
Typical usage pattern: connect your MCP client to the Gmail MCP Server, authenticate using the configured Gmail credentials, and issue actions to send messages or fetch mail. Your client can leverage the server’s capabilities to compose emails, attach files, and retrieve recent Gmail messages from specified folders.
How to install
Prerequisites: you need Python 3 and pip installed on your system.
Step 1: Install dependencies.
pip install -r requirements.txt
Step 2: Set up Gmail credentials.
export SMTP_USERNAME="your-email@gmail.com"
export SMTP_PASSWORD="your-app-password"
Step 3: Run the server locally.
python gmail_mcp.py
Step 4: Optional Docker deployment.
docker build -t gmail-mcp .
docker run -p 5000:5000 -e SMTP_USERNAME=your-email -e SMTP_PASSWORD=your-password gmail-mcp
Additional notes
The server is configured for deployment on Smithery.ai using a Streamable HTTP transport and runs on port 5000 binding to all interfaces (0.0.0.0) for container scenarios.
Environment variables shown for local setup include SMTP_USERNAME and SMTP_PASSWORD. Your MCP client will call the endpoint at http://localhost:8989/mcp for the remote configuration or the local endpoint configured in your environment.
Configuration and endpoints
MCP connection is exposed via an HTTP endpoint that the client can reach. The following remote MCP URL is used for the Gmail MCP Server:
http://localhost:8989/mcp (gmail_mcp) with no additional runtime arguments required for the HTTP connection.
Security and health
Keep Gmail credentials secure. Use app-specific passwords and rotate credentials as needed. The server provides a health endpoint at /health to confirm operational status for deployment monitoring.
Available tools
send_email
Sends an email via Gmail SMTP with subject, body, and optional attachments.
fetch_emails
Fetches recent emails from Gmail folders and returns metadata or full message bodies as needed.
handle_attachments
Attaches files to outgoing emails and processes incoming attachments when fetching messages.
health_check
Health check endpoint at /health to monitor deployment status.