google-drive-mcp
Supports creating, reading, and editing Google Docs documents, including text manipulation, formatting, and batch updates.
Provides tools for listing, searching, and managing files and folders in Google Drive, including metadata retrieval and filtering.
Enables reading and updating cell values in Google Sheets, as well as creating new spreadsheets and retrieving metadata.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@google-drive-mcplist my recently modified files"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Google Drive MCP Server
A custom Model Context Protocol (MCP) server for Google Drive, Docs, and Sheets. Built for powerful document editing and file management with Claude Code.
Author: Nick Feamster
Features
Drive Operations
List files with filtering and sorting
Search files by content or name
Get file metadata
List documents and spreadsheets
Document Operations
Get full document structure and content
Extract plain text from documents
Create new documents
Insert, append, and replace text
Delete content ranges
Apply text formatting (bold, italic, underline, font size/family)
Batch update documents with custom requests
Spreadsheet Operations
Get spreadsheet metadata and structure
Read cell values from ranges
Update cell values
Create new spreadsheets
Related MCP server: Google Drive MCP Server
Prerequisites
Python 3.10+
Box Drive sync (for credential storage)
A Google Cloud project with OAuth credentials
Claude Code installed
Architecture Overview
This MCP server uses a distributed credential storage approach:
Code Repository (
~/src/google-drive-mcp/) - Cloned from GitHubCredentials Storage (
~/Library/CloudStorage/Box-Box/mcp-auth/google-drive-mcp/) - OAuth credentials in Box (synced across machines)MCP Configuration (
~/.claude/.mcp.json) - Can be managed via dotfiles repo
This allows:
Code updates via git pull
Automatic credential sync via Box
Easy setup on new machines
Google Cloud Setup (One-time)
1. Create Google Cloud Project
Go to Google Cloud Console
Create a new project (or use existing)
Enable the following APIs:
Google Docs API
Google Drive API
Google Sheets API
2. Configure OAuth Consent Screen
Go to "APIs & Services" → "OAuth consent screen"
Choose "External" user type
Fill in required app info:
App name: "Google Drive MCP"
Support email: your email
Add scopes:
https://www.googleapis.com/auth/documentshttps://www.googleapis.com/auth/drivehttps://www.googleapis.com/auth/spreadsheetshttps://www.googleapis.com/auth/script.external_request
Add your email as a Test User (important!)
Save and continue
3. Create OAuth 2.0 Credentials
Go to "APIs & Services" → "Credentials"
Click "Create Credentials" → "OAuth 2.0 Client ID"
Application type: Desktop app
Name it (e.g., "Google Drive MCP Client")
Click "Create"
Save the Client ID and Client Secret
Credentials Storage in Box
All OAuth credentials are stored in Box for automatic sync across machines.
Directory Structure
~/Library/CloudStorage/Box-Box/mcp-auth/google-drive-mcp/
├── credentials.json # OAuth Client ID and Secret
└── tokens/
└── token.json # OAuth refresh token (auto-generated)Create credentials.json
Create the file in Box with your OAuth credentials:
# Create directory structure
mkdir -p ~/Library/CloudStorage/Box-Box/mcp-auth/google-drive-mcp/tokens
# Create credentials.json (replace with your actual credentials from Google Cloud Console)
cat > ~/Library/CloudStorage/Box-Box/mcp-auth/google-drive-mcp/credentials.json <<'EOF'
{
"client_id": "YOUR_CLIENT_ID.apps.googleusercontent.com",
"client_secret": "YOUR_CLIENT_SECRET"
}
EOFImportant: The credentials.json file contains the OAuth Client ID and Secret from your Google Cloud project. These are the same credentials used across all your machines.
Installation
First Machine Setup
Clone the repository:
cd ~/src
git clone https://github.com/feamster/google-drive-mcp.git
cd google-drive-mcpInstall the package:
python3 -m pip install -e .Verify Box credentials exist:
ls -la ~/Library/CloudStorage/Box-Box/mcp-auth/google-drive-mcp/
# Should show: credentials.json and tokens/ directoryRun authentication:
python3 -m google_drive_mcp.authThis will:
Open a browser for Google authorization
Ask you to sign in and grant permissions
Save the refresh token to Box at
~/Library/CloudStorage/Box-Box/mcp-auth/google-drive-mcp/tokens/token.json
Configure Claude Code:
Add to ~/.claude/.mcp.json:
{
"mcpServers": {
"google-drive": {
"command": "python",
"args": ["-m", "google_drive_mcp.server"],
"cwd": "/Users/YOUR_USERNAME/src/google-drive-mcp"
}
}
}Note: If you manage .mcp.json via a dotfiles repo, add this configuration there instead.
Restart Claude Code
New Machine Setup
When setting up on a new machine (assuming Box is already synced):
Clone the repository:
cd ~/src
git clone https://github.com/feamster/google-drive-mcp.git
cd google-drive-mcpInstall the package:
python3 -m pip install -e .Verify Box is synced with credentials:
ls -la ~/Library/CloudStorage/Box-Box/mcp-auth/google-drive-mcp/
# Should show: credentials.json and tokens/token.jsonIf the token exists in Box, you're done! The server will use it automatically.
If the token is missing (first-time Box sync), run authentication:
python3 -m google_drive_mcp.authConfigure Claude Code (if not using dotfiles):
Add to ~/.claude/.mcp.json (adjust username):
{
"mcpServers": {
"google-drive": {
"command": "python",
"args": ["-m", "google_drive_mcp.server"],
"cwd": "/Users/YOUR_USERNAME/src/google-drive-mcp"
}
}
}Restart Claude Code
Testing
Test the server before using it with Claude Code:
cd ~/src/google-drive-mcp
python3 test_server.pyThis will:
Initialize the DocsClient
List your recent Google Docs and Sheets
Read content from your first document
Verify all capabilities are working
Expected output:
Testing Google Drive MCP Server
==================================================
1. Initializing DocsClient...
✓ Client initialized successfully
2. Listing recent Google Docs...
✓ Found 5 documents
...
All tests passed! ✓Available Tools (18 total)
Drive Tools (5)
list_files(query?, maxResults?, orderBy?)- List files with optional filtering and sortinglist_documents(maxResults?)- List Google Docs documentslist_spreadsheets(maxResults?)- List Google Sheets spreadsheetssearch_files(searchTerm, maxResults?)- Search for files by name or contentget_file_metadata(fileId)- Get metadata for a specific file
Document Tools (9)
get_document(documentId)- Get full document structure and contentget_document_text(documentId)- Get plain text content from a documentcreate_document(title)- Create a new Google Docs documentinsert_text(documentId, text, index?)- Insert text at a specific indexappend_text(documentId, text)- Append text to the end of a documentreplace_all_text(documentId, findText, replaceText, matchCase?)- Replace all occurrences of textdelete_content_range(documentId, startIndex, endIndex)- Delete content in a specific rangeformat_text(documentId, startIndex, endIndex, bold?, italic?, underline?, fontSize?, fontFamily?)- Apply formatting to a text rangebatch_update_document(documentId, requests)- Execute batch updates (advanced - requires knowledge of Docs API)
Spreadsheet Tools (4)
get_spreadsheet(spreadsheetId)- Get spreadsheet metadata and structureget_sheet_values(spreadsheetId, range)- Get values from a spreadsheet range (A1 notation)update_sheet_values(spreadsheetId, range, values)- Update values in a spreadsheet rangecreate_spreadsheet(title)- Create a new Google Sheets spreadsheet
Usage Examples
List Recent Documents
Claude: "List my 10 most recent Google Docs"Read a Document
Claude: "Read the content of document ID 1Bdjo1UJSoxUMyr__zaaNU8Dgmlkmtoq3tRCdGcQLM0k"Edit a Document
Claude: "In document 1Bdjo1UJSoxUMyr__zaaNU8Dgmlkmtoq3tRCdGcQLM0k, replace all instances of 'old text' with 'new text'"Format Text
Claude: "Make the first paragraph of document XYZ bold and increase font size to 14pt"Create a New Document
Claude: "Create a new Google Doc titled 'Meeting Notes' and add an agenda with 3 bullet points"Work with Spreadsheets
Claude: "Read cells A1:D10 from spreadsheet 1IkXxxTBw7onokE0ZEH4RAVrFZBQQOtOEb2F9U6xZ_DE"
Claude: "Update cell A1 in that spreadsheet to say 'Total Revenue'"Development
Project Structure
google-drive-mcp/
├── google_drive_mcp/
│ ├── __init__.py # Package initialization
│ ├── auth.py # OAuth2 authentication with Box integration
│ ├── docs_client.py # Google API client (Drive, Docs, Sheets)
│ └── server.py # MCP server implementation
├── test_server.py # Testing script
├── setup.py # Package setup
├── requirements.txt # Python dependencies
├── .gitignore # Git ignore rules
└── README.md # This fileAdding New Features
The client (docs_client.py) can be extended with additional Google API methods. The server (server.py) exposes these as MCP tools.
Steps to add a new tool:
Add method to
DocsClientclass ingoogle_drive_mcp/docs_client.py:
def my_new_feature(self, document_id: str, param: str) -> Dict[str, Any]:
"""Description of what this does."""
# Implementation using Google API
...Add tool definition to
TOOLSlist ingoogle_drive_mcp/server.py:
Tool(
name="my_new_feature",
description="Brief description for Claude",
inputSchema={
"type": "object",
"properties": {
"documentId": {"type": "string", "description": "Document ID"},
"param": {"type": "string", "description": "Parameter description"}
},
"required": ["documentId", "param"]
}
)Add handler in
call_tool()function ingoogle_drive_mcp/server.py:
elif name == "my_new_feature":
result = docs.my_new_feature(
document_id=arguments["documentId"],
param=arguments["param"]
)
return [TextContent(type="text", text=json.dumps(result, indent=2))]Test and commit:
python3 test_server.py # Verify it works
git add .
git commit -m "Add my_new_feature capability"
git pushPlanned Features
Features to add (based on comparison with other MCP servers):
Priority 1:
Comments system (list, create, reply, resolve, delete)
Image insertion (from URLs or files)
Tables and page breaks
Advanced text formatting (colors, links, alignment, spacing)
File management (move, copy, rename, delete, folders)
Priority 2:
Markdown conversion and round-trip
Sheets formatting (cell colors, alignment, freeze panes, dropdowns)
Template support
Multi-tab document support
Troubleshooting
Authentication Issues
Problem: "No valid credentials found"
Solution:
Verify Box is synced:
ls ~/Library/CloudStorage/Box-Box/mcp-auth/google-drive-mcp/Check credentials.json exists and is valid JSON
Ensure your email is listed as a Test User in OAuth consent screen
Verify all required APIs are enabled in Google Cloud Console
Re-run authentication:
python3 -m google_drive_mcp.auth
Token Not Found
# Verify Box is synced
ls ~/Library/CloudStorage/Box-Box/mcp-auth/google-drive-mcp/tokens/
# Check token contents (should have refresh_token)
cat ~/Library/CloudStorage/Box-Box/mcp-auth/google-drive-mcp/tokens/token.json
# Re-authenticate if needed
python3 -m google_drive_mcp.authMCP Server Not Loading
Check Claude Code logs for errors
Verify the
cwdpath in.mcp.jsonmatches your username:whoami # Check your username cat ~/.claude/.mcp.json | grep google-driveTest the server manually:
cd ~/src/google-drive-mcp python3 -m google_drive_mcp.server # Should start without errors (use Ctrl+C to exit)Verify package is installed:
python3 -c "import google_drive_mcp; print(google_drive_mcp.__version__)" # Should print: 0.1.0
Box Sync Issues
Problem: Credentials or tokens not syncing
Solution:
Verify Box is running and synced
Check Box preferences for selective sync settings
Manually verify file exists on Box.com web interface
Force sync by touching the file:
touch ~/Library/CloudStorage/Box-Box/mcp-auth/google-drive-mcp/tokens/token.json
Dotfiles Repo Integration
If you manage your Claude Code configuration via a dotfiles repo:
Add
.mcp.jsonto your dotfiles repoSymlink it:
ln -s ~/dotfiles/.claude/.mcp.json ~/.claude/.mcp.jsonCommit and push the configuration
On new machines, your dotfiles setup script should handle the symlink
Resources
License
MIT
Support
For issues or questions:
Check the Troubleshooting section above
Review Google API documentation
Test with
test_server.pyto isolate the problemCheck Claude Code logs for detailed error messages
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/feamster/google-drive-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server