Secure Google Workspace access for AI agents

Gmail, Drive, Calendar, Chat, and Contacts via Google's Workspace MCP servers

Through Google Workspace, agents can search and draft mail, read and create Drive files, manage calendar events, read and send Chat messages, and look up people in your directory – every call runs through your policies and is logged for audit. A single catalog resource covers all five surfaces, and each user acts only as themselves: the tools inherit that user's own Workspace permissions.

Credential modes

Google Workspace supports bring your own app only. Google does not support dynamic client registration, and its Workspace scopes are classed as sensitive and restricted, so your organization registers its own OAuth client in a Google Cloud project you control and supplies the client ID and secret. Owning the client keeps consent, scope review, and revocation inside your own tenant. See Credential modes for how the modes compare.

Before you begin

  • A Google Cloud project you control, parented to your Cloud organization. Billing is not required, but org parentage is if you want the Internal consent audience.
  • An accepted Developer Preview enrollment for that project. Google gates the Workspace MCP endpoints behind its Developer Preview Program, so apply early: acceptance can take time.
  • A Google Workspace account for every user who will use these tools. Consumer Gmail accounts can connect, but the Chat and directory tools only return data for Workspace accounts.
  • A Google Workspace super admin, able to configure the OAuth consent screen and trust the OAuth client in the Admin console.
  • Administrator access to your Agent Authority workspace, to add the resource.

Setup moves between two consoles and takes longer than most. You copy a redirect URI in the Agent Authority console, do the bulk of the work in Google Cloud and the Google Admin console, then return to the console and paste the credentials. Keep both tabs open as you work.

Setup

1. Copy the redirect URI

In the Agent Authority console, go to Resources → Add Resource and select Google Workspace. Google Workspace is bring-your-own-app only, so the credentials form opens as soon as you select it, with no mode to pick.

Copy the Redirect URI shown on the form. It includes your tenant's region, so copy it rather than typing it. It takes the form https://oauth.aisecurity.services.<region>.connect.secureauth.com/auth/callback.

Leave this page open. You come back to it in step 4.

2. Register an OAuth client in Google Cloud

Sign in to console.cloud.google.com and work through the four parts below. They all target one Cloud project, created under your Cloud organization.

Enroll in the Developer Preview

Google delivers the Workspace MCP servers through its Developer Preview Program, and the endpoints are gated on it.

Open developers.google.com/workspace/preview, sign in with an account on your Workspace domain, and enroll the project that will own the OAuth client. Wait for the status to read accepted. Enrollment is tied to a specific project, so if you do not have one yet, create it first in the next part and come back.

Until enrollment is accepted, every tool call fails

While enrollment is pending, calls fail with The caller does not have permission, no matter which scopes you publish, whether the client is trusted, or how valid the token is. A status of Submitted is not enough. Enrollment gates all five products, so do this before anything else.

Create the project and enable the APIs

Create the project under your Cloud organization, then point the gcloud CLI at it. Org parentage is what makes the Internal consent audience available later:

gcloud organizations list
gcloud projects create PROJECT_ID --name="PROJECT_NAME" --organization=ORG_ID
gcloud config set project PROJECT_ID
gcloud projects describe PROJECT_ID

gcloud organizations list gives you the ORG_ID to pass to projects create. The describe call at the end confirms the project is ACTIVE and that its parent is the organization, not your personal account.

Each Workspace surface then needs two services enabled: the product API and its MCP service. Enabling the Gmail API alone is not enough. Enable all ten under APIs & Services → Library, or in one command:

gcloud services enable \
  gmail.googleapis.com gmailmcp.googleapis.com \
  drive.googleapis.com drivemcp.googleapis.com \
  calendar-json.googleapis.com calendarmcp.googleapis.com \
  chat.googleapis.com chatmcp.googleapis.com \
  people.googleapis.com \
  --project=PROJECT_ID

The People MCP surface is served by people.googleapis.com itself, so it has no separate MCP service. Confirm all ten landed:

gcloud services list --enabled --project=PROJECT_ID | grep -iE "gmail|drive|calendar|chat|people"

Consent settings live under Google Auth Platform, split across three screens:

  • Branding – set an app name your users will recognize on the consent screen, plus a user support email. Check that the project picker shows the project you just created.
  • Audience – choose Internal if every user is in your Workspace organization. Internal apps skip Google's verification review entirely, which is the fastest path and the recommended one. Choose External only if you need to connect accounts outside your organization. While an app is in Testing, only listed test users can connect, so publish it when you are ready for the whole organization.
  • Data Access – click Add or remove scopes and add all 28 scopes listed under Required scopes. If a scope is not in the list, paste it into Manually add scopes. Click Add to table, then Update, then Save.

Several of these scopes are marked Sensitive or Restricted by Google. For an Internal app you can add them and continue. For an External app, Google requires verification before the app leaves testing, and the restricted Gmail and Drive scopes trigger a security assessment, so budget weeks rather than days.

A scope missing from Data Access fails consent for everyone

Every scope the resource requests must be present on Data Access, or consent fails with invalid_scope.

Create the OAuth client

Under Google Auth Platform → Clients, click Create client:

  • Application typeWeb application
  • Name – your preferred name, for example Agent Authority
  • Authorized redirect URIs – click Add URI and paste the Redirect URI from the form in the Agent Authority console, using the Copy button next to it

Click Create. Google shows the Client ID and Client secret once, so copy both now.

3. Trust the client in your Workspace tenant

Two settings on the Workspace side gate the connection. Both need the Client ID from step 2.

Trust the OAuth client in the Admin console

Workspace classes these scopes as sensitive and restricted, so admin policy blocks them regardless of what an individual user consents to until the OAuth client is trusted. One trust covers all five products, because they share one client.

In the Google Admin console, go to Security → Access and data control → API controls → App access control. Click Add app → OAuth App Name or Client ID, enter the Client ID, select the app, and set access to Trusted.

If the setting shows a per-organizational-unit Overridden status, confirm the connecting user's org unit is covered, or set Trusted at the org root. Admin changes take a few minutes to propagate, so make one change, wait, then test once.

Configure the Chat app

The Chat tools need a Chat app configured in the same project. Under APIs & Services → Google Chat API → Configuration, set an app name and avatar, and leave interactive features disabled: the gateway calls the Chat API directly and does not receive Chat events. Without this configuration the four Chat tools return errors while the other 33 tools work normally.

4. Finish in the console

Back on the Google Workspace form in the Agent Authority console, paste the Client ID and Client Secret. Leave Token Endpoint Authentication on Auto-detect. Then click Add.

The resource is added with all tools and scopes pre-configured, and an Admin setup required dialog appears with a Setup guide button linking back to this page.

Changing scopes or trust later does not upgrade a token already issued

Editing the resource, changing the published scopes, or trusting the client after someone has connected leaves their existing token as it was. Revoke the connection in Connections and reconnect to mint a fresh one.

Verify the connection

The gateway syncs the Google Workspace tools automatically. To check the connection end to end, ask your agent to run a request:

Show my Google Workspace profile

If your name and email come back, the connection is working.

How users connect

Access is per user. Each additional user connects their own Google account the first time their agent calls a Google Workspace tool: the gateway returns a sign-in link, the user authorizes once, and the tools work from then on. Go to Connections to manage linked accounts.

Each user's own Workspace permissions control what they can reach. The gateway does not widen access beyond what the authenticated user could already do in Google Workspace.

Available tools

All 37 tools below ship with the catalog entry, so they appear in tool lists and policy pickers as soon as the resource is installed. Each tool is routed to the Google MCP server that serves it, and the live tool definitions are refreshed from those servers when the first user connects.

Gmail

ToolDescription
search_threadsSearch email threads with Gmail query syntax (from:, to:, subject:, label:, is:, has:, newer_than:); returns snippets
get_threadGet an email thread by ID, including its messages
get_messageGet a single email message by ID
create_draftCreate a draft email, optionally as a reply on an existing thread
list_draftsList draft emails with Gmail-syntax query filtering and pagination
list_labelsList all labels in the account; use to resolve label IDs before the labeling tools
create_labelCreate a label; supports nested labels, with parents created automatically
label_threadAdd labels to an entire thread, current and future messages
unlabel_threadRemove labels from an entire thread
label_messageAdd labels to a specific message
unlabel_messageRemove labels from a specific message
apply_sensitive_thread_labelTrash or mark as spam an entire thread
apply_sensitive_message_labelTrash or mark as spam a specific message

Gmail has no send tool. Agents can draft mail, and a person sends it from Gmail.

Drive

ToolDescription
search_filesSearch files by title, full text, MIME type, modified or created time, parent, owner, and sharing
list_recent_filesList recent files, sorted by recency or last modification
get_file_metadataGet general metadata for a file
get_file_permissionsList the permissions of a file
read_file_contentRead a text representation of a file (Docs, Sheets, Slides, PDF, Office formats, images), optionally with inlined comments
download_file_contentDownload a file's content as a base64-encoded string, with an export format for Google-native files
create_fileCreate or upload a file, including empty Docs, Sheets, Slides, and folders
copy_fileCopy a file, optionally with a new title and parent folder

Calendar

ToolDescription
list_calendarsList the user's calendars; use to resolve a calendar name to its ID
list_eventsList events on a calendar with optional time range, text, and event-type filters
search_eventsSemantic search of events on the user's primary calendar
get_eventGet a single event by ID
suggest_timeSuggest free time slots across the given attendees' calendars
create_eventCreate an event, with attendees, recurrence, Google Meet, reminders, and attachments supported
update_eventUpdate an event; unset fields are left unchanged
delete_eventDelete an event
respond_to_eventAccept, tentatively accept, or decline an invitation

Chat

ToolDescription
search_conversationsFind conversations by participants or display name; lists all memberships when no filters given
list_messagesList messages in a space, DM, or group DM, optionally scoped to a thread or time range
search_messagesSearch messages by keyword and filters across all accessible spaces, or within one conversation
send_messageSend a Markdown-formatted message, optionally into an existing thread

People

ToolDescription
search_directory_peopleSearch the organization's Workspace directory for people
search_contactsSearch the user's personal contacts
get_user_profileGet the signed-in user's own profile (name and email)

Required scopes

Add all 28 to the OAuth consent screen under Data Access, in step 2. This is the same list the gateway sends in the authorize request. All except the three identity scopes take the https://www.googleapis.com/auth/ prefix.

Identityopenid, email, profile

Gmailgmail.modify, gmail.readonly, gmail.compose, gmail.labels

Drivedrive, drive.readonly, drive.file

Calendarcalendar, calendar.readonly, calendar.events, calendar.events.readonly, calendar.events.freebusy, calendar.freebusy, calendar.calendarlist, calendar.calendarlist.readonly

Chatchat.spaces.readonly, chat.messages.readonly, chat.messages.create, chat.memberships.readonly, chat.users.readstate.readonly

Peoplecontacts.readonly, contacts.other.readonly, directory.readonly, userinfo.profile, userinfo.email

The set is deliberately narrower than what Google offers. It excludes https://mail.google.com/ (permanent deletion), the Gmail settings scopes (mail forwarding and delegation), gmail.send, the Chat space and membership write scopes, and contact write access, none of which any shipped tool needs. It also excludes gmail.metadata: a token carrying that scope is forced into metadata-only mode by the Gmail API even when fuller read scopes are granted, which breaks message search and message bodies.

Scopes are requested at connect time, so a user's consent screen lists exactly the access above. Narrowing further is possible by removing tools, but a scope removed while its tool ships means that tool fails at call time.

Policy examples

Rules are evaluated top to bottom and the first match wins. Allow rules on their own restrict nothing – your org starts with a seeded Allow all rule, so any tool your allows don't cover still falls through to it. A restrictive recipe needs a catch-all deny scoped to this resource, ordered below the allows. New rules are inserted at the top of the list, so create them in reverse order or drag them into place. See Policies.

  • Read-only access. Allow search_*, get_*, list_*, and read_*, then deny * below them.
  • Block anything that leaves the org. Deny send_message and create_draft above any allow rules.
  • Block destructive operations. Deny delete_event, apply_sensitive_thread_label, and apply_sensitive_message_label.
  • Mail triage without calendar changes. Allow search_threads, get_thread, get_message, and *_label*, then deny *_event, then deny *.
  • Drive reads but no writes. Allow search_files, list_recent_files, get_file_*, and read_file_content, then deny create_file, copy_file, and download_file_content.
  • Allow full access for a specific agent. Scope an allow rule for * to that agent on this MCP server.

Tool patterns are case-sensitive and match exactly unless they contain *, so the lowercase snake*case patterns above (get*_, not Get_) are what match Google Workspace tool names.

Next steps

  • Create a policy – start from the read-only pattern in Policy examples above.
  • Connections – manage the Google accounts your users have linked.

On this page