Gmail MCP Server
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Gmail MCP Server Show my unread emails and draft a reply using our style guide"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Gmail MCP Server
An MCP (Model Context Protocol) server that allows AI assistants to read unread emails from a Gmail account.
Features
OAuth 2.0 Authentication: Secure access to Gmail with user consent
Read Unread Emails: Fetch unread emails with sender, subject, snippet, and thread information
Create Draft Replies: Compose draft responses to emails while maintaining thread continuity
Style Guide Integration: Pull email writing guidelines from Notion to ensure consistent, professional communication
Related MCP server: Gmail MCP Server
Quick Start
# 1. Install dependencies
pnpm install
# 2. Build the server
pnpm build
# 3. Set up OAuth - follow the prompts (once)
pnpm setup:gmail
# 4. Get your MCP configuration (once)
./get-config.sh
# 5. (Optional) Set up Notion integration for style guides
# Add to .env.local:
# NOTION_API_KEY=your_notion_api_key
# NOTION_STYLE_GUIDE_PAGE_ID=your_page_id
# 6. Run the MCP server
pnpm startThen add the configuration to Claude Desktop and restart the app!
MCP Configuration
Run ./get-config.sh to get your configuration, then add it to your Claude Desktop config file:
macOS:
~/Library/Application Support/Claude/claude_desktop_config.jsonWindows:
%APPDATA%\Claude\claude_desktop_config.json
Configuration format:
{
"mcpServers": {
"gmail": {
"command": "node",
"args": [
"/absolute/path/to/foundation-project-mcp/dist/emailServer.js"
]
}
}
}Available Tools
get_unread_emails
Retrieves unread emails from the Gmail inbox.
Parameters:
maxResults(optional): Maximum number of emails to retrieve (default: 10, max: 50)
Example prompts: "Show me my unread emails" • "What unread emails do I have?" • "Get my recent unread messages"
create_draft_reply
Creates a draft reply to an email in a thread.
Parameters:
messageId(required): The messageId of the original emailthreadId(required): The threadId of the original emailsender(required): The sender of the original emailsubject(required): The subject of the original emailreplyBody(required): The draft reply content
get_style_guide
Retrieves the email writing style guide from Notion (if configured).
Parameters: None
Returns: Email writing guidelines and best practices from your Notion page
Example prompts
"Show me my unread emails"
"What unread emails do I have?"
"Get my recent unread messages"
"Get the email style guide and then draft a response to my latest unread email"
"Create a draft reply to this email saying..."
"Draft a response to the email from [sender]"
"Draft a response to important unread emails following our style guide"
Scroll down for screenshots of some of these prompts in action.
Notion Setup (Optional)
To enable the style guide feature:
Create a Notion Integration:
Click "New integration"
Give it a name (e.g., "Gmail MCP Server")
Copy the "Internal Integration Token"
Create a Style Guide Page:
Create a new page in Notion with your email writing guidelines
Click "Share" and invite your integration
Copy the page ID from the URL (the part after the page name and before the
?)Example:
https://notion.so/Email-Style-Guide-abc123def456→ Page ID isabc123def456
Update
.env.local:NOTION_API_KEY=secret_abc123... NOTION_STYLE_GUIDE_PAGE_ID=abc123def456Rebuild and restart:
pnpm build # Restart Claude Desktop
Security Notes
Never commit
.env.local(contains sensitive credentials)Uses
gmail.readonlyandgmail.composeOAuth scopesAccess tokens auto-refresh when expired
Email headers are sanitised to prevent injection attacks
Notion integration token should be kept secure and never shared
Troubleshooting
Invalid credentials / Token errors: Re-run
pnpm setup:gmailNo emails returned: Check you have unread emails and Gmail API is enabled in Google Cloud Console
Demo
Available Tools
3 toolscreate_draft_replyC
Create draft reply to an email in thread
Inputs: messageId (required), threadId (required), sender (required), subject (required), +1 more.
get_style_guideB
Retrieves the email writing style guide from Notion
Inputs: no named parameters.
get_unread_emailsC
Retrieves unread emails from Gmail inbox with sender, subject, snippet, and thread information
Inputs: maxResults.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 3 tools
The tools have distinct purposes (draft replies, get style guide, get unread emails), but 'create_draft_reply' and 'get_unread_emails' could be confused as both relate to email handling, while 'get_style_guide' stands apart as a Notion resource. Some overlap exists in the email domain, but descriptions help clarify boundaries.
The naming follows a consistent verb_noun pattern (create_draft_reply, get_style_guide, get_unread_emails) with 'get' used for two tools and 'create' for one. This is mostly consistent with minor deviations, as the verbs align well with the actions described.
With only 3 tools for a Gmail server, the count feels too thin for the apparent scope. A Gmail domain typically requires more operations like sending emails, managing labels, or searching beyond unread emails, making this set under-scoped and likely incomplete.
There are significant gaps in the tool surface for a Gmail server. Missing core operations include sending emails, searching emails beyond unread, managing labels or folders, and accessing full email content. This will cause agent failures when trying to perform common email tasks.
Related MCP Connectors
Manage Gmail end-to-end: search, read, send, draft, label, and organize threads. Automate workflow…
Email for AI agents: read, search and send from your Gmail, Outlook, Yahoo, iCloud or IMAP inbox.
Connect Gmail, iCloud Mail, Outlook, Yahoo Mail, Fastmail and other IMAP inboxes to ChatGPT, Claude and compatible AI assistants. Find emails by meaning across languages with semantic search. Ask AI to find customer conversations, summarize deadlines and draft follow-ups. Give a sales rep access to a shared outreach inbox or bring email into a compatible CRM. Share an iCloud custom-domain inbox with teammates without their own Apple ID or iCloud+ plan. Search results may be incomplete or stale; separate permissions control mail actions.
Connect any mailbox to Claude, ChatGPT & AI: read, send, reply, schedule & search emails.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceEnables AI assistants to manage Gmail by reading unread emails with automatic classification, creating AI-generated draft replies, and saving drafts directly to Gmail through the Gmail API.-
- FlicenseNot gradedqualityDmaintenanceEnables AI assistants to interact with Gmail accounts for reading unread emails, creating draft replies with proper threading, and managing messages, with optional professional writing guidelines, templates, and Google Docs/Calendar integration.-
- FlicenseNot gradedqualityDmaintenanceEnables AI assistants to read unread Gmail messages and create properly threaded draft replies through the Gmail API, allowing natural language email management while keeping drafts for manual review before sending.-
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to read unread Gmail emails and create draft replies, with optional NASA APOD integration.MIT