vivekdomadiya/google-sheets-mcp
If you are the rightful owner of google-sheets-mcp and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to dayong@mcphub.com.
A Model Context Protocol (MCP) server for interacting with Google Sheets.
Google Sheets MCP Server
A Model Context Protocol (MCP) server for interacting with Google Sheets.
Features
- Get spreadsheet information
- Read data from sheets
- Write data to sheets
- Append data to sheets
- Create formatted tables
- Clear sheet data
- Create new sheets
Setup
- Create a Google Cloud project and enable the Google Sheets API
- Create a service account and download the JSON key file
- Share your Google Sheets with the service account email
Configuration
The server uses the following environment variables:
GOOGLE_SERVICE_ACCOUNT_KEY: Path to the service account key JSON file (default:./credentials/service-account-key.json)DEFAULT_SPREADSHEET_ID: Default Google Spreadsheet ID to use when not explicitly provided
Usage
Starting the server
# Using npm scripts
npm start
# Development mode with auto-reload
npm run dev
# With explicit service account key path
GOOGLE_SERVICE_ACCOUNT_KEY=/path/to/credentials/service-account-key.json npm start
# With default spreadsheet ID
DEFAULT_SPREADSHEET_ID=your_spreadsheet_id npm start
# With both
GOOGLE_SERVICE_ACCOUNT_KEY=/path/to/credentials/service-account-key.json DEFAULT_SPREADSHEET_ID=your_spreadsheet_id npm start
Using Docker
You can also run the Google Sheets MCP server using Docker:
Building the Docker image
docker build -t google-sheets-mcp .
Running the Docker container
# Mount your service account key file and set environment variables
docker run -i --rm \
-v /path/to/your/service-account-key.json:/app/credentials/service-account-key.json \
-e GOOGLE_SERVICE_ACCOUNT_KEY=/app/credentials/service-account-key.json \
-e DEFAULT_SPREADSHEET_ID=your_spreadsheet_id \
google-sheets-mcp
Available Tools
get_spreadsheet_info
Get information about a spreadsheet including its sheets and properties.
{
"spreadsheetId": "optional - uses DEFAULT_SPREADSHEET_ID if not provided"
}
read_sheet
Read data from a specific range in a sheet.
{
"spreadsheetId": "optional - uses DEFAULT_SPREADSHEET_ID if not provided",
"range": "Sheet1!A1:C10"
}
write_sheet
Write data to a specific range in a sheet.
{
"spreadsheetId": "optional - uses DEFAULT_SPREADSHEET_ID if not provided",
"range": "Sheet1!A1",
"values": [
["Header 1", "Header 2"],
["Value 1", "Value 2"]
]
}
append_sheet
Append data to the end of a sheet.
{
"spreadsheetId": "optional - uses DEFAULT_SPREADSHEET_ID if not provided",
"range": "Sheet1!A:C",
"values": [["Value 1", "Value 2", "Value 3"]]
}
create_table
Create a formatted table with headers and data.
{
"spreadsheetId": "optional - uses DEFAULT_SPREADSHEET_ID if not provided",
"sheetName": "Sheet1",
"headers": ["Header 1", "Header 2", "Header 3"],
"rows": [
["Row 1 Col 1", "Row 1 Col 2", "Row 1 Col 3"],
["Row 2 Col 1", "Row 2 Col 2", "Row 2 Col 3"]
],
"startCell": "A1"
}
clear_sheet
Clear data from a specific range.
{
"spreadsheetId": "optional - uses DEFAULT_SPREADSHEET_ID if not provided",
"range": "Sheet1!A1:C10"
}
create_sheet
Create a new sheet in a spreadsheet.
{
"spreadsheetId": "optional - uses DEFAULT_SPREADSHEET_ID if not provided",
"sheetTitle": "New Sheet Name"
}
License
MIT