Prerequisites

To get the most out of this guide, you’ll need to:

1. Create a Google Docs MCP Server

Use the following endpoint to create a new remote Google Docs MCP server instance:

Request

curl --request POST \
  --url https://api.klavis.ai/mcp-server/instance/create \
  --header 'Authorization: Bearer <YOUR_API_KEY>' \
  --header 'Content-Type: application/json' \
  --data '{
  "serverName": "Google Docs",
  "userId": "<YOUR_USER_ID>",
  "platformName": "<YOUR_PLATFORM_NAME>"
}'

Response

{
  "serverUrl": "https://gdocs-mcp-server.klavis.ai/sse?instance_id=<instance-id>",
  "instanceId": "<instance-id>"
}
serverUrl specifies the endpoint of the Google Docs MCP server, which you can connect and use this MCP Server to interact with Google Docs data and functionality.
instanceId is used for authentication and identification of your server instance.

2. Google Docs OAuth Flow

Google Picker API

Klavis use Google Picker API to allow the user to create Drive files (including Docs) , and select and modify any file from their Drive that they want to share with your application , including files not created with the application. This gives users more control and confidence that your application’s access to their files is limited and secure.

Or if you want to set up your own branding - White Labeling

After you have set up the white labeling for Google Docs, you can then do the following:

const authUrl = `https://api.klavis.ai/oauth/gdocs/authorize?instance_id=${instanceId}&client_id=${clientId}`;
window.location.href = authUrl;

Watch the Example

Explore MCP Server Tools