Hosted MCPGoogle

Gmail MCP Server

Read, search, send, and manage labels in a Gmail account. Requires a Google account with an app password.

Setup

2 fields · 1 secret

Credentials are injected into an ephemeral sandbox at boot and destroyed with it.

Runtime

Light — starts in seconds

Sessions run up to 60 minutes before the sandbox is reclaimed.

Models

60+ AI models

Chat with 60+ AI models on the same workflow — switch to a different model mid-conversation and re-run the same prompt, or use Compare mode to put several side-by-side.

What the Gmail MCP server does

How models use it and what it is built for.

The Gmail MCP server exposes a Google mailbox to an AI model as a set of tools — search the inbox, read a thread, draft and send a message, and move mail between labels. It turns "find the invoice Stripe sent last week and forward it to accounting" into a sequence the model can actually execute.

It authenticates with a Google account plus an app password rather than a full OAuth consent screen, which is what makes it practical to run in a sandbox. The trade-off is that an app password grants access to the entire mailbox: there is no per-label or read-only scope to fall back on.

Run it hosted here and the server starts in an ephemeral sandbox with your credentials injected at boot. Nothing is installed locally and the sandbox is destroyed when the session ends.

What a model can do with it

Concrete operations exposed as tools.

  • Search mail with normal Gmail query syntax (from:, has:attachment, newer_than:)
  • Read a full thread including headers, body and attachment metadata
  • Compose and send new mail, or reply in an existing thread
  • Create, apply and remove labels
  • Move messages to archive or trash
  • Summarise an inbox slice — "what needs a reply today?"

How to set up the Gmail MCP server

In order. Each step assumes the previous one worked.

  1. 01

    Enable 2-Step Verification

    App passwords only exist on accounts with 2-Step Verification turned on. Enable it at myaccount.google.com → Security before anything else.

  2. 02

    Generate an app password

    Go to myaccount.google.com/apppasswords, create a password for "Mail", and copy the 16-character value. Google shows it once. This is the value the server expects — your normal account password will not work.

  3. 03

    Provide both fields

    The server needs your full email address and that app password. Both are injected as environment variables into the sandbox at boot and are never written to the page or the deploy log.

  4. 04

    Verify with a read-only prompt first

    Ask the model to list your five most recent subject lines before you let it send anything. If search works, authentication is correct.

Configuration

What you provide before the sandbox starts.

Gmail AddressRequired

Your full Google email address, e.g. you@gmail.com.

Gmail App PasswordRequiredSecret

16-character app password generated at https://myaccount.google.com/apppasswords (regular account password will not work; 2FA must be enabled).

Example prompts

Paste any of these into Agent Studio once the server is connected.

Search my inbox for unread mail from the last 3 days and summarise what needs a reply.

Find the most recent invoice from Stripe and tell me the amount and due date.

Draft a polite decline to the meeting invite from Priya — do not send it yet.

Label every message from noreply@ as "Automated" and archive them.

Limits and things to watch

Known constraints, stated plainly.

  • An app password grants full mailbox access. There is no read-only mode — if you only want search, say so in the prompt and verify before granting send permission.
  • Google Workspace administrators can disable app passwords org-wide, in which case this server cannot authenticate at all.
  • Very large mailboxes can be slow to search; narrow with newer_than: or a label filter.
  • The sandbox is ephemeral — no mail is cached between sessions.

Test Gmail against a real model

Deploy the server hosted, then watch which tools a model actually reaches for — with full JSON input and output on every call. Switch models mid-conversation to compare how each one uses the same server.

Frequently asked questions

About the Gmail MCP server.

Is it safe to give an AI model access to my Gmail?

Treat it as you would any third-party mail client. The app password is injected into an ephemeral sandbox and discarded when the session ends, but while the session is live the model can read and send anything in that mailbox. Use a dedicated account for automation rather than your primary inbox, and revoke the app password at myaccount.google.com/apppasswords when you are done.

Why an app password instead of OAuth?

OAuth requires a verified Google Cloud project, a consent screen and a redirect URL you control — impractical for an ephemeral sandbox. An app password gets a working connection in about two minutes. The cost is that the credential is all-or-nothing.

Can it send email without asking me?

Yes, if the model decides to. Send is a tool like any other. In Agent Studio every tool call is shown with its full JSON arguments before and after execution, so you can watch what it does — but there is no built-in confirmation gate on send.

Does this work with Google Workspace accounts?

Yes, provided your administrator allows app passwords and 2-Step Verification is enabled on the account. Many managed Workspace tenants disable app passwords by default.

More