Google Drive
Install the Google Drive integration and its MCP server so agents behind the P0 AI Gateway can request access to folders and files in your Google shared drives.
The Google Drive integration lets agents behind the P0 AI Gateway (see P0 Runtime Access for AI) request access to a folder or file in one of your Google shared drives. Each grant goes to a new service account that P0 creates for that grant alone, and the gateway calls Drive as that account. When the grant ends, P0 removes the account's access and deletes it.
Agents can request two roles on a folder or file:
reader: read the item.writer: also create, edit, and comment.
Access to a folder covers everything in it.
Setup has four parts, in this order:
Deploy the Drive connector in a Google Cloud project.
Register each shared drive, and add the connector as a manager of it.
Add the Google Drive MCP server to your gateway.
Write the policies that decide which agents get which access.
Prerequisites
A registered Gateway component, with the gateway deployed in your environment.
The GCP Service Account Creator installed on a Google Cloud project. The Drive connector runs in that same project, and P0 creates the service accounts it grants to there.
The Google Drive API (
drive.googleapis.com), the IAM API (iam.googleapis.com), and the Cloud Run Admin API (run.googleapis.com) turned on in that project. The Terraform P0 generates doesn't turn them on.Permission to apply Terraform in the project.
A user with the Manager role on each shared drive you want to register.
Deploy the Drive connector
Navigate to Integrations on p0.app, select Google Drive, and choose the Drive connector component.
Click Add Project, select the Google Cloud project, then click Next. The dropdown lists the projects where the GCP Service Account Creator is installed.
P0 generates a Terraform configuration. Copy it into your Terraform project,
applyit, then click Next.The configuration creates:
A service account,
p0-iam-manager-drive-<hash>@<project-id>.iam.gserviceaccount.com.A Cloud Run service,
p0-connector-google-drive-ai, that runs P0's connector as that service account.An invoker binding that lets P0's Google Cloud service account call the connector. The connector accepts calls from that service account only.
The connector's service account gets no role on the project. Its only access is the shared drives you add it to in the next section.
When you click Next, P0 checks that the connector is deployed. A new Cloud Run service can take a minute to start. If the check fails, wait a minute and click Next again.
Review the summary and click Finish.
To grant in shared drives from another project, repeat these steps for that project. Each shared drive you register names the project that manages it.
Register a shared drive
Open the shared drive in your browser and copy its URL from the address bar. It looks like
https://drive.google.com/drive/folders/<id>.In P0, on the Google Drive integration, choose the Shared drive component and click Add Shared drive.
Fill in the shared drive details, then click Next:
Drive identifier: the name agents, policies, and the CLI use for this drive in P0, such as
finance-reports. Use lowercase letters, digits, and hyphens, starting and ending with a letter or digit, up to 63 characters.Google shared drive URL: the URL you copied.
Service account project: the project whose Drive connector manages this drive.
P0 shows the connector's service account and a link to the drive. In Google Drive, open the shared drive, choose Manage members, and add that service account with the Manager role. Lower roles can't share items in the drive, so grants fail without it. Then click Next.
Review the summary and click Finish.
The shared drive now appears with the state Installed.
Repeat for each shared drive you want agents to reach. Agents can only request access in drives you register here.
Add the Google Drive MCP server
You can add the Google Drive MCP server once at least one shared drive is installed.
Follow the shared steps in Add an MCP server to name the server and choose its gateway. On the configuration screen, set the following fields, then click Finish:
Credential source: choose Service account impersonation.
Definition: choose P0, then select Google Drive as the predefined server identifier.
The server now appears with the state Installed.
P0 pushes the server definition to the gateway on its next sync, and the Google Drive MCP server becomes available to agents through the gateway URL.
How agents request access
An agent requests access by naming the drive by its P0 identifier, the folder or file by its Drive ID, and a role. The Drive ID is the last part of the item's URL, as in https://drive.google.com/drive/folders/<id>. The equivalent CLI request is:
Once a request is approved, access usually works within 15 to 45 seconds, and can take up to two minutes. Agents see every Drive tool whether or not their access covers an item. Drive answers 404 for an item outside the agent's access.
See Requesting access for how agents submit and use requests.
Write policies for Google Drive
Match Google Drive requests in an agentic access policy (see Agentic access policies) with service: google-drive-ai and accessType: resource. Three filters narrow them:
drive: the shared drive. Key onid, the identifier you gave the drive in P0.resource: the folder or file, keyed on its Driveid.role:readerorwriter, keyed onid.
For example, auto-approve read-only access for one agent, but only in the finance-reports drive:
Next steps
Define the Agentic access policies that determine which agents and users may request Google Drive access.
Last updated