by piotr-agier
A Model Context Protocol (MCP) server that provides secure integration with Google Drive, Docs, Sheets, Slides and Calendar. It allows Claude Desktop and other MCP clients to manage files in Google Drive through a standardized interface.
# Add to your Claude Code skills
git clone https://github.com/piotr-agier/google-drive-mcpA Model Context Protocol (MCP) server that provides secure integration with Google Drive, Docs, Sheets, Slides, and Calendar. It allows Claude Desktop and other MCP clients to manage files in Google Drive and calendar events through a standardized interface.
/Work/Projects)This MCP server enables powerful file management workflows through natural language:
Create a new Google Doc called "Project Plan" in the folder /Work/Projects
with an outline for our Q1 initiatives including milestones and deliverables.
No comments yet. Be the first to share your thoughts!
Search for files containing "budget" and organize them by moving each one
to the appropriate folder in your Drive hierarchy.
Create a Google Sheet called "Sales Analysis 2024" with columns for Date, Product,
Quantity, and Revenue to track your sales data.
Create a presentation called "Product Roadmap" with slides outlining
our Q1 milestones, key features, and timeline.
Update the "Team Contacts" spreadsheet with new employee information
by modifying specific cells or ranges with the provided data.
Search for documents in the /Reports folder and create a summary
document listing the files you found.
Create a Templates folder and add standard documents like
a Meeting Notes template, Project Proposal template,
and Budget Spreadsheet template.
./auth/drive.file.../auth/documents.../auth/spreadsheets.../auth/presentations.../auth/drive.../auth/drive.readonly.../auth/calendar.../auth/calendar.eventsgcp-oauth.keys.jsonYou can run the server directly without installation:
# Run the server (authentication happens automatically on first run)
npx @piotr-agier/google-drive-mcp
# Optional: Run authentication manually if needed
npx @piotr-agier/google-drive-mcp auth
Clone and install:
git clone https://github.com/piotr-agier/google-drive-mcp.git
cd google-drive-mcp
npm install
Set up credentials:
# Copy the example file
cp gcp-oauth.keys.example.json gcp-oauth.keys.json
# Edit gcp-oauth.keys.json with your OAuth client ID
Authenticate (optional):
npm run auth
Note: Authentication happens automatically on first run of an MCP client if you skip this step.
Authenticate locally first - Docker containers cannot open browsers for OAuth:
# Using npx
npx @piotr-agier/google-drive-mcp auth
# Or using local installation
npm run auth
Verify token location:
ls -la ~/.config/google-drive-mcp/tokens.json
Build the project (required before Docker build):
npm install
npm run build
Build the Docker image:
docker build -t google-drive-mcp .
The scripts/docker-mcp.sh wrapper manages the container lifecycle — it creates, reuses, and replaces containers automatically. MCP clients invoke this script directly (see configuration below).
To verify the image works after a rebuild:
docker run --rm google-drive-mcp --help
Uses a wrapper script that keeps a single named container running and reuses it across client restarts — faster startup and no container churn:
{
"mcpServers": {
"google-drive": {
"command": "/path/to/google-drive-mcp/scripts/docker-mcp.sh",
"env": {
"GOOGLE_DRIVE_OAUTH_CREDENTIALS": "$HOME/gcp-oauth.keys.json",
"GOOGLE_DRIVE_MCP_TOKEN_PATH": "$HOME/.config/google-drive-mcp/tokens.json"
}
}
}
}
The script will:
Note: The container stays running in the background until explicitly stopped.
To stop it: docker stop google-drive-mcp
Creates and removes a new container on every client restart:
{
"mcpServers": {
"google-drive": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"-v",
"/path/to/gcp-oauth.keys.json:/config/gcp-oauth.keys.json:ro",
"-v",
"/Users/yourname/.config/google-drive-mcp/tokens.json:/config/tokens.json",
"google-drive-mcp"
]
}
}
}
Docker-specific notes:
-i for interactive mode (required for MCP stdio communication)--rm to automatically remove the container after exitThe server supports multiple methods for providing OAuth credentials (in order of priority):
export GOOGLE_DRIVE_OAUTH_CREDENTIALS="/path/to/your/gcp-oauth.keys.json"
Place gcp-oauth.keys.json in the XDG config directory:
~/.config/google-drive-mcp/gcp-oauth.keys.json
This is the recommended location — it works reliably with npx, global installs, and local setups.
Place gcp-oauth.keys.json in the project root directory. This still works for local development but is unreliable with npx or global installs.
By default, the server requests a broad scope set for Drive/Docs/Sheets/Slides/Calendar. You can override requested scopes with:
export GOOGLE_DRIVE_MCP_SCOPES="drive.readonly,documents,spreadsheets"
Notes:
drive, drive.file, drive.readonly, documents, spreadsheets, presentations, calendar, calendar.events.Authentication tokens are stored securely following the XDG Base Directory specification:
| Priority | Location | Configuration |
|----------|----------|---------------|
| 1 | Custom path | Set GOOGLE_DRIVE_MCP_TOKEN_PATH environment variable |
| 2 | XDG Config | $XDG_CONFIG_HOME/google-drive-mcp/tokens.json |
| 3 | Default | ~/.config/google-drive-mcp/tokens.json |
Security Notes:
Add the server to your Claude Desktop configuration:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"google-drive": {
"command": "npx",
"args":