Connector guide8-minute read15 MCP tools7 languages

How to Connect Gmail to Cursor via MCP

Let your AI work in Gmail: search the mailbox with Gmail's own search syntax, read messages and conversations, mark mail as read, archive, star or label it, and write, reply to or send email, or save a draft for you to check first. Personal Gmail and Google Workspace, with your own Google OAuth client.

HCBy HelpCode teamUpdated 8 min read Open-source on GitHub

No credit card · 7-day trial · Self-host alternative available

Gmail

Gmail

Let your AI work in Gmail: search the mailbox with Gmail's own search syntax, read messages and conversations as plain text, see labels and unread counts, mark mail as read, archive, star or label it, write and send new mail, reply in a conversation, and save or send drafts. Personal Gmail and Google Workspace, signed in with your Google account.

tools

15

Region

INTL

Category

Email

Authentication

OAuth 2.0

Required env vars

GOOGLE_CLIENT_IDGOOGLE_CLIENT_SECRET
Install in one click on Cloud

7-day free trial · No credit card

  • 7-day free trial
    No credit card required
  • GDPR & SOC 2 ready
    EU data residency, audit logs
  • Open-source on GitHub
    Open source · AGPL-3.0
  • Works with ChatGPT, Claude, Gemini
    Any MCP-compatible client

Skip the install. Get this working in under 2 minutes.

Start a free trial on cloud.anythingmcp.com, add the Gmail in one click, then point your AI client (Claude, ChatGPT, Copilot or Cursor) at the generated MCP endpoint. No Docker, no git clone, zero engineering experience required.

Start free trial

Summary

Let your AI work in Gmail: search the mailbox with Gmail's own search syntax, read messages and conversations, mark mail as read, archive, star or label it, and write, reply to or send email, or save a draft for you to check first. Personal Gmail and Google Workspace, with your own Google OAuth client.

Try asking

Example prompts for Gmail

Click any prompt to copy it. Paste into Claude, ChatGPT, Cursor, Gemini, Copilot or OpenClaw to run it against this connector.

Gmail · live via MCP
Share
Opus 4.7

Claude is AI and can make mistakes. Please double-check responses.

💡 No install? Use cloud.anythingmcp.com directly. Sign in, click Connectors → Gmail, paste your credentials, mint an MCP API key and you're done. No Docker, no git clone, no local server.

Gmail + Cursor

Let your AI work in Gmail: search the mailbox with Gmail's own search syntax, read messages and conversations, mark mail as read, archive, star or label it, and write, reply to or send email, or save a draft for you to check first. Personal Gmail and Google Workspace, with your own Google OAuth client.

Prerequisites

See the full setup instructions baked into the connector (visible in the in-app store when you select the connector). The required environment variables for this connector are:

GOOGLE_CLIENT_ID, GOOGLE_CLIENT_SECRET

Step 1 — Get credentials

  1. Open console.cloud.google.com, pick or create a project, then go to APIs & Services → Library and enable the Gmail API.
  2. Open APIs & Services → OAuth consent screen. Choose Internal if the mailbox is on Google Workspace (the simplest option), otherwise External. For External, set the publishing status to In production: while the app is in Testing, Google revokes its refresh tokens after 7 days and the connector stops working every week.
  3. Open APIs & Services → Credentials → Create credentials → OAuth client ID, choose the application type Web application and add the authorized redirect URI https://cloud.anythingmcp.com/api/mcp-oauth/callback. If you host AnythingMCP yourself, enter https://your-anythingmcp-host/api/mcp-oauth/callback instead.
  4. Paste the client ID into GOOGLE_CLIENT_ID and the client secret into GOOGLE_CLIENT_SECRET, then install the connector.
  5. On the connector page, click Authorize with Provider and sign in with the Gmail account the AI should work with. The refresh token is stored encrypted and access tokens are renewed automatically.
  6. Ask the AI to run gmail_get_profile: it returns the address the connector works as and how many messages and threads the mailbox holds.

One Google client for all Google connectors: the same Cloud project and OAuth client can serve every Google connector: Gmail, Google Calendar, Google Drive, Google Sheets, Google Docs, Google Tasks, Search Console, Analytics and Ads. Enable each API in that project, reuse the same client ID and secret, and authorize each connector once. Each one asks only for its own permissions.

Google verification: Google classifies the Gmail permissions this connector uses (gmail.modify, and gmail.readonly for a read-only setup) as restricted. An Internal app, used only by accounts of the Workspace organization that owns the Cloud project, needs no verification: for a company it is the straightforward route. An External app that other people use shows a "Google hasn't verified this app" warning and is capped at 100 users until it passes Google's verification, which for restricted permissions includes a security assessment. For a single personal Gmail account, an External app In production that only you use works after you continue past the warning.

Permissions: the connector asks for https://www.googleapis.com/auth/gmail.modify: read mail, change labels (mark as read, archive, star), create drafts and send mail. It works as the Google account that authorized it and sees exactly what that account sees. It cannot delete anything permanently.

What sends real email: gmail_send_message (a new email), gmail_reply (an answer inside a conversation) and gmail_send_draft (an existing draft, exactly as written) send at once from the signed-in address, and sending cannot be undone. gmail_create_draft only saves a draft, also as a reply in a conversation, for you to check and send in Gmail; the connector tells the AI to prefer a draft when you have not clearly asked to send. One message reaches at most 500 recipients. An email the AI reads could contain text asking it to send something: if the AI should only prepare mail, disable gmail_send_message, gmail_reply and gmail_send_draft and send the drafts yourself.

Read-only setup: change the scope in the connector's OAuth settings to https://www.googleapis.com/auth/gmail.readonly, authorize again and disable gmail_modify_message_labels, gmail_modify_thread_labels, gmail_create_draft, gmail_send_draft, gmail_send_message and gmail_reply.

Reading and sorting mail: searches use the same syntax as the Gmail search box, for example from:[email protected] is:unread newer_than:7d or has:attachment. Messages and conversations come back as plain text (HTML-only mail is converted); a very long body is cut at 20,000 characters, or 100,000 across a conversation. Attachments are listed with name, type and size but not downloaded. Marking as read, archiving, starring and filing under a label are label changes on one message or a whole conversation.

Rate limits: Gmail allows 6,000 quota units per minute per user. A search costs 5, reading a message 20, a conversation 40, and sending a message or draft 100. Over the limit Gmail answers 429 (or 403 userRateLimitExceeded): wait a minute and try again.

Common errors: 401 means the authorization expired or was revoked (always after 7 days while the consent screen is in Testing): click Authorize with Provider again. 403 accessNotConfigured means the Gmail API is not enabled in the Cloud project. 403 insufficientPermissions or ACCESS_TOKEN_SCOPE_INSUFFICIENT means the scope does not allow the call, for example a label change on a read-only setup. 404 means the id does not exist in this mailbox; a draft id (it starts with r-) is not a message id. 400 invalidArgument usually means a label id that does not exist: user labels have ids such as Label_12, which gmail_list_labels returns.

The connector does not send or download attachments, forward mail with its original attachments, move mail to the trash or delete it, and does not handle filters, settings, send-as aliases or other people's mailboxes.

Step 2 — Install the adapter

curl -fsSL https://raw.githubusercontent.com/HelpCode-ai/anythingmcp/main/docker-compose.quickstart.yml -o docker-compose.yml
printf 'JWT_SECRET=%s\nENCRYPTION_KEY=%s\n' "$(openssl rand -hex 32)" "$(openssl rand -hex 32)" > .env
docker compose up -d

Step 3 — Add the connector in Cursor

Your server URL: in AnythingMCP, open MCP Servers → the server this connector is on, and copy its URL (https://cloud.anythingmcp.com/mcp/…). Use it wherever this guide shows YOUR_SERVER_ID.

Cursor reads MCP servers from ~/.cursor/mcp.json. Add this entry:

{
  "mcpServers": {
    "anythingmcp": {
      "url": "https://cloud.anythingmcp.com/mcp/YOUR_SERVER_ID",
      "headers": { "X-API-Key": "YOUR_MCP_API_KEY" }
    }
  }
}
  1. Create an MCP API key in AnythingMCP under MCP Servers → your server → API keys, and paste it in place of YOUR_MCP_API_KEY.
  2. Save the file and restart Cursor.
  3. Open Cursor → Settings → MCP and check that anythingmcp is listed and connected.
  4. Start chatting: the agent can now call the Gmail tools.

Available tools

ToolWhat it does
gmail_get_profileReturn the Gmail account the connector works with: its email address, the total number of messages and threads in the mailbox, and the…
gmail_list_messagesSearch or list messages in the mailbox with Gmail search syntax and optional label filters
gmail_get_messageGet one message by id, decoded: sender, recipients, subject, date, Message-ID and References, labels and the body as plain text (HTML-only…
gmail_list_threadsSearch or list conversations (threads) with Gmail search syntax and optional label filters
gmail_get_threadGet one conversation by thread id with all its messages in order, each decoded like gmail_get_message: sender, recipients, subject, date…
gmail_list_labelsList all labels of the mailbox, system labels (INBOX, UNREAD, STARRED, SENT, SPAM, TRASH, categories) and the user's own, with id, name and…
gmail_get_labelGet one label by id with its message and thread counts, total and unread, plus its visibility settings and colour
gmail_modify_message_labelsAdd and remove labels on one message: mark it read (remove UNREAD) or unread (add UNREAD), archive it (remove INBOX), star it (add STARRED)…
gmail_modify_thread_labelsAdd and remove labels on every message of a conversation at once, e.g. archive a whole thread (remove INBOX) or mark it read (remove UNREAD)
gmail_list_draftsList the drafts in the mailbox, optionally filtered with Gmail search syntax
gmail_get_draftGet one draft by draft id with its message decoded: recipients, subject and the body as plain text, to check it before it is sent with…
gmail_create_draftSave a new email as a draft in the mailbox without sending it, so the user can review it in Gmail; send it later with gmail_send_draft
gmail_send_draftSend an existing draft to its recipients exactly as it is written
gmail_send_messageWrite and send a new email from the signed-in Gmail account right away
gmail_replySend a reply inside an existing conversation

Example prompts

  • "Which unread emails from the last 3 days still need a reply from me? Summarize each one in a sentence."
  • "Find the latest email from [email protected] about the offer and draft a reply that accepts the new date. Don't send it, I'll check it in Gmail."
  • "Archive and mark as read every newsletter in my inbox that is older than a week, then list what you archived."
  • "List all emails with attachments since October 1 that look like invoices, with sender, date, subject and file name."

FAQ

Does Cursor support custom MCP servers on the free tier? Yes, MCP is available on Hobby, Pro and Business plans.

Next steps

Was this guide helpful?

Your Gmail agent is one click away.

Install the connector, paste the key, prompt Cursor. Free for 7 days, no credit card.

Related guides

Connectors

How to Connect Gmail to ChatGPT via MCP

Let your AI work in Gmail: search the mailbox with Gmail's own search syntax, read messages and conversations, mark mail as read, archive, star or label it, and write, reply to or send email, or save a draft for you to check first. Personal Gmail and Google Workspace, with your own Google OAuth client.

Connectors

How to Connect Gmail to Claude via MCP

Let your AI work in Gmail: search the mailbox with Gmail's own search syntax, read messages and conversations, mark mail as read, archive, star or label it, and write, reply to or send email, or save a draft for you to check first. Personal Gmail and Google Workspace, with your own Google OAuth client.

Connectors

How to Connect Gmail to Gemini via MCP

Let your AI work in Gmail: search the mailbox with Gmail's own search syntax, read messages and conversations, mark mail as read, archive, star or label it, and write, reply to or send email, or save a draft for you to check first. Personal Gmail and Google Workspace, with your own Google OAuth client.

Connectors

How to Connect Gmail to Meta Muse via MCP

Let your AI work in Gmail: search the mailbox with Gmail's own search syntax, read messages and conversations, mark mail as read, archive, star or label it, and write, reply to or send email, or save a draft for you to check first. Personal Gmail and Google Workspace, with your own Google OAuth client.

Connectors

Gmail to MCP: Drive Gmail from any AI Agent

Let your AI work in Gmail: search the mailbox with Gmail's own search syntax, read messages and conversations, mark mail as read, archive, star or label it, and write, reply to or send email, or save a draft for you to check first. Personal Gmail and Google Workspace, with your own Google OAuth client.

Connectors

How to Connect Canva to Cursor via MCP

Let your AI work in Canva: find and read designs, create new ones, export them to PDF, PNG, PowerPoint or video with download links, organise folders, upload images from a link, read brand templates and comment on designs.