google-sheets-mcp
Local Model Context Protocol server for reading and writing Google Sheets through Google Sheets API v4.
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_statusget_spreadsheetlist_worksheetsread_rangeupdate_rangeappend_rowsbatch_update_valuesclear_range
Install
npm.cmd install
npm.cmd run build
On macOS/Linux, use npm instead of npm.cmd.
Authentication: Service Account
Recommended for automation.
- Create or choose a Google Cloud project.
- Enable Google Sheets API.
- Create a service account and download a JSON key.
- Put the JSON key at:
secrets/google-service-account.json
- 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:
GOOGLE_APPLICATION_CREDENTIALSGOOGLE_SERVICE_ACCOUNT_JSON./secrets/google-service-account.json
Authentication: OAuth User Account
Use OAuth when the MCP should act as your Google user account.
- Create OAuth Client credentials in Google Cloud.
- Add this redirect URI:
http://127.0.0.1:3333/oauth2callback
- Create
.env:
GOOGLE_OAUTH_CLIENT_ID=your-client-id.apps.googleusercontent.com
GOOGLE_OAUTH_CLIENT_SECRET=your-client-secret
OAUTH_CALLBACK_PORT=3333
- Generate a refresh token:
npm.cmd run oauth:init
- 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_statusfirst to verify the active authentication mode. - Use
list_worksheetsbefore reading or writing ranges. - For destructive operations, prefer reading the target range first.
- Use
batch_update_valuesfor large table edits to reduce Google API request count.
Security
Never commit credentials. The following are ignored by default:
.env.env.*except.env.examplecredentials/secrets/*exceptsecrets/.gitkeep*.service-account.json*.credentials.json*.token.json
License
MIT
Recommended Servers
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.
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.
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.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
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.
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.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
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.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.