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 or other MCP clients.
Claude Desktop Configuration
Add to your Claude Desktop config (claude_desktop_config.json):
Available MCP Tools
Tool | Description |
| Search emails with query |
| List unread emails by category |
| Get full email content |
| Generate categorized summary |
| Summary for one category |
| Current inbox statistics |
| List Gmail labels |
| Show configured categories |
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 (Phase 2)
Gmail labels modification
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: