Google Sheets MCP Server

by Meerkats-Ai

1 383 downloads Not rated yet MIT
GitHub

About

A Model Context Protocol (MCP) server that integrates with the Google Sheets API, allowing AI assistants to programmatically create, read, update, and manage Google Sheets.

Details

License
MIT

Explore

- Create, read, update, and delete Google Sheets
- Manage sheet data with cell-level operations
- Format cells and ranges
- Share spreadsheets with other users
- Search for spreadsheets
- Comprehensive authentication options

Setting up with Highlight

This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:

  1. Download and install Highlight from highlightai.com/download
  2. Navigate to the plugins tab and select "Add Custom Plugin"
  3. Configure the plugin with the settings below
    Plugin Name Google Sheets MCP Server
    Command (node, npx, python, etc.)

    Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.

  4. Enable "Start Automatically" if you want the plugin to start when Highlight launches

From the repository

- Node.js (v16 or higher)
- A Google Cloud Project with the Google Sheets API enabled
- Authentication credentials (see below)

This MCP server supports multiple authentication methods:

1. Service Account Authentication (recommended for production)
- Provide a path to a service account key file
- Or provide the service account JSON content directly

2. API Key Authentication (simpler for development)
- Provide a Google API key

3. OAuth2 Authentication (for user-specific operations)
- Provide OAuth client ID, client secret, and refresh token

For operations that require user consent (like creating/editing spreadsheets), you'll need OAuth credentials:

1. Create OAuth credentials in the Google Cloud Console
2. Update the CLIENT_ID and CLIENT_SECRET in src/get-refresh-token.js
3. Install required dependencies:

   npm install open server-destroy

4. Run the script to get a refresh token:
   node src/get-refresh-token.js

5. Follow the browser prompts to authorize the application
6. Copy the refresh token to your .env file

Here's an example of how to use this MCP server with Claude:

You can now use Google Sheets! Try these commands:

1. Create a new spreadsheet:
"Create a new Google Sheet titled 'Monthly Budget'"

2. Add data to the spreadsheet:
"Add expense categories and amounts to my Monthly Budget spreadsheet"

3. Format the spreadsheet:
"Format the header row to be bold and centered"

4. Share the spreadsheet:
"Share my Monthly Budget spreadsheet with [email protected]"

google_sheets_create

Create a new Google Sheet

google_sheets_get

Get a Google Sheet by ID

google_sheets_update_values

Update values in a Google Sheet

google_sheets_append_values

Append values to a Google Sheet

google_sheets_get_values

Get values from a Google Sheet

google_sheets_clear_values

Clear values from a Google Sheet

google_sheets_add_sheet

Add a new sheet to an existing spreadsheet

google_sheets_delete_sheet

Delete a sheet from a spreadsheet

google_sheets_list

List Google Sheets accessible to the authenticated user

google_sheets_delete

Delete a Google Sheet

google_sheets_share

Share a Google Sheet with specific users

google_sheets_search

Search for Google Sheets by title

google_sheets_format_cells

Format cells in a Google Sheet

google_sheets_verify_connection

Verify connection with Google Sheets API

The server provides the following tools:

- google_sheets_create: Create a new Google Sheet
- google_sheets_get: Get a Google Sheet by ID
- google_sheets_update_values: Update values in a Google Sheet
- google_sheets_append_values: Append values to a Google Sheet
- google_sheets_get_values: Get values from a Google Sheet
- google_sheets_clear_values: Clear values from a Google Sheet
- google_sheets_add_sheet: Add a new sheet to an existing spreadsheet
- google_sheets_delete_sheet: Delete a sheet from a spreadsheet
- google_sheets_list: List Google Sheets accessible to the authenticated user
- google_sheets_delete: Delete a Google Sheet
- google_sheets_share: Share a Google Sheet with specific users
- google_sheets_search: Search for Google Sheets by title
- google_sheets_format_cells: Format cells in a Google Sheet
- google_sheets_verify_connection: Verify connection with Google Sheets API

Claude Desktop / Cursor

Paste into your MCP client config file to install this server.

{
    "mcpServers": {
        "google sheets mcp server": {
            "google-sheet-mcp-server": {
                "command": "node",
                "args": [
                    "src/get-refresh-token.js"
                ]
            }
        }
    }
}

McpServers

{
    "google-sheet-mcp-server": {
        "command": "node",
        "args": [
            "src/get-refresh-token.js"
        ]
    }
}

A powerful Model Context Protocol (MCP) server implementation for seamless Google Sheets API integration, enabling AI assistants to create, read, update, and manage Google Sheets.

Features

- Create, read, update, and delete Google Sheets
- Manage sheet data with cell-level operations
- Format cells and ranges
- Share spreadsheets with other users
- Search for spreadsheets
- Comprehensive authentication options

Authentication Options

This MCP server supports multiple authentication methods:

1. Service Account Authentication (recommended for production)
- Provide a path to a service account key file
- Or provide the service account JSON content directly

2. API Key Authentication (simpler for development)
- Provide a Google API key

3. OAuth2 Authentication (for user-specific operations)
- Provide OAuth client ID, client secret, and refresh token

Setup

Prerequisites

- Node.js (v16 or higher)
- A Google Cloud Project with the Google Sheets API enabled
- Authentication credentials (see below)

Installation

1. Clone the repository:

   git clone https://github.com/yourusername/google-sheets-mcp-server.git
cd google-sheets-mcp-server

2. Install dependencies:

   npm install

3. Set up authentication:
- Create a .env file based on the .env.example template
- Add your Google Cloud credentials

4. Build the project:

   npm run build

5. Start the server:

   npm start

OAuth Setup

For operations that require user consent (like creating/editing spreadsheets), you'll need OAuth credentials:

1. Create OAuth credentials in the Google Cloud Console
2. Update the CLIENT_ID and CLIENT_SECRET in src/get-refresh-token.js
3. Install required dependencies:

   npm install open server-destroy

4. Run the script to get a refresh token:
   node src/get-refresh-token.js

5. Follow the browser prompts to authorize the application
6. Copy the refresh token to your .env file

Available Tools

The server provides the following tools:

- google_sheets_create: Create a new Google Sheet
- google_sheets_get: Get a Google Sheet by ID
- google_sheets_update_values: Update values in a Google Sheet
- google_sheets_append_values: Append values to a Google Sheet
- google_sheets_get_values: Get values from a Google Sheet
- google_sheets_clear_values: Clear values from a Google Sheet
- google_sheets_add_sheet: Add a new sheet to an existing spreadsheet
- google_sheets_delete_sheet: Delete a sheet from a spreadsheet
- google_sheets_list: List Google Sheets accessible to the authenticated user
- google_sheets_delete: Delete a Google Sheet
- google_sheets_share: Share a Google Sheet with specific users
- google_sheets_search: Search for Google Sheets by title
- google_sheets_format_cells: Format cells in a Google Sheet
- google_sheets_verify_connection: Verify connection with Google Sheets API

Example Usage

Here's an example of how to use this MCP server with Claude:

You can now use Google Sheets! Try these commands:

1. Create a new spreadsheet:
"Create a new Google Sheet titled 'Monthly Budget'"

2. Add data to the spreadsheet:
"Add expense categories and amounts to my Monthly Budget spreadsheet"

3. Format the spreadsheet:
"Format the header row to be bold and centered"

4. Share the spreadsheet:
"Share my Monthly Budget spreadsheet with [email protected]"

License

MIT

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.