Gmail MCP Server
A Gmail integration for Cursor IDE that enables email management, collaborative drafting, and AI-powered email composition.
README
Gmail MCP Server
A comprehensive Gmail integration for Cursor IDE that provides email management, collaborative drafting, and intelligent email crafting capabilities.
Features
- Email Management: Read, reply, archive, delete emails
- Collaborative Drafting: Create, review, and edit drafts before sending
- Smart Email Crafting: AI-powered email composition with your personal style
- Bulk Operations: Efficiently manage multiple emails
- Web UI: Clean, modern interface for email management
- Search & Filter: Advanced Gmail search capabilities
Setup
1. Google OAuth Credentials
- Create Google OAuth Desktop credentials in Google Cloud Console
- Add redirect URI:
http://127.0.0.1:53682/oauth2callback - Provide credentials via environment variables or config file
2. Cursor Configuration
Register in ~/.cursor/mcp.json:
{
"mcpServers": {
"gmail": {
"command": "node",
"args": ["/Users/danny/development/mcp-servers/mcp-gmail/index.js"],
"env": {
"GOOGLE_CLIENT_ID": "<your_client_id>",
"GOOGLE_CLIENT_SECRET": "<your_client_secret>"
}
}
}
}
Configuration
Auto-Labeling Rules
Auto-labeling rules are stored in auto-labeling-rules.json within the project directory. This file contains:
- Rule definitions with search criteria
- Enable/disable status for each rule
- Creation and last-run timestamps
- Version control metadata
Tools
Authentication
start_oauth({ port? })- Start OAuth flow, returns authorization URLauth_status()- Check current authentication status
Email Reading
list_unread({ max? })- List recent unread emailslist_recent_unread({ days?, max? })- List recent unread emails in table format (default: 7 days)get_message({ id })- Get full message contentsearch_emails({ query, max? })- Search emails with Gmail syntax
list_recent_unread Method
This new method provides a clean table format for viewing recent unread emails:
Parameters:
days(string, optional): Number of days to look back. Supports multiple formats:"2"- 2 days"3d"- 3 days"2 days"- 2 days"--2"- 2 days- Default:
"7"(7 days)
max(number, optional): Maximum emails to return (default: 50, max: 100)
Output Format:
| ID | Date | Sender | Subject |
|---|---|---|---|
| 1 | 18/09 16:56 | Dumith Salinda (GitHub) | Re: [pixeltoplanet/carbonfooter-plugin] feat(cache) |
| 2 | 18/09 21:40 | Ivan at Notion | Notion 3.0: Agents |
**Total: 2 unread emails**
Examples:
list_recent_unread()- Last 7 days, max 50 emailslist_recent_unread({days: "2"})- Last 2 dayslist_recent_unread({days: "3d", max: 20})- Last 3 days, max 20 emails
Email Management
mark_as_read({ id })- Mark message as readbatch_archive({ ids[] })- Archive multiple messagesbatch_delete({ ids[], permanent? })- Delete multiple messagesdelete_email({ id, permanent? })- Delete single emaildelete_emails_by_query({ query, max?, permanent?, dry_run? })- Delete emails by search querybulk_delete_emails({ query, batch_size?, permanent?, dry_run? })- High-performance bulk delete
Email Composition
reply_to_message({ message_id, body })- Send immediate replycreate_draft({ to, subject, body, html?, reply_to_message_id? })- Create draft emailget_draft({ draft_id })- Review draft contentlist_drafts({ max? })- List all draftsupdate_draft({ draft_id, to?, subject?, body?, html? })- Update existing draftsend_draft({ draft_id })- Send draft emaildelete_draft({ draft_id })- Delete draft
User Interface
start_ui({ port?, query?, max? })- Launch web UI at http://127.0.0.1:53750/stop_ui()- Stop the web UI server
Auto-Labeling Rules Management
list_auto_labeling_rules()- List all stored auto-labeling rulesadd_auto_labeling_rule({ label_name, sender_pattern?, subject_pattern?, query?, enabled? })- Add new auto-labeling ruleremove_auto_labeling_rule({ rule_index })- Remove rule by indexupdate_auto_labeling_rule({ rule_index, label_name?, sender_pattern?, subject_pattern?, query?, enabled? })- Update existing rulerun_auto_labeling_rules({ dry_run?, max_per_rule? })- Execute all enabled rulesexport_auto_labeling_rules({ file_path? })- Export rules to JSON fileimport_auto_labeling_rules({ file_path, merge? })- Import rules from JSON file
Automated Scheduler
start_scheduler({ recent_unread_interval?, auto_labeling_interval? })- Start automated schedulerstop_scheduler()- Stop the automated schedulerget_scheduler_status()- Get current scheduler status and configuration
Scheduler Features
The scheduler automatically runs two key functions at configurable intervals while the server is running:
- Recent Unread Check: Runs
list_recent_unreadto monitor new emails - Auto-Labeling: Runs
run_auto_labeling_rulesto apply labeling rules
Default Intervals:
- Recent Unread: 5 minutes (300,000ms)
- Auto-Labeling: 15 minutes (900,000ms)
Usage Examples:
// Start with default intervals
start_scheduler()
// Start with custom intervals (1 minute and 5 minutes)
start_scheduler({
recent_unread_interval: 60000, // 1 minute
auto_labeling_interval: 300000 // 5 minutes
})
// Check status
get_scheduler_status()
// Stop scheduler
stop_scheduler()
Scheduler Benefits:
- Continuous Monitoring: Automatically checks for new emails
- Automatic Organization: Applies labeling rules without manual intervention
- Server-Only: Only runs while the MCP server is active
- Configurable: Adjust intervals based on your needs
- Error Handling: Continues running even if individual operations fail
- Logging: All scheduler activity is logged to stderr for monitoring
Usage
Basic Workflow
- Call
start_oauthand authorize in browser - Use
list_unreadorsearch_emailsto find emails - Use
get_messageto read full content - Use
reply_to_messagefor quick replies orcreate_draftfor collaborative writing
Collaborative Email Crafting
create_draft- Start with basic contentget_draft- Review the draftupdate_draft- Refine the content togethersend_draft- Send when perfect
Web Interface
- Call
start_uito open the modern web interface - Browse emails, select multiple items, perform bulk actions
- Rich text editor for composing replies
Danny's Email Writing Style & Templates
Based on analysis of 30 recent sent emails
Writing Style Preferences
- Tone: Conversational yet professional, direct and honest
- Language: Dutch (80% of emails) for personal/business relationships, English for international/technical contexts
- Structure: Clear problem-solution format, bullet points for achievements, short paragraphs
- Sign-off: "Met vriendelijke groet, Danny Moons" (standard)
- Signature: Always includes email (danny@moonsio.nl) and phone (0628509910)
Actual Email Patterns
Opening Styles
- Dutch Personal: "Hoi [Name]," (most common)
- English: "Hi [Name]," (international/technical)
- Casual: "Hey [Name]," (close business relationships)
Content Structure
- Problem Identification: Clear explanation of issues
- Solution-Oriented: Always provides actionable next steps
- Educational Approach: Explains what went wrong and how to prevent it
- Collaborative Tone: "Laten we samen bepalen wat prioriteit heeft"
- Timeline Management: Clear expectations ("na mijn vakantie", "begin oktober")
Closing Patterns
- Standard: "Met vriendelijke groet, Danny Moons"
- Contact Info: Always includes email and phone
- Personal Touch: "Ik hoor het graag" / "Ik hoor graag wat je ervan vind"
- Confirmation Requests: "Kun je controleren of het zo goed staat?"
Email Templates
Dutch Personal Template (Based on Actual Usage)
Hoi {name},
{personal greeting and context}
{main content with bullet points for achievements}
Wat we hebben bereikt:
• {achievement 1}
• {achievement 2}
• {achievement 3}
Ik hoor graag wat je ervan vind.
Met vriendelijke groet,
Danny Moons
E: danny@moonsio.nl
T: 0628509910
Dutch Business Template (Based on Actual Usage)
Hoi {name},
{problem identification and context}
{clear solution or next steps}
{timeline or expectations}
Ik hoor het graag. Voor nu alvast een fijn weekend en ik spreek je ongetwijfeld na mijn korte vakantie.
Met vriendelijke groet,
Danny Moons
E: danny@moonsio.nl
T: 0628509910
Technical Support Template
Hi {name},
Waarschijnlijk heb je {issue} per ongeluk {cause}, waardoor {symptom}. Ik heb het nu {solution} door {action}. Kun je controleren of het zo goed staat?
Wil je dat ik nog andere {items} aanpas of is dit voldoende voor nu?
Met vriendelijke groet,
Danny Moons
E: danny@moonsio.nl
T: 0628509910
Out of Office Template (Actual Template Used)
Hoi hoi,
Bedankt voor je bericht. Op dit moment ben ik met vakantie en vanaf 30 september ben ik weer bereikbaar en pak ik mijn werkzaamheden op.
Tot snel!
Met vriendelijke groet,
Danny Moons
E: danny@moonsio.nl
T: 0628509910
Communication Guidelines for AI Assistant
When helping Danny craft emails:
- Language Selection: Use Dutch for 80% of communications, English only for international/technical contexts
- Tone Matching: Match Danny's conversational yet professional, direct and honest style
- Structure: Use bullet points for achievements, problem-solution format, short paragraphs
- Personalization: Include personal context ("na mijn vakantie"), acknowledge challenges ("Helemaal soepel ging het niet")
- Signature: Always include full contact details (email + phone)
- Proactivity: Offer solutions before being asked, be solution-oriented
- Confirmation: Ask for confirmation ("Kun je controleren of het zo goed staat?")
- Timeline Management: Set clear expectations about availability and deadlines
Email Formatting Rules
IMPORTANT: When creating emails or drafts:
-
{signature} Placeholder: When user mentions
{signature}, always replace with the complete signature:Met vriendelijke groet, Danny Moons E: danny@moonsio.nl T: 0628509910 -
Proper Email Structure: Always create complete, professional emails with:
- Appropriate greeting (Hoi/Hi + name)
- Clear, well-formatted body content
- Complete signature with contact details
- Proper line breaks and spacing
-
Language Corrections: fix typos and make sure to use correct sentences.
-
Draft Quality: Ensure drafts are ready to send without additional editing
Email Categories & Approaches (Based on Actual Usage)
- Technical Support: Problem identification → Solution explanation → Confirmation request
- Business Communication: Transparent pricing, clear timelines, professional boundaries
- Personal Updates: Achievement sharing with bullet points, storytelling elements
- Project Management: Collaborative decision-making, priority setting
- Client Relations: Educational approach, proactive problem-solving
- Vacation Management: Clear out-of-office with return dates
Key Writing Characteristics Observed
- Efficiency: Gets to the point quickly without unnecessary fluff
- Empathy: Acknowledges challenges and difficulties honestly
- Proactivity: Offers solutions and next steps before being asked
- Personalization: Adapts tone based on relationship (formal vs casual)
- Professionalism: Maintains business standards while being approachable
- Educational: Explains technical issues in understandable terms
- Collaborative: Uses inclusive language ("laten we samen", "ik hoor het graag")
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.