Route Gmail MCP traffic through Formal to control and log what AI agents do in Gmail:
Gmail doesn’t support Formal’s App, so register your own OAuth app.See Gmail OAuth documentation and register an app.The rule matches known agents only.
See Identity headers.Cloud agents such as Claude, ChatGPT and Cursor Cloud Agents don’t run the Endpoint.
Point them at this server’s Connector address, See MCP resources for the
- Block risky tools, such as
delete_label. - Mask sensitive data in tool results, such as emails and phone numbers in
search_threadsresponses. - Keep credentials at the Connector, so users and agents never see Gmail tokens.
- Log every tool call with the user, the MCP client and its parameters.
0. Prepare your Connector
The Connector needs an MCP listener and a hostname with wildcard DNS and TLS. Set them up once by following Deploy the Connector. Every MCP server reuses them.1. Add Gmail MCP server to your Resources
- UI
- Terraform
- Pulumi
- API
- Open the Admin Catalog and click Add MCP.
- Select the Gmail template.
- Enter a DNS-label Name, such as
gmail. - Choose the Space containing your Connector, such as
default. - Configure upstream authentication as described below, then save.
No Connector is in this server's Space.2. Setup Authentication
- Linked Accounts (Recommended)
- Pass Through
Each user links their own Gmail account once in the Employee Catalog, and the Connector sends that user’s token to Gmail.

1
Enable the APIs
In your Google Cloud project, enable the Gmail API and the Gmail MCP API.
2
Configure the consent screen
Go to Google Auth Platform > Branding and click Get Started. Under Audience, select Internal if available.
3
Choose scopes
In Data Access, click Add or Remove Scopes. Paste the Gmail scopes under Manually add scopes, then click Update and Save.
4
Create the client
Go to Clients > Create Client and select Web application. Under Authorized redirect URIs, click + Add URI and paste Formal’s Redirect URI.
5
Copy the credentials
Select Use this client for an AI-powered agent, click Create, and copy the Client ID and Client secret.
6
Enter the app in Formal
- UI
- Terraform
- Pulumi
- API
Back in the Admin Catalog, enter the Client ID and Client secret, then save.
Users then link their accounts on the Gmail server’s page in the Employee Catalog.

3. Route Endpoint traffic
Auth is managed at the Connector level when you use Linked Accounts or Shared Credentials, so the Endpoint needs to forward the MCP traffic to it. Laptops and VMs with the Formal Endpoint keep usinghttps://gmailmcp.googleapis.com/mcp/v1, and a network rule sends that traffic to the Connector.- UI
- Terraform
- Pulumi
- API
- Go to Network Rules and create a rule named
gmail-mcp. - Paste this expression, set the rule to Active, then save:
https://gmail.<connector-hostname>/mcp.
Find it in the Admin Catalog: open Gmail, then copy Connector address on the Configuration tab.4. Create policies
Tools
The Admin Catalog lists these tools for Gmail:Policies examples
- Block a tool
- Mask a tool's output
This policy blocks the tools that change data, so agents can only read Gmail.
input.mcp fields and Rewrite Action for body rewrites.5. Check the logs
Open Logs and search forresource.name:gmail.
Each Gmail tool call is one request log with the user, the MCP client and the tool.
Open a log to see its tool parameters and the policies it triggered.
A blocked write shows the block policy and its message.
A masked search shows the rewrite policy.See Logs for search syntax and filters.Troubleshooting
The agent says Formal has no current sign-in
The agent says Formal has no current sign-in
The agent relays:
Formal has no current gmail sign-in for you. Link or re-link your gmail account in Formal…Cause: The user never linked Gmail, or the token expired and couldn’t be refreshed.Fix: Open the server in the Employee Catalog and link Gmail again.The agent says Gmail rejected your credentials
The agent says Gmail rejected your credentials
The agent relays:
gmail rejected your credentials. Link or re-link your gmail account in Formal…Cause: Gmail no longer accepts the linked token, for example after the user revoked access in Gmail.Fix: Link Gmail again from the Employee Catalog.Laptop traffic doesn't appear in Logs
Laptop traffic doesn't appear in Logs
Cause: The Endpoint isn’t running, or the network rule doesn’t match the client.Fix: Check the Endpoint is connected. The rule above only matches known agents. Other clients, such as a browser, reach Gmail directly unless the rule also matches them. See Network rules.
MCP clients can't connect directly yet
MCP clients can't connect directly yet
Cause: The Configuration tab lists the reason, most often
No Connector is in this server's Space.Fix: Edit the server and choose the Space containing its Connector.Next Steps
MCP Gateway
Configure Connector routing and downstream access
All MCP servers
Browse every MCP server template

