Gmail Headless
Free可远程托管的 Gmail 服务器,无需本地凭证或文件系统即可收发邮件。
FreeFree tier
About Gmail Headless
MCP Headless Gmail Server is a Model Context Protocol (MCP) server that enables sending and receiving Gmail messages without requiring local credential files or token setup. It runs completely headless in remote environments, supporting Docker containerization. Key advantages include decoupled architecture (credentials passed as context, not stored locally), focused Gmail-only functionality, and reliance on the well-maintained google-api-python-client library. Features include fetching recent emails, retrieving full email body in 1KB chunks, sending emails, and automatic token refresh.
Key Features
Get most recent emails from Gmail with first 1k characters of the body
Get full email body content in 1k chunks using offset parameter
Send emails through Gmail
Refresh access tokens separately with automatic refresh token handling
Docker-ready with one-click setup
Decoupled architecture: credentials passed as context, not stored locally
Built on google-api-python-client library
Pros & Cons
Pros
- Completely headless operation – no browser or local file access needed
- Decoupled architecture separates credential storage from server implementation
- Docker containerization provides isolated, environment-independent setup
- Focused solely on Gmail, ideal for use cases that don't need Calendar or other services
- Reliable dependencies on well-maintained google-api-python-client library
Cons
- Requires Google API credentials (client ID, secret, access/refresh tokens) to be provided
- Only supports Gmail – no integration with other Google services like Calendar
- Email body retrieval limited to 1k character chunks requiring offset parameter for full content
- No built-in search or filtering capabilities beyond most recent emails
- Credentials must be passed in each tool call, not as environment variables
Best For
Marketing applications requiring Gmail access without additional Google servicesRemote email automation in containerized environmentsHeadless email integration for AI agents or MCP clientsDecoupled credential management for enterprise deployments
FAQ
What is MCP Headless Gmail Server?
It is an MCP server that allows sending and receiving Gmail messages without needing to set up local credentials or tokens, designed for headless remote environments.
What are the prerequisites?
Python 3.10 or higher and Google API credentials (client ID, client secret, access token, and refresh token).
How do I run it with Docker?
Clone the repository, build the Docker image with 'docker build -t mcp-headless-gmail .', then run the image. Configuration examples for Claude Desktop are provided in the README.
How is credential management handled?
Credentials are passed as context in tool calls, not stored locally or passed as environment variables, maintaining separation between credential storage and server implementation.