MCP Server Archived reference

Google Drive

MCP server that lets clients search Google Drive and read files as resources, with Google Workspace files auto-exported to Markdown, CSV, text or PNG.

Google Drive preview image

What it is

The Google Drive server is an MCP server that integrates with Google Drive to allow listing, reading, and searching over files. It exposes a search tool that returns file names and MIME types, and provides files as resources at gdrive:///<file_id>. Google Workspace files are automatically exported (Docs to Markdown, Sheets to CSV, Presentations to plain text, Drawings to PNG), while other files are provided in their native format.

Who it's for

  • Developers who want an MCP client to search and read files in Google Drive
  • Users of the desktop app or VS Code who want to add a Drive server via Docker or NPX

Requirements

Requirements

  • A Google Cloud project with the Google Drive API enabled
  • An OAuth consent screen configured, with scope https://www.googleapis.com/auth/drive.readonly
  • An OAuth Client ID for application type "Desktop App", with its JSON key file renamed to gcp-oauth.keys.json
  • Completed authentication so credentials are saved (e.g. .gdrive-server-credentials.json)
  • Docker or NPX to run the server
  • The server built with npm run build or npm run watch when running from the repo

Setup

  1. Create Google Cloud OAuth credentials

    Create a new Google Cloud project, enable the Google Drive API, and configure an OAuth consent screen ("internal" is fine for testing). Add OAuth scope https://www.googleapis.com/auth/drive.readonly, create an OAuth Client ID for application type "Desktop App", and download the JSON file of your client's OAuth keys. Rename it to gcp-oauth.keys.json and place it in the root of the repo (i.e. servers/gcp-oauth.keys.json). Build the server with npm run build or npm run watch.

  2. Authenticate locally

    Run the server with the auth argument. This opens an authentication flow in your system browser. Credentials are saved in the root of the repo (i.e. servers/.gdrive-server-credentials.json).

    bash
    node ./dist auth
  3. Authenticate with Docker

    Replace /path/to/gcp-oauth.keys.json with the path to your OAuth keys file. The command prints a URL to open in your browser to complete authentication. Credentials are saved in the mcp-gdrive volume.

    bash
    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
  4. Configure the desktop app (NPX)

    Add this to your app's server configuration, pointing GDRIVE_CREDENTIALS_PATH at your saved credentials file.

    json
    {
      "mcpServers": {
        "gdrive": {
          "command": "npx",
          "args": [
            "-y",
            "@modelcontextprotocol/server-gdrive"
          ],
          "env": {
            "GDRIVE_CREDENTIALS_PATH": "/path/to/.gdrive-server-credentials.json"
          }
        }
      }
    }
  5. Configure the desktop app (Docker)

    After authenticating with Docker, use this server configuration.

    json
    {
      "mcpServers": {
        "gdrive": {
          "command": "docker",
          "args": ["run", "-i", "--rm", "-v", "mcp-gdrive:/gdrive-server", "-e", "GDRIVE_CREDENTIALS_PATH=/gdrive-server/credentials.json", "mcp/gdrive"]
        }
      }
    }
  6. Configure VS Code (NPX)

    Add this to your User Settings (JSON) file (Ctrl + Shift + P, then Preferences: Open User Settings (JSON)), or to .vscode/mcp.json in your workspace, where the mcp key is not needed.

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

Examples

Desktop app config via NPX

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

What it does: Registers the Google Drive server in an MCP client using the saved credentials file.

Authenticate the server with Docker

bash
bash
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

What it does: Runs the one-time auth flow and stores credentials in the mcp-gdrive volume.

Search tool input

Prompt
prompt
search with query: <your search query>

Expected output: The search tool takes a single query string and returns file names and MIME types of matching files. The phrasing here is illustrative, not from the source.

Pros & cons

Pros

  • Pro:Read-only OAuth scope (drive.readonly) limits what the server can access
  • Pro:Google Docs, Sheets, Presentations and Drawings are auto-exported to Markdown, CSV, plain text and PNG
  • Pro:Supports all file types, with non-Workspace files returned in native format
  • Pro:Can be run via Docker or NPX, with VS Code and desktop app configuration examples

Cons

  • Con:Setup requires creating a Google Cloud project, OAuth consent screen and Desktop App client credentials
  • Con:Only one tool (search) is documented, and it returns only file names and MIME types
  • Con:Repository is in the archived servers repo, as shown by the URL

Images