Google Drive MCP server

Search and access Google Drive files and folders via read-only API.
Back to servers
Provider
Anthropic
Release date
Nov 19, 2024
Language
TypeScript
Package
Stats
17.8K downloads
47.1K stars

The Google Drive MCP server allows you to integrate with Google Drive to list, read, and search files. It enables direct access to Google Drive content through a standardized protocol, with automatic conversion of Google Workspace files to more accessible formats.

Setup and Installation

Prerequisites

  1. Create a new Google Cloud project
  2. Enable the Google Drive API
  3. Configure an OAuth consent screen ("internal" is fine for testing)
  4. Add OAuth scope https://www.googleapis.com/auth/drive.readonly
  5. Create an OAuth Client ID for application type "Desktop App"
  6. Download the JSON file of your client's OAuth keys
  7. Rename the key file to gcp-oauth.keys.json and place in the appropriate location

Authentication

To authenticate and save your credentials:

node ./dist auth

This will open an authentication flow in your browser. After completing the process, credentials will be saved as .gdrive-server-credentials.json.

Usage Options

Using with Desktop Applications

Docker Setup

First, authenticate the server (replace with your actual path):

docker run -i --rm --mount type=bind,source=/path/to/gcp-oauth.keys.json,target=/gcp-oauth.keys.json -v mcp-gdrive:/gdrive-server -e GDRIVE_OAUTH_PATH=/gcp-oauth.keys.json -e "GDRIVE_CREDENTIALS_PATH=/gdrive-server/credentials.json" -p 3000:3000 mcp/gdrive auth

Open the URL printed in your browser and complete authentication. Then configure your app's server:

{
  "mcpServers": {
    "gdrive": {
      "command": "docker",
      "args": ["run", "-i", "--rm", "-v", "mcp-gdrive:/gdrive-server", "-e", "GDRIVE_CREDENTIALS_PATH=/gdrive-server/credentials.json", "mcp/gdrive"]
    }
  }
}

NPX Setup

{
  "mcpServers": {
    "gdrive": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-gdrive"
      ],
      "env": {
        "GDRIVE_CREDENTIALS_PATH": "/path/to/.gdrive-server-credentials.json"
      }
    }
  }
}

VS Code Integration

Manual Installation

Add the following to your VS Code User Settings (JSON) file or in .vscode/mcp.json in your workspace:

For NPX:

{
  "mcp": {
    "servers": {
      "gdrive": {
        "command": "npx",
        "args": [
          "-y",
          "@modelcontextprotocol/server-gdrive"
        ],
        "env": {
          "GDRIVE_CREDENTIALS_PATH": "/path/to/.gdrive-server-credentials.json"
        }
      }
    }
  }
}

For Docker:

{
  "mcp": {
    "servers": {
      "gdrive": {
        "command": "docker",
        "args": [
          "run",
          "-i",
          "--rm",
          "-v",
          "mcp-gdrive:/gdrive-server",
          "-e",
          "GDRIVE_CREDENTIALS_PATH=/gdrive-server/credentials.json",
          "mcp/gdrive"
        ]
      }
    }
  }
}

Features

Search Capability

The server provides a search tool to find files in Google Drive:

  • Input: Search query string
  • Returns file names and MIME types of matching files

Accessing Files

Files are accessible using the URI format: gdrive:///<file_id>

The server supports all file types with automatic conversions:

  • Google Docs → Markdown
  • Google Sheets → CSV
  • Google Presentations → Plain text
  • Google Drawings → PNG
  • Other files → Native format

How to add this MCP server to Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > MCP and click "Add new global MCP server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "cursor-rules-mcp": {
            "command": "npx",
            "args": [
                "-y",
                "cursor-rules-mcp"
            ]
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later