Google Drive

Google Drive

Let your AI work in Google Drive: search files and folders in My Drive and shared drives, read Google Docs, Sheets and Slides as text, see details, comments and who has access, create folders and text files (or new Docs and Sheets from text), copy, rename, move, share and trash. Personal Google accounts and Google Workspace.

7 天免费 · 无需信用卡 · EU 托管

问 Google 任何事

通过 AnythingMCP 对 Google Drive 试一个真实提示 — Claude 调用工具并返回答案。在你的消息上按 Enter 即可在 Cloud 安装。

在 Cloud 上安装 Google
Google Drive · 通过 MCP 实时
分享
Opus 4.7

Claude 是 AI,可能会出错。请核对回答。

2 分钟设置

  1. 1在 cloud.anythingmcp.com 开始免费试用。
  2. 2在连接器商店点击 Google Drive。提示时粘贴凭据。
  3. 3生成 MCP API 密钥,将 AI 客户端指向生成的 MCP URL。
立即安装 Google Drive

Google 指南

面向主流 AI 客户端的逐步设置。

配置 Google Drive

直接来自连接器定义:在哪里获取凭据、需要哪些权限,以及该适配器调用的是哪个 API。 由连接器作者以英文提供。

Google Drive

This connector searches, reads and organises the signed-in user's Google Drive through the Google Drive API v3 (https://www.googleapis.com/drive/v3): My Drive, files shared with the user and shared drives. It exports Google Docs, Sheets and Slides as text, creates folders and text files, copies, renames, moves, shares and trashes. It works with personal Google accounts and Google Workspace, as the Google account that authorized the connector.

Setup (one-time, about 10 minutes)

  1. Open https://console.cloud.google.com, pick or create a project, then APIs & Services → Library → enable Google Drive API.
  2. APIs & Services → OAuth consent screen: choose Internal if you are on Google Workspace (simplest), otherwise External. For External, set the publishing status to In production: while an app is in Testing, Google revokes its refresh tokens after 7 days and the connector stops working every week. For your own use, the "unverified app" warning can be clicked through.
  3. APIs & Services → Credentials → Create credentials → OAuth client ID → application type Web application → add the authorized redirect URI <your AnythingMCP URL>/api/mcp-oauth/callback (on AnythingMCP Cloud: https://cloud.anythingmcp.com/api/mcp-oauth/callback).
  4. Paste the client ID and secret into GOOGLE_CLIENT_ID and GOOGLE_CLIENT_SECRET and install the connector.
  5. On the connector page, click Authorize with Provider and sign in with the Google account whose Drive the AI should use. The refresh token is stored encrypted and access tokens are renewed automatically.

One Google client for all Google connectors: the same Cloud project and OAuth client can serve every Google connector (Gmail, Google Calendar, Google Drive, Google Sheets, Google Docs, Google Tasks, Search Console, Analytics, Ads). Enable each API in that project, reuse the same GOOGLE_CLIENT_ID and GOOGLE_CLIENT_SECRET, and authorize each connector once: each one asks only for its own scopes.

Google verification (restricted scope): Google classifies drive and drive.readonly as restricted scopes. An External app that other people use needs Google's OAuth app verification, which for restricted scopes includes a security assessment; until then Google shows a "Google hasn't verified this app" warning and caps the app at 100 users. An Internal app, used only by accounts of the Workspace organisation that owns the Cloud project, needs no verification. For your own account, an External app In production works after you continue past the warning.

Scope: the connector asks for https://www.googleapis.com/auth/drive, because searching and reading files the connector did not create needs full Drive access; narrower scopes such as drive.file only see files the app created itself. For a read-only setup, change the scope to https://www.googleapis.com/auth/drive.readonly in the connector's OAuth settings, authorize again, and disable gdrive_create_folder, gdrive_create_text_file, gdrive_copy_file, gdrive_update_file, gdrive_share_file and gdrive_trash_file.

Switched off at install: gdrive_trash_file and gdrive_share_file. Turn them on per tool if the AI should move files to the trash or share files: sharing gives other people access to the user's files, and a document the AI reads could ask it to share something. Nothing here deletes permanently.

Ids: every file and folder has an id, the long string in its link: https://docs.google.com/document/d/<id>/edit, https://docs.google.com/spreadsheets/d/<id>/edit, https://drive.google.com/file/d/<id>/view, https://drive.google.com/drive/folders/<id>. The root of My Drive is root. Shared drives have ids from gdrive_list_shared_drives.

Searching (q): combine conditions with and, or, not and parentheses; strings use single quotes.

  • name contains 'invoice', name = 'Budget 2026', fullText contains 'purchase order' (searches content too).
  • mimeType = 'application/vnd.google-apps.folder' (folders), 'application/vnd.google-apps.document' (Docs), 'application/vnd.google-apps.spreadsheet' (Sheets), 'application/vnd.google-apps.presentation' (Slides), 'application/pdf'.
  • '<folderId>' in parents lists a folder's direct children ('root' in parents for the top of My Drive); '[email protected]' in owners; sharedWithMe; starred.
  • modifiedTime > '2026-10-01T00:00:00' (RFC 3339, UTC unless an offset is given).
  • Add trashed = false unless the user asks about the trash: without it results include trashed files. Searches include shared drives the user belongs to. With corpora: "allDrives" Google may answer incompleteSearch: true; narrow the query or search one shared drive with corpora: "drive" and drive_id.

Reading content: gdrive_export_file returns Google Docs as text/plain, text/markdown or text/html, Sheets as text/csv or text/tab-separated-values (first sheet only; the Google Sheets connector reads any range of any sheet), Slides as text/plain. Google allows exports up to 10 MB; this connector cuts the answer at 200 KB and marks it _truncated. Uploaded files such as PDFs, Word documents or images cannot be read or downloaded through this connector: give the user the webViewLink. For Office files, gdrive_copy_file does not convert, so ask the user to open the file with Google Docs or Sheets first.

Creating and organising

  • gdrive_create_text_file uploads text in one call. Set content_type to the text's format and drive_mime_type to the same value to keep it as a file, or to application/vnd.google-apps.document (from plain text, Markdown or HTML) or application/vnd.google-apps.spreadsheet (from CSV) to create a Google Doc or Sheet. folder_id defaults to root. File names cannot contain double quotes or backslashes.
  • gdrive_update_file renames or moves: to move, pass the target folder in add_parents and the current parent (from gdrive_get_file) in remove_parents. Items on a shared drive have exactly one parent.
  • gdrive_trash_file moves an item to the trash, restorable from drive.google.com for 30 days; only the owner (or a shared drive organizer) can do it.

Sharing: gdrive_list_permissions shows who has access. gdrive_share_file adds access: type: "user" with email_address and role reader, commenter or writer; type: "anyone" makes it available to anyone with the link. Google emails the person unless send_notification_email is false. Ownership transfer and removing access are not available here.

Pagination: list responses carry nextPageToken while more results exist; call the same tool with the same arguments and page_token set to it. page_size goes up to 1000 for files and 100 for permissions, comments and shared drives.

Quotas: Drive allows about 12,000 requests per minute per project and per user. Over the limit Google answers 403 userRateLimitExceeded / rateLimitExceeded or 429: wait a little and retry.

Common errors

  • 401: the authorization expired or was revoked (always after 7 days while the consent screen is in Testing). Click Authorize with Provider again.
  • 403 insufficientPermissions / ACCESS_TOKEN_SCOPE_INSUFFICIENT: the scope does not allow the call (a write on a read-only setup). 403 accessNotConfigured: enable the Google Drive API in the Cloud project. 403 insufficientFilePermissions: the user may not change that file.
  • 404 notFound: the id is wrong or the file is not visible to this account.
  • 400 invalid on export: the format does not suit the file type (e.g. text/csv for a Doc). 403 exportSizeLimitExceeded: the file is over 10 MB as an export.
  • 400 invalidQuery / Invalid Value on search: check quoting in q, and do not combine order_by with fullText contains.

Out of scope here: downloading or uploading binary files, permanent deletion, removing access, revisions, labels and Drive activity.

你的 AI 距离 Google Drive 仅两次点击。

安装连接器、粘贴凭据、向 AI 提问。7 天免费,无需信用卡。