Designed to run as a Google Cloud Function with support for Cloud Functions deployment and Secret Manager for credential storage.
Exposes Google Sheets as queryable database tables with tools for listing sheets, retrieving column schemas, and fetching rows with pagination support.
Google Sheets MCP Server
An MCP (Model Context Protocol) server that exposes Google Sheets as queryable database tables. Designed to run as a Google Cloud Function.
Features
list_sheets - List all sheet names in a spreadsheet
get_schema - Get column headers for a sheet
query_rows - Fetch rows with optional pagination (limit/offset)
Prerequisites
A Google Cloud project with the Sheets API enabled
A service account with access to the spreadsheets you want to query
Google Cloud CLI (
gcloud) installed and configured
Setup
1. Create a Service Account
2. Share Spreadsheets
Share your Google Spreadsheets with the service account email:
Grant "Viewer" permission for read-only access.
3. Install Dependencies
4. Build
Local Development
Set the environment variable and run:
Deploy to Google Cloud Functions
Deploy Command
For authenticated access (recommended for production):
Using Secret Manager (Recommended)
For better security, store credentials in Secret Manager:
MCP Client Configuration
Add the deployed function URL to your MCP client configuration:
Tool Usage
list_sheets
List all sheets in a spreadsheet:
get_schema
Get column headers for a sheet:
query_rows
Fetch rows from a sheet:
Finding the Spreadsheet ID
The spreadsheet ID is in the URL of your Google Sheet:
License
MIT