Integrate
Integrations

Google Workspace

Manage Google Sheets, Docs, and Slides

The Google Workspace integration provides access to Google Sheets, Docs, and Slides APIs through the Integrate MCP server.

Installation

The Google Workspace integration is included with the SDK:

import { gworkspaceIntegration } from "integrate-sdk/server";

Setup

1. Create Google OAuth Credentials

  1. Go to Google Cloud Console
  2. Create a new project or select an existing one
  3. Enable the Google Sheets, Docs, Slides, and Drive APIs
  4. Create OAuth 2.0 credentials
  5. Note your Client ID and Client Secret

2. Configure the Integration on Your Server

Add the Google Workspace integration to your server configuration. The integration automatically reads GWORKSPACE_CLIENT_ID and GWORKSPACE_CLIENT_SECRET from your environment variables:

import { createMCPServer, gworkspaceIntegration } from "integrate-sdk/server";

export const { client: serverClient } = createMCPServer({
  apiKey: process.env.INTEGRATE_API_KEY,
  integrations: [
    gworkspaceIntegration({
      scopes: [
        "https://www.googleapis.com/auth/spreadsheets",
        "https://www.googleapis.com/auth/documents",
        "https://www.googleapis.com/auth/presentations",
        "https://www.googleapis.com/auth/drive.readonly",
      ], // Optional
    }),
  ],
});

You can override the environment variables by passing explicit values:

gworkspaceIntegration({
  clientId: process.env.CUSTOM_GWORKSPACE_ID,
  clientSecret: process.env.CUSTOM_GWORKSPACE_SECRET,
  scopes: ["https://www.googleapis.com/auth/spreadsheets"],
});

3. Client-Side Usage

The default client automatically includes all integrations. You can use it directly:

import { client } from "integrate-sdk";

await client.authorize("gworkspace");
const sheets = await client.gworkspace.sheetsList({});

If you're using a custom client, add the integration to the integrations array:

import { createMCPClient, gworkspaceIntegration } from "integrate-sdk";

const customClient = createMCPClient({
  integrations: [gworkspaceIntegration()],
});

Configuration Options

Prop

Type

Available Tools

Sheets

  • gworkspace_sheets_list - List spreadsheets
  • gworkspace_sheets_get - Get spreadsheet details
  • gworkspace_sheets_get_values - Get cell values
  • gworkspace_sheets_update_values - Update cell values
  • gworkspace_sheets_create - Create a new spreadsheet

Docs

  • gworkspace_docs_list - List documents
  • gworkspace_docs_get - Get document content
  • gworkspace_docs_create - Create a new document

Slides

  • gworkspace_slides_list - List presentations
  • gworkspace_slides_get - Get presentation details
  • gworkspace_slides_get_page - Get specific slide
  • gworkspace_slides_create - Create a new presentation

Examples

Update Spreadsheet Values

const result = await client.gworkspace.sheetsUpdateValues({
  spreadsheetId: "1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms",
  range: "Sheet1!A1:B2",
  values: [
    ["Name", "Value"],
    ["Item 1", "100"],
  ],
});

console.log("Updated cells:", result);

Read Spreadsheet Values

const result = await client.gworkspace.sheetsGetValues({
  spreadsheetId: "1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms",
  range: "Sheet1!A1:B10",
});

console.log("Values:", result);

Create a Document

const result = await client.gworkspace.docsCreate({
  title: "My New Document",
});

console.log("Document created:", result);

OAuth Scopes

The default scopes provide access to Sheets, Docs, Slides, and Drive. You may need different scopes:

  • https://www.googleapis.com/auth/spreadsheets - Read and write spreadsheets
  • https://www.googleapis.com/auth/spreadsheets.readonly - Read-only spreadsheets
  • https://www.googleapis.com/auth/documents - Read and write documents
  • https://www.googleapis.com/auth/documents.readonly - Read-only documents
  • https://www.googleapis.com/auth/presentations - Read and write presentations
  • https://www.googleapis.com/auth/drive.readonly - Read-only Drive access

Error Handling

try {
  const result = await client.gworkspace.sheetsUpdateValues({
    spreadsheetId: "1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms",
    range: "Sheet1!A1",
    values: [["Hello"]],
  });
} catch (error) {
  if (error.message.includes("not found")) {
    console.error("Spreadsheet not found");
  } else if (error.message.includes("authentication")) {
    console.error("Authentication failed");
  } else {
    console.error("Unexpected error:", error);
  }
}

Next Steps

On this page