ShakibaMirbagheri/mcp-google-drive
If you are the rightful owner of mcp-google-drive and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to dayong@mcphub.com.
A server that provides MCP (Machine Control Protocol) interface to interact with Google Drive files and folders.
Google Drive MCP Server
A server that provides MCP (Machine Control Protocol) interface to interact with Google Drive files and folders.
Features
- Search for files in Google Drive
- Get file content and metadata
- OAuth authentication with token persistence
- HTTP and stdio transport modes
Quick Start with Docker Compose
The easiest way to get started is using Docker Compose:
Prerequisites
- Docker and Docker Compose installed on your system
- Google Drive API credentials - Download
credentials.jsonfrom Google Cloud Console - Authentication token - Generate
tokens.jsonby running auth setup (see below)
Setup Steps
-
Place your files in the project root:
credentials.json- Your Google Drive API credentialstokens.json- Your authentication token (generate if you don't have it)
-
Generate authentication token (if needed):
# First, set up a local environment python -m venv venv source venv/bin/activate pip install -e . # Run authentication setup python -m gdrive_mcp_server.auth_setup --credentials credentials.json --token tokens.json -
Start the server:
docker-compose up -d -
Verify it's running:
docker-compose logs -f # You should see: "Starting Google Drive MCP server!" -
Test the connection:
curl -X POST http://localhost:8000/mcp/v1/initialize \ -H "Content-Type: application/json" \ -d '{"protocolVersion": "2024-11-05", "capabilities": {}, "clientInfo": {"name": "test", "version": "1.0"}}' -
Stop the server:
docker-compose down
Configuration
- Custom port: Create a
.envfile withHTTP_PORT=8000(or your preferred port) - View logs:
docker-compose logs -f - Restart:
docker-compose restart
The server will be available at http://localhost:8000 (or your configured port).
Requirements
- Python 3.11 or higher
- Google Drive API credentials
Setup
- Create a virtual environment:
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
- Install the package in editable mode:
pip install -e .
-
Set up Google Drive API credentials:
- Go to the Google Cloud Console
- Create a new project or select an existing one
- Enable the Google Drive API for your project
- Go to "Credentials" in the left sidebar
- Click "Create Credentials" and select "OAuth client ID"
- Choose "Desktop app" as the application type
- Download the credentials file and save it as
credentials.json
-
Set up Google Drive authentication:
python -m gdrive_mcp_server.auth_setup --credentials /path/to/your/credentials.json --token /path/to/your/tokens.json
Usage
Run the server:
# Standard mode
gdrive-mcp
# HTTP mode
gdrive-mcp --http
Docker Usage
Quick Start: See the Quick Start with Docker Compose section above for the fastest way to get started.
Running with Docker Compose
- Create a
.envfile (optional, for custom port):
HTTP_PORT=8000
- Build and run the container:
docker-compose up -d
- View logs:
docker-compose logs -f
- Stop the container:
docker-compose down
Running with Docker
- Build the image:
docker build -t gdrive-mcp-server .
- Run the container:
docker run -d \
-p 8000:8000 \
-v $(pwd)/credentials.json:/app/data/credentials.json:ro \
-v $(pwd)/tokens.json:/app/data/tokens.json \
--name gdrive-mcp-server \
gdrive-mcp-server
Running in stdio mode
To run in stdio mode instead of HTTP mode, modify the command in docker-compose.yml:
command: ["python", "-m", "gdrive_mcp_server.server", "--token", "/app/data/tokens.json"]
Claude Desktop Integration
To integrate with Claude Desktop, add the following configuration to your claude_desktop_config.json:
"mcpServers": {
"google_drive": {
"command": "/path/to/your/venv/bin/gdrive-mcp",
"args": [
"--token",
"/path/to/your/tokens.json"
]
}
}
Replace the paths with your actual paths:
command: Path to the gdrive-mcp executable in your virtual environmentargs[1]: Path to your tokens.json file (generated during authentication setup)
Development
The project uses:
- Python 3.11+
- Google Drive API
- MCP server framework
- FastMCP for HTTP transport
- Rich for terminal formatting
Development dependencies can be installed with:
pip install -e ".[dev]"
Testing and Examples
Quick Start
See for a 5-minute guide to get started.
Usage Documentation
See for detailed documentation on:
- Connecting to the server
- Listing available tools
- Calling tools
- Example code in Python and curl
Test Scripts
Python test client:
# Make sure server is running first
python test_mcp_client.py
Bash examples:
./examples.sh
License
MIT License