by rohans2
mcp-google-sheets is a TypeScript-based Model Context Protocol (MCP) server that enables AI agents to securely interact with Google Sheets. It provides a comprehensive toolset for programmatic access and manipulation of Google Sheets data, supporting various use cases like automated data entry, reporting, and workflow automation.
mcp-google-sheets is a TypeScript-based Model Context Protocol (MCP) server that enables AI agents to securely interact with Google Sheets. It is built on Bun and the @modelcontextprotocol/sdk
, supporting both OAuth2 and Service-Account authentication flows.
To use mcp-google-sheets, you need to have Bun (v1.0+) installed and a Google Cloud project with the Sheets API & Drive API enabled. You'll also need an OAuth2 Client ID or a Service Account key. After cloning the repository and installing dependencies, configure your environment by creating a .env
file with your CREDENTIALS_CONFIG
(base64-encoded service-account key JSON) or by placing credentials.json
and token.json
next to index.ts
for OAuth2. You also need to provide the EMAIL_ID
you'll use to access the spreadsheet and optionally a DRIVE_FOLDER_ID
. Once configured, you can run the server using bun index.ts
.
CREDENTIALS_CONFIG
and OAuth2 using credentials.json
+ token.json
for user-scoped access.create
: Creates a new spreadsheet.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 for a spreadsheet.listSpreadsheets
: Lists all spreadsheets in your configured Drive folder.shareSpreadsheet
: Shares a spreadsheet with users.sheetData
: Reads cell values from a 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.copySheet
: Copies a sheet tab between spreadsheets.mcp-google-sheets can be used in various scenarios where AI agents need to programmatically access and manipulate Google Sheets data. Some potential use cases include:
Q: What are the prerequisites for running mcp-google-sheets? A: You need Bun (v1.0+), a Google Cloud project with Sheets API & Drive API enabled, and either an OAuth2 Client ID or a Service Account key.
Q: How do I configure authentication?
A: You can use a base64-encoded service-account key via CREDENTIALS_CONFIG
in your .env
file, or place credentials.json
and token.json
(generated after the first OAuth run) next to index.ts
for OAuth2.
Q: How does the server work internally?
A: It initializes the context by picking an authentication method, builds Google Sheets and Drive clients, and registers each tool via server.tool(...)
. It uses StdioServerTransport
for tool invocation over stdin/stdout, and processes JSON requests from the agent to run handlers and return JSON-wrapped results.
Q: Can I contribute to the project? A: Yes, contributions for new tools, bug fixes, and enhancements are welcome via issues or PRs.
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.
CREDENTIALS_CONFIG
credentials.json
+ token.json
for user-scoped accesscreate
listSheets
renameSheet
createSheet
spreadsheetInfo
listSpreadsheets
shareSpreadsheet
sheetData
updateCells
batchUpdate
addRows
/ addColumns
copySheet
PATH
credentials.json
) or a Service Account key (download service_account.json
)git clone https://github.com/yourusername/mcp-google-sheets.git
cd mcp-google-sheets
bun install
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')
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.
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
Transport
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.
Clone & configure as above.
Start the server:
bun index.ts
Invoke a tool via Claude
Feel free to open issues or PRs for new tools, bug fixes, and enhancements.
Please log in to share your review and rating for this MCP.
Discover more MCP servers with similar functionality and use cases
by danny-avila
Provides a customizable ChatGPT‑like web UI that integrates dozens of AI models, agents, code execution, image generation, web search, speech capabilities, and secure multi‑user authentication, all open‑source and ready for self‑hosting.
by ahujasid
BlenderMCP integrates Blender with Claude AI via the Model Context Protocol (MCP), enabling AI-driven 3D scene creation, modeling, and manipulation. This project allows users to control Blender directly through natural language prompts, streamlining the 3D design workflow.
by pydantic
Enables building production‑grade generative AI applications using Pydantic validation, offering a FastAPI‑like developer experience.
by GLips
Figma-Context-MCP is a Model Context Protocol (MCP) server that provides Figma layout information to AI coding agents. It bridges design and development by enabling AI tools to directly access and interpret Figma design data for more accurate and efficient code generation.
by mcp-use
Easily create and interact with MCP servers using custom agents, supporting any LLM with tool calling and offering multi‑server, sandboxed, and streaming capabilities.
by sonnylazuardi
This project implements a Model Context Protocol (MCP) integration between Cursor AI and Figma, allowing Cursor to communicate with Figma for reading designs and modifying them programmatically.
by lharries
WhatsApp MCP Server is a Model Context Protocol (MCP) server for WhatsApp that allows users to search, read, and send WhatsApp messages (including media) through AI models like Claude. It connects directly to your personal WhatsApp account via the WhatsApp web multi-device API and stores messages locally in a SQLite database.
by idosal
GitMCP is a free, open-source remote Model Context Protocol (MCP) server that transforms any GitHub project into a documentation hub, enabling AI tools to access up-to-date documentation and code directly from the source to eliminate "code hallucinations."
by Klavis-AI
Klavis AI provides open-source Multi-platform Control Protocol (MCP) integrations and a hosted API for AI applications. It simplifies connecting AI to various third-party services by managing secure MCP servers and authentication.