
Mcp Gsheets
io.github.freemaPublished by GitHub account freemav1.11.1Updated Nov 7, 2026
MCP server for Google Sheets API — read, write, format, batch operations.
Overview
Local MCP server that lets an assistant read, write, format and manage Google Sheets spreadsheets through a Google service account.
- What you can do
- Read cell values from single or multiple ranges, plus spreadsheet metadata and access checks
- Write, append, clear and insert values, rows, links and dates
- Create, duplicate, copy, delete and rename sheets and tabs
- Format cells, borders, merges, conditional rules and native tables
- Create, update and delete charts
- Inspect structure, dimensions, formatting, filters and data validation, with compact snapshots
- When to use it
- Use it when you want an assistant to work directly on Google Sheets files: pulling data out, filling or cleaning ranges, restructuring tabs, or applying formatting and charts. A read-only mode and toolset limits make it usable for lighter, read-focused sessions.
- Requirements
- Runs locally via npx with Node.js v22 or higher. Needs a Google Cloud project with the Sheets API enabled and a service account key, supplied as a key file path (GOOGLE_APPLICATION_CREDENTIALS), a JSON string (GOOGLE_SERVICE_ACCOUNT_KEY), or private key plus email (GOOGLE_PRIVATE_KEY, GOOGLE_CLIENT_EMAIL); GOOGLE_PROJECT_ID is required for some methods. Each spreadsheet must be shared with the service account email.
Installation
In SourceWeft
- Open Mcp Gsheets in the dashboard and add it to a workspace.
- Enable the server for the chats that should use its tools.
Desktop only via STDIO. STDIO servers start a local process, so they need the SourceWeft desktop host.
Other MCP clients
Follow the launch instructions in the repository.
README
MCP Google Sheets Server
[Image][npm version] [CI] [Coverage] [License: MIT] [TypeScript] [Node] [code style: prettier]
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.).
Key Features
- Complete Google Sheets Integration: Read, write, and manage spreadsheets
- Advanced Operations: Batch operations, formatting, charts, and conditional formatting
- Flexible Authentication: Support for both file-based and JSON string credentials
- Production Ready: Built with TypeScript, comprehensive error handling, and full test coverage
Requirements
- Node.js v22 or higher
- Google Cloud Project with Sheets API enabled
- Service Account with JSON key file
- npm
Getting Started
Quick Install (Recommended)
Add the following config to your MCP client:
[!NOTE] Using
mcp-gsheets@latestensures that your MCP client will always use the latest version of the MCP Google Sheets server.
MCP Client Configuration
Claude Code
Use the Claude Code CLI to add the MCP Google Sheets server (guide):After adding, edit your Claude Code config to add the required environment variables:
Claude Desktop
Add to your Claude Desktop config:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Windows:
%APPDATA%\Claude\claude_desktop_config.json - Linux:
~/.config/claude/claude_desktop_config.json
Cursor
Go to Cursor Settings → MCP → New MCP Server. Use the config provided above.
Cline
Follow https://docs.cline.bot/mcp/configuring-mcp-servers and use the config provided above.
Other MCP Clients
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.
Google Cloud Setup
- Go to Google Cloud Console
- Create a new project or select existing
- Enable Google Sheets API:
- Navigate to "APIs & Services" → "Library"
- Search for "Google Sheets API" and click "Enable"
- Create Service Account:
- Go to "APIs & Services" → "Credentials"
- Click "Create Credentials" → "Service Account"
- In the service accounts list, click the three dots in the
Actionscolumn →Manage keys→Add key→Create new key→ select JSON format - Download the JSON key file
- Share your spreadsheets:
- Open your Google Sheet
- Click Share and add the service account email (from JSON file)
- Grant "Editor" permissions
Alternative Authentication Methods
Option 1: JSON String Authentication
Instead 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.
Note: When using GOOGLE_SERVICE_ACCOUNT_KEY:
- The entire JSON must be on a single line
- All quotes must be escaped with backslashes
- Newlines in the private key must be represented as
\\n - If the JSON includes a
project_id, you can omitGOOGLE_PROJECT_ID
Option 2: Private Key Authentication (Simplified)
For 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:
Note: When using GOOGLE_PRIVATE_KEY:
- Newlines in the private key should be represented as
\\n - The private key must include the
-----BEGIN PRIVATE KEY-----and-----END PRIVATE KEY-----markers - The client email should be the service account email from your JSON file
GOOGLE_PROJECT_IDis optional when using this method
Local Development Setup
If you want to develop or contribute to this project, you can clone and build it locally:
Interactive Setup Script
Run the interactive setup script to configure your local MCP client:
This will:
- Guide you through the configuration
- Automatically detect your Node.js installation (including nvm)
- Find your Claude Desktop config
- Create the proper JSON configuration
- Optionally create a .env file for development
Manual Local Configuration
If you prefer manual configuration with a local build, add to your MCP client config:
📦 Build & Development
Development Commands
Task Runner (Alternative)
If you have Task installed:
Development Setup
- Create
.envfile for testing:
- Run in development mode:
🎚️ Reducing context cost with toolsets
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:
Measured tools/list cost:
Notes:
- The default is unchanged — leave
GSHEETS_TOOLSETSunset and you get every tool, exactly as before. coreis always included.GSHEETS_TOOLSETS=chartsmeans "charts as well as core", not "charts only" — without core the server cannot read a cell.- A typo is a startup error, not a silently smaller tool list.
GSHEETS_READ_ONLY=truedrops every writing tool and can be combined withGSHEETS_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.
📋 Available Tools
Reading Data
Writing Data
Sheet Management
Cell Formatting
Native Tables
Charts
Read / Snapshot Tools
🔧 Code Quality
Linting
Formatting
Type Checking
❗ Troubleshooting
Common Issues
"Authentication failed"
- If using file-based auth: Verify JSON key path is absolute and correct
- If using JSON string auth: Ensure JSON is properly escaped and valid
- If using private key auth: Check that the private key includes BEGIN/END markers and newlines are escaped as
\\n - Verify GOOGLE_CLIENT_EMAIL is a valid service account email
- Check GOOGLE_PROJECT_ID matches your project (or is included in JSON for full JSON auth)
- Ensure Sheets API is enabled
"Permission denied"
- Share spreadsheet with service account email
- Service account needs "Editor" role
- Check email in JSON file (client_email field)
"Spreadsheet not found"
- Verify spreadsheet ID from URL
- Format:
https://docs.google.com/spreadsheets/d/[SPREADSHEET_ID]/edit
MCP Connection Issues
- Ensure you're using the built version (
dist/index.js) - Check that Node.js path is correct in Claude Desktop config
- Look for errors in Claude Desktop logs
- Use
npm run inspectorto debug
🔍 Finding IDs
Spreadsheet ID
From the URL:
Sheet ID
Use sheets_get_metadata to list all sheets with their IDs.
📝 Tips
- Always test with a copy of your data
- Use batch operations for better performance
- Set appropriate permissions (read-only vs edit)
- Check rate limits for large operations
- Use
sheets_check_accessto verify permissions before operations
📘 Tool Details
sheets_get_sheet_structure
Returns 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)
sheets_get_formatting_compact
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
sheets_get_full_sheet_snapshot
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): Whentrue, identical adjacent cells are collapsed into rectangular ranges (RLE). Reduces a typical 85×28 sheet from ~60 000 lines to ~500 lines (default:false)
sheets_insert_rows
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:
sheets_delete_columns
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:
sheets_delete_rows
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:
📋 Changelog
See CHANGELOG.md for a list of changes in each version.
🤝 Contributing
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Run tests and linting (
npm run check) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
👤 Author
Tomáš Grásl - tomasgrasl.cz
📄 License
This project is licensed under the MIT License - see the LICENSE file for details.
Source: README.md at commit 48435ef
Tools
0Version history
4- v1.11.1LatestNov 7, 2026
- v1.11.0Oct 25, 2026
- v1.10.3Sep 19, 2026
- v1.10.1Sep 16, 2026
Score
50% of the applicable checks met
How complete this listing is, computed from the registry entry, the endpoint and public sources. Not a rating of the server and not a statement that it is safe or working today: reachability is a dated check, and no installs or reviews go into the score.
- Reached in the last 30 days25 pts
Keep the endpoint answering the MCP handshake; SourceWeft probes it every 30 days.
- Auth declared10 pts
Declare the credential headers in the registry entry, or keep the endpoint answering the probe so its auth can be classified.
- Tools listed15 pts
Answer tools/list without a credential, or ship a package that starts in a sandbox without one.
- DescriptionRequired15 pts
- Logo10 pts
- Documentation15 pts
- License10 pts