google-sheets-mcp

google-sheets-mcp

Local Model Context Protocol server for reading and writing Google Sheets through Google Sheets API v4.

Category
Visit Server

README

google-sheets-mcp

English | Korean

Local Model Context Protocol server for reading and writing Google Sheets through Google Sheets API v4.

This project is designed for local Codex/AI-agent workflows. It supports both service account credentials and OAuth user credentials.

Features

  • Read spreadsheet metadata and worksheet tabs.
  • Read values from A1 ranges.
  • Update exact ranges.
  • Append rows.
  • Batch update multiple ranges.
  • Clear values while preserving formatting.
  • Report authentication status without exposing private keys or tokens.

MCP Tools

  • auth_status
  • get_spreadsheet
  • list_worksheets
  • read_range
  • update_range
  • append_rows
  • batch_update_values
  • clear_range

Install

npm.cmd install
npm.cmd run build

On macOS/Linux, use npm instead of npm.cmd.

Authentication: Service Account

Recommended for automation.

  1. Create or choose a Google Cloud project.
  2. Enable Google Sheets API.
  3. Create a service account and download a JSON key.
  4. Put the JSON key at:
secrets/google-service-account.json
  1. Share each target spreadsheet with the service account email from the JSON key:
{
  "client_email": "your-service-account@your-project.iam.gserviceaccount.com"
}

Give Viewer access for read-only use or Editor access for writes.

The secrets/ directory is committed with only .gitkeep. All credential files inside it are ignored.

Authentication: Custom Credential Path

If you do not want credentials under the repository directory, create a local .env file:

GOOGLE_APPLICATION_CREDENTIALS=C:/secure/path/google-service-account.json

or provide inline JSON through a secret manager/environment variable:

GOOGLE_SERVICE_ACCOUNT_JSON={"type":"service_account",...}

Credential lookup order:

  1. GOOGLE_APPLICATION_CREDENTIALS
  2. GOOGLE_SERVICE_ACCOUNT_JSON
  3. ./secrets/google-service-account.json

Authentication: OAuth User Account

Use OAuth when the MCP should act as your Google user account.

  1. Create OAuth Client credentials in Google Cloud.
  2. Add this redirect URI:
http://127.0.0.1:3333/oauth2callback
  1. Create .env:
GOOGLE_OAUTH_CLIENT_ID=your-client-id.apps.googleusercontent.com
GOOGLE_OAUTH_CLIENT_SECRET=your-client-secret
OAUTH_CALLBACK_PORT=3333
  1. Generate a refresh token:
npm.cmd run oauth:init
  1. Open the printed URL, approve access, and add the printed refresh token to .env:
GOOGLE_OAUTH_REFRESH_TOKEN=your-refresh-token

Register With Codex

Build first:

npm.cmd run build

Then register the MCP server:

codex mcp add google-sheets-local -- node <path-to-google-sheets-mcp>/dist/index.js

Recommended ~/.codex/config.toml entry:

[mcp_servers.google-sheets-local]
command = "node"
args = ["<path-to-google-sheets-mcp>/dist/index.js"]
cwd = "<path-to-google-sheets-mcp>"

Restart Codex after changing MCP configuration or credentials.

Usage Notes

  • Use auth_status first to verify the active authentication mode.
  • Use list_worksheets before reading or writing ranges.
  • For destructive operations, prefer reading the target range first.
  • Use batch_update_values for large table edits to reduce Google API request count.

Security

Never commit credentials. The following are ignored by default:

  • .env
  • .env.* except .env.example
  • credentials/
  • secrets/* except secrets/.gitkeep
  • *.service-account.json
  • *.credentials.json
  • *.token.json

License

MIT

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured