Google Sheets

Google Sheets

An MCP Server written in TypeScript to access and edit data in your Google Sheets.

17
Stars
3
Forks
0
Releases

Overview

An MCP server in TypeScript for secure AI-driven interaction with Google Sheets, built on Bun and the @modelcontextprotocol/sdk. It exposes well-typed tools that map to Google Sheets and Drive operations and supports both Service-Account and OAuth2 authentication flows. Initialization selects the authentication method (Service-Account via a base64-encoded CREDENTIALS_CONFIG, or OAuth2 using credentials.json and token.json) and builds google.sheets and google.drive clients stored in a shared context. Tools are registered via server.tool(...) and can be invoked by AI agents through a JSON RPC-style interface over a Stdio transport (StdioServerTransport), enabling Claude or other agents to call functions like create, listSheets, sheetData, updateCells, etc. The server expects requests like { "tool": "create", "args": { "title": "Budget Q2" } } and returns JSON-wrapped results. Setup requires Bun v1.0+, a Google Cloud project with Sheets and Drive APIs enabled, and credentials either as a base64-encoded service account (CREDENTIALS_CONFIG) or OAuth client credentials. Optional DRIVE_FOLDER_ID moves new sheets out of My Drive. Running bun index.ts starts the server and may require visiting an OAuth URL to grant access and generate token.json. The server provides secure, typed access to Google Sheets via MCP tools.

Details

Owner
rohans2
Language
TypeScript
License
MIT License
Updated
2025-12-07

Features

Authentication - Service Account

Supports base64-encoded CREDENTIALS_CONFIG for service accounts.

Authentication - OAuth2

Uses credentials.json and token.json for user-scoped access.

Tool: create

Creates a new spreadsheet (and moves it into a Drive folder if configured).

Tool: listSheets

Lists all sheet tabs in a given spreadsheet.

Tool: renameSheet

Renames an existing sheet tab.

Tool: createSheet

Adds a new sheet tab to a spreadsheet.

Tool: spreadsheetInfo

Fetches metadata (title, sheet IDs, grid properties) for a spreadsheet.

Tool: listSpreadsheets

Lists all spreadsheets in your configured Drive folder (or My Drive).

Audience

AI DevelopersBuild agents that securely read, write, and manage Google Sheets via MCP tools.
Sheet AdminsAutomate routine spreadsheet tasks without exposing Google API credentials.
DevelopersIntegrate MCP-based servers to expose Google Sheets APIs via typed tools.

Tags

MCPGoogle SheetsGoogle DriveSheets APIDrive APITypeScriptBunOAuth2Service Account