Skip to content
AI Agent How-To

Home ›MCP server setup guides

Gmail MCP Server (Google Workspace Remote OAuth)

Intermediate ~5 min read Last tested November 2026

Updated 2026-11-10

Google’s remote Gmail MCP server exposes search, threads, labels, and draft tools over Streamable HTTP at https://gmailmcp.googleapis.com/mcp/v1. MCP clients such as Claude or Google Antigravity connect with OAuth 2.0 instead of pasting long-lived passwords. For a Python agent with the REST Gmail API, use Connect an AI agent to Gmail or Build an AI agent that triages Gmail. Last tested 2026-11-10.

Gmail MCP is in Google Workspace Developer Preview; APIs and client steps can change. Check the release notes before you ship a production workflow.

Prerequisites

  • Access to the Google Workspace Developer Preview Program when required for your account
  • A Google Cloud project where you can enable APIs and create OAuth clients
  • An MCP host that supports remote Streamable HTTP with OAuth (Claude Desktop/Claude.ai, Google Antigravity, or another client listed in Google’s docs)

Docs used:

Steps

1. Enable Gmail and Gmail MCP APIs

In Google Cloud Console, pick your project, then enable:

  • Gmail API (gmail.googleapis.com)
  • Gmail MCP API (gmailmcp.googleapis.com)

CLI equivalent from Google’s guide:

gcloud services enable gmail.googleapis.com gmailmcp.googleapis.com --project=PROJECT_ID
  1. Open Google Auth Platform → Branding and finish app branding if prompted.
  2. Under Data Access, add the scopes Google documents for Gmail MCP:
    • https://www.googleapis.com/auth/gmail.readonly
    • https://www.googleapis.com/auth/gmail.compose
  3. If the app is External, add yourself as a test user under Audience.

3. Create an OAuth client for an AI agent

  1. Go to Google Auth Platform → Clients → Create client.
  2. Choose Web application (Google’s Claude and Antigravity examples use this type).
  3. Add the Authorized redirect URI your MCP client expects. Examples from Google’s guide:
    • Claude: https://claude.ai/api/mcp/auth_callback
    • Antigravity: https://antigravity.google/oauth-callback
  4. Enable Use this client for an AI-powered agent. Google’s release notes state Workspace MCP servers reject non-agentic OAuth clients after the 2026 enforcement window.
  5. Copy the Client ID and Client secret.

If one OAuth client also serves non-agent features, create a separate agent-only client and leave the original client for REST-only integrations.

4. Register the remote server in your MCP client

Use these values in every client (per Workspace MCP configuration):

  • Server name: gmail
  • Server URL: https://gmailmcp.googleapis.com/mcp/v1
  • Transport: Streamable HTTP
  • Authentication: OAuth 2.0 with the agent client from step 3

Claude (Enterprise, Team, Pro, or Max): In Settings → Connectors → Add custom connector, enter the server name and URL, then paste the OAuth client ID and secret under Advanced settings as described in Configure the Gmail MCP server.

Antigravity: Add to ~/.gemini/config/mcp_config.json:

{
  "mcpServers": {
    "gmail": {
      "serverUrl": "https://gmailmcp.googleapis.com/mcp/v1",
      "oauth": {
        "clientId": "YOUR_CLIENT_ID",
        "clientSecret": "YOUR_CLIENT_SECRET"
      }
    }
  }
}

Complete the browser sign-in flow, then confirm tools such as search_threads and create_draft appear.

5. Smoke-test with safe prompts

Google suggests prompts like:

  • “Search my mail for messages from Ariel about the marketing plan.”
  • “Draft an email to ariel@example.com saying I approve the marketing plan.”

Drafts should land in Drafts, not Sent. Review every action; Gmail MCP can label and draft on your behalf.

6. Call Gmail from your own Python agent (optional)

After MCP works in a host client, attach the same tools from code with Connect an AI agent to an MCP server. Keep REST OAuth in Connect an AI agent to Gmail when you need fine-grained scope control outside MCP.

Common errors

MCP requests rejected / OAuth errors. Confirm Use this client for an AI-powered agent is selected on the OAuth client. Create a new agent-marked client if an older one cannot be updated.

Hourly sign-in prompts. The MCP client may not request access_type=offline, so no refresh token is issued. Google’s troubleshooting section recommends adding access_type=offline (and prompt=consent once) when the client supports custom authorization parameters.

Tools missing after connect. Verify both gmail.googleapis.com and gmailmcp.googleapis.com are enabled, consent screen scopes include readonly + compose, and the signed-in user is a test user on external apps.

Client does not support remote HTTP MCP. Use Google’s documented host (Claude or Antigravity) or run a stdio bridge only if your security review allows it. Do not paste refresh tokens into git.

Indirect prompt injection. Email content can hijack tool plans. Google recommends Model Armor or your own screening; never point the agent at untrusted mail without human review.

FAQ

What is the Gmail MCP server URL?

https://gmailmcp.googleapis.com/mcp/v1 over Streamable HTTP with OAuth 2.0.

Which tools does Gmail MCP expose?

Google documents create_draft, get_thread, get_message, label_message, label_thread, list_drafts, list_labels, search_threads, unlabel_message, and unlabel_thread in the MCP reference.

Do I still need the Gmail REST API?

Use MCP when your host client integrates with Google’s remote server. Use the REST API in Python when you need custom agents, batch jobs, or scopes MCP does not cover.

How does this relate to inbox triage guides?

MCP fits IDE assistants. Triage Gmail fits scheduled Python jobs with labels and drafts.