Provides read-only access to Gmail inbox with natural language search, email categorization, daily summaries organized by category (Navy, Kids, Financial, Action Items), and inbox statistics.
Uses Google Cloud Console for OAuth credential management and Gmail API access configuration to authenticate and interact with Gmail services.
Exposes REST API endpoints for Home Assistant sensors to monitor unread email counts by category, trigger daily summary notifications via webhooks, and integrate Gmail data into Home Assistant automations.
Gmail MCP Server
A Model Context Protocol (MCP) server for Gmail that provides natural language interaction with your inbox, daily summaries organized by category, and Home Assistant integration.
Features
š Natural Language Search - Search emails using plain language or Gmail query syntax
š Category-Based Summaries - Automatic categorization: Navy, Kids, Financial, Action Items
š± Home Assistant Integration - REST API with sensors and notifications support
š³ Docker Support - Easy deployment with Docker Compose
š Read-Only - Currently read-only access to your inbox (safe!)
Quick Start
1. Google Cloud Setup
Go to Google Cloud Console
Create a new project or select existing
Enable the Gmail API:
Navigate to "APIs & Services" ā "Enable APIs"
Search for "Gmail API" and enable it
Create OAuth credentials:
Go to "APIs & Services" ā "Credentials"
Click "Create Credentials" ā "OAuth client ID"
Choose "Web application" (or "Desktop app")
For Web application, add
http://localhost:8080to Authorized redirect URIsCopy the Client ID and Client Secret
2. Configuration
3. Initial Authentication (OAuth)
For the first-time setup, you need to authenticate with Google:
This will:
Open a browser window for Google authentication
Request permission to read your Gmail
Save the OAuth token to
./credentials/token.json
4. Start the Server
The REST API will be available at http://localhost:8000
API Endpoints
Health & Status
Endpoint | Description |
| Health check with auth status |
| Inbox statistics |
Email Data (for Home Assistant Sensors)
Endpoint | Description |
| Total unread count |
| Unread count per category |
Summaries
Endpoint | Description |
| Full daily summary (JSON) |
| Daily summary as text |
| Category-specific summary |
Home Assistant Integration
Endpoint | Description |
| Send summary to HA webhook |
Home Assistant Configuration
REST Sensors
Add to your configuration.yaml:
Template Sensors (from attributes)
Automation: Daily Summary Notification
Webhook Integration
Configure in your .env:
Then create an automation triggered by the webhook:
MCP Server Usage
The MCP server can be used with Claude Desktop, Home Assistant, or other MCP clients via SSE transport.
Claude Desktop Configuration
Add to your Claude Desktop config (claude_desktop_config.json):
Home Assistant MCP Integration
The server exposes SSE endpoints for MCP connections:
/mcp/sse- Primary MCP SSE endpoint/sse- Alias endpoint for Home Assistant compatibility
Available MCP Tools
Tool | Description |
| Search emails with query and optional filters |
| Get full email content by ID |
| List unread emails with optional category filter |
| Generate categorized daily summary |
| Summary for a specific category |
| Current inbox statistics |
| List all Gmail labels |
| Create a new Gmail label |
| Delete a Gmail label |
| Show configured categories |
| Mark specific emails as read by IDs |
| Mark emails matching a query as read |
| Send an email (plain text or HTML) |
| Add labels to messages |
| Remove labels from messages |
Example Queries
"What unread emails do I have about Navy?"
"Show me my daily email summary"
"Are there any action items I need to handle?"
"Search for emails from the school"
"What financial emails came in this week?"
Customizing Categories
Edit config/categories.yaml to customize email categorization:
Matcher Types
senders: Partial match on sender email/name
subjects: Partial match on subject line
labels: Exact match on Gmail labels
Development
Local Setup (without Docker)
Running Tests
Architecture
Roadmap
Read-only email access
Category-based summaries
Home Assistant REST API
Docker deployment
Email sending
Gmail labels management (create, delete, add to messages, remove from messages)
Mark emails as read
SSE transport with session isolation
Gemini-compatible tool schemas
Scheduled summary notifications
IMAP fallback option
License
MIT License
Troubleshooting
OAuth Token Expired
Container Won't Start
Check that credentials exist:
Home Assistant Can't Connect
Ensure the container is on the same Docker network or use the host IP: