Get the FREE Ultimate OpenClaw Setup Guide →

google-workspace -with-script

MCP server for Claude Code CLI with full Google Workspace integration - Docs, Sheets, Drive, Gmail, Calendar & Apps Script (72 tools)

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio sputnicyoji-google-workspace-mcp-with-script node dist/server.js \
  --env GOOGLE_APPLICATION_CREDENTIALS="Path to your Google service account key JSON file (optional if using user credentials)"

How to use

This MCP server provides a comprehensive Google Workspace integration, exposing 72 tools across Google Docs, Sheets, Drive, Gmail, Calendar, and Apps Script APIs. It includes capabilities to read, write, format, manage documents and sheets, handle Drive file and folder operations, send and manage Gmail messages, manipulate calendar events, and create or manage bound Apps Script projects. The server is designed to work with MCP-compatible clients such as Claude Code CLI and Cursor IDE, enabling AI-assisted automation of Workspace workflows. To use it, start the server and connect your MCP client to the local or configured host/port. You can then issue commands like readGoogleDoc, writeSpreadsheet, createCalendarEvent, or createBoundScript, depending on the tool you want to invoke. Tokenless interaction is supported when using a service account or OAuth credentials via the Google APIs setup, as described in the setup steps.

How to install

Prerequisites:

  • Node.js v18+ and npm
  • Git
  • Access to Google Cloud Console for API enablement and OAuth credentials (optional: service account for automated environments)

Step-by-step:

  1. Clone the repository git clone https://github.com/your-org/google-workspace-mcp-with-script.git cd google-workspace-mcp-with-script

  2. Install dependencies npm install

  3. Build the TypeScript project (if required by the repo setup) npm run build

  4. Run the server node dist/server.js // or if you have a different entry point, adjust accordingly

  5. Configure MCP clients

    • Claude Code CLI: add an mcp_config entry pointing to the node server with the path to dist/server.js
    • Cursor IDE: configure .cursor/mcp.json or global MCP settings to point to dist/server.js
  6. Authentication setup (choose one):

    • User credentials: Ensure OAuth consent screen and credentials.json are in place and Google APIs are enabled as described in the README
    • Service account (recommended for servers): Set GOOGLE_APPLICATION_CREDENTIALS to the service account key JSON path

Tips:

  • Ensure Google Docs, Sheets, Drive, Gmail, Calendar, and Apps Script APIs are enabled in your Google Cloud project
  • For first-time setup, run the interactive setup if provided by the project (npm run setup) to configure credentials

Additional notes

Environment variables and configuration options:

  • GOOGLE_APPLICATION_CREDENTIALS: Path to a Google service account key JSON file (optional if using user OAuth flow)
  • CLIENT_ID / CLIENT_SECRET / REDIRECT_URI: If using OAuth flow, ensure credentials are configured in the Google Cloud project
  • Make sure the OAuth consent screen is configured with the required scopes: documents, spreadsheets, drive.file, script.projects, gmail, calendar

Common issues:

  • API access not authorized: re-authenticate or ensure the OAuth tokens are refreshed
  • Insufficient permissions: share documents/files with the service account or authorize the user account used for OAuth
  • Network/endpoint problems: confirm dist/server.js exists after build and the server is reachable by the MCP client

Configuration tips:

  • Use the service account approach for unattended environments by setting GOOGLE_APPLICATION_CREDENTIALS and sharing resources with the service account
  • Keep the server up-to-date with the latest API scopes and client libraries to maintain compatibility with Google Workspace changes

Related MCP Servers

Sponsor this space

Reach thousands of developers