MCP Google Sheets Server
A Model Context Protocol (MCP) server for Google Sheets API integration. Enables reading, writing, and managing Google Sheets documents directly from your MCP client (e.g., Claude Code, Claude Desktop, Cursor, etc.).
Power your agent
คำสั่งของผู้เผยแพร่เอง ไม่ใช่เอนด์พอยต์ของ PlugMCP
Host a copy with our keys and logs.
npx -y [email protected]Claude Code ไม่มีลิงก์ติดตั้งสำหรับคำสั่งแบบโลคัล ให้คัดลอกคำสั่งด้านล่างแล้วรันในเทอร์มินัล
claude mcp add mcp-gsheets -- npx -y mcp-gsheets@1.11.1รันในเทอร์มินัล
{ "mcpServers": { "mcp-gsheets": { "command": "npx", "args": [ "-y", "[email protected]" ] } }}claude_desktop_config.json
URL แบบรีโมตหรือคำสั่งบนเครื่องของคุณ? การติดตั้งสองแบบต่างกันอย่างไร
รันบน PlugMCP
A new server you create. It is not this listing's official endpoint. Use the publisher install when you want their URL and their credentials.
เปิดจากผู้เผยแพร่
A Model Context Protocol (MCP) server for Google Sheets API integration. Enables reading, writing, and managing Google Sheets documents directly from your MCP client (e.g., Claude Code, Claude Desktop, Cursor, etc.).
Model Context Protocol (MCP) server for Google Sheets API integration
Add the following config to your MCP client:
{
"mcpServers": {
"mcp-gsheets": {
"command": "npx",
"args": ["-y", "mcp-gsheets@latest"],
"env": {
"GOOGLE_PROJECT_ID": "your-project-id",
"GOOGLE_APPLICATION_CREDENTIALS": "/absolute/path/to/service-account-key.json"
}
}
}
}
[!NOTE] Using
mcp-gsheets@latestensures that your MCP client will always use the latest version of the MCP Google Sheets server.
claude mcp add mcp-gsheets npx mcp-gsheets@latest
After adding, edit your Claude Code config to add the required environment variables:
{
"mcpServers": {
"mcp-gsheets": {
"command": "npx",
"args": ["mcp-gsheets@latest"],
"env": {
"GOOGLE_PROJECT_ID": "your-project-id",
"GOOGLE_APPLICATION_CREDENTIALS": "/absolute/path/to/service-account-key.json"
}
}
}
}
Add to your Claude Desktop config:
~/Library/Application Support/Claude/claude_desktop_config.json%APPDATA%\Claude\claude_desktop_config.json~/.config/claude/claude_desktop_config.json{
"mcpServers": {
"mcp-gsheets": {
"command": "npx",
"args": ["-y", "mcp-gsheets@latest"],
"env": {
"GOOGLE_PROJECT_ID": "your-project-id",
"GOOGLE_APPLICATION_CREDENTIALS": "/absolute/path/to/service-account-key.json"
}
}
}
}
Go to Cursor Settings → MCP → New MCP Server. Use the config provided above.
Follow https://docs.cline.bot/mcp/configuring-mcp-servers and use the config provided above.
For other MCP clients, use the standard configuration format shown above. Ensure the command is set to npx and include the environment variables for Google Cloud authentication.
Actions column → Manage keys → Add key → Create new key → select JSON formatInstead of using a file path for credentials, you can provide the service account credentials directly as a JSON string. This is useful for containerized environments, CI/CD pipelines, or when you want to avoid managing credential files.
{
"mcpServers": {
"mcp-gsheets": {
"command": "npx",
"args": ["-y", "mcp-gsheets@latest"],
"env": {
"GOOGLE_PROJECT_ID": "your-project-id",
"GOOGLE_SERVICE_ACCOUNT_KEY": "{\"type\":\"service_account\",\"project_id\":\"your-project\",\"private_key_id\":\"...\",\"private_key\":\"-----BEGIN PRIVATE KEY-----\\n...\\n-----END PRIVATE KEY-----\\n\",\"client_email\":\"[email protected]\",\"client_id\":\"...\",\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"token_uri\":\"https://oauth2.googleapis.com/token\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\",\"client_x509_cert_url\":\"...\"}"
}
}
}
}
Note: When using GOOGLE_SERVICE_ACCOUNT_KEY:
\\nproject_id, you can omit GOOGLE_PROJECT_IDFor the most user-friendly approach, you can provide just the private key and email directly. This is the simplest method and requires only two fields from your service account JSON:
{
"mcpServers": {
"mcp-gsheets": {
"command": "npx",
"args": ["-y", "mcp-gsheets@latest"],
"env": {
"GOOGLE_PRIVATE_KEY": "-----BEGIN PRIVATE KEY-----\\nMIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCgR6bvMNOUHZ29\\n+YgbVHAXsT/s+L/jnXTCB193zikCzspSBSfxLu8VRDjkNq9WUoDxizTATzMFNvNf\\n...\\n-----END PRIVATE KEY-----\\n",
"GOOGLE_CLIENT_EMAIL": "[email protected]"
}
}
}
}
Note: When using GOOGLE_PRIVATE_KEY:
\\n-----BEGIN PRIVATE KEY----- and -----END PRIVATE KEY----- markersGOOGLE_PROJECT_ID is optional when using this methodIf you want to develop or contribute to this project, you can clone and build it locally:
# Clone the repository
git clone https://github.com/freema/mcp-gsheets.git
cd mcp-gsheets
# Install dependencies
npm install
# Build the project
npm run build
Run the interactive setup script to configure your local MCP client:
npm run setup
This will:
If you prefer manual configuration with a local build, add to your MCP client config:
{
"mcpServers": {
"mcp-gsheets": {
"command": "node",
"args": ["/absolute/path/to/mcp-gsheets/dist/index.js"],
"env": {
"GOOGLE_PROJECT_ID": "your-project-id",
"GOOGLE_APPLICATION_CREDENTIALS": "/absolute/path/to/service-account-key.json"
}
}
}
}
# Development mode with hot reload
npm run dev
# Build for production
npm run build
# Type checking
npm run typecheck
# Clean build artifacts
npm run clean
# Run MCP inspector for debugging
npm run inspector
# Run MCP inspector in development mode
npm run inspector:dev
If you have Task installed:
# Install dependencies
task install
# Build the project
task build
# Run in development mode
task dev
# Run linter
task lint
# Format code
task fmt
# Run all checks
task check
.env file for testing:cp .env.example .env
# Edit .env with your credentials:
# GOOGLE_PROJECT_ID=your-project-id
# GOOGLE_APPLICATION_CREDENTIALS=/path/to/service-account.json
# TEST_SPREADSHEET_ID=your-test-spreadsheet-id
npm run dev # Watch mode with auto-reload
All 44 tools together cost about 9,900 tokens of context in every session,
before the model does anything. Most workflows need a fraction of that.
GSHEETS_TOOLSETS limits which tools the server exposes:
{
"mcpServers": {
"gsheets": {
"command": "npx",
"args": ["mcp-gsheets"],
"env": {
"GOOGLE_PROJECT_ID": "your-project-id",
"GOOGLE_APPLICATION_CREDENTIALS": "/path/to/key.json",
"GSHEETS_TOOLSETS": "core,charts"
}
}
}
}
Measured tools/list cost:
Notes:
GSHEETS_TOOLSETS unset and you get
every tool, exactly as before.core is always included. GSHEETS_TOOLSETS=charts means "charts as
well as core", not "charts only" — without core the server cannot read a cell.GSHEETS_READ_ONLY=true drops every writing tool and can be combined with
GSHEETS_TOOLSETS. It is enforced when a tool is called, not just when the
list is built, so a client cannot write by naming a hidden tool.All tools also carry MCP annotations (readOnlyHint, destructiveHint,
idempotentHint), so clients can skip confirmation prompts on reads and warn
before destructive operations.
# Run ESLint
npm run lint
# Fix auto-fixable issues
npm run lint:fix
# Check formatting with Prettier
npm run format:check
# Format code
npm run format
# Run TypeScript type checking
npm run typecheck
"Authentication failed"
\\n"Permission denied"
"Spreadsheet not found"
https://docs.google.com/spreadsheets/d/[SPREADSHEET_ID]/editMCP Connection Issues
dist/index.js)npm run inspector to debugFrom the URL:
https://docs.google.com/spreadsheets/d/1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms/edit
↑ This is the spreadsheet ID
Use sheets_get_metadata to list all sheets with their IDs.
sheets_check_access to verify permissions before operationsReturns lightweight structural/dimensional metadata for a sheet without any per-cell data. Much faster and cheaper than sheets_get_full_sheet_snapshot when you only need layout information.
Parameters:
spreadsheetId (required): The ID of the spreadsheetsheetName (required): Name of the sheet (tab)Returns: sheetName, sheetId, sheetIndex, tabColor, tabColorStyle, dimensions (rowCount, columnCount), frozen (rowCount, columnCount), columnWidths (array of pixel sizes), rowHeights (array of pixel sizes), hiddenColumns (0-based indices), hiddenRows (0-based indices), mergeCount, merges (A1 notation array)
Read cell formatting for a range and return it as compact A1Range → format pairs. Adjacent cells with identical formatting are collapsed into rectangular ranges (run-length encoded), reducing output by 90 %+ compared to per-cell data.
Parameters:
spreadsheetId (required): The ID of the spreadsheetsheetName (required): Name of the sheet (tab)range (required): Range without sheet prefix, e.g. "A1:Z85"useEffectiveFormat (optional): false (default) = userEnteredFormat (only explicit overrides, smaller output); true = effectiveFormat (all inherited defaults)fields (optional): Array of format field names to include, e.g. ["backgroundColor", "textFormat", "borders"]Returns: { range, formatType, rangeCount, data: { "A1:C3": { backgroundColor: {...} }, ... } }
Supported fields: backgroundColor, backgroundColorStyle, textFormat, horizontalAlignment, verticalAlignment, wrapStrategy, textRotation, numberFormat, padding, borders
Master one-shot tool that returns all structural and formatting metadata in a single API call.
Parameters:
spreadsheetId (required): The ID of the spreadsheetsheetName (required): Name of the sheet (tab)includeFormattingRange (optional): If provided (e.g. "A1:Z100"), per-cell formatting is included in the responseuseEffectiveFormat (optional): Use effectiveFormat instead of userEnteredFormat when including cell formatting (default: false)fields (optional): Array of format field names to return, e.g. ["backgroundColor", "textFormat"] — reduces API transfer size and response sizecompactMode (optional): When true, identical adjacent cells are collapsed into rectangular ranges (RLE). Reduces a typical 85×28 sheet from ~60 000 lines to ~500 lines (default: false)Insert new rows at a specific position in a spreadsheet with optional data.
Parameters:
spreadsheetId (required): The ID of the spreadsheetrange (required): A1 notation anchor point where rows will be inserted (e.g., "Sheet1!A5")rows (optional): Number of rows to insert (default: 1)position (optional): 'BEFORE' or 'AFTER' the anchor row (default: 'BEFORE')inheritFromBefore (optional): Whether to inherit formatting from the row before (default: false)values (optional): 2D array of values to fill the newly inserted rowsvalueInputOption (optional): 'RAW' or 'USER_ENTERED' (default: 'USER_ENTERED')Examples:
// Insert 1 empty row before row 5
{
"spreadsheetId": "your-spreadsheet-id",
"range": "Sheet1!A5"
}
// Insert 3 rows after row 10 with data
{
"spreadsheetId": "your-spreadsheet-id",
"range": "Sheet1!A10",
"rows": 3,
"position": "AFTER",
"values": [
["John", "Doe", "[email protected]"],
["Jane", "Smith", "[email protected]"],
["Bob", "Johnson", "[email protected]"]
]
}
Delete one or more columns from a sheet using a full-column A1 range.
Parameters:
spreadsheetId (required): The ID of the spreadsheetrange (required): Full-column A1 range to delete (e.g., "Sheet1!B:D" or "Sheet1!C:C")Examples:
// Delete columns B through D from Sheet1
{
"spreadsheetId": "your-spreadsheet-id",
"range": "Sheet1!B:D"
}
// Delete a single column from the first sheet
{
"spreadsheetId": "your-spreadsheet-id",
"range": "C:C"
}
Delete one or more rows from a sheet using a full-row A1 range.
Parameters:
spreadsheetId (required): The ID of the spreadsheetrange (required): Full-row A1 range to delete (e.g., "Sheet1!2:4" or "Sheet1!3:3")Examples:
// Delete rows 2 through 4 from Sheet1
{
"spreadsheetId": "your-spreadsheet-id",
"range": "Sheet1!2:4"
}
// Delete a single row from the first sheet
{
"spreadsheetId": "your-spreadsheet-id",
"range": "3:3"
}
See CHANGELOG.md for a list of changes in each version.
git checkout -b feature/amazing-feature)npm run check)git commit -m 'Add some amazing feature')git push origin feature/amazing-feature)Tomáš Grásl - tomasgrasl.cz
This project is licensed under the MIT License - see the LICENSE file for details.
Model Context Protocol (MCP) server for Google Sheets API integration
{ "mcpServers": { "mcp-gsheets": { "command": "npx", "args": [ "-y", "[email protected]" ] } }}เครื่องมือ
ยังไม่มีรายการเครื่องมือ เซิร์ฟเวอร์แบบรีโมตจะได้รายการหลังการตรวจสอบสถานะครั้งแรก
FAQ
คัดลอกคอนฟิก stdio สำหรับ Cursor, Claude Desktop, Claude Code หรือ VS Code ได้ในหน้านี้ คอนฟิกนี้ใช้การติดตั้งของผู้เผยแพร่ ไม่ใช่พร็อกซีของ PlugMCP
ระเบียนนี้ไม่ได้ระบุตัวแปรสภาพแวดล้อมที่จำเป็น
MCP Gsheets ทำงานแบบโลคัลผ่าน stdio
ตรวจสอบล่าสุดเมื่อ 2026-11-13 Model Context Protocol (MCP) server for Google Sheets API integration