Headless Gmail MCP Server
Secure, headless Gmail automation for cloud and container environments. Send, receive, and manage emails in your AI workflows with streamlined credential management.

What does “Headless Gmail” MCP Server do?
The Headless Gmail MCP Server is a Model Context Protocol (MCP) server that enables seamless interaction with Gmail accounts for sending and retrieving emails, all without the need for local credential or token setup. Designed for headless and remote operation, it allows clients to complete OAuth flows independently and pass credentials securely as context, making it possible to run in fully containerized or cloud environments without local file access or browser interaction. This server is ideal for workflows that need focused, reliable Gmail access—such as marketing automation or notification systems—by exposing standardized tools through the MCP interface for email management and integration into AI-powered development pipelines.
List of Prompts
No specific prompt templates are mentioned in the repository.
List of Resources
No explicit MCP resources are described in the available documentation or code.
List of Tools
- Get recent emails
Retrieves the most recent emails from a Gmail account, returning the first 1,000 characters of the email body. - Get full email body
Fetches the full content of an email in 1,000-character chunks using an offset parameter, allowing for large email retrieval. - Send email
Sends emails through the connected Gmail account. - Refresh access token
Handles token refreshes independently, ensuring ongoing secure access.
Use Cases of this MCP Server
- Automated Email Notifications
Integrate with AI agents or automation platforms to send real-time email alerts or notifications without manual intervention. - Gmail Inbox Monitoring
Fetch and process the latest emails to automate responses, triage, or extract information for downstream workflows. - Marketing Campaign Automation
Send personalized marketing emails programmatically, leveraging MCP for scalable, credential-separated campaign execution. - Seamless API Integration
Embed Gmail operations into developer environments or other MCP-aware platforms without exposing or managing local credentials. - Remote/Cloud Email Management
Manage Gmail accounts within Dockerized or remote setups, enabling secure, headless operation without local dependencies.
How to set it up
Windsurf
- Ensure you have Node.js and Windsurf installed.
- Open your configuration file (e.g.,
windsurf.json
). - Add the Headless Gmail MCP Server to the
mcpServers
section:{ "mcpServers": { "headless-gmail": { "command": "npx", "args": ["@baryhuang/mcp-headless-gmail@latest"] } } }
- Save changes and restart Windsurf.
- Verify the server is running from the Windsurf dashboard.
Securing API Keys
Use environment variables to pass credentials securely:
{
"mcpServers": {
"headless-gmail": {
"command": "npx",
"args": ["@baryhuang/mcp-headless-gmail@latest"],
"env": {
"GMAIL_CLIENT_ID": "...",
"GMAIL_CLIENT_SECRET": "...",
"GMAIL_ACCESS_TOKEN": "...",
"GMAIL_REFRESH_TOKEN": "..."
}
}
}
}
Claude
- Install Claude and ensure Node.js is available.
- Edit the configuration file (e.g.,
claude.json
). - Add the server:
{ "mcpServers": { "headless-gmail": { "command": "npx", "args": ["@baryhuang/mcp-headless-gmail@latest"] } } }
- Save and restart Claude.
- Check for server status within Claude’s interface.
Securing API Keys
Use the env
key as above to securely inject credentials.
Cursor
- Ensure Cursor is installed and up-to-date.
- Open Cursor’s settings or configuration file.
- Insert the MCP server entry:
{ "mcpServers": { "headless-gmail": { "command": "npx", "args": ["@baryhuang/mcp-headless-gmail@latest"] } } }
- Save and restart Cursor.
- Confirm the MCP server is detected.
Securing API Keys
Configure credentials using the env
section as shown previously.
Cline
- Install Cline and dependencies.
- Open the Cline configuration file.
- Add the MCP server:
{ "mcpServers": { "headless-gmail": { "command": "npx", "args": ["@baryhuang/mcp-headless-gmail@latest"] } } }
- Save changes, then restart Cline.
- Ensure server connectivity via Cline’s tools.
Securing API Keys
Pass API credentials using environment variables in the configuration as in previous examples.
How to use this MCP inside flows
Using MCP in FlowHunt
To integrate MCP servers into your FlowHunt workflow, start by adding the MCP component to your flow and connecting it to your AI agent:

Click on the MCP component to open the configuration panel. In the system MCP configuration section, insert your MCP server details using this JSON format:
{
"headless-gmail": {
"transport": "streamable_http",
"url": "https://yourmcpserver.example/pathtothemcp/url"
}
}
Once configured, the AI agent is now able to use this MCP as a tool with access to all its functions and capabilities. Remember to change “headless-gmail” to whatever the actual name of your MCP server is (e.g., “github-mcp”, “weather-api”, etc.) and replace the URL with your own MCP server URL.
Overview
Section | Availability | Details/Notes |
---|---|---|
Overview | ✅ | |
List of Prompts | ⛔ | No prompt templates found |
List of Resources | ⛔ | No resources described |
List of Tools | ✅ | Found in features and README |
Securing API Keys | ✅ | Described in setup |
Sampling Support (less important in evaluation) | ⛔ | Not mentioned |
Our opinion
Based on the available information, the Headless Gmail MCP Server is highly focused and easy to integrate, with clear instructions for most platforms and robust Docker/headless support. However, it lacks explicit prompt templates and resource definitions, which may limit some advanced MCP features. Its strengths lie in simplicity, security, and real-world utility for email-focused automation. Overall, it’s practical and reliable for its intended use, but not as feature-complete as some other MCP servers.
MCP Score
Has a LICENSE | ✅ (MIT) |
---|---|
Has at least one tool | ✅ |
Number of Forks | 22 |
Number of Stars | 39 |
Frequently asked questions
- What is the Headless Gmail MCP Server?
It’s a Model Context Protocol (MCP) server that enables secure, headless access to Gmail for sending and retrieving emails without local token or browser setup. It's ideal for remote, cloud, and containerized email automation.
- What tools are included in this MCP server?
It can get recent emails, fetch full email bodies (in chunks), send emails, and refresh access tokens automatically.
- How do I securely manage credentials?
Use environment variables in your configuration files to inject API keys and tokens, keeping sensitive information out of your codebase.
- What are typical use cases?
Automated email notifications, inbox monitoring, marketing campaign automation, API integrations, and Gmail management in containerized/cloud setups.
- Does it support prompt templates or advanced resources?
No explicit prompt templates or resource definitions are currently provided, focusing on core email automation tools.
Try Headless Gmail MCP with FlowHunt
Automate your Gmail workflows securely and efficiently with FlowHunt’s Headless Gmail MCP Server. Perfect for notifications, marketing, and AI-powered email automation.