Prerequisites

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

1. Create a Google Sheets MCP Server

Use the following endpoint to create a new remote Google Sheets 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 Sheets",
  "userId": "<YOUR_USER_ID>",
  "platformName": "<YOUR_PLATFORM_NAME>"
}'

Response

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

2. Google Sheets OAuth Flow with White Labeling

If you want to enable your MCP server to access private Google Sheets information, you must use the OAuth flow with White Labeling. General white labeling information can be found in

Google OAuth Security Review Notice

Klavis AI only supports using your own custom Google OAuth application. You must set up and configure your own Google OAuth App to use Google Sheets functionality with Klavis AI’s MCP server. This ensures proper security, compliance, and reliability for your application.

Please refer to Google’s OAuth documentation to set up your own OAuth application.

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

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

Watch the Example

Explore MCP Server Tools