# How to use the Google Drive MCP server

- Tool: MCP
- Difficulty: Intermediate
- Time required: 25 minutes
- Compatibility: Claude Desktop, Cursor, Windsurf, VS Code (Copilot)
- Last updated: March 2026

## TL;DR

The Google Drive MCP server lets your AI assistant search, read, and manage files in your Google Drive. It authenticates via OAuth 2.0 so your credentials stay secure, and exposes tools to list files, read document contents, search across your Drive, and create new files. This is ideal for having your AI summarize documents, extract data from spreadsheets, search for specific files, and work with your Google Workspace content directly from the chat window.

## Access and Search Your Google Drive from Your AI Assistant

The Google Drive MCP server connects your AI assistant to your Google Drive account through OAuth 2.0 authentication. It provides tools to search for files by name or content, read document text, list folder contents, and interact with your entire Drive library. This is especially powerful for knowledge workers who store documentation, meeting notes, spreadsheets, and specifications in Google Drive. Instead of manually searching and reading files, you can ask your AI to find, summarize, and extract information from your Drive in seconds.

## Before you start

- A Google account with Google Drive access
- A Google Cloud project with the Drive API enabled
- OAuth 2.0 client credentials (client ID and client secret)
- Node.js 18 or later installed on your machine
- Claude Desktop, Cursor, or another MCP-compatible AI host

## Step-by-step guide

### 1. Create a Google Cloud project and enable the Drive API

Go to console.cloud.google.com and create a new project (or select an existing one). Navigate to APIs & Services > Library, search for 'Google Drive API', and click Enable. This allows your MCP server to make API calls to Google Drive on your behalf.

**Expected result:** The Google Drive API is enabled in your Google Cloud project.

### 2. Create OAuth 2.0 credentials

In your Google Cloud project, go to APIs & Services > Credentials. Click 'Create Credentials' > 'OAuth client ID'. Choose 'Desktop app' as the application type and give it a name like 'MCP Google Drive'. Download the JSON credentials file. You will need the client_id and client_secret from this file. If this is a new project, you may need to configure the OAuth consent screen first — choose 'External' user type and add your email as a test user.

```
Steps:
1. Google Cloud Console > APIs & Services > Credentials
2. Create Credentials > OAuth client ID
3. Application type: Desktop app
4. Name: MCP Google Drive
5. Download JSON file
6. Extract client_id and client_secret values
```

**Expected result:** You have OAuth client_id and client_secret values from the downloaded credentials JSON.

### 3. Add the Google Drive MCP server to your configuration

Open your MCP host's configuration file and add a google-drive entry. Pass the client_id and client_secret as environment variables. The server will initiate an OAuth flow on first run, opening a browser window where you authorize access to your Google Drive.

```
{
  "mcpServers": {
    "google-drive": {
      "command": "npx",
      "args": [
        "-y",
        "@anthropic-ai/google-drive-mcp"
      ],
      "env": {
        "GOOGLE_CLIENT_ID": "your-client-id.apps.googleusercontent.com",
        "GOOGLE_CLIENT_SECRET": "your-client-secret"
      }
    }
  }
}
```

**Expected result:** Your configuration file contains the Google Drive MCP server entry with your OAuth credentials.

### 4. Authenticate and authorize Google Drive access

Restart your AI host. On first launch, the Google Drive MCP server will open a browser window asking you to sign in with your Google account and authorize access to Google Drive. Grant the requested permissions. The server stores the refresh token locally so you only need to authenticate once. Future startups will use the stored token automatically.

**Expected result:** You have authorized the MCP server to access your Google Drive, and the server shows as connected.

### 5. Search and read files from Google Drive

Ask your AI to find and read files from your Drive. It can search by filename, content, file type, or folder. When reading Google Docs, the server extracts the text content. For Sheets, it can read cell data. For PDFs and other files, it returns available text content.

```
Example prompts:

"Search my Google Drive for files containing 'Q4 budget'"

"Read the contents of the document called 'Product Requirements v2' in my Drive"

"List all spreadsheets in my 'Project Alpha' folder"
```

**Expected result:** The AI finds and reads files from your Google Drive, presenting the content in the chat.

### 6. Configure for VS Code with the servers key

For VS Code with GitHub Copilot, use the servers key instead of mcpServers. Create a .vscode/mcp.json file in your workspace root with the same command, args, and env values.

```
{
  "servers": {
    "google-drive": {
      "command": "npx",
      "args": [
        "-y",
        "@anthropic-ai/google-drive-mcp"
      ],
      "env": {
        "GOOGLE_CLIENT_ID": "your-client-id.apps.googleusercontent.com",
        "GOOGLE_CLIENT_SECRET": "your-client-secret"
      }
    }
  }
}
```

**Expected result:** VS Code recognizes the Google Drive MCP server and Copilot can search and read your Drive files.

## Complete code example

File: `claude_desktop_config.json`

```json
{
  "mcpServers": {
    "google-drive": {
      "command": "npx",
      "args": [
        "-y",
        "@anthropic-ai/google-drive-mcp"
      ],
      "env": {
        "GOOGLE_CLIENT_ID": "your-client-id.apps.googleusercontent.com",
        "GOOGLE_CLIENT_SECRET": "your-client-secret"
      }
    }
  }
}

// VS Code variant (.vscode/mcp.json):
// {
//   "servers": {
//     "google-drive": {
//       "command": "npx",
//       "args": ["-y", "@anthropic-ai/google-drive-mcp"],
//       "env": {
//         "GOOGLE_CLIENT_ID": "your-client-id.apps.googleusercontent.com",
//         "GOOGLE_CLIENT_SECRET": "your-client-secret"
//       }
//     }
//   }
// }

// Setup steps:
// 1. Google Cloud Console > Enable Google Drive API
// 2. Create OAuth 2.0 credentials (Desktop app)
// 3. Add client_id and client_secret to config
// 4. Restart AI host > authorize in browser

// Available tools:
// - search_files: Search Drive by name or content
// - read_file: Read document/sheet/file contents
// - list_files: List files in a folder
// - get_file_metadata: Get file details and sharing info
// - create_file: Create new files in Drive
```

## Common mistakes

- **Not enabling the Google Drive API in the Cloud project** — undefined Fix: The server will fail to authenticate if the Drive API is not enabled. Go to Google Cloud Console > APIs & Services > Library > search for 'Google Drive API' > click Enable.
- **Using 'Web application' instead of 'Desktop app' for OAuth type** — undefined Fix: The MCP server runs locally and uses the Desktop app OAuth flow. Web application credentials require a redirect URI and will not work with the local server. Choose 'Desktop app' when creating OAuth credentials.
- **Forgetting to add yourself as a test user on the consent screen** — undefined Fix: If your OAuth consent screen is in 'Testing' mode, only users listed as test users can authenticate. Go to APIs & Services > OAuth consent screen > Test users and add your Google email.
- **Sharing OAuth credentials in version control** — undefined Fix: Never commit your client_id and client_secret to a repository. Add your MCP config file to .gitignore. These credentials grant access to anyone's Google Drive who authorizes them.

## Best practices

- Use a dedicated Google Cloud project for MCP access rather than a shared one
- Keep your OAuth consent screen in 'Testing' mode unless you need external users
- Search for specific files before asking the AI to read them to save context window space
- Combine with filesystem MCP server to download and save Drive content locally
- Ask the AI to summarize long documents rather than reading the entire content
- Organize Google Drive folders to make AI search more effective
- Revoke access from Google Account > Security > Third-party apps if you stop using the server
- Use specific search terms — Drive search supports file type filters and date ranges

## Frequently asked questions

### Does the AI have access to all files in my Google Drive?

Yes, the OAuth authorization grants access to your entire Drive. The AI can search and read any file your Google account can access, including shared files and team drives. Be mindful of what you ask the AI to read, especially in shared workspaces.

### Can the AI edit my Google Docs?

The current MCP server focuses on read and search operations. Write support depends on the specific server implementation. If write access is available, Claude Desktop will show an approval dialog before any modifications.

### Do I need to pay for Google Cloud to use this?

No. The Google Drive API has a generous free quota (1 billion queries per day). The OAuth credentials are free to create. You only pay for Google Cloud if you exceed the free tier limits, which is extremely unlikely for MCP use.

### Will my Google Drive data be sent to Brave, OpenAI, or other services?

No. The MCP server runs locally on your machine and communicates directly with Google's API. File contents are sent to your AI host (Claude, Cursor, etc.) for processing, following that service's privacy policy. No third-party services receive your Drive data.

### Can I connect multiple Google accounts?

Add multiple server entries with different names (like google-drive-personal and google-drive-work), each with its own OAuth credentials. Each entry authenticates independently with a different Google account.

### What if I need help building a document processing pipeline with Google Drive and AI?

For complex workflows that combine Google Drive document analysis with database storage, automated reporting, or multi-step processing, RapidDev can help architect and build the integration using MCP servers and custom tooling.

---

Source: https://www.rapidevelopers.com/mcp-tutorial/how-to-use-google-drive-mcp-server
© RapidDev — https://www.rapidevelopers.com/mcp-tutorial/how-to-use-google-drive-mcp-server
