gdrive-mcp

gdrive-mcp

A Model Context Protocol server that provides tools to search, list, and read files from Google Drive.

Category
Visit Server

README

Google Drive MCP Server

A Model Context Protocol (MCP) server that provides tools to search, list, and read files from Google Drive. Use it with Claude Desktop, Cursor, or any MCP-compatible client.

Features

Tool Description
search_drive Full-text search across file names and contents
list_recent_files Show recently modified files
get_file_content Download and return file content as text
get_file_metadata Get detailed file information
list_folder_contents Browse folder contents
list_shared_with_me Files others have shared with you
list_starred_files Your starred/important files
get_file_comments Read comments and discussions on a file

Prerequisites

  • Python 3.11+
  • A Google account with Google Drive access

Setup

1. Clone the Repository

git clone https://github.com/YOUR_USERNAME/gdrive-mcp.git
cd gdrive-mcp

2. Install Dependencies

pip install -r requirements.txt

3. Create Google OAuth Credentials

  1. Go to Google Cloud Console
  2. Create a new project (or select an existing one)
  3. Enable the Google Drive API:
    • Go to APIs & Services → Library
    • Search for "Google Drive API" → Click Enable
  4. Create OAuth credentials:
    • Go to APIs & Services → Credentials
    • Click + Create Credentials → OAuth client ID
    • If prompted, configure the OAuth consent screen:
      • User Type: External
      • Add your email as a test user
    • Application type: Desktop app
    • Click Create
  5. Download the JSON file and save it as client_secrets.json in the project root

4. Configure Your MCP Client

For Cursor

Add to ~/.cursor/mcp.json:

{
  "mcpServers": {
    "gdrive": {
      "command": "python3",
      "args": ["/path/to/gdrive-mcp/server.py"]
    }
  }
}

For Claude Desktop

Add to your Claude Desktop config:

{
  "mcpServers": {
    "gdrive": {
      "command": "python3",
      "args": ["/path/to/gdrive-mcp/server.py"]
    }
  }
}

Note: Replace /path/to/gdrive-mcp with the actual path where you cloned the repo.

5. Authenticate

On first use, the server will:

  1. Open a browser window for Google OAuth
  2. Ask you to sign in and grant "View files in Google Drive" permission
  3. Save the token to token.json for future use

Usage Examples

Once configured, you can ask your AI assistant:

  • "Search my Google Drive for quarterly reports"
  • "Show me files I've modified in the last 48 hours"
  • "Get the content of file with ID xyz123"
  • "List the contents of my Drive root folder"

File Structure

gdrive-mcp/
├── server.py               # MCP server (main entry point)
├── requirements.txt        # Python dependencies
├── client_secrets.json     # Your OAuth credentials (do not commit!)
├── client_secrets.example.json  # Template for credentials
├── token.json              # Auth token (auto-generated, do not commit!)
├── README.md               # This file
└── _tools/                 # Standalone CLI scripts (optional)
    ├── gdrive_download.py
    └── gdrive_recent.py

Security Notes

  • Never commit client_secrets.json or token.json — they contain sensitive credentials
  • Each user must create their own Google Cloud project and OAuth credentials
  • The server only requests read-only access (drive.readonly scope)

Troubleshooting

"Access blocked" error during OAuth

  • Go to Google Cloud Console → APIs & Services → OAuth consent screen
  • Add your email to Test Users

Token expired

  • Delete token.json and restart the server to re-authenticate

Module not found errors

  • Ensure you're using the same Python that has the dependencies installed
  • Try using the full path to Python: /usr/bin/python3 or similar

License

MIT

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured
E2B

E2B

Using MCP to run code via e2b.

Official
Featured