Skip to main content

Google Drive MCP Server

An MCP server for managing files and folders in Google Drive, integrating seamlessly with AI assistants using the Model Context Protocol.

Features

  • List Files/Folders: Search and list files with advanced query support.
  • Get Metadata: Retrieve detailed information about specific files or folders.
  • Manage Folders: Create new folders and organize content.
  • Organize Content: Move, copy, and delete (or trash) files.
  • Trash Management: List trashed items and restore by file ID or name.
  • Export: Export Google Docs, Sheets, and Slides to formats like PDF or DOCX.
  • Download / Upload: Download files or whole folders into a local workspace, edit them, and upload them back (update in place or create new).

Installation

Prerequisites

  • Python 3.9 or higher.
  • A Google Cloud Project with the Drive API enabled.
  • OAuth2 credentials (Client ID and Client Secret).
  • OAuth scope: ["https://www.googleapis.com/auth/drive"].

Local Setup

  1. Install dependencies:

    pip install -e .
    
  2. Run the server:

    python main.py --access-token <TOKEN> --refresh-token <REFRESH_TOKEN> --client-id <CLIENT_ID> --client-secret <CLIENT_SECRET>
    

Configuration

Add the following to your MCP host configuration (e.g., mcp-config.json):

{
  "mcpServers": {
    "barie-google-drive-mcp": {
      "command": "uvx",
      "args": [
        "barie-google-drive-mcp",
        "--access-token",
        "YOUR_ACCESS_TOKEN",
        "--refresh-token",
        "YOUR_REFRESH_TOKEN",
        "--client-id",
        "YOUR_CLIENT_ID",
        "--client-secret",
        "YOUR_CLIENT_SECRET"
      ]
    }
  }
}

Tools

  • list_files: Search and list files.
  • get_file_metadata: Get file details.
  • create_folder: Create a new folder.
  • delete_file: Delete or trash a file.
  • move_file: Move a file to a new folder.
  • copy_file: Copy a file.
  • export_file: Export Google Workspace files and return base64 content with metadata.
  • list_trashed_files: List files/folders currently in trash.
  • restore_file: Restore trashed files/folders by fileId or name.
  • download_file: Download a file or folder into the workspace and return the local path(s).
  • upload_file: Upload a workspace file or folder; with fileId it updates the existing Drive file in place.

Download / Upload

Files are transferred between Drive and a local workspace directory; file content is never returned in the tool result, only the local path.

Option Default Description
--workspace-dir /home/workspace All local paths must be inside this directory
--max-file-size-mb 20 Max size of one file
--max-total-size-mb 100 Max total size of a folder transfer
--max-files 20 Max number of files in a folder transfer

Typical agent flow:

  1. download_file {"fileId": "abc123"} → {"localPath": "/home/workspace/budget.xlsx", "modifiedTime": "..."}
  2. The agent edits /home/workspace/budget.xlsx.
  3. upload_file {"path": "/home/workspace/budget.xlsx", "fileId": "abc123", "expected_modified_time": "..."}

Behavior:

  • Google Docs/Sheets/Slides/Drawings are exported on download (docx/xlsx/pptx/png by default, or export_format). An edited docx/xlsx/pptx can update the original Google file in place.
  • upload_file with fileId keeps the file ID, link and sharing; the previous content stays in Drive version history. Without fileId a new file is created in parentId (or My Drive).
  • Folders: a folder ID downloads the whole tree. Uploading a directory with a folder fileId updates changed same-name files (unchanged ones are skipped), creates new ones, and never deletes anything.
  • expected_modified_time makes the update fail if the Drive file changed since it was downloaded.

Restore Tool Behavior

restore_file supports two modes:

  1. Restore by ID:
{ "fileId": "FILE_ID" }
  1. Restore by name:
{
  "name": "report",
  "exactMatch": false,
  "restoreAllMatches": false
}

Notes:

  • Provide either fileId or name.
  • When restoring by name and multiple files match, only the first is restored unless restoreAllMatches is true.

License

MIT

Metadata

Release files for barie-google-drive-mcp 0.1.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for barie-google-drive-mcp 0.1.6
File Size Uploaded Provenance
barie_google_drive_mcp-0.1.6.tar.gz 15.2 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for barie-google-drive-mcp 0.1.6
File Interpreter ABI Platform
barie_google_drive_mcp-0.1.6-py3-none-any.whl Python 3 none any Details

Total release size: 32.0 kB

Release files / barie_google_drive_mcp-0.1.6.tar.gz

Download URL barie_google_drive_mcp-0.1.6.tar.gz
Size 15.2 kB
Tags Source
SHA-256 checksum
How to use checksums
44f94203aa068bce0619ebe94c39386e27981c9d5711885ec706d05a786627f9
BLAKE2b-256 checksum
How to use checksums
e5921257155271c6d379d6d15b88f02641f8439203161a947dee8f8b72d4ca18
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.0

Release files / barie_google_drive_mcp-0.1.6-py3-none-any.whl

Download URL barie_google_drive_mcp-0.1.6-py3-none-any.whl
Size 16.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4cf54a699fdcd697f32c2b2c8a4ad42639f23cf5e26f3e6ae6fa3e9e63fb7400
BLAKE2b-256 checksum
How to use checksums
c37b1fa8400ea1e8f58e791479fbd6e1051d64a74278b14a144c2e50ff5bc615
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.0

Security for barie-google-drive-mcp 0.1.6

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page