MCP server for google workspace (Docs, Sheets, Slides)
Google Workspace MCP Server
A Model Context Protocol (MCP) server that enables Claude to create and manage Google Docs, Sheets, and Slides directly.
Features
- Create, read, and update Google Documents
- Create and manage Google Sheets (read/write data, format cells)
- Create and manage Google Slides presentations
- Insert images (from URLs or local files) into documents and slides
- Insert native tables with borders into Google Docs
- Format text and cells (bold, italic, underline, colors)
Prerequisites
- Node.js v18 or higher
- A Google Cloud account
- Claude Desktop or Claude Code
Quick Start
1. Clone and Install
git clone <your-repo-url>
cd google-workspace-mcp
npm install
2. Set Up Google Cloud Credentials
a. Create a Google Cloud Project
- Go to Google Cloud Console
- Click "Select a project" → "New Project"
- Enter a project name and click "Create"
b. Enable Required APIs
In your Google Cloud project, go to "APIs & Services" → "Library" and enable:
- Google Docs API
- Google Sheets API
- Google Slides API
- Google Drive API
c. Create OAuth 2.0 Credentials
- Go to "APIs & Services" → "Credentials"
- Click "Create Credentials" → "OAuth client ID"
- Configure OAuth consent screen if prompted:
- User Type: External
- App name: Your choice (e.g., "Google Workspace MCP")
- Add your email for support and developer contact
- Click "Save and Continue"
- On "Create OAuth client ID":
- Application type: Desktop app
- Name: "Google Workspace MCP" (or your choice)
- Click "Create"
- Click "Download JSON"
- Save the downloaded file as
credentials.jsonin the project root directory
d. Add Test Users
Since your app is in testing mode:
- Go to "APIs & Services" → "OAuth consent screen"
- Scroll to "Test users" → Click "Add Users"
- Enter your Google account email
- Click "Save"
3. Build the Project
npm run build
4. Authenticate with Google
Run the one-time authentication:
npm run auth
This will:
- Display a Google authorization URL
- Open it in your browser (or copy/paste manually)
- Ask you to sign in and grant permissions
- Provide an authorization code
Steps:
- Click "Allow" to grant permissions
- Copy the authorization code
- Paste it into the terminal
- Press Enter
A token.json file will be created with your access credentials.
5. Configure Claude
Windows
- Navigate to
%APPDATA%\Claude\ - Open or create
claude_desktop_config.json - Add this configuration (update the path to match your installation):
{
"mcpServers": {
"google-workspace": {
"command": "node",
"args": ["C:\\Users\\YOUR_USERNAME\\path\\to\\google-workspace-mcp\\dist\\index.js"]
}
}
}
macOS/Linux
- Edit
~/Library/Application Support/Claude/claude_desktop_config.json - Add this configuration:
{
"mcpServers": {
"google-workspace": {
"command": "node",
"args": ["/absolute/path/to/google-workspace-mcp/dist/index.js"]
}
}
}
6. Restart Claude
Completely quit and restart Claude Desktop/Code (not just close the window).
Available Tools
Google Docs
create_document- Create a new Google Docread_document- Read document contentupdate_document- Replace document textinsert_image_to_doc- Insert image from URLinsert_local_image_to_doc- Insert image from local fileformat_text_in_doc- Format text (bold, italic, underline, color)insert_table_to_doc- Insert a native table with borders and optional header formatting
Google Sheets
create_spreadsheet- Create a new spreadsheetread_sheet- Read data from a rangewrite_sheet- Write data to a rangeformat_cells- Format cells (bold, italic, underline, colors)
Google Slides
create_presentation- Create a new presentationread_presentation- Get presentation dataadd_slide- Add a new slideadd_text_to_slide- Add text to a slideinsert_image_to_slide- Insert image from URLinsert_local_image_to_slide- Insert image from local fileformat_text_in_slide- Format text in slides
Usage Examples
Once connected, you can ask Claude:
Documents:
- "Create a new Google Doc called 'Meeting Notes'"
- "Add this content to my document: [your text]"
- "Make the title bold in my document"
- "Insert a table with project tasks and status"
Spreadsheets:
- "Create a new spreadsheet called 'Q1 Budget'"
- "Write this data to cells A1:C3 in my spreadsheet"
- "Read the data from Sheet1!A1:D10"
Presentations:
- "Create a new presentation called 'Project Proposal'"
- "Add a slide with the title 'Overview'"
- "Insert this image into the first slide"
Table Feature
The insert_table_to_doc tool creates native Google Docs tables with:
- Solid black borders on all cells (1pt weight)
- Header row formatting (optional) - bold text with light gray background
- Proper cell structure that supports sorting, resizing, and formatting
Table Example
When you ask Claude to insert a table, it creates a properly formatted table like this:

Table Parameters
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| documentId | string | Yes | The Google Doc ID |
| index | number | Yes | Position in document (1 = start) |
| rows | number | Yes | Number of rows |
| columns | number | Yes | Number of columns |
| data | string[][] | Yes | 2D array of cell contents |
| headerRow | boolean | No | Format first row as header (bold + gray background) |
Example Usage
{
"documentId": "1abc123...",
"index": 1,
"rows": 3,
"columns": 2,
"data": [
["Name", "Status"],
["Task 1", "Complete"],
["Task 2", "In Progress"]
],
"headerRow": true
}
Troubleshooting
"Error: credentials.json not found"
- Ensure you downloaded OAuth credentials from Google Cloud Console
- Verify the file is named exactly
credentials.json - Place it in the project root directory
"Error: token.json not found"
- Run
npm run authto complete authentication - Make sure you paste the authorization code correctly
"Invalid grant" or "Token expired"
- Delete
token.json - Run
npm run authagain
"Access blocked: This app's request is invalid"
- Add your Google account as a test user in OAuth consent screen
- Verify all required APIs are enabled
MCP server not showing in Claude
- Verify the path in
claude_desktop_config.jsonis correct - Use double backslashes on Windows (
C:\\Users\\...) - Ensure you ran
npm run build - Completely quit and restart Claude
"Cannot find module" errors
- Run
npm installto ensure dependencies are installed
Security Notes
IMPORTANT: Never commit these files to version control:
credentials.json- Contains your OAuth client secrettoken.json- Contains your access tokens
These files are already in .gitignore. If you need to share your project:
- Use
credentials.example.jsonas a template - Recipients must create their own credentials from Google Cloud Console
Project Structure
google-workspace-mcp/
├── src/ # Source code
│ ├── interfaces/ # TypeScript interfaces
│ ├── services/ # Google API services
│ ├── tools/ # MCP tool definitions
│ ├── authenticate.ts # Auth script
│ └── index.ts # Main MCP server
├── dist/ # Compiled JavaScript (after build)
├── credentials.json # Your OAuth credentials (DO NOT COMMIT)
├── token.json # Access token (DO NOT COMMIT)
├── credentials.example.json # Template for credentials
├── token.example.json # Template for token
├── package.json
├── tsconfig.json
└── README.md
Commands Reference
# Install dependencies
npm install
# Build the project
npm run build
# Run authentication (first time only)
npm run auth
# Start server (for testing)
npm run start
# Development mode with auto-reload
npm run dev
Additional Documentation
- MCP_CREATION_GUIDE.md - Learn how this MCP server was built from scratch
- SETUP_GUIDE.md - Detailed setup instructions with screenshots
Resources
License
MIT
Happy automating with Claude and Google Workspace!