Google Drive MCP

Overview

The Google Drive MCP connector enables your Leena AI Agents to integrate with your organization's Google Drive platform, facilitating automated document workflows such as searching and reading files, creating and copying documents, and checking file permissions.

The Drive MCP server is Google's official remote Model Context Protocol (MCP) server that securely exposes a user's Google Drive as tools for AI agents. Leena AI connects to it through the MCP connector, allowing Agents to search Drive files, read documents (including Docs, Sheets, Slides, PDFs, and Office files), create and upload new files, copy existing ones, and review who has access — all while respecting each user's existing Drive access and permissions.

API Details

Leena AI integrates with the Drive MCP server via the Model Context Protocol (MCP) over Streamable HTTP.

MCP server URL: https://drivemcp.googleapis.com/mcp/v1

📘

The Drive MCP server is currently available as a Developer Preview through the Google Workspace Developer Preview Program.

Documentation link: https://developers.google.com/workspace/drive/api/guides/configure-mcp-server

Setup

The Drive MCP server is connected through Leena AI's MCP connector. The connector supports the following authentication types: No authentication, Custom auth (static headers), Admin OAuth 2.0, and User OAuth 2.0.

The Drive MCP server uses OAuth 2.0 with an OAuth client created in your Google Cloud project. For Drive MCP, use one of the following:

  • User OAuth 2.0 (recommended): Each employee signs in with their own Google account, and every action runs on the signed-in user's own Drive with their existing access permissions.
  • Admin OAuth 2.0: A single admin/shared account completes the OAuth flow once, and all actions run on that account's Drive.

Prerequisites

Before setting up the Google Drive MCP connector, ensure you have:

  • Administrator access to your Google Cloud Console and a Google Cloud project
  • Ability to enable APIs and create OAuth applications in the Google Cloud project
  • Enrollment in the Google Workspace Developer Preview Program (the Drive MCP server is in Developer Preview)
  • Google Workspace / Google Drive accounts for the employees who will use the actions
  • Access to your Leena AI workspace with connector management permissions

Get credentials

Here is how to prepare the Google Cloud project and create an OAuth client:

  1. Log in to Google Cloud Console (Ensure you're signed in as an admin) and select or create a project.
  2. Enable the Google Drive API:
    1. Go to API & Services > Library
    2. Search for "Google Drive API" (drive.googleapis.com)
    3. Click Enable
  3. Enable the Google Drive MCP API:
    1. Go to API & Services > Library
    2. Search for "Google Drive MCP API" (drivemcp.googleapis.com)
    3. Click Enable
  4. Configure the OAuth consent screen:
    1. Navigate to Google Auth Platform > Branding (OAuth consent screen)
    2. Enter the app name and support email
    3. Under Audience, choose Internal so the app is limited to users in your Google Workspace organization
  5. Create OAuth Client:
    1. Navigate to API & Services > Credentials
    2. Click + CREATE CREDENTIALS
    3. Select OAuth client ID
  6. Configure OAuth Client Details
    1. Application Type: Web application
    2. Name: Enter a descriptive name for your application
    3. Authorized redirect URIs: This will be filled later from Leena AI
  7. Save and Note Credentials (The client secret is displayed only once during creation)

The Drive MCP server uses the following OAuth scopes:

  • https://www.googleapis.com/auth/drive.readonly
  • https://www.googleapis.com/auth/drive.file

Add connection

Here is how to add a connection on Leena AI:

  1. Log in to your Leena AI workspace
  2. Navigate to Settings > Integrations
  3. Search for "Custom MCP" and select it from the list to add its new connector
  4. Give the connection a name (for example, "Google Drive MCP")
  5. Start configuring the connector
    1. MCP remote URL: The Drive MCP server URL — https://drivemcp.googleapis.com/mcp/v1
    2. Authentication type: Select "User OAuth 2.0" (recommended) or "Admin OAuth 2.0"
  6. Fill in the OAuth fields:
    1. Redirect URI: The callback URL for the OAuth flow (auto-generated by Leena AI)
    2. Client ID: OAuth client ID from your Google Cloud project
    3. Client secret: OAuth client secret from your Google Cloud project
  7. Copy the Redirect URI and update the Google Cloud OAuth client
    1. Copy the auto-generated Redirect URI from Leena AI
    2. Go back to Google Cloud Console > API & Services > Credentials
    3. Edit your OAuth client and add the Redirect URI to Authorized redirect URIs
    4. Save the changes
  8. Complete the OAuth flow and save the configuration
    1. Click Connect in Leena AI for the Google Drive MCP connection
    2. You'll be redirected to Google's authorization page
    3. Sign in to your Google account if prompted
    4. Click Allow to grant access to Google Drive
    5. You'll be redirected back to Leena AI with a successful connection
    6. The connector will be saved
  9. Once the connection is authorized, the available actions are fetched automatically from the Drive MCP server and can be selected while building skills (workflows)
📘

With User OAuth 2.0, each employee authorizes their own Google account the first time an action runs on their behalf. If a user hasn't connected yet, Leena AI shares an authorization link so they can sign in to Google.

Actions

Actions for this connector are discovered dynamically from the Drive MCP server. Every action runs on the authenticated user's own Drive with their existing access permissions.

The following actions are supported for the Google Drive MCP connector:

search_files

Searches for Drive files using a structured query. Clauses can be combined with and, or, not, and parentheses, and string values must be single-quoted. This action can be leveraged by the Leena AI Orchestrator/Agent to locate a file (and its file ID) before reading, copying, or downloading it. Here are some common use cases:

  • Document Lookup: Find a policy or process document by title or content keywords
  • Type-based Search: Find documents, spreadsheets, or presentations using MIME type filters
  • Folder Listing: List the files inside a specific folder using its parent ID
  • Shared File Discovery: Find files shared with the user or owned by a specific person

Input Parameters

Here are the input parameters required to set up this action:

Mandatory

This action has no mandatory input parameters.

Optional

NameDescription
QueryThe search query, using supported terms — title (contains, =, !=), fullText (contains), mimeType (contains, =, !=), modifiedTime/viewedByMeTime/createdTime (comparison operators with RFC 3339 timestamps), parentId (= , != ; use 'root' for My Drive), owner (= , != ; use 'me' for the requesting user), and sharedWithMe (true/false)
Page SizeThe maximum number of files to return in each page
Page TokenThe page token to use for pagination. An empty response means no more results
Exclude Content SnippetsIf true, content snippets are excluded from the response

Here is a sample JSON input:

//Search by Title and Type

{
  "query": "title contains 'leave policy' and mimeType = 'application/vnd.google-apps.document'",
  "pageSize": 10
}

//Search Recent Files Shared with the User

{
  "query": "sharedWithMe = true and modifiedTime > '2026-01-01T00:00:00Z'",
  "pageSize": 20,
  "pageToken": "ChDJk9..."
}

Response

The action returns a list of matching files, each containing:

  • File ID and title
  • MIME type
  • File metadata (owner, timestamps, links)
  • Content snippet (unless excluded)
  • Page token for the next page (when more results are available)

list_recent_files

Lists the user's recent Drive files in a specified sort order. The Agent can leverage the skill (workflow), which has been designed to surface the files a user has been working on, once the user raises a query to do so. Here are some common use cases:

  • Recent Work: Show the files the user viewed or edited most recently
  • My Edits: List files last modified by the user
  • Quick Pick: Let the user pick from recent files before reading or sharing

Input Parameters

Here are the input parameters required to set up this action:

Mandatory

This action has no mandatory input parameters.

Optional

NameDescription
Order ByThe sort order for the files — recency (default): the most recent timestamp from the file's date-time fields; lastModified: the last time the file was modified by anyone; lastModifiedByMe: the last time the file was modified by the user
Page SizeThe maximum number of files to return. The default page size is 10
Page TokenThe page token to use for pagination
Exclude Content SnippetsIf true, content snippets are excluded from the response

Here is a sample JSON input:

{
  "orderBy": "lastModifiedByMe",
  "pageSize": 10
}

Response

The action returns a list of recent files, each containing:

  • File ID and title
  • MIME type
  • File metadata (owner, timestamps, links)
  • Content snippet (unless excluded)
  • Page token for the next page (when more results are available)

get_file_metadata

Retrieves general metadata about a Drive file. The Agent can leverage the skill (workflow), which has been designed to inspect a file's details, once the user specifies the file. Here are some common use cases:

  • File Details: Check a file's type, owner, and modification dates
  • Pre-action Check: Confirm the right file was found before reading or copying it
  • Link Retrieval: Get the file's links for sharing in a conversation

Input Parameters

Here are the input parameters required to set up this action:

Mandatory

NameDescription
File IDThe ID of the file to retrieve

Optional

NameDescription
Exclude Content SnippetsIf true, the content snippet is excluded from the response

Here is a sample JSON input:

{
  "fileId": "1AbC2dEf3GhI4jKl5MnO"
}

Response

The action returns the file's metadata including:

  • File ID and title
  • MIME type
  • Owner and timestamps
  • Links to the file
  • Content snippet (unless excluded)

read_file_content

Fetches a natural language (text) representation of a known Drive file, and optionally its comments. The file ID must come from a previous search_files or list_recent_files action or be provided explicitly. Supported types include Google Docs, Sheets, and Slides (with comments), PDFs, Microsoft Word/Excel/PowerPoint files, OpenDocument files, and PNG/JPEG images. Here are some common use cases:

  • Document Q&A: Read a policy document to answer an employee's question
  • Summarization: Read a document or deck so the Agent can summarize it
  • Comment Review: Read a Google Doc along with its comment threads

Input Parameters

Here are the input parameters required to set up this action:

Mandatory

NameDescription
File IDThe ID of the file to retrieve

Optional

NameDescription
Include CommentsWhether to include comments in the response; comments are inlined in the text content with a mapping to the comment threads (supported for Google Docs, Slides, and Sheets only)

Here is a sample JSON input:

{
  "fileId": "1AbC2dEf3GhI4jKl5MnO",
  "includeComments": true
}

Response

The action returns:

  • A text representation of the file's content
  • Inlined comment threads (when requested and supported)
📘

The content may be incomplete for very large files. For an exact copy of the file in a specific format, use the download_file_content action instead.

download_file_content

Downloads the content of a Drive file as a Base64-encoded string. For Google-native files (Docs, Sheets, Slides), the export MIME type determines the format of the downloaded file. Here are some common use cases:

  • File Export: Download a Google Doc as a PDF or Word file
  • Workflow Input: Pass the downloaded file to downstream workflow steps (e.g. document extraction or e-signature)
  • Archival: Store a copy of a Drive file in another system

Input Parameters

Here are the input parameters required to set up this action:

Mandatory

NameDescription
File IDThe ID of the file to retrieve

Optional

NameDescription
Export MIME TypeFor Google-native files, the MIME type to export the file to (ignored for other files). Defaults to text if not specified

Here is a sample JSON input:

{
  "fileId": "1AbC2dEf3GhI4jKl5MnO",
  "exportMimeType": "application/pdf"
}

Response

The action returns:

  • The file content as a Base64-encoded string (in the requested export format for Google-native files)

create_file

Creates or uploads a file to Google Drive. The Agent can leverage the skill (workflow), which has been designed to create documents or folders, or upload generated content, once the user raises a query to do so. Empty Google Docs, Sheets, and Slides can be created without providing content, and folders can be created using the folder MIME type (application/vnd.google-apps.folder). By default, supported uploaded content is converted to the equivalent Google format. Here are some common use cases:

  • Document Generation: Save a generated letter, summary, or report to the user's Drive
  • Blank Documents: Create an empty Google Doc, Sheet, or Slide deck for the user to work in
  • Folder Setup: Create folders to organize workflow outputs
  • Content Upload: Upload text or Base64 content produced in a workflow

Input Parameters

Here are the input parameters required to set up this action:

Mandatory

This action has no mandatory input parameters (provide the title, content, and MIME type relevant to your use case).

Optional

NameDescription
TitleThe title of the file
Parent IDThe ID of the parent folder in which the file is created
Text ContentThe UTF-8 text content to upload (cannot be set together with Base64 content)
Base64 ContentThe Base64-encoded content to upload, for non-text files (cannot be set together with text content)
Content MIME TypeThe MIME type of the content being uploaded; required when any content is provided. Google-native types (document, spreadsheet, presentation, folder) can be created without content
Disable Conversion To Google TypeSet to true to retain the uploaded content's MIME type instead of converting it to the equivalent Google type (e.g. keep text/plain instead of converting to a Google Doc)

Here is a sample JSON input:

//Upload a Text File (converted to a Google Doc by default)

{
  "title": "Onboarding Summary - John Doe",
  "parentId": "0BxHrFolderId",
  "textContent": "Onboarding summary for John Doe...",
  "contentMimeType": "text/plain"
}

//Create an Empty Google Doc

{
  "title": "Meeting Notes",
  "contentMimeType": "application/vnd.google-apps.document"
}

Response

Upon successful creation, the action returns the created file object including:

  • File ID and title
  • MIME type
  • Links to the file

copy_file

Copies an existing file in Google Drive, optionally with a new title and parent folder. If the title is not specified, the copy is named 'Copy of {original title}'. If the parent folder is not specified, the copy is created in the same folder as the original (or in the user's root folder if the user does not have write access to that folder). Here are some common use cases:

  • Template Duplication: Copy a template document (offer letter, checklist) for a new employee
  • Working Copies: Duplicate a document before making changes
  • Folder Distribution: Copy a file into a different folder

Input Parameters

Here are the input parameters required to set up this action:

Mandatory

NameDescription
File IDThe ID of the file to copy

Optional

NameDescription
TitleThe title of the newly created file. If empty, the title will be 'Copy of [original file title]'
Parent IDThe parent folder ID of the newly created file. If empty, the copy is created alongside the original file

Here is a sample JSON input:

{
  "fileId": "1AbC2dEf3GhI4jKl5MnO",
  "title": "Offer Letter - John Doe",
  "parentId": "0BxHrFolderId"
}

Response

Upon successful copying, the action returns the newly created file object including:

  • File ID and title
  • MIME type
  • Links to the file

get_file_permissions

Lists the permissions of a Drive file. The Agent can leverage the skill (workflow), which has been designed to review who has access to a file, once the user specifies the file. Here are some common use cases:

  • Access Review: Check who can view or edit a document
  • Pre-sharing Check: Confirm a file's current access before sharing its link
  • Audit Support: Review permissions on sensitive documents

Input Parameters

Here are the input parameters required to set up this action:

Mandatory

NameDescription
File IDThe ID of the file to get permissions for

Here is a sample JSON input:

{
  "fileId": "1AbC2dEf3GhI4jKl5MnO"
}

Response

The action returns the list of permissions on the file, each containing:

  • The principal (user, group, domain, or anyone)
  • The access role (e.g. owner, editor, viewer)


Did this page help you?