MCP server for Gmail email management
## Gmail MCP Server: Email Integration The **Gmail MCP Server** integrates Gmail's email platform into Google Antigravity. This enables reading, sending, and managing emails programmatically for automation, notifications, and email-based workflows. ### Why Gmail MCP? Gmail is ubiquitous: - **1.8B Users**: Massive user base - **Google Workspace**: Enterprise integration - **Labels**: Powerful organization - **Search**: Google-quality search - **APIs**: Comprehensive REST API ### Key Features #### 1. Send Email ```python from google.oauth2.credentials import Credentials from googleapiclient.discovery import build import base64 from email.mime.text import MIMEText creds = Credentials.from_authorized_user_file("token.json") service = build("gmail", "v1", credentials=creds) def send_email(to, subject, body): message = MIMEText(body) message["to"] = to message["subject"] = subject raw = base64.urlsafe_b64encode(message.as_bytes()).decode() service.users().messages().send( userId="me", body={"raw": raw} ).execute() ``` #### 2. Read Email ```python # List recent messages results = service.users().messages().list( userId="me", q="is:unread from:important@example.com", maxResults=10 ).execute() for msg in results.get("messages", []): message = service.users().messages().get( userId="me", id=msg["id"] ).execute() # Parse headers headers = {h["name"]: h["value"] for h in message["payload"]["headers"]} print(f"Subject: {headers.get('Subject')}") ``` #### 3. Labels and Filters ```python # Create label label = service.users().labels().create( userId="me", body={"name": "Automated"} ).execute() # Apply label to messages service.users().messages().modify( userId="me", id=message_id, body={"addLabelIds": [label["id"]]} ).execute() ``` ### Configuration ```json { "mcpServers": { "gmail": { "command": "npx", "args": ["-y", "@anthropic/mcp-gmail"], "env": { "GMAIL_CREDENTIALS_PATH": "~/.config/gmail/credentials.json", "GMAIL_TOKEN_PATH": "~/.config/gmail/token.json" } } } } ``` ### Use Cases **Email Automation**: Auto-respond to specific emails. **Report Distribution**: Send automated reports via email. **Email Monitoring**: Watch for important incoming messages. The Gmail MCP Server brings Gmail automation to Antigravity.
{
"mcpServers": {
"gmail": {
"mcpServers": {
"gmail": {
"args": [
"-y",
"@gongrzhe/server-gmail-autoauth-mcp"
],
"command": "npx"
}
}
}
}
}