Connector guide9-minute read16 MCP tools7 languages

Connect Gmail to Microsoft Copilot 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 9 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

16

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

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.

Guided setup

Connect Gmail to Microsoft Copilot in 2 minutes

Start a free trial on AnythingMCP Cloud, connect Gmail in the guided setup, then add your MCP URL to Microsoft Copilot. No code and no server to run.

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

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 + Microsoft Copilot

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 Microsoft Copilot

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.

Microsoft Copilot uses MCP servers through agents built in Copilot Studio: you add AnythingMCP to an agent as a tool, then publish the agent to Microsoft 365 Copilot and Teams. Copilot Studio connects from Microsoft's cloud over Streamable HTTP, which AnythingMCP supports.

  1. In Copilot Studio, open your agent (or create one), go to Tools and choose Add a tool → New tool → Model Context Protocol.
  2. Enter a Server name (for example AnythingMCP), a Server description that says what the connector does, and the Server URL https://cloud.anythingmcp.com/mcp/YOUR_SERVER_ID. Copilot Studio uses the description to decide when to call the server.
  3. Under authentication, choose API key, set Type to Header and the header name to X-API-Key, then select Create.
  4. In Add tool, choose Create a new connection, paste an MCP API key from AnythingMCP (MCP Servers → your server → API keys) and select Add to agent.
  5. Try it in the agent's Test pane: ask for something that needs the Gmail tools.
  6. Select Publish, then Channels → Microsoft 365 and Microsoft Teams, keep Make agent available in Microsoft Copilot selected and choose Add channel. See agent in Teams installs it for you; in Microsoft 365 Copilot, type @ and pick the agent.

Prefer per-user sign-in? Choose OAuth 2.0 → Dynamic discovery instead of an API key: each user then signs in to AnythingMCP the first time the agent calls it.

Self-hosting? Use your instance's public HTTPS address instead of https://cloud.anythingmcp.com. Copilot Studio connects from Microsoft's cloud, so localhost does not work.

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
gmail_get_attachmentDownload one attachment of a message by its attachmentId, from the attachments list of gmail_get_message, gmail_get_thread or…

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

Which Copilot is this for? Microsoft 365 Copilot at work, through agents built in Copilot Studio. The Microsoft Copilot app for personal accounts has no option to add your own MCP server.

What do I need? A work account with access to Copilot Studio (a license or a trial) to build the agent. People who use it in Microsoft 365 Copilot or Teams need access to the agent: share it with them, or ask an admin to publish it to the organization. If your organization applies data policies to Power Platform connectors, they cover MCP servers too.

The agent doesn't call the tools. Check that the header name is exactly X-API-Key and that the key belongs to the same MCP server as the URL, and make the server description specific: Copilot Studio uses it to decide when to call the server. Publish the agent again after each change; in an open chat, type "start over" to get the new version.

Next steps

Was this guide helpful?

Connect Gmail to Microsoft Copilot in 2 minutes

Start a free trial on AnythingMCP Cloud, connect Gmail in the guided setup, then add your MCP URL to Microsoft Copilot. No code and no server to run.

Related guides

Connectors

Connect Gmail to ChatGPT via MCP: Search and Reply

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

Connect Gmail to Claude via MCP: Search and Draft

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

Connect Gmail to Cursor via MCP: Search and Draft

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

Connect Gmail to Gemini CLI via MCP: Search and Reply

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

Connect Gmail to Meta Muse via MCP: Search and Draft

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 MCP Server: Search, Draft and Send Email

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.