# Connecting Gemini to Treasure AI Studio

You can add Treasure AI Studio to Gemini on the web as a custom connected app, so you can run Studio agents and Actions from a Gemini chat. Each request runs with the work folders, permissions, and cost of the person who connected. This page covers the setup in Treasure AI Studio and in Gemini, and what happens when you send a request. Use it when you already work in Gemini and want audience information or the output of a Studio Action there, without switching tools.

## How the Connection Is Set Up

Two people set up the connection, in two places.

| Who  | Where  | What They Do  |
|  --- | --- | --- |
| **Account administrator** | Treasure AI Studio, under **Settings → Agent Channels** | Creates one OAuth endpoint and copies its Connection URL |
| **Each person who uses Gemini** | Gemini, under **Connected apps** | Adds the Connection URL to Gemini, signs in to Studio, and allows access |


Only account administrators can create OAuth endpoints. Everyone else connects to an endpoint that an administrator has already created. Each person also needs a Treasure AI Studio account in the same account, with access to the work folders they want to use. In Gemini, each person needs a Google account that shows **+ Custom** on the **Connected apps** page. That option can depend on the Google account type, rollout status, and administrator policy, so a missing **+ Custom** button does not mean the Studio endpoint has a problem.

Check what Gemini shares before you connect. [Data Sharing with Gemini](#data-sharing-with-gemini) explains what the connection notice says.

## Step 1: Create an OAuth Endpoint in Studio

An account administrator creates one OAuth endpoint, and everyone who connects uses its Connection URL. For the full setup, see [Create an OAuth Endpoint](/products/ai-studio/agent-channels/mcp-oauth#create-an-oauth-endpoint).

1. Open **Settings → Agent Channels** and select **New MCP Endpoint** in the **MCP Endpoints** section.
2. Under **Connection method**, select **OAuth · connected user**.
3. Enter an **Endpoint name**, such as *Studio MCP OAuth*, and add an optional **Comment**.
4. Select **Create endpoint**.
5. On the **OAuth endpoint created** screen, select **Copy** next to the **Connection URL**.


The Connection URL has the form `https://<your account's Agent Gateway>/v1/mcp/<endpoint ID>`, for example `https://agent-gateway.us01.treasure.ai/v1/mcp/<endpoint ID>` on the US01 site. The endpoint's detail page shows its status as **Active**. Give the Connection URL to the people who will set up the connection. This guide uses the endpoint's own Connection URL. The common MCP URL is an alternative, described in [The Common MCP URL](/products/ai-studio/agent-channels/mcp-oauth#the-common-mcp-url).

## Step 2: Add Treasure AI Studio to Gemini

Each person does this in Gemini.

1. In Gemini, open the settings menu and select **Personal Intelligence**. The menu location can differ by Google account and Gemini interface. The same page is also available under **Customise → Connectors**.


1. Select **Connected apps**.


1. On **Connected apps**, select **+ Custom**.


1. In **Connect to an MCP server**, paste the Connection URL from Step 1 into **MCP server URL**. The URL must start with `https://`. Select **Next**.


1. On **Connect this MCP server**, check that the URL and the Google account are the ones you intend to use. Read the notice, select **I understand and accept the security and privacy risks of connecting this custom app**, and select **Connect**.


1. On **Link your Google Account and [Custom] Treasure account**, review what Google may be able to do, scroll through the notice, and select **Agree and continue** if you accept it. Your browser opens Treasure AI Studio.


1. If Studio asks you to sign in, sign in. On **Authorize MCP access**, check that the callback host shown at the top is `oauth-redirect.googleusercontent.com` and the application name is **Google**. Check the requested MCP resource, which is the Connection URL from Step 1, and the account. Select **Allow access**.


The requested permissions are to view work folders, list Actions, read execution results, run Actions, and start or continue chats. These are the same permissions described in [The MCP Permission](/products/ai-studio/agent-channels/mcp-oauth#the-mcp-permission).

1. On **Save your custom app**, enter a name, such as *Treasure AI CDP*. Check that Gemini lists the six Studio tools under **Available actions**, and select **Connect**.


1. Check **Connected apps**. The app appears under **Custom apps**.


## Step 3: Review the App's Actions

Open the app from **Custom apps**. Under **App actions**, Gemini lists the six Studio tools and how often it asks for permission before using each one. Keep them set to **Always ask** so that Gemini asks you before each request. The page also shows the app's MCP URL and the **Disconnect** button.

## Step 4: Send a Request from Gemini

1. Select the app for a chat. Use one of these ways:
  - On the app's page, open the **...** menu and select **Use now**.
  - In the prompt box, type `@Treasure` and select the app from **Connectors**.


1. Send a request that needs Studio, such as *List the Studio work folders I can access. Do not run Actions or change anything.*
2. When Gemini asks for permission to use a tool, review the named tool and choose **Allow once** to allow only that request. For higher-level requests, such as listing audiences, Gemini may use `start_chat`, which hands the request to a Studio agent.


If Gemini answers without using a tool, select the app for the chat and ask for something specific that needs Studio. A general explanation of what the app can do does not show that Gemini reached Studio.

## What Runs in Studio

Each request runs as the person who connected. It uses that person's work folders, permissions, and cost. Studio does not ask for approval before each request. The confirmation you see in this flow is Gemini's prompt in Step 4, not a Studio prompt.

Requests that start or continue chats appear in your Studio chat list as ordinary chats, with the name of the work folder they ran in. They can change files in your work folders as far as your work mode allows. [The Chats Are the Person's Own Studio Chats](/products/ai-studio/agent-channels/mcp-oauth#the-chats-are-the-persons-own-studio-chats) describes this in more detail. `run_action` runs a saved Studio Action, so check its purpose and expected effects before you allow it.

## Data Sharing with Gemini

The **Connect this MCP server** notice in Step 2 says that, to work with the custom connected app, Gemini will run the MCP server's tools, retrieve and manage data from the MCP server, and share data with it. It says that Gemini may share any info that it has access to, like skills, tasks, and websites that you're logged in to, and that this may be tailored based on data in your Google Account, depending on your settings. It also says that data retrieved from the MCP server may be shared with other connected apps and services when you use Gemini with them.

Review these settings in Gemini before you connect. Do not send chats that include data you would not share with the app.

## Stop the Connection

You can stop the connection for one person or for everyone. Stopping it in Studio refuses requests on the Studio side, and disconnecting in Gemini stops Gemini from using the connection.

- **Stop everyone (Studio).** Turn off the **Enabled** switch on the endpoint. Gemini's requests are refused until you turn it back on.
- **Stop one person (Studio).** Remove the person from the account, or remove their access to the work folders involved.
- **Disconnect (Gemini).** The person opens the app's page and selects **Disconnect**. To remove the app, open the **...** menu and select **Delete**.


If the Gemini session expires or access is revoked, Gemini asks for the Studio consent again the next time it uses the app. If authorization keeps failing, disconnect the app and connect it again with the current Connection URL.

## Troubleshooting

| Symptom  | Cause and Fix  |
|  --- | --- |
| The consent screen says *"No accessible account has an OAuth endpoint for the requested MCP resource."* | The URL isn't an OAuth endpoint's Connection URL, or your accounts can't be offered for this endpoint. Create or select an endpoint whose connection method is **OAuth · connected user**, and paste its Connection URL into Gemini. Otherwise, ask an account administrator |
| The settings menu doesn't list **Connected apps** | Look under **Personal Intelligence → Connected apps**, or under **Customise → Connectors** |
| Gemini doesn't show **+ Custom** | The option depends on the Google account type, rollout status, and administrator policy. Check with your Google administrator |
| The consent screen shows an unexpected account or resource | Select **Deny**, check the Google account and the Connection URL, and connect again |
| Requests are refused with `403` and `mcp_disabled` | The endpoint is disabled. An account administrator enables it |
| Other errors after you connect | See the troubleshooting table in [OAuth MCP Endpoints](/products/ai-studio/agent-channels/mcp-oauth#troubleshooting) |


## Next Steps

- [OAuth MCP Endpoints](/products/ai-studio/agent-channels/mcp-oauth): permissions, the common MCP URL, and how access ends.
- [Connecting an MCP Client](/products/ai-studio/agent-channels/mcp-clients): the six tools and how to read their results.
- [What an Agent Channel Chat Can Reach](/products/ai-studio/agent-channels/channel-chats): what these chats can and cannot change.
- [Headless](/products/headless): the overview of connecting other AI tools to Treasure AI Studio.
- Other Headless guides: [ChatGPT](/products/headless/chatgpt), [Claude](/products/headless/claude-web), [Databricks Genie One](/products/headless/databricks-genie-one).