我們在上一篇有介紹如何設定 gcp 獲得 credentials 以便使用任何 google mcp server,
這一篇我們會用 json 的方式來驗證並使用 mcp-google-sheet

Note: 這個是社群開發的不是官方的!請斟酌使用~
首先我們需要下載 uvx
macOS / Linux
curl -LsSf https://astral.sh/uv/install.sh | sh
Windows
powershell -c "irm https://astral.sh/uv/install.ps1 | iex"
或著用 pip 下載
pip install uv
接著設定環境變數, 指定 google oauth credentials json 的檔案路徑:
以及指定 token 檔案生成的路徑位置,
接著執行 mcp server:
uvx mcp-google-sheets@latest
就會跳轉到 oauth 驗證頁面:

看到
The authentication flow has completed. You may close this window.
就完成了
接著去 cursor 設定 mcp server:
{
"mcpServers": {
"google-sheets": {
"command": "uvx",
"args": ["mcp-google-sheets@latest"],
"env": {
"CREDENTIALS_PATH": "/full/path/to/your/credentials.json",
"TOKEN_PATH": "/full/path/to/your/token.json"
}
}
}
}
記得檔案路徑如果是 \ 需要多加上\跳脫字符:
"TOKEN_PATH": "C:\\Users\\Alicia\\test-mcp-google-excel-token.json"
可以看到設定成功了:

prompt:
幫我打這支api @https://jsonplaceholder.typicode.com/todos , 接著把結果新增到 google sheet, 名稱為 todo, 並且計算已完成的數量
過程:

結果:

