officialstdio

Google Drive MCP Server

Let Claude Code and Cursor read Google Docs, Sheets, and Drive files through the MCP protocol.

Updated: April 15, 2026

Install

npx @modelcontextprotocol/server-gdrive
~/.claude/settings.json
{
  "mcpServers": {
    "mcp-server-google-drive": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-gdrive"
      ],
      "env": {
        "GDRIVE_CREDENTIALS_FILE": "/Users/you/.config/gdrive-credentials.json"
      }
    }
  }
}

Capabilities

  • + List files and folders in Drive with pagination
  • + Read Google Docs content as plain text or markdown
  • + Read Google Sheets data with range selection
  • + Search across Drive by name, type, or content
  • + Download file content for non-Google formats
  • + Get file metadata including owner, permissions, and sharing status

Limitations

  • - Requires an OAuth2 setup with a Google Cloud project
  • - Read-only access by default - no file creation or editing
  • - Large files (over 10 MB) are slow to download
  • - No real-time sync - always reads current snapshot on demand

Google Drive MCP server setup for Claude Code and Cursor

Quick answer: The Google Drive MCP server connects Claude Code and Cursor to your personal or workspace Drive using OAuth2. The model can list files, search by name, read Docs and Sheets, and download arbitrary file types. Setup is the slowest of any official MCP server because you need to create an OAuth2 client in Google Cloud Console. Budget 15 minutes. Tested April 15, 2026 with server version 0.6.2.

For knowledge work where important context lives in shared Docs, Drive access is what finally bridges "your docs" and "what Claude knows about the project." Pull a meeting notes doc into a code task, read a spec while writing tests, or search 6 months of design docs for a decision.

This guide covers the Google Cloud project setup, OAuth2 credentials, both editor configs, 7 example prompts, and troubleshooting the 4 common OAuth errors.

What this server does

The server wraps the Google Drive API v3 and the Docs/Sheets APIs with about 6 MCP tools: gdrive_list_files, gdrive_search_files, gdrive_read_file, gdrive_read_gdoc, gdrive_read_gsheet, and gdrive_get_file_metadata. Together they cover the common read patterns.

When Claude wants to read a Google Doc, it calls gdrive_read_gdoc with the file ID (found via search or list). The server exports the doc as plain text or markdown and hands it back to the model. For spreadsheets, the server calls spreadsheets.values.get on a specified range and returns rows.

What works well:

  • Reading meeting notes, specs, and other Docs content
  • Pulling tabular data from Sheets into analysis prompts
  • Searching for a doc by title or partial content
  • Listing the contents of a project folder
  • Getting file metadata to check last modified date or sharing

What does not:

  • Creating or editing files (the server is read-only by default)
  • Handling large binary files well - anything over 10 MB gets slow
  • Parsing Google Drawings or Forms
  • Real-time updates - you get the current snapshot each call

Installing the Google Drive MCP server

The package is @modelcontextprotocol/server-gdrive. Standard npx -y pattern. About 8 MB install because the Google API client libraries are chunky. First cold start takes 2 to 3 seconds.

Before the MCP config, you need OAuth2 credentials:

  1. Open https://console.cloud.google.com/ and create a new project (or pick an existing one).
  2. Enable the Google Drive API and Google Docs API and Google Sheets API under "APIs & Services".
  3. Go to "Credentials", click "Create Credentials", pick "OAuth client ID".
  4. Choose "Desktop app" as the application type and name it something like "Claude MCP".
  5. Download the resulting JSON file. This is your credentials file.
  6. Move it somewhere stable like ~/.config/gdrive-credentials.json.

The first time the MCP server runs, it will print an OAuth URL. Open it in a browser, log in, approve the scopes, and paste the callback code back. After that a token cache is written next to the credentials file and subsequent runs are silent.

Google requires consent screen setup for OAuth apps. For personal use, set it to "External" and add yourself as a test user - that avoids the verification requirement. For workspace use, set it to "Internal" which restricts to your domain but skips the review process.

Configuring for Claude Code

Claude Code reads from ~/.claude/mcp.json or a per-project .mcp.json. Add a gdrive entry:

{
  "mcpServers": {
    "gdrive": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-gdrive"],
      "env": {
        "GDRIVE_CREDENTIALS_FILE": "/Users/you/.config/gdrive-credentials.json"
      }
    }
  }
}

Restart Claude Code. The first time a Drive tool is called, the server will print the OAuth URL in stderr. Open the URL, approve, paste back the code. Token is cached at ~/.config/gdrive-credentials.json.token and subsequent starts are automatic.

Run /mcp to confirm the 6 Drive tools are attached.

Configuring for Cursor

Cursor's config is ~/.cursor/mcp.json on macOS and Linux, or %USERPROFILE%\.cursor\mcp.json on Windows. Same JSON:

{
  "mcpServers": {
    "gdrive": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-gdrive"],
      "env": {
        "GDRIVE_CREDENTIALS_FILE": "/Users/you/.config/gdrive-credentials.json"
      }
    }
  }
}

Cursor does not show stderr inline, so the OAuth flow is a little awkward. The cleanest path: run the server once from a terminal with the same env to do the initial OAuth exchange, then start Cursor. Token cache carries over.

Example prompts and workflows

Some prompts that work:

  • "Search my Drive for docs titled 'Q2 planning' and summarize the most recent one."
  • "Read the Google Doc with ID 1AbCdEfGhIjK_2026 and pull out the list of action items."
  • "Read the first 100 rows of the 'Sales data' sheet and tell me the top 5 products by revenue."
  • "List all files shared with me in the last 7 days and tell me which are specs for projects I am working on."
  • "Search my Drive for docs containing authentication refactor and link me the top 3."
  • "Get the metadata for the doc at this URL and tell me who last edited it."
  • "Pull the data from the 'Q1 budget' sheet range A1:F50 and calculate the total for column F."

A common workflow: at the start of a coding task, ask Claude to search Drive for any relevant design doc and load it. That replaces 5 minutes of "let me find the right doc" with one prompt. Chain with the GitHub MCP to get both the spec and the code in the same context.

Troubleshooting

invalid_grant during OAuth. The callback code expired. Run the flow again from scratch - codes are valid for 10 minutes.

access_denied. You rejected the OAuth consent or the app is not approved for the scopes requested. If using External consent screen, make sure your email is added as a test user.

Tool returns empty file list. The OAuth token was granted with drive.metadata.readonly only. Re-run OAuth with the full drive.readonly scope. Check the credentials file and delete the token cache to force re-consent.

Large Sheet times out. The Sheets API paginates at 10000 rows. Ask the model to request specific ranges rather than the whole sheet. For a 100000-row sheet, 10 range requests is more reliable than 1 big one.

Token refresh fails. Refresh tokens expire if the OAuth consent screen is in Testing mode for more than 7 days. Move the app to "Published" (which stays in Testing if no reviewers are assigned), or re-OAuth weekly.

Shared Drive files not visible. The default scope only sees My Drive. Add drive (full) or drive.readonly and ensure the OAuth consent screen lists shared drive access. Some organizations disable third-party access entirely - check workspace admin settings.

Alternatives

Close neighbors:

  • google-sheets-mcp for Sheets-only workflows, simpler setup
  • google-calendar-mcp for Calendar access
  • box-mcp or dropbox-mcp for those file services
  • confluence-mcp for Atlassian-based docs
  • notion-mcp if your team is on Notion instead

The official Google Drive MCP server is the right pick when your company runs on Google Workspace and you want your coding agent to see the documents you see. The OAuth setup is the annoying one-time cost - everything after that is smooth. The verdict from 6 weeks of daily use: attach it if you read Google Docs as part of planning or debugging sessions at least once a day.

Guides

Frequently asked questions

How do I get the OAuth credentials file for Google Drive?

Create a project in Google Cloud Console, enable the Drive, Docs, and Sheets APIs, then create an OAuth2 Desktop app client under Credentials. Download the JSON and save it somewhere stable. The MCP server reads this file to start the OAuth flow.

Is read-write access possible?

The official server is read-only. For write access, fork the server and add tools that call `drive.files.create` and `docs.documents.batchUpdate`. Or use a community MCP server that already exposes those tools. Read-only is the safer default for agents.

Does the server work with Shared Drives and team Drives?

Yes, but you need the full `drive` scope and your OAuth consent screen must allow shared drive access. Some workspace admins block third-party OAuth apps entirely - check with your admin if you cannot see shared files.

What happens when my OAuth token expires?

The server uses the refresh token to get a new access token automatically. If the refresh token itself expires (Testing mode, 7-day lifetime), the server will print a new OAuth URL on next run. Published-mode tokens last much longer.

Can I share OAuth credentials with teammates?

Technically yes, practically no. Each person should run the OAuth flow with their own Google account so access reflects their actual permissions. A shared token also widens the blast radius if the machine is compromised.

How does it handle very large spreadsheets?

The Sheets API returns up to 10000 rows per call. For larger sheets, ask the model to request specific ranges like A1:F1000 rather than the whole sheet. The server does not auto-paginate, so explicit ranges are faster and more reliable.