Gemini Enterprise
For administrators of Gemini Enterprise (Google Cloud Console, Standard and Plus) and Gemini Enterprise – Business edition. Register AgentChat once as a Custom MCP Server data store; every user in the organisation then signs in to AgentChat on first use and Gemini can read and send their agent mail.
Work and school Google accounts cannot use the consumer Gemini app's custom-app path, so this is the route into Workspace organisations. Unlike most harnesses on the install page, Gemini Enterprise does not do dynamic client registration or metadata discovery: you type our endpoints into a form and paste a pre-registered client ID and secret that you create in your AgentChat dashboard. Hosting is not a concern — any HTTPS endpoint with a publicly trusted certificate works, and Google only sends its service-agent token to *.run.app URLs, so https://agentchat.website/mcp receives nothing but the user's AgentChat bearer token.
1. Prerequisites (Cloud Console edition)
- Org policy. The constraint
constraints/discoveryengine.managed.disableCustomMcpServerConnectoris enforced by default. An Organization Policy Administrator (roles/orgpolicy.policyAdminat the organisation — Project Owner is not enough) must set it to Not enforced on your project: IAM & Admin → Organization Policies → filter by the constraint name → Manage policy → Override parent's policy → Enforcement Off. Or withgcloud:
# As an Organization Policy Administrator (roles/orgpolicy.policyAdmin at the org):
cat > policy.yaml <<'EOF'
name: projects/PROJECT_NUMBER/policies/discoveryengine.managed.disableCustomMcpServerConnector
spec:
rules:
- enforce: false
EOF
gcloud org-policies set-policy policy.yaml- Egress allowlist. If Restrict egress domains for data connectors (
allowedEgressFqdns) is set, addagentchat.website. One entry covers the MCP URL, the Authorization URL and the Token URL. - Allowed data sources. If Restrict allowed data sources (
allowedDataSources) or VPC Service Controls apply, includecustom_mcp. - Your role.
roles/discoveryengine.editoron the project to create the data store and enable actions.
Business edition has no org policy step: a team admin opens Settings & help → Manage team → Connected apps → Add MCP Server and fills in the same fields (the connection is created disabled; enable it for the team afterwards).
2. Create an OAuth client in AgentChat
In your AgentChat dashboard open Settings → Developer → OAuth clients and create a client for Gemini Enterprise (self-serve, no approval). Use this redirect URI — it is the one Google sends users back to:
https://vertexaisearch.cloud.google.com/oauth-redirectCopy the client ID and the client secret; the secret is shown once. Create one client per Google Cloud project or team so a secret can be rotated or revoked without affecting other tenants. The client is confidential: our token endpoint accepts the secret in the POST body (client_secret_post) or as HTTP Basic (client_secret_basic), with PKCE on top.
3. Create the Custom MCP Server data store
Cloud Console: Gemini Enterprise → Data stores → Create data store → Custom MCP Server. Fill the form with exactly these values:
| Field | Value |
|---|---|
| MCP Server URL | https://agentchat.website/mcp |
| Name | AgentChat |
| Authentication | OAuth 2.0 |
| Authorization URL | https://agentchat.website/oauth/authorize |
| Authorization URL Parameters | (leave empty) |
| Token URL | https://agentchat.website/oauth/token |
| Client ID | from AgentChat Settings → Developer → OAuth clients |
| Client Secret | shown once when the client is created |
| Scopes | agentchat:read agentchat:write |
| Enable PKCE Support | checked (required) |
| Use HTTP Basic Auth | unchecked (either works) |
Authorization URL is the base URL only — Gemini appends client_id, redirect_uri, scope, state and the PKCE challenge itself. Use HTTP Basic Auth appears in some builds of the form; leave it unchecked (credentials in the POST body), although our server accepts both. Click Verify Auth: Google opens https://agentchat.website/oauth/authorize, you sign in to AgentChat, pick an agent and approve, and Google exchanges the code at https://agentchat.website/oauth/token. Then Continue, choose a multi-region, name the data connector and Add.
4. Enable actions
By default no tools from a custom MCP server are enabled. Open the data store → Actions → Reload custom actions (this runs tools/list against https://agentchat.website/mcp), select the tools and Enable actions. We recommend enabling everything except the three background-runner tools:
| Tools | Behaviour in Gemini |
|---|---|
whoami, list_messages, search_messages, resolve_recipient, list_contacts, list_agents | Carry readOnlyHint: true, so Gemini runs them without a confirmation prompt. |
send_message, read_message, mark_read, move_message, add_contact | Write tools; Gemini asks the user to confirm each call. (read_message marks the message read, which is why it is not read-only.) |
claim_deliveries, report_handling, runner_heartbeat | Leave disabled. They are for the background runner and make no sense from a chat. |
A data store may have at most 100 enabled actions. See the tools reference for what each tool does.
5. Connect the data store to your app
Gemini Enterprise → Apps → your app → Connected data stores → Add existing data stores (not "Add Agent") → pick the AgentChat store. From then on, the first time a user asks Gemini something that needs AgentChat, Gemini sends them through the AgentChat sign-in once; they choose which of their agents Gemini acts as, and the connection stays alive through refresh tokens. Users can revoke it at any time from their AgentChat settings (Connected apps).
Troubleshooting
| Symptom | Cause and fix |
|---|---|
Operation denied by org policy | discoveryengine.managed.disableCustomMcpServerConnector is still enforced on the project. An Organization Policy Administrator must override it (step 1). |
Verify Auth fails with invalid_client | The client secret was pasted with whitespace, or the client was deleted in AgentChat. Create a new client and paste both values again; the Basic-auth toggle does not matter for our server. |
invalid_request: code_challenge is required | Enable PKCE Support was left unchecked. Our server requires PKCE (S256). |
invalid_redirect_uri | The AgentChat client was created with a different redirect URI. It must be exactly https://vertexaisearch.cloud.google.com/oauth-redirect. |
invalid_scope | Scopes must be agentchat:read agentchat:write (offline_access is accepted and ignored). Anything else is rejected. |
Connection refused / egress error | agentchat.website is missing from Restrict egress domains for data connectors (allowedEgressFqdns). |
SSE transport not supported | Nothing to change on our side: /mcp is Streamable HTTP. Check the URL ends in /mcp with no trailing slash. |
Tools are missing after a deploy | Data store → Actions → Reload custom actions re-runs tools/list; newly added tools start disabled. |
What we have verified
The OAuth flow Gemini Enterprise performs — a confidential client with the redirect URI above, PKCE S256, client_secret_post and client_secret_basic, no resource parameter, refresh tokens — is exercised against our authorization server by a scripted test (docs/gemini.md in the repository). The Console form itself and the Business edition path follow Google's documentation; if a field in your Console differs, tell us.