Skip to main content
Glama
pliablepixels

claude-gmail-mcp

claude-gmail-mcp

PyPI

A super tiny Gmail MCP server for Claude Code. Lets Claude send, search, and read Gmail on your behalf.

Two backends are supported and auto-selected at startup:

  • Gmail API (OAuth) — recommended. No app password. Batch search. Direct Gmail web URLs on every result.

  • SMTP/IMAP (app password) — simpler setup. Fallback when the OAuth token isn't present.

I needed something for my projects — there were a bunch around which seemed super complicated. So why not have Claude CLI build one for me :-p

Prerequisites

  • uv installed

  • One of:

    • A Google Cloud OAuth client (Desktop app) — for the API backend, OR

    • A Gmail App Password — for the SMTP/IMAP backend

Related MCP server: gmail-mcp

  1. In Google Cloud Console, create a project, enable the Gmail API, and configure the OAuth consent screen (External, add your Gmail as a test user). Create an OAuth client of type Desktop app and download the credentials JSON.

  2. Run the auth helper, pointing at the downloaded file:

    uvx --from claude-gmail-mcp claude-gmail-mcp-auth /path/to/credentials.json

    Browser opens → sign in → approve (scope: gmail.modify). Refresh token is saved to ~/.config/claude-gmail-mcp/token.json (perms 600).

  3. Register the MCP server with Claude Code (no env vars needed):

    claude mcp add gmail --scope user -- uvx claude-gmail-mcp

Install (SMTP/IMAP backend — fallback)

claude mcp add gmail --scope user \
  -e GMAIL_ADDRESS=you@gmail.com \
  -e GMAIL_APP_PASSWORD=your-app-password \
  -- uvx claude-gmail-mcp

Replace you@gmail.com and your-app-password with your actual credentials. Drop --scope user to install only for the current project directory.

Verify

claude mcp list

You should see gmail listed as a configured server. To see which backend is active, run:

uvx claude-gmail-mcp 2>&1 | head -1

Expected: [gmail-mcp] backend=api or [gmail-mcp] backend=imap. Ctrl-C to exit.

Backend selection

At startup the server picks exactly one backend:

  1. Token file at GMAIL_TOKEN_PATH (default ~/.config/claude-gmail-mcp/token.json) exists → API backend.

  2. Else GMAIL_ADDRESS + GMAIL_APP_PASSWORD env vars set → IMAP backend.

  3. Else tools return a "no backend configured" error.

To force a switch to the IMAP backend when a token file exists, set GMAIL_TOKEN_PATH to a non-existent path (or delete the token file).

Usage

Ask Claude to send an email:

Send an email to alice@example.com with subject "Hello" and body "Hi from Claude!"

Tools exposed:

  • send_emailto, subject, body, optional cc/bcc, html, attachments (local file paths; unreadable files are skipped with a warning).

  • search_emailsqueries (single string or list of strings), max_results (per query when a list is passed). Results include the Gmail message ID in hex and a direct Gmail web URL per hit.

  • read_emailuid (the hex ID from search_emails). Output includes the Gmail web URL at the top.

Batch search example:

Search Gmail for "is:unread from:alice" and "is:unread from:bob" — show me both side by side.

Claude passes both queries in a single tool call. The response is sectioned per query. API backend executes the list step in one HTTP roundtrip; IMAP backend iterates.

Attachment example:

Send an email to alice@example.com with subject "Report" and attach ~/Documents/report.pdf

Publishing to PyPI

python -m build && twine upload dist/*

For Development

git clone https://github.com/pliablepixels/claude-gmail-mcp.git
cd claude-gmail-mcp
uv sync
uv run pytest

Run the server locally:

uv run claude-gmail-mcp

Test with Claude Code using your local copy instead of the published package:

claude mcp add gmail --scope user \
  -- uv run --directory /path/to/claude-gmail-mcp claude-gmail-mcp

(For the IMAP backend add -e GMAIL_ADDRESS=... -e GMAIL_APP_PASSWORD=....)

Available Tools

3 tools
read_emailA

Fetch the full content of an email by its UID (from search_emails results).

Args: uid: Email UID shown in search_emails output

ParametersJSON Schema
NameRequiredDescriptionDefault
uidYes

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A4/5.0
Behavior2/5

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

No annotations provided, and description does not mention any behavioral traits such as side effects (e.g., marking as read), auth requirements, rate limits, or error handling.

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 concise (two sentences), front-loaded with purpose, and uses a clear docstring-style format for the parameter.

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 the tool is simple (single required param) and an output schema exists (assumed), the description covers the essential logic, though it lacks details on error states or behavior for invalid UIDs.

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?

Schema description coverage is 0%, but the description adds meaning by explaining that the uid comes from search_emails output, which goes beyond the schema's name and type.

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 verb 'Fetch' and the resource 'full content of an email', and distinguishes from siblings by specifying the UID comes from search_emails results.

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?

The description implies usage context (after search_emails) but does not explicitly exclude other scenarios or mention alternatives.

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 full Gmail search syntax (from:, subject:, is:unread, etc).

Pass a single query string for a flat list of results, or a list of queries to run several searches in one call (output is sectioned by query, and max_results applies per query).

Returns UID, sender, subject, date, and a Gmail web URL for each match.

Args: queries: Single query string or list of query strings. max_results: Max emails to return per query (default 10).

ParametersJSON Schema
NameRequiredDescriptionDefault
queriesYes
max_resultsNo

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A4.4/5.0
Behavior4/5

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

No annotations provided, so the description carries full burden. It discloses that the tool returns UID, sender, subject, date, and a Gmail web URL. It explains how multiple queries behave (sectioned output, per-query limits). It does not mention rate limits or potential side effects, but for a search tool this is acceptable.

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

Conciseness4/5

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

The description is clear and well-structured, with a first sentence summarizing the tool's purpose, followed by usage modes and output details. The Args section is somewhat redundant with the schema but still helpful. Could be slightly more 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?

Given the presence of an output schema (not shown but indicated), the description covers return fields adequately. It explains query syntax and output format. It lacks details on sorting or pagination beyond max_results, but for a search tool with two parameters it is adequately complete.

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

Parameters5/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 fully explain parameters. It does so clearly: queries can be a string or array, max_results is an integer default 10 applied per query. This adds significant meaning beyond the raw schema.

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 it searches Gmail using full Gmail search syntax, with a specific verb ('Search') and resource ('Gmail'). It distinguishes from sibling tools (read_email, send_email) as a search tool.

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?

The description explains when to use a single query versus a list of queries, and mentions that max_results applies per query. It does not explicitly state when not to use it (e.g., for reading a specific email), but the sibling context implies alternatives.

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 via Gmail.

Args: to: Recipient email address(es). subject: Email subject line. body: Email body content (plain text or HTML). cc: CC recipient(s), optional. bcc: BCC recipient(s), optional. html: If True, send body as HTML instead of plain text. attachments: List of local file paths to attach, optional. Files that cannot be read are skipped with a warning.

ParametersJSON Schema
NameRequiredDescriptionDefault
toYes
subjectYes
bodyYes
ccNo
bccNo
htmlNo
attachmentsNo

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A4.1/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 the full burden. It mentions that unreadable attachment files are skipped with a warning, adding some behavior context, but lacks details on authentication, rate limits, or other side effects.

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

Conciseness4/5

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

The description is well-structured with bullet points, no fluff, and front-loaded with the main action. Slightly more conciseness could be achieved, but overall efficient.

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?

With 7 parameters and an output schema, the description covers all parameters and adds attachment usage details. It does not explain output, but the output schema exists.

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?

Schema coverage is 0% (only titles and types), so the description compensates by explaining each parameter's purpose, including the behavior for attachments.

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 verb 'Send' and the resource 'email via Gmail', which distinguishes it from siblings 'read_email' and 'search_emails'.

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?

The description implies usage for sending emails, but does not explicitly state when to use versus alternatives or provide exclusions. The context is clear given siblings.

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.2.0
    • First observedread_email
    • First observedsearch_emails
    • First observedsend_email

TDQS

A4.2/5.0
Disambiguation5/5

Each tool has a clearly distinct purpose: reading, searching, and sending emails. There is no overlap in functionality, making it easy for an agent to select the correct tool.

Naming Consistency5/5

All tools follow a consistent verb_noun pattern (read_email, search_emails, send_email), ensuring predictability and ease of use.

Tool Count4/5

With only 3 tools, the set is minimal but covers the core email operations. While slightly under-scoped, it is still reasonable for a focused MCP server.

Completeness3/5

The tools cover essential read, search, and send operations, but lack common Gmail features like deleting, labeling, or managing drafts, which are notable gaps for a full email client.

Maintenance

ActivityInactive
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
    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
  • A
    license
    Not graded
    quality
    C
    maintenance
    A secure MCP server that enables Claude to read, search, send, reply, forward, and manage Gmail messages and labels through natural language commands.
    215
    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/pliablepixels/claude-gmail-mcp'

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