Sponsored by Deepsite.site

Google Sheets MCP Server

Created By
hightemp7 months ago
A Model Context Protocol (MCP) server for Google Sheets written in Go. Provides comprehensive tools for interacting with Google Spreadsheets.
Content

Google Sheets MCP Server

A Model Context Protocol (MCP) server for Google Sheets written in Go. Provides comprehensive tools for interacting with Google Spreadsheets.

Features

  • Sheet Data: Get/update cell data, formulas, batch operations
  • Sheet Management: Create, rename, copy sheets, add rows/columns
  • Spreadsheet Management: Create, list, share spreadsheets
  • Multiple Authentication Methods: Service account, OAuth2, ADC

Quick Start

  1. Build:

    make build
    
  2. Setup Google API Credentials (see SETUP.md for detailed instructions)

  3. Configure Environment:

    # Service Account (recommended)
    export SERVICE_ACCOUNT_PATH="path/to/service-account.json"
    
    # OAuth2
    export CREDENTIALS_PATH="path/to/credentials.json"
    
    # Base64 encoded service account
    export CREDENTIALS_CONFIG="base64_encoded_service_account_json"
    
  4. Run:

    # Stdio mode
    ./go_mcp_server_google_sheets
    
    # SSE mode
    ./go_mcp_server_google_sheets -t sse -p 8891
    

Environment Variables

  • SERVICE_ACCOUNT_PATH - Path to service account JSON file
  • CREDENTIALS_PATH - Path to OAuth2 credentials JSON file
  • CREDENTIALS_CONFIG - Base64 encoded service account JSON
  • TOKEN_PATH - OAuth2 token storage path (default: token.json)
  • DRIVE_FOLDER_ID - Google Drive folder ID for new spreadsheets

Available Tools

Data Operations

  • get_sheet_data - Get data from sheet
  • get_sheet_formulas - Get formulas from sheet
  • update_cells - Update cell values
  • batch_update_cells - Batch update multiple ranges

Sheet Management

  • list_sheets - List all sheets in spreadsheet
  • create_sheet - Create new sheet
  • rename_sheet - Rename existing sheet
  • copy_sheet - Copy sheet between spreadsheets
  • add_rows / add_columns - Add rows or columns

Spreadsheet Management

  • create_spreadsheet - Create new spreadsheet
  • list_spreadsheets - List spreadsheets in Drive
  • share_spreadsheet - Share spreadsheet with users

Authentication Setup

  1. Create Google Cloud Project:

  2. Enable APIs:

    • Go to "APIs & Services" > "Library"
    • Enable "Google Sheets API"
    • Enable "Google Drive API"
  3. Create Service Account:

    • Go to "APIs & Services" > "Credentials"
    • Click "Create Credentials" > "Service Account"
    • Fill in service account details
    • Click "Create and Continue"
  4. Generate Key:

    • Click on created service account
    • Go to "Keys" tab
    • Click "Add Key" > "Create new key"
    • Choose "JSON" format
    • Download the file (this is your service-account.json)
  5. Set Environment Variable:

    export SERVICE_ACCOUNT_PATH="/path/to/your/service-account.json"
    

Method 2: OAuth2 (For User Access)

  1. Create OAuth2 Credentials:

    • In Google Cloud Console, go to "APIs & Services" > "Credentials"
    • Click "Create Credentials" > "OAuth client ID"
    • Choose "Desktop application"
    • Download the JSON file (this is your credentials.json)
  2. Set Environment Variable:

    export CREDENTIALS_PATH="/path/to/your/credentials.json"
    

Method 3: Base64 Encoded (For Containers/CI)

  1. Encode Service Account:

    base64 -w 0 /path/to/service-account.json
    
  2. Set Environment Variable:

    export CREDENTIALS_CONFIG="your_base64_encoded_string_here"
    

Sharing Spreadsheets with Service Account

When using Service Account, you need to share your spreadsheets with the service account email:

  1. Open your Google Spreadsheet
  2. Click "Share" button
  3. Add the service account email (found in your JSON file as client_email)
  4. Give appropriate permissions (Viewer/Editor)

License

MIT

Recommend Servers
TraeBuild with Free GPT-4.1 & Claude 3.7. Fully MCP-Ready.
Jina AI MCP ToolsA Model Context Protocol (MCP) server that integrates with Jina AI Search Foundation APIs.
Playwright McpPlaywright MCP server
WindsurfThe new purpose-built IDE to harness magic
EdgeOne Pages MCPAn MCP service designed for deploying HTML content to EdgeOne Pages and obtaining an accessible public URL.
BlenderBlenderMCP connects Blender to Claude AI through the Model Context Protocol (MCP), allowing Claude to directly interact with and control Blender. This integration enables prompt assisted 3D modeling, scene creation, and manipulation.
TimeA Model Context Protocol server that provides time and timezone conversion capabilities. This server enables LLMs to get current time information and perform timezone conversions using IANA timezone names, with automatic system timezone detection.
Tavily Mcp
ChatWiseThe second fastest AI chatbot™
Zhipu Web SearchZhipu Web Search MCP Server is a search engine specifically designed for large models. It integrates four search engines, allowing users to flexibly compare and switch between them. Building upon the web crawling and ranking capabilities of traditional search engines, it enhances intent recognition capabilities, returning results more suitable for large model processing (such as webpage titles, URLs, summaries, site names, site icons, etc.). This helps AI applications achieve "dynamic knowledge acquisition" and "precise scenario adaptation" capabilities.
AiimagemultistyleA Model Context Protocol (MCP) server for image generation and manipulation using fal.ai's Stable Diffusion model.
Amap Maps高德地图官方 MCP Server
Baidu Map百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Visual Studio Code - Open Source ("Code - OSS")Visual Studio Code
Howtocook Mcp基于Anduin2017 / HowToCook (程序员在家做饭指南)的mcp server,帮你推荐菜谱、规划膳食,解决“今天吃什么“的世纪难题; Based on Anduin2017/HowToCook (Programmer's Guide to Cooking at Home), MCP Server helps you recommend recipes, plan meals, and solve the century old problem of "what to eat today"
Serper MCP ServerA Serper MCP Server
MCP AdvisorMCP Advisor & Installation - Use the right MCP server for your needs
MiniMax MCPOfficial MiniMax Model Context Protocol (MCP) server that enables interaction with powerful Text to Speech, image generation and video generation APIs.
CursorThe AI Code Editor
DeepChatYour AI Partner on Desktop
Context7Context7 MCP Server -- Up-to-date code documentation for LLMs and AI code editors