A comprehensive Google MCP (Model Context Protocol) server written in Rust. Currently provides 41 tools, resource templates, and prompts for full Google Drive access, with Gmail and other Google services planned.
Supports both stdio and Streamable HTTP transports with multi-user OAuth.
cargo install gdrive-mcp-server
gdrive-mcp-server --credentials-file client_secret.json| Domain | Count | Tools |
|---|---|---|
| Files | 12 | list, get, create, update, delete, copy, move, trash, untrash, empty_trash, export, download |
| Permissions | 5 | create, list, get, update, delete |
| Comments | 5 | create, list, get, update, delete |
| Replies | 5 | create, list, get, update, delete |
| Revisions | 4 | list, get, update, delete |
| Shared Drives | 5 | create, list, get, update, delete |
| Changes | 2 | get_start_page_token, list |
| About | 1 | get |
| Labels | 2 | list, modify |
gdrive:///{file_id}-- Read file content with auto-conversion (Docs → Markdown, Sheets → CSV, Slides → text, Drawings → PNG)gdrive:///folder/{folder_id}-- List folder contents
gdrive_search_help-- Help building Google Drive search queriesgdrive_organize_files-- File/folder organization guidancegdrive_sharing_guide-- Sharing and permissions guidance
- Rust 1.80+ (stable toolchain)
- Google Cloud Project with the Drive API enabled
- OAuth2 credentials (
client_secret.json)
- Go to Google Cloud Console
- Create a new project (or select an existing one)
- Enable the Google Drive API (APIs & Services → Library → search "Google Drive API")
- Go to APIs & Services → Credentials → Create Credentials → OAuth client ID
- Select Desktop app as application type
- Download the JSON file and save it as
client_secret.jsonin the project root
Note: For HTTP transport (multi-user), you may use Web application type instead, but Desktop app works for both modes.
git clone https://github.com/cafercangundogdu/google-mcp.git
cd google-mcp
cargo build --releaseThe binary will be at target/release/gdrive-mcp-server.
Single-user mode for Claude Desktop, MCP Inspector, or any stdio-based MCP client. On first run, a browser window opens for Google OAuth2 authorization. The token is cached for subsequent runs.
gdrive-mcp-server --credentials-file client_secret.jsonMulti-user mode with full MCP OAuth 2.1 support. Each user authenticates with their own Google account via the MCP OAuth flow (RFC 9728). The server acts as an OAuth proxy to Google.
gdrive-mcp-server --transport http --http-addr 0.0.0.0:3000 --credentials-file client_secret.jsonThe MCP endpoint will be available at http://localhost:3000/mcp.
OAuth flow:
- MCP client discovers OAuth metadata via
/.well-known/oauth-protected-resource - Client registers dynamically via
/oauth/register(RFC 7591) - Authorization redirects to Google OAuth consent screen
- User authenticates with their Google account
- Server issues per-user MCP tokens bound to Google tokens
- Each user gets isolated Google Drive access
All CLI options can be set via environment variables:
| Variable | Default | Description |
|---|---|---|
GDRIVE_MCP_TRANSPORT |
stdio |
Transport mode: stdio or http |
GDRIVE_MCP_HTTP_ADDR |
127.0.0.1:3000 |
HTTP bind address |
GDRIVE_MCP_CREDENTIALS |
-- | Path to OAuth2 credentials JSON |
GDRIVE_MCP_TOKEN_CACHE |
~/.gdrive-mcp-token.json |
Token cache path (stdio mode) |
GDRIVE_MCP_LOG_LEVEL |
info |
Log level: error, warn, info, debug, trace |
Add to your claude_desktop_config.json:
{
"mcpServers": {
"gdrive": {
"command": "/path/to/gdrive-mcp-server",
"args": ["--credentials-file", "/path/to/client_secret.json"]
}
}
}# Stdio
npx @modelcontextprotocol/inspector ./target/release/gdrive-mcp-server -- --credentials-file client_secret.json
# HTTP
npx @modelcontextprotocol/inspector http://localhost:3000/mcpFor server-to-server usage without user interaction, use a service account key:
gdrive-mcp-server --credentials-file service-account-key.jsonThe server auto-detects the credential type from the JSON file.
crates/
gdrive-mcp-server/ # Binary crate (thin main.rs)
gdrive-mcp-core/ # Library crate (all logic)
src/
auth.rs # OAuth2 setup, token persistence, service account
client.rs # DriveClient wrapper
config.rs # CLI args + env vars (clap)
convert.rs # Google Doc format conversions
error.rs # Error types (thiserror)
oauth.rs # MCP OAuth 2.1 proxy to Google (HTTP mode)
server.rs # GDriveServer, ServerHandler impl
transport.rs # stdio / Streamable HTTP switching
tools/ # 41 MCP tools across 9 domain modules
resources/ # Resource templates (file, folder)
prompts/ # Prompts (search, organize, sharing)
| Component | Choice |
|---|---|
| MCP SDK | rmcp v0.16 |
| Google Drive API | google-drive3 v7.0 |
| OAuth2 | yup-oauth2 v12 |
| Async Runtime | tokio |
| HTTP Framework | axum v0.8 |
| CLI | clap v4 |
Contributions are welcome! Please feel free to open issues or submit pull requests.
- Fork the repository
- Create your feature branch (
git checkout -b feature/my-feature) - Commit your changes
- Push to the branch
- Open a Pull Request
This project is licensed under the MIT License.
Roadmap: Gmail tools, Google Calendar, and more Google services are planned. Contributions welcome!