by rohans2
Provides typed tools for AI agents to read, write, and manage Google Sheets and Drive resources through a Model Context Protocol server.
Enables AI agents to securely interact with Google Sheets and Google Drive using well‑typed tool calls. The server abstracts the Google Sheets and Drive APIs behind a set of high‑level operations that agents can invoke via standard MCP JSON messages.
credentials.json
+ token.json
) or a Service‑Account key (service_account.json
).git clone https://github.com/rohans2/mcp-google-sheets.git
cd mcp-google-sheets
bun install
CREDENTIALS_CONFIG
with a base64‑encoded service‑account JSON or place the OAuth2 files next to index.ts
. Optionally define EMAIL_ID
and DRIVE_FOLDER_ID
.bun index.ts
The server starts a Stdio transport allowing an AI model (e.g., Claude) to call tools via stdin/stdout.Q: Do I need a Google Cloud project? A: Yes, a project with the Sheets and Drive APIs enabled is required.
Q: Which authentication method should I choose? A: Use Service‑Account for server‑to‑server automation; use OAuth2 when actions must run under a specific user’s account.
Q: Can I run the server with Node instead of Bun? A: The codebase targets Bun, but it can be adapted to Node with minor changes to the runtime scripts.
Q: How does the agent send requests?
A: By sending a JSON object containing the tool
name and args
via the server’s stdin; the server returns a JSON‑wrapped response.
Q: Where are the credentials stored?
A: Service‑Account credentials are provided via the CREDENTIALS_CONFIG
env var; OAuth2 credentials are read from credentials.json
and the generated token.json
.
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.
Explore related MCPs that share similar capabilities and solve comparable challenges
by modelcontextprotocol
An MCP server implementation that provides a tool for dynamic and reflective problem-solving through a structured thinking process.
by danny-avila
Provides a self‑hosted ChatGPT‑style interface supporting numerous AI models, agents, code interpreter, image generation, multimodal interactions, and secure multi‑user authentication.
by block
Automates engineering tasks on local machines, executing code, building projects, debugging, orchestrating workflows, and interacting with external APIs using any LLM.
by RooCodeInc
Provides an autonomous AI coding partner inside the editor that can understand natural language, manipulate files, run commands, browse the web, and be customized via modes and instructions.
by pydantic
A Python framework that enables seamless integration of Pydantic validation with large language models, providing type‑safe agent construction, dependency injection, and structured output handling.
by lastmile-ai
Build effective agents using Model Context Protocol and simple, composable workflow patterns.
by mcp-use
A Python SDK that simplifies interaction with MCP servers and enables developers to create custom agents with tool‑calling capabilities.
by nanbingxyz
A cross‑platform desktop AI assistant that connects to major LLM providers, supports a local knowledge base, and enables tool integration via MCP servers.
by gptme
Provides a personal AI assistant that runs directly in the terminal, capable of executing code, manipulating files, browsing the web, using vision, and interfacing with various LLM providers.