Google Sheets MCP server

Integrates with Google Drive and Google Sheets to create, read, update, and manage spreadsheets with support for both OAuth and service account authentication methods.
Back to servers
Setup instructions
Provider
Xing Wu
Release date
Mar 22, 2025
Language
Python
Package
Stats
20.2K downloads
331 stars

This MCP server acts as a bridge between MCP-compatible clients (like Claude Desktop) and the Google Sheets API, allowing you to interact with Google Spreadsheets through AI assistants. It provides a comprehensive set of tools for creating, reading, updating, and managing spreadsheets.

Prerequisites

Before using the MCP server, you must set up Google Cloud Platform credentials:

  1. Create or select a GCP project in the Google Cloud Console
  2. Enable both the Google Sheets API and Google Drive API
  3. Configure authentication credentials (Service Account recommended)

Installation and Setup

Quick Start with uvx

  1. Install uv (which includes uvx):

    # macOS / Linux
    curl -LsSf https://astral.sh/uv/install.sh | sh
    # Windows
    powershell -c "irm https://astral.sh/uv/install.ps1 | iex"
    
  2. Set up authentication environment variables:

    For Service Account (recommended):

    # Linux/macOS
    export SERVICE_ACCOUNT_PATH="/path/to/your/service-account-key.json"
    export DRIVE_FOLDER_ID="YOUR_DRIVE_FOLDER_ID"
    
    # Windows CMD
    set SERVICE_ACCOUNT_PATH="C:\path\to\your\service-account-key.json"
    set DRIVE_FOLDER_ID="YOUR_DRIVE_FOLDER_ID"
    
    # Windows PowerShell
    $env:SERVICE_ACCOUNT_PATH = "C:\path\to\your\service-account-key.json"
    $env:DRIVE_FOLDER_ID = "YOUR_DRIVE_FOLDER_ID"
    
  3. Run the server:

    uvx mcp-google-sheets@latest
    
  4. Connect your MCP client (e.g., Claude Desktop) to the running server

Authentication Methods

Method A: Service Account (Recommended)

  1. Create a Service Account:

    • Go to GCP Console → "IAM & Admin" → "Service Accounts"
    • Create a new service account with appropriate permissions
    • Create and download a JSON key file
  2. Create & Share a Google Drive Folder:

    • Create a folder in Google Drive
    • Note the Folder ID from the URL
    • Share the folder with the service account's email, granting Editor access
  3. Set Environment Variables:

    • SERVICE_ACCOUNT_PATH: Path to the JSON key file
    • DRIVE_FOLDER_ID: ID of the shared folder

Method B: OAuth 2.0

For personal use with interactive browser login:

  1. Configure OAuth consent screen in GCP Console
  2. Create OAuth client ID (Desktop app type)
  3. Set environment variables:
    • CREDENTIALS_PATH: Path to the OAuth credentials JSON
    • TOKEN_PATH: Path to store the user token

Alternative Methods

  • Direct Credential Injection: Use CREDENTIALS_CONFIG with Base64-encoded credentials
  • Application Default Credentials: Use Google's ADC chain for automatic credential discovery

Using with Claude Desktop

Add the server configuration to your claude_desktop_config.json:

{
  "mcpServers": {
    "google-sheets": {
      "command": "uvx",
      "args": ["mcp-google-sheets@latest"],
      "env": {
        "SERVICE_ACCOUNT_PATH": "/full/path/to/your/service-account-key.json",
        "DRIVE_FOLDER_ID": "your_shared_folder_id_here"
      }
    }
  }
}

Note for macOS users: Use the full path to uvx (e.g., /Users/yourusername/.local/bin/uvx).

Available Tools

The server provides numerous tools for working with Google Sheets:

  • list_spreadsheets: Lists accessible spreadsheets
  • create_spreadsheet: Creates a new spreadsheet
  • get_sheet_data: Reads data from a sheet range
  • update_cells: Writes data to a specific range
  • add_rows: Appends rows to a sheet
  • list_sheets: Lists all sheets in a spreadsheet
  • create_sheet: Adds a new sheet to a spreadsheet
  • share_spreadsheet: Shares a spreadsheet with specific users
  • get_multiple_spreadsheet_summary: Gets summaries of multiple spreadsheets

And several other tools for comprehensive spreadsheet management.

Example Prompts

  • "List all spreadsheets I have access to."
  • "Create a new spreadsheet titled 'Quarterly Sales Report Q3 2024'."
  • "In the 'Project Tasks' spreadsheet, update cell B2 to 'In Progress'."
  • "Append these rows to the 'Log' sheet: [['2024-07-31', 'Task A Completed'], ['2024-08-01', 'Task B Started']]"
  • "Share the 'Team Schedule' spreadsheet with [email protected] as a reader."

How to install this MCP server

For Claude Code

To add this MCP server to Claude Code, run this command in your terminal:

claude mcp add-json "google-sheets" '{"command":"uvx","args":["mcp-google-sheets@latest"],"env":{"SERVICE_ACCOUNT_PATH":"/path/to/your/service-account-key.json","DRIVE_FOLDER_ID":"your_shared_folder_id_here"},"healthcheck_url":"http://localhost:8000/health"}'

See the official Claude Code MCP documentation for more details.

For Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "google-sheets": {
            "command": "uvx",
            "args": [
                "mcp-google-sheets@latest"
            ],
            "env": {
                "SERVICE_ACCOUNT_PATH": "/path/to/your/service-account-key.json",
                "DRIVE_FOLDER_ID": "your_shared_folder_id_here"
            },
            "healthcheck_url": "http://localhost:8000/health"
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.

For Claude Desktop

To add this MCP server to Claude Desktop:

1. Find your configuration file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json

2. Add this to your configuration file:

{
    "mcpServers": {
        "google-sheets": {
            "command": "uvx",
            "args": [
                "mcp-google-sheets@latest"
            ],
            "env": {
                "SERVICE_ACCOUNT_PATH": "/path/to/your/service-account-key.json",
                "DRIVE_FOLDER_ID": "your_shared_folder_id_here"
            },
            "healthcheck_url": "http://localhost:8000/health"
        }
    }
}

3. Restart Claude Desktop for the changes to take effect

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later