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")
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。