mcp-google-spreadsheet

MCP.Pizza Chef: kazz187

The mcp-google-spreadsheet is an MCP server that provides structured access to Google Spreadsheet and Google Drive functionalities. It enables AI assistants to list, copy, rename files and sheets, retrieve and update spreadsheet data, and manage rows and columns programmatically. This server requires Google Cloud Platform API activation and Go 1.24+, facilitating seamless integration of Google Sheets and Drive operations into AI workflows.

Use This MCP server To

List Google Drive files for AI-driven file management Copy and rename Google Drive files programmatically Retrieve and list sheets within a Google Spreadsheet Copy and rename sheets inside a spreadsheet Fetch spreadsheet data for analysis or processing Add rows or columns to Google Sheets dynamically Update single or multiple cell ranges in spreadsheets Automate spreadsheet data manipulation via AI workflows

README

MCP Google Spreadsheet

MCP (Model Context Protocol) サーバーとして実装された Google Spreadsheet および Google Drive 操作ツールです。このツールを使用することで、AI アシスタントが Google Spreadsheet や Google Drive のファイルを操作できるようになります。

機能

Google Drive 操作

  • list_files: Google Drive のファイル一覧を取得
  • copy_file: Google Drive のファイルをコピー
  • rename_file: Google Drive のファイル名を変更

Google Spreadsheet 操作

  • list_sheets: スプレッドシート内のシート一覧を取得
  • copy_sheet: スプレッドシート内のシートをコピー
  • rename_sheet: スプレッドシート内のシート名を変更
  • get_sheet_data: シートのデータを取得
  • add_rows: シートに行を追加
  • add_columns: シートに列を追加
  • update_cells: 単一範囲のセルを更新
  • batch_update_cells: 複数範囲のセルを一括更新

前提条件

  • Go 1.24 以上
  • Google Cloud Platform のプロジェクトと API 有効化
    • Google Drive API
    • Google Sheets API

インストール

go install github.com/kazz187/mcp-google-spreadsheet@latest

これにより、$GOPATH/bin ディレクトリに mcp-google-spreadsheet バイナリがインストールされます。

設定

以下の環境変数を設定する必要があります:

  • MCPGS_CLIENT_SECRET_PATH: Google API のクライアントシークレットファイルのパス (https://developers.google.com/identity/protocols/oauth2/native-app?hl=ja)
  • MCPGS_TOKEN_PATH: Google API のトークンファイルのパス(存在しない場合は自動的に作成されます)
  • MCPGS_FOLDER_ID: 操作対象とする Google Drive のフォルダ ID

Google API の設定手順

  1. Google Cloud Console にアクセス
  2. プロジェクトを作成
  3. Google Drive API と Google Sheets API を有効化
  4. 認証情報を作成(OAuth クライアント ID)
  5. クライアントシークレットをダウンロード

使用方法

起動

export MCPGS_CLIENT_SECRET_PATH=/path/to/client_secret.json
export MCPGS_TOKEN_PATH=/path/to/token.json
export MCPGS_FOLDER_ID=your_folder_id
mcp-google-spreadsheet

go install でインストールした場合は、$GOPATH/bin が PATH に含まれていることを確認してください。

初回起動時は認証が必要です。ブラウザが自動的に開き、Google アカウントでの認証画面が表示されます。認証が完了すると自動的にアプリケーションに戻ります。ブラウザが自動的に開かない場合は、コンソールに表示される URL をブラウザで開いてください。

MCP 設定

Claude や ChatGPT などの AI アシスタントで使用するには、MCP の設定ファイルに以下のように追加します:

{
  "mcpServers": {
    "mcp_google_spreadsheet": {
      "command": "mcp-google-spreadsheet",
      "args": [],
      "env": {
        "MCPGS_CLIENT_SECRET_PATH": "/path/to/client_secret.json",
        "MCPGS_TOKEN_PATH": "/path/to/token.json",
        "MCPGS_FOLDER_ID": "your_folder_id"
      }
    }
  }
}

go install でインストールした場合は、command に絶対パスを指定する代わりに、上記のように実行ファイル名のみを指定することもできます。その場合は、MCP サーバーを実行するユーザーの PATH に $GOPATH/bin が含まれていることを確認してください。

セキュリティ

  • 指定されたフォルダ ID 内のファイルのみにアクセスが制限されます
  • ディレクトリトラバーサル攻撃(../ などを使用したパス指定)は防止されます
  • ユーザーから指定されたファイルが指定フォルダ内に存在するかが検証されます

mcp-google-spreadsheet FAQ

How do I install the mcp-google-spreadsheet server?
Install it using Go with 'go install github.com/kazz187/mcp-google-spreadsheet@latest', which places the binary in your $GOPATH/bin directory.
What Google APIs must be enabled to use this MCP server?
You need to enable the Google Drive API and Google Sheets API in your Google Cloud Platform project.
What environment variables are required for configuration?
Set 'MCPGS_CLIENT_SECRET_PATH' to the path of your Google API client secret file for authentication.
Which Go version is required to run this MCP server?
Go 1.24 or higher is required to build and run the mcp-google-spreadsheet server.
Can this server handle batch updates to spreadsheet cells?
Yes, it supports batch updating multiple cell ranges in a single operation.
Is it possible to automate file copying and renaming in Google Drive?
Yes, the server provides commands to copy and rename files in Google Drive programmatically.
How does this MCP server enhance AI assistant capabilities?
It allows AI models to interact directly with Google Sheets and Drive, enabling real-time data retrieval and manipulation.
Does this server support multi-sheet management within spreadsheets?
Yes, it can list, copy, and rename individual sheets inside a Google Spreadsheet.