Get the FREE Ultimate OpenClaw Setup Guide →

google-workspace

A Model Context Protocol server for Google Workspace integration (Gmail and Calendar)

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio epaproditus-google-workspace-mcp-server node /path/to/google-workspace-server/build/index.js \
  --env GOOGLE_CLIENT_ID="YOUR_CLIENT_ID" \
  --env GOOGLE_CLIENT_SECRET="YOUR_CLIENT_SECRET" \
  --env GOOGLE_REFRESH_TOKEN="YOUR_REFRESH_TOKEN"

How to use

This MCP server exposes tools to manage Gmail messages and Google Calendar events via the MCP interface. It provides Gmail tools such as listing emails, searching with Gmail query syntax, sending emails, and modifying emails (labels). It also exposes Calendar tools to list, create, update, and delete events. You can interact with these capabilities by sending MCP requests that include the appropriate method and payload for the desired tool. The server relies on OAuth credentials (client ID, client secret, and refresh token) that you configure in credentials.json and environment variables to authorize operations against Gmail and Google Calendar APIs.

How to install

Prerequisites:

  • Node.js >= 14
  • Access to Google Cloud Console with Gmail and Google Calendar APIs enabled
  • OAuth 2.0 Client ID/Secret and a refresh token

Installation steps:

  1. Clone the repository
git clone https://github.com/epaproditus/google-workspace-mcp-server.git
cd google-workspace-mcp-server
  1. Install dependencies
npm install
  1. Create OAuth credentials file (credentials.json)
{
  "web": {
    "client_id": "YOUR_CLIENT_ID",
    "client_secret": "YOUR_CLIENT_SECRET",
    "redirect_uris": ["http://localhost:4100/code"],
    "auth_uri": "https://accounts.google.com/o/oauth2/auth",
    "token_uri": "https://oauth2.googleapis.com/token"
  }
}
  1. Get a refresh token
node get-refresh-token.js

This will open a browser to authorize and will save tokens to token.json and display the refresh token. 5. Configure MCP settings (example snippet):

{
  "mcpServers": {
    "google-workspace": {
      "command": "node",
      "args": ["/path/to/google-workspace-server/build/index.js"],
      "env": {
        "GOOGLE_CLIENT_ID": "your_client_id",
        "GOOGLE_CLIENT_SECRET": "your_client_secret",
        "GOOGLE_REFRESH_TOKEN": "your_refresh_token"
      }
    }
  }
}
  1. Build and run
npm run build

Run the server via your MCP host using the configured command and arguments as shown above.

Additional notes

Environment variables GOOGLE_CLIENT_ID, GOOGLE_CLIENT_SECRET, and GOOGLE_REFRESH_TOKEN are required for authentication. Ensure the Gmail API and Google Calendar API are enabled in your Google Cloud project and that the OAuth client ID has the correct redirect URI (http://localhost:4100/code). If you encounter authentication issues, re-authenticate or re-issue tokens. When updating scopes, re-run the refresh token flow to obtain valid credentials. Keep credentials secure and do not commit credentials.json or token.json to version control.

Related MCP Servers

Sponsor this space

Reach thousands of developers