← All articles
Dev Jain

How to Set Up Google Drive MCP Server in Claude Code (Step by Step Guide)

Learn how to set up a Google Drive MCP server for Claude Code using OAuth, connect AI agents securely to Google Drive, troubleshoot common issues, and scale with Corsair.

Google Drive stores the documents, spreadsheets, and files that power day-to-day work across engineering, product, marketing, and operations teams. As AI agents become more capable, developers increasingly want those agents to access Google Drive securely without relying on manual uploads or copy-pasting information.

The Model Context Protocol (MCP) makes this possible by giving AI applications a standardized way to connect with external tools like Google Drive. Whether you're using Claude Code, Cursor, VS Code, or another MCP-compatible client, a Google Drive MCP server allows your AI agent to search, read, and manage Drive files through natural language.

While it's possible to configure Google Drive MCP servers manually, managing authentication, permissions, and multiple SaaS integrations quickly becomes complex as projects grow. That's where an integration layer like Corsair helps by providing a unified way to connect AI agents with Google Drive and dozens of other business applications through standardized MCP interfaces.

In this guide, you'll learn how to configure a Google Drive MCP server for Claude Code, authenticate with Google using OAuth, troubleshoot common issues, and understand when an integration platform like Corsair becomes the better choice for production AI applications.

What Is the Google Drive MCP Server and How Does It Work?

A Google Drive MCP server is a lightweight service that sits between your AI agent (in this case, Claude Code) and the Google Drive API. It implements the Model Context Protocol, which means it exposes a standardized set of tools that any MCP compatible client can discover and call. When Claude Code connects to this server, it gains the ability to search files, read document contents, retrieve metadata, and create new files inside your Google Drive account.

The flow works like this: you issue a natural language prompt in Claude Code, something like "find the latest product brief in my Drive." Claude Code recognizes this as a Drive operation and calls the appropriate MCP tool exposed by the server. The server translates that tool call into a Google Drive API request, authenticates using your stored OAuth token, sends the request to Google, and returns the result back to Claude Code. All of this happens in a few seconds, and you never have to switch windows or copy paste content manually.

While you can configure Google Drive MCP servers manually, teams managing multiple integrations often use an integration layer like Corsair. Corsair lets developers connect AI agents to services like Google Drive, Slack, GitHub, Gmail, and Notion without maintaining separate authentication flows or custom MCP configurations.

There are several Google Drive MCP server options available today. Google now ships its own official remote MCP server, currently in Developer Preview, which connects directly to the Google Drive API using OAuth 2.0. There are also popular community built servers like @piotr-agier/google-drive-mcp and felores/gdrive-mcp-server on GitHub, which run locally via Node.js and offer additional flexibility for developers who prefer self hosted setups.

If you want a deeper understanding of how Google's APIs work at a foundational level and why authentication matters so much in these integrations, our guide on what Google APIs are and how they work covers the essential concepts.

Why Connect Google Drive to Claude Code?

The most obvious reason is context. AI coding agents are only as useful as the information they can access. When Claude Code can read your Google Drive, it stops being limited to whatever is in your local directory. It can pull in product requirements, review design documents, reference meeting notes, and check shared spreadsheets, all without you having to download, convert, and paste those files into the terminal.

This becomes especially valuable in collaborative teams. Most engineering organizations store their documentation, project plans, API specifications, and even code review templates in Google Drive because that is where non-engineering teammates already work. Connecting Drive to Claude Code means your AI assistant understands the full picture of a project, not just the code. You can ask it to cross reference a feature spec stored in Drive against the current codebase and identify gaps, or summarize a shared design document before a pull request review.

There is also a productivity angle that goes beyond reading files. Once connected, Claude Code can create new documents in your Drive, organize files into folders, and search across your entire Drive using natural language queries. Instead of manually hunting for a file buried three folders deep, you can ask Claude to find it. Instead of writing a status update in a separate window, you can ask Claude to draft one and save it directly to a shared team folder.

For developers building AI powered applications that need to interact with Google Workspace, connecting Google Drive to Claude Code also serves as a hands on way to understand how MCP servers work in practice, knowledge that directly applies when building your own agent integrations at scale.

Why Use Corsair Instead of Managing MCP Servers Individually?

Setting up a single Google Drive MCP server is straightforward. However, production AI agents rarely interact with only one application. Most workflows also require access to Slack, GitHub, Gmail, Notion, Jira, HubSpot, CRMs, databases, and internal tools.

Managing separate MCP servers for every service means maintaining multiple OAuth flows, rotating credentials, updating server packages, monitoring compatibility, and handling permissions individually.

Corsair simplifies this by acting as an integration layer for AI agents. Instead of maintaining separate integrations for every SaaS application, developers can securely connect multiple services through a unified platform while keeping authentication, permissions, and tenant isolation centralized.

If you're experimenting with one integration, a standalone Google Drive MCP server works well. If you're building production AI applications, an integration layer significantly reduces operational complexity.

Prerequisites Before Setting Up Google Drive MCP

Before you begin the configuration process, make sure you have the following in place.

You need a Google account with access to Google Drive. This can be a personal Gmail account or a Google Workspace account. If you are using a Workspace account, note that your organization's admin may need to approve OAuth consent for external applications.

You need a Google Cloud project. If you do not already have one, go to console.cloud.google.com and create a new project. This is where you will enable the Drive API and generate your OAuth credentials.

You need Claude Code installed and running on your machine. Claude Code operates in the terminal and requires Node.js (version 18 or higher). If you are using the Claude.ai web interface or Claude Desktop instead, the setup path differs slightly. This guide focuses specifically on the Claude Code CLI workflow.

You need Node.js and npm available in your environment. Most MCP servers for Google Drive are distributed as npm packages, and you will use npx to run them during configuration.

Finally, it helps to have a basic understanding of how API key management and OAuth credentials work in multi service environments. You will be generating a client ID and client secret during setup, and understanding what those credentials do will make troubleshooting much easier if something goes wrong.

Step by Step: Configure the Google Drive MCP Server in Claude Code

This section walks through the full setup process from enabling the API to running your first query.

Step 1: Enable the Google Drive API

Open the Google Cloud Console, navigate to your project, and go to APIs & Services, then Library. Search for "Google Drive API" and click Enable. This allows the MCP server to make API calls to Google Drive on your behalf.

Step 2: Configure the OAuth Consent Screen

Before you can create credentials, Google requires you to set up an OAuth consent screen. Navigate to APIs & Services, then OAuth consent screen. For personal Google accounts, select "External" as the user type. Fill in the required fields: app name (something like "Google Drive MCP Server"), user support email, and developer contact email. Add the scopes https://www.googleapis.com/auth/drive.readonly for read access, or https://www.googleapis.com/auth/drive for full read and write access. If your project is in Testing mode, add your own email address under Test Users.

Step 3: Create OAuth Client Credentials

Go to APIs & Services, then Credentials. Click "Create Credentials" and select "OAuth client ID." Choose "Desktop application" as the application type. Give it a descriptive name like "Drive MCP Client." Click Create, then download the JSON credentials file. Save this file securely. You will need the client_id and client_secret values from it during the server configuration.

Step 4: Install and Configure the MCP Server

For a self hosted setup using a community server, create a directory for your credentials and place the downloaded JSON file:

mkdir credentials

mv ~/Downloads/client_secret_*.json credentials/gcp-oauth.keys.json

Then add the server to your Claude Code configuration. In your project's .mcp.json file or your global ~/.claude.json, add the MCP server entry:

{

"mcpServers": {

"google-drive": {

"command": "npx",

"args": ["-y", "@piotr-agier/google-drive-mcp"]

}

}

}

Alternatively, you can register the server using the Claude Code CLI:

claude mcp add google-drive --command "npx -y @piotr-agier/google-drive-mcp"

Step 5: Authenticate and Authorize

Restart Claude Code after saving the configuration. The first time the MCP server starts, it will open a browser window prompting you to sign in with your Google account and grant the requested permissions. After you approve, the server stores a refresh token locally (typically at ~/.config/google-drive-mcp/tokens.json) so you do not need to re-authenticate every session.

Step 6: Verify the Connection

Once authenticated, ask Claude Code a simple Drive related question to confirm everything is working:

Search my Google Drive for files modified in the last seven days.

If the server returns a list of recent files, your setup is complete.

Authenticating Google Drive with OAuth

OAuth 2.0 is the authentication layer that makes this entire integration possible without ever sharing your Google password with the MCP server or Claude Code. Here is how the flow works in practice.

When you first launch the MCP server, it reads your client ID and client secret from the credentials file. It then redirects you to Google's authorization server, where you sign in and approve the permissions your server is requesting. Google issues a short lived access token and a long lived refresh token. The access token is used for immediate API calls, while the refresh token allows the server to request new access tokens automatically when the old ones expire.

This means your actual Google credentials never touch the MCP server's code. The server only ever holds OAuth tokens, which are scoped to the specific permissions you granted and can be revoked at any time through your Google Account settings.

A few things to keep in mind about OAuth in this context. If your Google Cloud project is still in "Testing" mode, access tokens expire after seven days. You will need to re-authenticate weekly until you publish the consent screen to Production mode. Also, make sure the credentials you download are of type "Desktop app," not "Web application." Web application credentials require a redirect URI that local MCP servers cannot handle properly.

For teams managing credentials across multiple services and agents, understanding how to scope, rotate, and isolate tokens is essential. Our deep dive on how to extend Claude agents with custom tool integrations covers how authentication patterns like these fit into broader agent architectures.

Common Google Drive MCP Setup Errors (and How to Fix Them)

Even with a clean walkthrough, a few issues come up frequently. Here are the most common problems and their solutions.

"Access blocked: This app's request is invalid" error during OAuth. This usually means your OAuth consent screen is not configured correctly or the redirect URI does not match. For Desktop app credentials, the redirect URI should be http://localhost or handled automatically by the library. Double check that you selected "Desktop application" when creating the OAuth client ID, not "Web application."

Token expires every seven days. Your Google Cloud project is in Testing mode, which forces token expiration after one week. To fix this, go to the OAuth consent screen settings in Google Cloud Console and switch the publishing status to "Production." For personal projects that do not need verification, this change takes effect immediately.

"Module not found" or npm errors when starting the server. Make sure Node.js version 18 or higher is installed. Run node --version to verify. If you are using npx, it should automatically download the required package. If it fails, try installing the package globally first: npm install -g @piotr-agier/google-drive-mcp and then reference the global path in your configuration.

Claude Code does not recognize Drive tools. This happens when the MCP server configuration is not in the right file or has a syntax error. Claude Code reads its MCP configuration from .mcp.json in the current project directory or from ~/.claude.json for global settings. Verify the JSON syntax is valid and restart Claude Code after making changes.

"Insufficient permissions" when trying to read a file. Check the OAuth scopes you granted during the consent screen setup. If you used drive.readonly, the server cannot create or modify files. If you need full access, revoke the existing token, update the scopes to drive, and re-authenticate.

Testing Your Google Drive MCP Connection in Claude Code

Once the server is configured and authenticated, run a few test prompts to confirm that each capability works as expected.

Start with a basic search query:

Find all PDF files in my Google Drive that contain "Q2 report" in the title.

This tests the server's ability to search across your Drive using metadata filters. If it returns results, the read permissions are working correctly.

Next, test document content reading:

Read the contents of the file called "Product Roadmap" in my Drive and summarize the key priorities.

This confirms that Claude Code can not only find files but also retrieve and process their contents. For Google Docs, the server typically converts the document to plain text or markdown before returning it.

Then test file creation:

Create a new Google Doc in my Drive called "Meeting Notes July 2026" with the following content: [your content here].

If the file appears in your Google Drive, write permissions are working. Note that some MCP server implementations only support read operations. The official Google Drive MCP server and most well maintained community servers support both read and write.

Finally, test a multi step workflow to simulate a real use case:

Search my Drive for the latest design spec, read its contents, and then create a summary document in the "Engineering" folder.

This validates that the MCP server can handle sequential tool calls within a single prompt, which is how most practical workflows will operate.

What You Can Build After Connecting Google Drive to Claude Code

With a working Google Drive MCP connection, the range of what Claude Code can do expands significantly. Here are some practical workflows that become possible.

Automated documentation review. Point Claude at a folder of technical specs and have it identify inconsistencies, outdated references, or missing sections across multiple documents. Instead of reading ten files manually, you ask one question and get a consolidated report.

Intelligent file organization. If your Drive has grown into a maze of unsorted files, Claude can search, categorize, and move files based on content and metadata. Ask it to find every file related to a specific project and organize them into a dedicated folder structure.

Code and spec cross referencing. When your codebase references design decisions documented in Drive, Claude can look up the relevant spec, confirm whether the implementation matches the intended behavior, and flag discrepancies.

Cross-platform AI workflows. Google Drive is only one part of most business processes. Using Corsair, AI agents can securely combine Google Drive with GitHub, Slack, Gmail, Notion, Jira, HubSpot, Salesforce, and other SaaS applications through a unified integration layer. This enables workflows such as generating release notes from GitHub commits, saving them to Google Docs, and notifying teams in Slack all from a single AI prompt.

Content pipeline automation. Marketing and content teams that store drafts in Google Drive can use Claude Code to pull in a draft, edit it against a style guide, and save the revised version back to Drive, all from the terminal. For teams already connecting Drive to other AI agent frameworks, the MCP pattern stays consistent regardless of which SDK you use.

Scale Beyond a Single Google Drive MCP Server with Corsair

A standalone Google Drive MCP server is an excellent way to give AI agents access to your files. But production AI applications often need to connect with many services, not just Google Drive.

Managing separate MCP servers, OAuth credentials, permissions, and updates across multiple providers quickly becomes difficult as your application grows.

Corsair solves this by providing a unified integration layer for AI agents. Instead of maintaining individual integrations for every SaaS application, developers can connect Google Drive, Gmail, Slack, GitHub, Notion, Jira, CRMs, databases, and dozens of other services through standardized MCP interfaces with centralized authentication and permission management.

Whether you're building internal AI assistants, coding agents, customer support bots, or enterprise automation workflows, Corsair lets you spend less time managing integrations and more time building intelligent AI applications.