Safe Gmail MCP
Provides tools for reading, searching, labeling, archiving, drafting emails, and managing labels in Gmail, with restrictions on sending (only to self) and no deletion.
Click on "Deploy 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., "@Safe Gmail MCPsearch my inbox for unread emails from last week"
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.
Safe Gmail MCP
A security-hardened Gmail MCP server for Claude Code. Supports reading, labeling, archiving, and drafting emails - but cannot send or delete.
Quick Start
git clone <this-repo>
cd safe-gmail-mcp
npm install
npm run initThe setup wizard will guide you through:
Creating Google Cloud OAuth credentials
Authenticating with your Gmail account
Configuring Claude Code
Related MCP server: mcp-gmail
Why This Exists
The original Gmail MCP has powerful capabilities that could be dangerous if misused:
Send emails (impersonation risk)
Delete emails (data loss)
Create filters (auto-forward/delete)
This fork removes those dangerous operations while keeping everything needed for email triage workflows.
What You Can Do
Tool | Description |
| Create a draft email (you send manually) |
| Send email to yourself only (for reminders) |
| Read email content by ID |
| Search with Gmail syntax |
| List all labels |
| Create a new label |
| Update a label |
| Delete a user-created label |
| Get existing or create new label |
| Add/remove labels from an email |
| Bulk label modifications |
| Save attachment to disk |
What You CANNOT Do
Send emails to others (only drafts)
Delete emails
Create filters
Commands
Command | Description |
| Interactive setup wizard |
| Re-authenticate (if token expires) |
| Check authentication status |
| Run the MCP server |
Manual Setup
If you prefer not to use the wizard:
1. Create Google Cloud OAuth Credentials
Go to Google Cloud Console
Create a new project
Enable the Gmail API: APIs & Services > Library > Gmail API > Enable
Configure OAuth consent screen:
User type: External
Add your email as a test user
Create credentials: Credentials > Create > OAuth Client ID > Desktop app
Download the JSON file
2. Set Up Credentials
mkdir -p ~/.safe-gmail-mcp
chmod 700 ~/.safe-gmail-mcp
mv ~/Downloads/client_secret_*.json ~/.safe-gmail-mcp/gcp-oauth.keys.json
chmod 600 ~/.safe-gmail-mcp/gcp-oauth.keys.json3. Authenticate
npm run auth4. Configure Claude Code
Add to your .mcp.json:
{
"mcpServers": {
"safe-gmail": {
"command": "node",
"args": ["/path/to/safe-gmail-mcp/src/index.js"],
"env": {
"GMAIL_OAUTH_PATH": "/Users/you/.safe-gmail-mcp/gcp-oauth.keys.json",
"GMAIL_CREDENTIALS_PATH": "/Users/you/.safe-gmail-mcp/credentials.json"
}
}
}
}Troubleshooting
"Gmail API has not been used"
Enable Gmail API: APIs & Services > Library > Gmail API > Enable
"Access denied" or 403 error
Add your email as a test user in the OAuth consent screen.
Token expired
Run npm run auth to re-authenticate.
Port already in use
The auth flow tries ports 3000, 3001, 3002. Close any apps using these ports.
Security
See SECURITY.md for detailed security design documentation.
License
ISC (inherited from original project)
Credits
This server cannot be deployed
Maintenance
Related MCP Connectors
A MCP server for Gmail that lets you search, read, and draft emails and replies.
Email safety MCP server. Detects phishing, prompt injection, CEO fraud for AI agents.
Email infrastructure for AI agents — send, receive, search, and reply to email over MCP.
MCP server connecting AI agents to 100+ apps (Gmail, Slack, Notion, GitHub) via one-click OAuth.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceA minimal MCP server that enables Claude to search, read, and manage Gmail messages and threads using official Google API libraries. It supports actions like sending emails, creating drafts, replying to threads, and managing labels through secure OAuth2 authentication.MIT
- AlicenseBqualityFmaintenanceMCP server that connects Claude with Gmail to read, send, delete, and manage messages and labels via the Google Gmail API.3MIT
- AlicenseNot gradedqualityDmaintenanceAn MCP server that lets Claude read, search, send, label, and manage your Gmail through OAuth2.MIT
- AlicenseNot gradedqualityDmaintenanceA secure MCP server that enables Claude to read, search, send, reply, forward, and manage Gmail messages and labels through natural language commands.62 npm1MIT