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
- Go to Google Cloud Console
- Create a new project or select an existing one
- Enable the Google Sheets, Docs, Slides, and Drive APIs
- Create OAuth 2.0 credentials
- 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 spreadsheetsgworkspace_sheets_get- Get spreadsheet detailsgworkspace_sheets_get_values- Get cell valuesgworkspace_sheets_update_values- Update cell valuesgworkspace_sheets_create- Create a new spreadsheet
Docs
gworkspace_docs_list- List documentsgworkspace_docs_get- Get document contentgworkspace_docs_create- Create a new document
Slides
gworkspace_slides_list- List presentationsgworkspace_slides_get- Get presentation detailsgworkspace_slides_get_page- Get specific slidegworkspace_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 spreadsheetshttps://www.googleapis.com/auth/spreadsheets.readonly- Read-only spreadsheetshttps://www.googleapis.com/auth/documents- Read and write documentshttps://www.googleapis.com/auth/documents.readonly- Read-only documentshttps://www.googleapis.com/auth/presentations- Read and write presentationshttps://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
- Explore the Google Calendar Integration
- Explore the Gmail Integration
- See Advanced Usage for more examples