Skip to main content
Glama

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 start

Then 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.json

  • Windows: %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 email

  • threadId (required): The threadId of the original email

  • sender (required): The sender of the original email

  • subject (required): The subject of the original email

  • replyBody (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:

  1. Create a Notion Integration:

  2. 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 is abc123def456

  3. Update .env.local:

    NOTION_API_KEY=secret_abc123...
    NOTION_STYLE_GUIDE_PAGE_ID=abc123def456
  4. Rebuild and restart:

    pnpm build
    # Restart Claude Desktop

Security Notes

  • Never commit .env.local (contains sensitive credentials)

  • Uses gmail.readonly and gmail.compose OAuth scopes

  • Access 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:gmail

  • No emails returned: Check you have unread emails and Gmail API is enabled in Google Cloud Console

Demo

Available Tools

3 tools
create_draft_replyC

Create draft reply to an email in thread

ParametersJSON Schema
NameRequiredDescriptionDefault
messageIdYesThe messageId of the original email
threadIdYesThe threadId of the original email
senderYesThe sender of the original email
subjectYesThe subject of the original email
replyBodyYesThe draft reply

TDQS

C2.9/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions 'Create draft reply,' implying a write operation, but doesn't specify permissions needed, whether the draft is saved automatically, or any side effects. This is inadequate for a mutation tool with zero annotation coverage.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that directly states the tool's purpose without any wasted words. It's appropriately sized and front-loaded, making it easy for an agent to parse quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity as a write operation with no annotations and no output schema, the description is insufficient. It lacks details on behavioral traits, usage context, and expected outcomes, making it incomplete for effective agent use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema description coverage is 100%, so the input schema already documents all parameters thoroughly. The description adds no additional meaning beyond what's in the schema, such as explaining relationships between parameters like messageId and threadId. Baseline 3 is appropriate when the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Create draft reply') and resource ('to an email in thread'), making the purpose unambiguous. However, it doesn't differentiate from sibling tools like get_unread_emails, which is a different operation, so it doesn't fully distinguish from alternatives.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives or any prerequisites. It states what the tool does but offers no context for usage, leaving the agent to infer based on the tool name and parameters alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_style_guideB

Retrieves the email writing style guide from Notion

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

TDQS

B3.2/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states this is a retrieval operation, implying it's likely read-only and non-destructive, but doesn't confirm this or add context about permissions, rate limits, error handling, or what the return format looks like. For a tool with zero annotation coverage, this leaves significant behavioral gaps.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that front-loads the core purpose ('Retrieves the email writing style guide from Notion') with zero wasted words. Every element earns its place by specifying what is retrieved and from where, making it highly concise and well-structured.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's simplicity (0 parameters, no output schema, no annotations), the description is adequate but has clear gaps. It covers the basic purpose but lacks usage guidelines, behavioral context, and output details. For a retrieval tool with no structured support, it meets minimum viability but doesn't provide complete contextual understanding.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool has 0 parameters, and schema description coverage is 100% (though empty). The description doesn't need to compensate for any parameter documentation gaps. It appropriately focuses on the tool's purpose without unnecessary parameter details, earning a baseline score for parameterless tools.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb ('Retrieves') and resource ('email writing style guide from Notion'), making the purpose immediately understandable. It doesn't explicitly distinguish from sibling tools like 'get_unread_emails', but the specificity of 'style guide' versus 'unread emails' provides implicit differentiation. The description avoids tautology by not just restating the tool name.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'get_unread_emails' or 'create_draft_reply'. It doesn't mention prerequisites, context for retrieval, or any exclusions. The agent must infer usage based solely on the purpose statement without explicit direction.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_unread_emailsC

Retrieves unread emails from Gmail inbox with sender, subject, snippet, and thread information

ParametersJSON Schema
NameRequiredDescriptionDefault
maxResultsNoMaximum number of emails to retrieve (default: 10, max: 50)

TDQS

C2.9/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions the tool retrieves unread emails but doesn't cover important behavioral aspects like authentication requirements, rate limits, pagination behavior, error conditions, or whether this is a read-only operation. The description is insufficient for a tool that accesses email data.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that clearly communicates the core functionality. Every word earns its place, with no wasted verbiage or redundant information.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a tool that accesses sensitive email data with no annotations and no output schema, the description is incomplete. It doesn't address authentication, privacy implications, error handling, or what the return structure looks like. The agent would need to guess about important behavioral aspects.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema description coverage is 100%, with the single parameter 'maxResults' well-documented in the schema. The description doesn't add any parameter semantics beyond what's already in the schema, so it meets the baseline of 3 when the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb ('retrieves') and resource ('unread emails from Gmail inbox'), and specifies what information is included (sender, subject, snippet, thread). It doesn't explicitly differentiate from sibling tools, but the purpose is specific and unambiguous.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives, nor does it mention any prerequisites or context for usage. It simply states what the tool does without indicating when it's appropriate to invoke it.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. 3 tool updatesv1.0.0
    • First observedcreate_draft_reply
    • First observedget_style_guide
    • First observedget_unread_emails

TDQS

C2.9/5.0
Disambiguation3/5

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.

Naming Consistency4/5

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.

Tool Count2/5

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.

Completeness2/5

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.

Maintenance

ActivityInactive
ResponsivenessNo issues

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    D
    maintenance
    Enables 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.
    215
    MIT
  • F
    license
    Not graded
    quality
    D
    maintenance
    Enables 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.
    -
  • A
    license
    Not graded
    quality
    D
    maintenance
    Enables AI assistants to read unread Gmail emails and create draft replies, with optional NASA APOD integration.
    MIT

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/victormasson21/foundation-project-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server