Skip to main content
Glama
Warrenn

gmail-mcp

by Warrenn

gmail-mcp

A local stdio MCP server that gives your local Claude clients these Gmail tools:

Tool

What it does

send_email

Send mail from your Gmail/Workspace address (plain or HTML, cc/bcc). Every send is logged.

search_emails

Search Gmail (has:attachment from:bob newer_than:7d…) and return message summaries including attachment metadata.

download_attachment

Pull an attachment from a message and upload it to your Google Drive, returning the Drive link.

download_attachment_local

Pull an attachment from a message and save it to a local directory (dest_dir, expanded and created if absent), returning the saved file path.

Design

  • Local stdio — no public endpoint, no OAuth-for-callers, no server to host. Runs as a subprocess of your Claude client.

  • Single Google account for both Gmail and Drive.

  • Least-privilege scopesgmail.send, gmail.readonly, drive.file (the app only ever sees Drive files it created).

  • Credentials in AWS SSM — the refresh token lives in an SSM SecureString and is fetched at launch; nothing is written to disk. Requires AWS credentials at runtime (e.g. an AWS_PROFILE).

  • Attachments upload into a Drive folder named Gmail Attachments by default (created on first use; override per call with the drive_folder argument).

Related MCP server: Gmail Local MCP

Prerequisites

  • uv (manages Python 3.12 + deps).

  • AWS credentials with read/write access to the SSM parameter (any standard method — AWS_PROFILE, env vars, instance role). A region from your AWS config, env AWS_REGION, or GMAIL_MCP_AWS_REGION.

  • A Google Cloud project with the Gmail API and Google Drive API enabled (Console → APIs & Services → Library).

  • A Google OAuth client of type "Desktop app" — download its client_secret.json (Console → APIs & Services → Credentials).

One-time setup: mint the token

Runs a browser consent for the three scopes and stores the credentials in SSM (default param /gmail-mcp/authorized-user-json).

cd /path/to/gmail-mcp

# Using a downloaded Desktop client_secret.json:
AWS_PROFILE=<your-aws-profile> \
  uv run python scripts/mint_token.py --client-secrets-file /path/to/client_secret.json

# ...or reuse an existing Google token already in SSM (its client_id/secret):
AWS_PROFILE=<your-aws-profile> \
  uv run python scripts/mint_token.py --client-secrets-ssm-param /path/to/existing-token

A browser window opens — approve access for the intended account. On success the token is written to SSM and the server can run.

Register with your Claude client(s)

Replace /path/to/gmail-mcp and <your-aws-profile> with your values.

Claude Code

claude mcp add gmail-mcp -s user \
  -e AWS_PROFILE=<your-aws-profile> \
  -- uv run --directory /path/to/gmail-mcp gmail-mcp

Claude Desktop

Add to ~/Library/Application Support/Claude/claude_desktop_config.json (macOS):

{
  "mcpServers": {
    "gmail-mcp": {
      "command": "uv",
      "args": ["run", "--directory", "/path/to/gmail-mcp", "gmail-mcp"],
      "env": { "AWS_PROFILE": "<your-aws-profile>" }
    }
  }
}

Restart Claude Desktop after editing. The three tools appear under the gmail-mcp server.

Usage examples (things to ask Claude)

  • "Email alice@example.com with the subject 'Lunch?' and body 'Free tomorrow at 1?'"

  • "Search my Gmail for emails with attachments from the last week."

  • "Download the PDF attached to that invoice email into my Drive."

Configuration

Variable

Default

Purpose

AWS_PROFILE (or any AWS cred)

AWS credentials used to read the token from SSM

GMAIL_MCP_AWS_REGION

standard AWS config

Region of the SSM parameter

GMAIL_MCP_SSM_PARAM

/gmail-mcp/authorized-user-json

SSM param holding the credentials JSON

drive_folder (tool arg)

Gmail Attachments

Destination Drive folder for downloads

Security

  • The server can send mail as you. Every send is logged (recipients, subject, timestamp). There is no recipient allowlist by default; treat the tool as injection-sensitive.

  • The refresh token never touches disk — only an SSM SecureString, fetched in-memory at launch.

  • Scopes are least-privilege: read Gmail, send Gmail, and Drive access limited to app-created files.

Development

uv sync
uv run pytest        # unit tests (all mocked; no live Google/AWS calls)
uv run ruff check .  # lint

Layout: src/gmail_mcp/auth.py (SSM→credentials), gmail_client.py (send/search/attachments), drive_client.py (folder + upload), attachments.py (orchestration), server.py (FastMCP wiring), bootstrap.py (token mint).

Available Tools

3 tools
download_attachmentA

Download an attachment from a Gmail message and upload it to Google Drive.

Identify the attachment by `filename` (preferred — stable across requests) or `attachment_id`;
if the message has exactly one attachment, neither is required. Uploads into the Drive folder
`drive_folder` (created if absent). Returns the Drive file id, name, and web_view_link.
ParametersJSON Schema
NameRequiredDescriptionDefault
message_idYes
attachment_idNo
filenameNo
drive_folderNoGmail Attachments

TDQS

A4.4/5.0
Behavior4/5

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

With no annotations, the description carries full burden. It discloses key behaviors: uploading to Drive, folder creation if absent, and return object fields. Missing details like permission requirements, file size limits, or error handling but covers the main workflow.

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?

Two sentences, front-loaded with action, every sentence essential. No filler, perfectly concise.

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

Completeness4/5

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

No output schema but description mentions return fields. Covers main functionality and parameter rationale. Minor gaps: no mention of error cases (e.g., missing attachment) or behavior when multiple attachments without identifier. Still highly functional for an agent.

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?

Adds significant meaning beyond the schema: explains how to identify attachment (filename preferred), notes it's not required if one attachment, and clarifies drive_folder is created if absent. The message_id is obvious from context.

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

Purpose5/5

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

The description clearly states 'Download an attachment from a Gmail message and upload it to Google Drive', specifying the verb, resource, and scope. It also distinguishes itself from sibling tools by focusing on attachment download/upload specifically.

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

Usage Guidelines4/5

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

Provides explicit guidance on parameter usage: prefer filename, fallback to attachment_id, and not needed if exactly one attachment. However, it does not explicitly state when not to use this tool or mention alternatives like direct download without Drive upload.

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

search_emailsA

Search Gmail using a standard Gmail query (e.g. 'has:attachment from:bob newer_than:7d').

Returns a list of message summaries: id, from, to, subject, date, snippet, and any attachment
metadata (attachment_id, filename, mime_type, size) needed by download_attachment.
ParametersJSON Schema
NameRequiredDescriptionDefault
queryYes
max_resultsNo

TDQS

A3.6/5.0
Behavior3/5

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

With no annotations provided, the description carries full burden. It describes the return format but does not disclose side effects, auth requirements, rate limits, or that this is a read-only operation.

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?

Two concise sentences that front-load the key action and example, followed by a clear list of return fields. No redundancy.

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 no output schema and no annotations, the description covers core functionality but misses details about max_results limits, pagination, default behavior, and potential empty results.

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

Parameters2/5

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

Schema coverage is 0%, so the description must compensate. It provides an example for the 'query' parameter but entirely omits explanation of the 'max_results' parameter, leaving its purpose and behavior ambiguous.

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

Purpose5/5

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

The description clearly states the tool searches Gmail with a standard Gmail query, provides a concrete example, and specifies the return fields including attachment metadata, distinguishing it from sibling tools like download_attachment and send_email.

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

Usage Guidelines3/5

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

The description implies usage for searching emails and mentions that the output is needed by download_attachment, but does not explicitly state when to use this tool versus alternatives or provide any exclusion criteria.

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

send_emailA

Send an email from the configured Gmail account.

`to`, `cc`, `bcc` accept a single address or a comma-separated list. Set `html=true` to send
`body` as HTML. Returns the Gmail message id and thread id.
ParametersJSON Schema
NameRequiredDescriptionDefault
toYes
subjectYes
bodyYes
ccNo
bccNo
htmlNo

TDQS

A3.8/5.0
Behavior3/5

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

No annotations are provided, so the description carries full burden. It discloses that it returns Gmail message id and thread id, and explains address format and HTML toggle, but does not mention side effects, auth needs, rate limits, or failure behavior.

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 two sentences: first sentence states purpose, second provides parameter details and return info. It is front-loaded, concise, and contains no unnecessary words.

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

Completeness4/5

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

Given no output schema, the description covers return values (message id, thread id) and explains key parameters. It lacks error handling and size limits, but for a simple email sending tool it is fairly complete.

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?

Schema description coverage is 0%, so the description must compensate. It explains the comma-separated list behavior for to/cc/bcc and the html boolean, adding meaning beyond the schema. However, it does not explain subject, body constraints, or provide complete parameter semantics.

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

Purpose5/5

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

The description clearly states 'Send an email from the configured Gmail account,' specifying the verb and resource. It is distinct from sibling tools (download_attachment, search_emails) which perform different actions.

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

Usage Guidelines3/5

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

The description implies usage by stating its function but provides no explicit guidance on when to use this tool versus alternatives, nor does it mention prerequisites or scenarios.

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 updatesv0.1.0
    • First observeddownload_attachment
    • First observedsearch_emails
    • First observedsend_email

TDQS

A3.9/5.0
Disambiguation5/5

Each tool has a clearly distinct purpose: search, send, and download attachment. No overlap in functionality, making selection unambiguous.

Naming Consistency5/5

All tools follow a consistent verb_noun pattern in snake_case (search_emails, send_email, download_attachment), with no deviations.

Tool Count4/5

3 tools are appropriate for a basic Gmail MCP, covering core operations (search, send, attachment download). Could be slightly expanded but well-scoped.

Completeness3/5

Covers essential email tasks but lacks common operations like mailbox listing, labeling, or message deletion. Gaps exist but are not critical for basic usage.

Maintenance

ActivityStale
ResponsivenessSyncing

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
    A minimal MCP server that enables Claude to search, read, and manage Gmail messages and threads using official Google API libraries. It supports actions like sending emails, creating drafts, replying to threads, and managing labels through secure OAuth2 authentication.
    MIT
  • A
    license
    Not graded
    quality
    D
    maintenance
    Local stdio MCP server that mirrors the public Gmail MCP server tool surface while calling the Gmail REST API directly, enabling email management tasks like creating drafts, searching threads, and managing labels.
    MIT
  • A
    license
    B
    quality
    F
    maintenance
    MCP server that connects Claude with Gmail to read, send, delete, and manage messages and labels via the Google Gmail API.
    3
    MIT
  • A
    license
    Not graded
    quality
    C
    maintenance
    A local MCP server that provides tool-level access to Gmail, allowing Claude to search, read, send, and manage emails using the Gmail API.
    1
    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/Warrenn/gmail-mcp'

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