Skip to main content
Glama
jsyapps

Google Sheets MCP Server

by jsyapps
README.md
# Google Sheets MCP Server

An MCP (Model Context Protocol) server that provides Google Sheets integration capabilities.

## Features

- **read_sheet**: Read data from a Google Sheet
- **write_sheet**: Write data to a Google Sheet  
- **append_sheet**: Append data to a Google Sheet
- **create_sheet**: Create a new Google Sheet

## Setup

1. **Install dependencies**:
   ```bash
   npm install
   ```

2. **Authentication Setup** (Shared with gmail_mcp):
   - This server uses the same OAuth2 credentials as `gmail_mcp`
   - Make sure you have already set up `gmail_mcp` with Google OAuth2 credentials
   - The server will automatically use `../gmail_mcp/credentials.json` and `../gmail_mcp/token.json`

3. **Google Cloud Setup** (if not done for gmail_mcp):
   - Create a project in [Google Cloud Console](https://console.cloud.google.com/)
   - Enable the Google Sheets API (in addition to Gmail API)
   - Create OAuth2 credentials (not service account) and download as `credentials.json`
   - Place `credentials.json` in the `gmail_mcp` folder

4. **Build the server**:
   ```bash
   npm run build
   ```

## Usage

### Running the server
```bash
npm start
```

### Development
```bash
npm run dev
```

### MCP Client Configuration

Add this server to your MCP client configuration:

```json
{
  "mcpServers": {
    "gsheets": {
      "command": "node",
      "args": ["/path/to/gsheets_mcp/dist/index.js"]
    }
  }
}
```

## Tools

### read_sheet
Read data from a Google Sheet.

**Parameters:**
- `spreadsheetId` (string): The ID of the Google Sheet
- `range` (string): The range to read (e.g., 'Sheet1!A1:C10')

### write_sheet
Write data to a Google Sheet.

**Parameters:**
- `spreadsheetId` (string): The ID of the Google Sheet
- `range` (string): The range to write to (e.g., 'Sheet1!A1')
- `values` (array): 2D array of values to write

### append_sheet
Append data to a Google Sheet.

**Parameters:**
- `spreadsheetId` (string): The ID of the Google Sheet
- `range` (string): The range to append to (e.g., 'Sheet1!A:C')
- `values` (array): 2D array of values to append

### create_sheet
Create a new Google Sheet.

**Parameters:**
- `title` (string): Title of the new spreadsheet

## Authentication

This server uses OAuth2 authentication shared with the gmail_mcp server. The authentication is handled automatically using the credentials from the gmail_mcp folder.

**Required Scopes:**
- `https://www.googleapis.com/auth/spreadsheets` (for Sheets access)

Make sure the Google Sheets API is enabled in your Google Cloud project alongside the Gmail API.

## License

MIT