Google Workspace

by j3k0

13 232 downloads Not rated yet MIT

About

Integrates Google Workspace APIs to enable tasks like sending emails, scheduling meetings, and managing documents in Gmail, Calendar, and Drive.

Details

Repository
j3k0/mcp-google-workspace
License
MIT

Explore

- Multiple Google Account Support
- Use and switch between multiple Google accounts
- Each account can have custom metadata and descriptions

- Gmail Integration
- Query emails with advanced search
- Read full email content and attachments
- Create and manage drafts
- Reply to emails
- Archive emails
- Handle attachments
- Bulk operations support

- Calendar Integration
- List available calendars
- View calendar events
- Create new events
- Delete events
- Support for multiple calendars
- Custom timezone support

Setting up with Highlight

This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:

  1. Download and install Highlight from highlightai.com/download
  2. Navigate to the plugins tab and select "Add Custom Plugin"
  3. Configure the plugin with the settings below
    Plugin Name Google Workspace
    Command (node, npx, python, etc.) npx
    Arguments
    • Argument 1 mcp-google-workspace

    Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.

  4. Enable "Start Automatically" if you want the plugin to start when Highlight launches

From the repository

- Node.js >= 20
- A Google Cloud project with Gmail and Calendar APIs enabled
- OAuth 2.0 credentials for Google APIs

Google Workspace (G Suite) APIs require OAuth2 authorization. Follow these steps to set up authentication:

1. Create OAuth2 Credentials:
- Go to the Google Cloud Console
- Create a new project or select an existing one
- Enable the Gmail API and Google Calendar API for your project
- Go to "Credentials" → "Create Credentials" → "OAuth client ID"
- Select "Desktop app" or "Web application" as the application type
- Configure the OAuth consent screen with required information
- Add authorized redirect URIs (include http://localhost:4100/code for local development)

2. Required OAuth2 Scopes:

   [
"openid",
"https://mail.google.com/",
"https://www.googleapis.com/auth/gmail.settings.basic",
"https://www.googleapis.com/auth/calendar",
"https://www.googleapis.com/auth/userinfo.email"
]

3. Create a .gauth.json file in the project root with your Google OAuth 2.0 credentials:

   {
"installed": {
"client_id": "your_client_id",
"project_id": "your_project_id",
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
"token_uri": "https://oauth2.googleapis.com/token",
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
"client_secret": "your_client_secret",
"redirect_uris": ["http://localhost:4100/code"]
}
}

4. Create a .accounts.json file to specify which Google accounts can use the server:

   {
"accounts": [
{
"email": "[email protected]",
"account_type": "personal",
"extra_info": "Primary account with Family Calendar"
}
]
}

You can specify multiple accounts. Make sure they have access in your Google Auth app. The extra_info field is especially useful as you can add information here that you want to tell the AI about the account (e.g., whether it has a specific calendar).

npm run authenticate -- [email protected] --force

npm run authenticate -- --gauth-file /path/to/.gauth.json --accounts-file /path/to/.accounts.json


If installed via npm, you can also run:

bash
npx mcp-gmail-authenticate

Configure Claude Desktop to use the mcp-google-workspace server:

On MacOS: Edit ~/Library/Application\ Support/Claude/claude_desktop_config.json

On Windows: Edit %APPDATA%/Claude/claude_desktop_config.json

<details>
<summary>Development/Unpublished Servers Configuration</summary>

json
{
"mcpServers": {
"mcp-google-workspace": {
"command": "<dir_to>/mcp-google-workspace/launch"
}
}
}
</details>

<details>
<summary>Published Servers Configuration</summary>

json
{
"mcpServers": {
"mcp-google-workspace": {
"command": "npx",
"args": [
"mcp-google-workspace"
]
}
}
}
``
</details>

- GMAIL_ALLOW_SENDING — set to true to allow gmail_send to actually send mail. Defaults to disabled.
-
GMAIL_ALLOW_DRAFTS — set to true to allow draft creation tools. Defaults to disabled.
-
GMAIL_ATTACHMENTS_DIR — base directory under which gmail_get_attachment and gmail_bulk_save_attachments may write files. Attachment paths supplied by the caller are treated as relative to this directory; absolute paths, traversal, and symlinks that escape the directory are rejected. Defaults to ~/.mcp-gsuite/attachments`.

gmail_list_accounts

List all configured Google accounts. View account metadata and descriptions. No user_id required.

calendar_list_accounts

List all configured Google accounts. View account metadata and descriptions. No user_id required.

gmail_query_emails

Search emails with Gmail's query syntax (e.g., 'is:unread', 'from:[email protected]'). Returns emails in reverse chronological order, including metadata and content summary.

gmail_get_email

Retrieve complete email content by ID. Includes full message body and attachment info.

gmail_bulk_get_emails

Retrieve multiple emails by ID in a single request. Efficient for batch processing.

gmail_create_draft

Create new email drafts. Support for CC recipients.

gmail_delete_draft

Delete draft emails by draft_id. Note: draft_id is distinct from the message ID.

gmail_list_drafts

List Gmail drafts, optionally filtered by a Gmail search query. Returns each draft's draft_id alongside its message_id, subject, recipients, and snippet.

gmail_reply

Reply to existing emails. Option to send immediately or save as draft. Support for 'Reply All' via CC.

gmail_get_attachment

Download email attachments. Save to disk or return as embedded resource.

gmail_bulk_save_attachments

Save multiple attachments in a single operation.

gmail_archive

Move emails out of inbox. Support for individual or bulk operations.

gmail_bulk_archive

Move multiple emails out of inbox. Support for bulk operations.

calendar_list

List all accessible calendars. Includes calendar metadata, access roles, and timezone information.

calendar_get_events

Retrieve events in a date range. Support for multiple calendars and filter options.

calendar_create_event

Create new calendar events. Support for attendees and notifications, with location and description fields.

calendar_delete_event

Delete events by ID. Option for cancellation notifications.

1. gmail_query_emails
- Search emails with Gmail's query syntax (e.g., 'is:unread', 'from:[email protected]', 'newer_than:2d', 'has:attachment')
- Returns emails in reverse chronological order
- Includes metadata and content summary

2. gmail_get_email
- Retrieve complete email content by ID
- Includes full message body and attachment info

3. gmail_bulk_get_emails
- Retrieve multiple emails by ID in a single request
- Efficient for batch processing

4. gmail_create_draft
- Create new email drafts
- Support for CC recipients

5. gmail_delete_draft
- Delete draft emails by draft_id
- Note: draft_id is distinct from the message ID returned by gmail_query_emails. Use gmail_list_drafts to obtain it.

6. gmail_list_drafts
- List Gmail drafts, optionally filtered by a Gmail search query
- Returns each draft's draft_id (required for gmail_delete_draft) alongside its message_id, subject, recipients, and snippet

7. gmail_reply
- Reply to existing emails
- Option to send immediately or save as draft
- Support for "Reply All" via CC

7. gmail_get_attachment
- Download email attachments
- Save to disk or return as embedded resource

8. gmail_bulk_save_attachments
- Save multiple attachments in a single operation

9. gmail_archive / gmail_bulk_archive
- Move emails out of inbox
- Support for individual or bulk operations

1. calendar_list
- List all accessible calendars
- Includes calendar metadata, access roles, and timezone information

2. calendar_get_events
- Retrieve events in a date range
- Support for multiple calendars
- Filter options (deleted events, max results)
- Timezone customization

3. calendar_create_event
- Create new calendar events
- Support for attendees and notifications
- Location and description fields
- Timezone handling

4. calendar_delete_event
- Delete events by ID
- Option for cancellation notifications

Claude Desktop / Cursor

Paste into your MCP client config file to install this server.

{
    "mcpServers": {
        "google workspace": {
            "env": {},
            "args": [
                "mcp-google-workspace"
            ],
            "command": "npx"
        }
    }
}

Linux

{
    "env": [],
    "args": [
        "mcp-google-workspace"
    ],
    "command": "npx"
}

Macos

{
    "env": [],
    "args": [
        "mcp-google-workspace"
    ],
    "command": "npx"
}

Windows

{
    "env": [],
    "args": [
        "/c",
        "npx",
        "mcp-google-workspace"
    ],
    "command": "cmd"
}

MCP Google Workspace Server

A Model Context Protocol server for Google Workspace services. This server provides tools to interact with Gmail and Google Calendar through the MCP protocol.

Features

- Multiple Google Account Support
- Use and switch between multiple Google accounts
- Each account can have custom metadata and descriptions

- Gmail Integration
- Query emails with advanced search
- Read full email content and attachments
- Create and manage drafts
- Reply to emails
- Archive emails
- Handle attachments
- Bulk operations support

- Calendar Integration
- List available calendars
- View calendar events
- Create new events
- Delete events
- Support for multiple calendars
- Custom timezone support

Example Prompts

Try these example prompts with your AI assistant:

Gmail

- "Retrieve my latest unread messages" - "Search my emails from the Scrum Master" - "Retrieve all emails from accounting" - "Take the email about ABC and summarize it" - "Write a nice response to Alice's last email and upload a draft" - "Reply to Bob's email with a Thank you note. Store it as draft"

Calendar

- "What do I have on my agenda tomorrow?" - "Check my private account's Family agenda for next week" - "I need to plan an event with Tim for 2hrs next week. Suggest some time slots"

Prerequisites

- Node.js >= 20
- A Google Cloud project with Gmail and Calendar APIs enabled
- OAuth 2.0 credentials for Google APIs

Installation

1. Clone the repository:

   git clone https://github.com/j3k0/mcp-google-workspace.git
cd mcp-google-workspace

2. Install dependencies:

   npm install

3. Build the TypeScript code:

   npm run build

Configuration

OAuth 2.0 Setup

Google Workspace (G Suite) APIs require OAuth2 authorization. Follow these steps to set up authentication:

1. Create OAuth2 Credentials:
- Go to the Google Cloud Console
- Create a new project or select an existing one
- Enable the Gmail API and Google Calendar API for your project
- Go to "Credentials" → "Create Credentials" → "OAuth client ID"
- Select "Desktop app" or "Web application" as the application type
- Configure the OAuth consent screen with required information
- Add authorized redirect URIs (include http://localhost:4100/code for local development)

2. Required OAuth2 Scopes:

   [
"openid",
"https://mail.google.com/",
"https://www.googleapis.com/auth/gmail.settings.basic",
"https://www.googleapis.com/auth/calendar",
"https://www.googleapis.com/auth/userinfo.email"
]

3. Create a .gauth.json file in the project root with your Google OAuth 2.0 credentials:

   {
"installed": {
"client_id": "your_client_id",
"project_id": "your_project_id",
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
"token_uri": "https://oauth2.googleapis.com/token",
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
"client_secret": "your_client_secret",
"redirect_uris": ["http://localhost:4100/code"]
}
}

4. Create a .accounts.json file to specify which Google accounts can use the server:

   {
"accounts": [
{
"email": "[email protected]",
"account_type": "personal",
"extra_info": "Primary account with Family Calendar"
}
]
}

You can specify multiple accounts. Make sure they have access in your Google Auth app. The extra_info field is especially useful as you can add information here that you want to tell the AI about the account (e.g., whether it has a specific calendar).

Authenticate

Once .gauth.json and .accounts.json are configured, authenticate your accounts:

npm run authenticate

This opens a browser for each configured account to complete the OAuth consent flow. The script waits up to 5 minutes per account for the callback.

```bash

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.