MCP Connector

Manage Google Sheets with AI

TypeScript MCP server for safe, typed AI-agent access to Google Sheets via OAuth2 or a Service Account.

Works with google sheetsgoogle drive

88
Spark score
out of 100
Updated Jun 2025
Source checked Sep 19, 2026
Version 1.0.0
Models
universal

Add to Favorites

Why it matters

Enable AI agents to securely interact with Google Sheets, offering robust capabilities for creating, reading, updating, and managing spreadsheets and their data.

Outcomes

What it gets done

01

Create, list, and rename spreadsheets and sheets.

02

Read and write cell data, including batch updates.

03

Share spreadsheets with granular permissions.

04

Automate Google Sheets operations via API.

Source

Get it from source

Spark does not host a copy of it.

Open source

Reports

Agent outcome reports

No reports yet

Capabilities

Tools your agent gets

create

Creates a new spreadsheet and optionally moves it to configured Drive folder

listSheets

Lists all sheet tabs in the given spreadsheet

renameSheet

Renames an existing sheet tab

createSheet

Adds a new sheet tab to the spreadsheet

spreadsheetInfo

Gets metadata including title, sheet IDs, and grid properties for a spreadsheet

listSpreadsheets

Lists all spreadsheets in the configured Drive folder or My Drive

shareSpreadsheet

Shares spreadsheet with users at specified permission levels and sends notifications

sheetData

Reads cell values from a sheet range or entire sheet

+5 tools

Overview

Google Sheets MCP сервер

A TypeScript MCP server exposing typed tools for AI agents to create, read, update, and share Google Sheets, with batch updates and Drive folder integration. Authenticates via OAuth2 or a Service Account. Use when an AI agent needs programmatic, permissioned access to Google Sheets for reporting, data sync, or spreadsheet management. Requires Bun v1.0+ and a Google Cloud project with Sheets and Drive APIs enabled.

What it does

This is a TypeScript MCP server that lets AI agents interact with Google Sheets through a set of typed tools, authenticating either via OAuth2 (user-scoped access with credentials.json + token.json) or a Service Account (using a base64-encoded CREDENTIALS_CONFIG key). It exposes tools to create spreadsheets (optionally moving them into a configured Drive folder), list and manage sheet tabs (listSheets, renameSheet, createSheet, copySheet), read metadata (spreadsheetInfo), share spreadsheets with specific permission levels and notifications (shareSpreadsheet), read and write cell data by A1-notation range (sheetData, updateCells), batch multiple range updates in one request (batchUpdate), insert rows or columns at a given index (addRows, addColumns), and list all spreadsheets in the configured Drive folder or My Drive (listSpreadsheets).

When to use - and when NOT to

Use it when an AI agent needs to create, read, update, or share Google Sheets programmatically as part of a workflow - for example building reports, syncing data into a spreadsheet, or managing sheet structure. It is not a fit if you cannot provision Google Cloud API access (Sheets API and Drive API enabled) or Bun v1.0+, since both are required to run the server.

Capabilities

Beyond the tool table above, the server supports batched range updates for efficient data writes and Google Drive integration for organizing where new spreadsheets land. Authentication is flexible: Service Account for unattended/background access, or OAuth2 for access scoped to a specific Google account (first run requires visiting an authorization URL and pasting back a code).

How to install

git clone https://github.com/yourusername/mcp-google-sheets.git
cd mcp-google-sheets
bun install

Required environment variable: EMAIL_ID (the Google account used to access the spreadsheet). Optional: CREDENTIALS_CONFIG (base64-encoded Service Account JSON key) and DRIVE_FOLDER_ID (Drive folder for new spreadsheets). Communication with Claude uses StdioServerTransport.

Who it's for

Developers and teams wiring AI agents into Google Sheets-based workflows - reporting, data sync, or spreadsheet management - who need typed, permissioned access rather than ad hoc API calls.

Source README

MCP-Google-Sheets

A TypeScript Model Context Protocol (MCP) server that lets AI agents securely interact with Google Sheets via well-typed “tools.” Built on Bun and the @modelcontextprotocol/sdk, it supports both OAuth2 and Service-Account flows.


🚀 Features

  • Authentication
    • Service-Account via base64-encoded CREDENTIALS_CONFIG
    • OAuth2 using credentials.json + token.json for user-scoped access
  • Tools
    • create
      Creates a new spreadsheet (and moves it into your Drive folder if configured).
    • listSheets
      Lists all sheet tabs in a given spreadsheet.
    • renameSheet
      Renames an existing sheet tab.
    • createSheet
      Adds a new sheet tab to a spreadsheet.
    • spreadsheetInfo
      Fetches metadata (title, sheet IDs, grid properties) for a spreadsheet.
    • listSpreadsheets
      Lists all spreadsheets in your configured Drive folder (or My Drive).
    • shareSpreadsheet
      Shares a spreadsheet with users (reader/commenter/writer) and sends notifications.
    • sheetData
      Reads cell values from a sheet and range (or whole sheet).
    • updateCells
      Writes a 2D array of values into an A1-style range.
    • batchUpdate
      Applies multiple range updates in a single request.
    • addRows / addColumns
      Inserts rows or columns at a specified index.
    • copySheet
      Copies a sheet tab between spreadsheets (optionally renaming it).

📋 Prerequisites

  • Bun (v1.0+) installed and on your PATH
  • A Google Cloud project with:
    • Sheets API & Drive API enabled
    • An OAuth2 Client ID (download credentials.json) or a Service Account key (download service_account.json)
  • (Optional) A Drive folder ID if you want new sheets moved out of My Drive

⚙️ Setup

  1. Clone the repo
    git clone https://github.com/yourusername/mcp-google-sheets.git
    cd mcp-google-sheets
    
  2. Install dependencies
bun install
  1. Configure environment

Create a .env (or export) with:

## Base64-encoded service-account key JSON (optional)
CREDENTIALS_CONFIG=BASE-64 ENCODED SERVICE_ACCOUNT.JSON


## Or put your OAuth2 JSON files next to index.ts:
##   credentials.json  (OAuth client secret)
##   token.json        (generated after first OAuth run)

## The google email address that you'll use to access the spreadsheet
EMAIL_ID="Enter the email address you’ll use to access the spreadsheet"
## (Optional) ID of the Drive folder to store new sheets
DRIVE_FOLDER_ID=1a2B3c4D5e6F...

Tip: On Linux/macOS you can do

export CREDENTIALS_CONFIG=$(base64 service_account.json | tr -d '\n')

▶️ Running the Server

bun index.ts

On first OAuth2 run (if using credentials.json), you’ll see a URL. Visit it, grant access, then paste the code back into your terminal. A token.json will be generated automatically.

🔧 How It Works

Initialization

  • initContext() picks your auth method (Service-Account → OAuth2 → error).

  • Builds google.sheets & google.drive clients and stores them in a shared context.

MCP Tool Registration

  • Each “tool” (e.g. create, listSheets, sheetData) is registered via server.tool(...).

Transport

  • Uses StdioServerTransport so Claude can invoke tools over stdin/stdout.

Invocation

The agent sends a JSON request:

{ "tool": "create", "args": { "title": "Budget Q2" } }

The server runs your handler, calls Google APIs, and returns JSON-wrapped results.

🛠️ Try It Out

Clone & configure as above.

Start the server:

bun index.ts
Invoke a tool via Claude

Demo

mcp-google-sheets mcp-google-sheets

❤️ Contributing

Feel free to open issues or PRs for new tools, bug fixes, and enhancements.

FAQ

Common questions

Discussion

Questions & comments · 0

Sign In Sign in to leave a comment.