Get the FREE Ultimate OpenClaw Setup Guide →

gdrive

A google drive mcp servers based on Python

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio hxie-pallas-gdrive-mcp-server python -m gdrive_mcp_server \
  --env TOKENS_PATH="path/to/tokens.json" \
  --env CREDENTIALS_PATH="path/to/credentials.json"

How to use

This MCP server provides a Google Drive interface over the MCP protocol, allowing clients to search for files, retrieve file metadata, and fetch file contents with OAuth authentication and token persistence. It supports both standard and HTTP transport modes, enabling you to interact with Drive through MCP clients or via HTTP when enabled. After starting, you can use the MCP commands defined by the server to query Drive resources and access file data using your authenticated session. The server relies on Google Drive API credentials and a stored token file to authorize API requests and persist access across sessions.

How to install

Prerequisites:

  • Python 3.12 or higher
  • pip available in your environment
  • Google Drive API credentials (credentials.json)

Installation steps:

  1. Create and activate a virtual environment: python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate

  2. Install the package in editable mode: pip install -e .

  3. Prepare Google Drive credentials:

    • In Google Cloud Console, enable the Drive API for your project
    • Create OAuth 2.0 Client ID (Desktop app) and download credentials.json
    • Place credentials.json at a known path, for example: /path/to/credentials.json
  4. Configure and run authentication setup (first-run): python -m gdrive_mcp_server.auth_setup --credentials /path/to/credentials.json --token /path/to/tokens.json

  5. Run the MCP server (standard mode): python -m gdrive_mcp_server

  6. Optional HTTP mode (enable by adding --http): python -m gdrive_mcp_server --http

Additional notes

Tips and notes:

  • Ensure credentials.json is secure and token file is writeable by the running process.
  • The server supports HTTP transport if you need browser-friendly access; use the --http flag when starting.
  • If you encounter OAuth token expiration, re-run the auth_setup or re-authenticate to refresh tokens.
  • For Claude Desktop integration, point the command to your virtual environment's gdrive-mcp executable and provide the token path as shown in the README example.
  • Development and testing dependencies can be installed with: pip install -e ".[dev]" if you are contributing to the project.
  • If using a virtual environment, make sure to reference the correct python interpreter when starting the server.

Related MCP Servers

Sponsor this space

Reach thousands of developers