This is a Model Context Protocol (MCP) server that enables LLMs to interact with Google Sheets. It provides tools to read, write, update, and delete rows in a Google Sheet.
This project allows AI agents to directly manipulate data in Google Sheets, enabling automation of tasks like inventory management, data entry, and report generation directly from a chat interface.
- Node.js installed
- A Google Cloud Service Account with access to the Google Sheets API
- A
service.jsoncredential file from your Google Cloud project
-
Install Dependencies
npm install
-
Configure Credentials Place your Google Cloud service account credentials file named
service.jsonin thesrc/directory.Note: The application expects
service.jsonto be available to the running script. Ensure it is copied to the build directory or accessible. -
Build the Project
npm run build
You may need to manually copy
src/service.jsontobuild/service.jsonif the build script doesn't handle it.
To run the server:
node build/index.jsread-sheet: Read all rows from the configured Google Sheet.write-sheet: Append a new row (specifically formatted for inventory: apples, bananas, oranges, grapes).update-sheet-row: Update a specific row.delete-sheet-row: Delete a specific row.
The spreadsheet ID is currently hardcoded in src/index.js. You may need to update SPREADSHEET_ID with your own sheet ID.