Labsco
pliablepixels logo

Gmail MCP server

from pliablepixels

A super simple and tiny MCP server for gmail in python

๐Ÿ”ฅ๐Ÿ”ฅ๐Ÿ”ฅโœ“ VerifiedFreeAdvanced setup

claude-gmail-mcp

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

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).

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=....)