Gmail MCP Server
Provides tools for sending emails, listing unread emails, retrieving emails by ID, archiving, trashing, and managing templates via the Gmail API. Supports App Password and OAuth2 authentication.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Gmail MCP ServerSend an email to friend@example.com with subject 'Hi' and body 'How are you?'"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Gmail MCP Server
A custom MCP server for sending emails through Gmail.
Features
Send custom emails (App Password or OAuth2)
Send professional introduction emails
Gmail configuration validation
Support for both App Password and OAuth2 authentication
HTML and text email support
List Gmail labels (OAuth2)
List unread emails with optional search query (OAuth2)
Retrieve a full email by ID (OAuth2)
Archive (remove from INBOX) or trash an email (OAuth2)
Simple template engine (Mustache) for reusable email content
Send email from template with variable substitution
Quick Setup
1. Install Dependencies
npm install2. Configure Gmail Authentication
Option A: App Password (Recommended for simplicity)
Go to your Google Account settings: https://myaccount.google.com/
Navigate to Security > 2-Step Verification (must be enabled)
Go to Security > 2-Step Verification > App passwords
Generate a new app password for "Mail"
Copy the 16-character password
Update your
.envfile:GMAIL_USER = example@example.com GMAIL_AUTH_METHOD=app_password GMAIL_APP_PASSWORD=your_16_character_password_here
Option B: OAuth2 (More secure, requires Google Cloud setup)
Create a project in Google Cloud Console
Enable Gmail API
Create OAuth2 credentials
Get refresh token
Update
.envwith OAuth2 credentials
GMAIL_CLIENT_ID=xxx
GMAIL_CLIENT_SECRET=xxx
GMAIL_REDIRECT_URI=https://developers.google.com/oauthplayground
GMAIL_REFRESH_TOKEN=xxxNote: Reading/listing/archiving/deleting emails REQUIRES OAuth2. Sending can still work with App Password only.
3. Test the Server
npm start4. Add to Claude MCP Config
Add this to your Claude MCP configuration file:
{
"mcpServers": {
"gmail": {
"command": "node",
"args": ["/Users/user/Desktop/gmail-mcp/index.js"],
"cwd": "/Users/user/Desktop/gmail-mcp"
}
}
}Usage Examples
Once configured in Claude:
"Send an introduction email to abc@gmail.com"
"Check if my Gmail configuration is working"
"Send an email to someone@example.com with subject 'Hello' and body 'Test message'"
"List unread emails"
"List unread emails with query 'from:recruiter'"
"Get email with id 18c5b9b1a2e3a4b5"
"Archive email with id 18c5b9b1a2e3a4b5"
"Delete email with id 18c5b9b1a2e3a4b5"
"List email templates"
"Send a template email to user@example.com using template introduction with variables {\"name\":\"Nasir\", \"recipientName\":\"Alex\"}"
### Template Emails
Templates live in the `templates/` directory. Each template is a `.txt` file and can optionally start with a `Subject:` line. Mustache-style placeholders (`{{variable}}`) are replaced using the `variables` object you pass.
Example command via MCP:
Send a template email to user@example.com using template follow_up with variables {"name":"Nasir","recipientName":"Alex","topic":"our earlier discussion"}
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/nasirhuss86/gmail-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server