mcp-gsheets 1.5.0 → 1.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +148 -50
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -12,68 +12,79 @@
|
|
|
12
12
|

|
|
13
13
|

|
|
14
14
|
|
|
15
|
-
A Model Context Protocol (MCP) server for Google Sheets API integration. Enables reading, writing, and managing Google Sheets documents directly from your MCP client (e.g., Claude Desktop).
|
|
15
|
+
A Model Context Protocol (MCP) server for Google Sheets API integration. Enables reading, writing, and managing Google Sheets documents directly from your MCP client (e.g., Claude Code, Claude Desktop, Cursor, etc.).
|
|
16
16
|
|
|
17
|
-
##
|
|
17
|
+
## Key Features
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
- **Complete Google Sheets Integration**: Read, write, and manage spreadsheets
|
|
20
|
+
- **Advanced Operations**: Batch operations, formatting, charts, and conditional formatting
|
|
21
|
+
- **Flexible Authentication**: Support for both file-based and JSON string credentials
|
|
22
|
+
- **Production Ready**: Built with TypeScript, comprehensive error handling, and full test coverage
|
|
20
23
|
|
|
21
|
-
|
|
22
|
-
|
|
24
|
+
## Requirements
|
|
25
|
+
|
|
26
|
+
- [Node.js](https://nodejs.org/) v18 or higher
|
|
27
|
+
- [Google Cloud Project](https://console.cloud.google.com) with Sheets API enabled
|
|
23
28
|
- Service Account with JSON key file
|
|
29
|
+
- [npm](https://www.npmjs.com/)
|
|
24
30
|
|
|
25
|
-
|
|
31
|
+
## Getting Started
|
|
26
32
|
|
|
27
|
-
|
|
28
|
-
# Clone the repository
|
|
29
|
-
git clone https://github.com/freema/mcp-gsheets.git
|
|
30
|
-
# Or using SSH
|
|
31
|
-
# git clone git@github.com:freema/mcp-gsheets.git
|
|
32
|
-
cd mcp-gsheets
|
|
33
|
+
### Quick Install (Recommended)
|
|
33
34
|
|
|
34
|
-
|
|
35
|
-
npm install
|
|
35
|
+
Add the following config to your MCP client:
|
|
36
36
|
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
```json
|
|
38
|
+
{
|
|
39
|
+
"mcpServers": {
|
|
40
|
+
"mcp-gsheets": {
|
|
41
|
+
"command": "npx",
|
|
42
|
+
"args": ["-y", "mcp-gsheets@latest"],
|
|
43
|
+
"env": {
|
|
44
|
+
"GOOGLE_PROJECT_ID": "your-project-id",
|
|
45
|
+
"GOOGLE_APPLICATION_CREDENTIALS": "/absolute/path/to/service-account-key.json"
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
39
50
|
```
|
|
40
51
|
|
|
41
|
-
|
|
52
|
+
> [!NOTE]
|
|
53
|
+
> Using `mcp-gsheets@latest` ensures that your MCP client will always use the latest version of the MCP Google Sheets server.
|
|
42
54
|
|
|
43
|
-
|
|
44
|
-
2. Create a new project or select existing
|
|
45
|
-
3. Enable Google Sheets API:
|
|
46
|
-
- Navigate to "APIs & Services" → "Library"
|
|
47
|
-
- Search for "Google Sheets API" and click "Enable"
|
|
48
|
-
4. Create Service Account:
|
|
49
|
-
- Go to "APIs & Services" → "Credentials"
|
|
50
|
-
- Click "Create Credentials" → "Service Account"
|
|
51
|
-
- Download the JSON key file
|
|
52
|
-
5. Share your spreadsheets:
|
|
53
|
-
- Open your Google Sheet
|
|
54
|
-
- Click Share and add the service account email (from JSON file)
|
|
55
|
-
- Grant "Editor" permissions
|
|
55
|
+
### MCP Client Configuration
|
|
56
56
|
|
|
57
|
-
|
|
57
|
+
<details>
|
|
58
|
+
<summary>Claude Code</summary>
|
|
59
|
+
Use the Claude Code CLI to add the MCP Google Sheets server (<a href="https://docs.anthropic.com/en/docs/claude-code/mcp">guide</a>):
|
|
58
60
|
|
|
59
|
-
|
|
61
|
+
```bash
|
|
62
|
+
claude mcp add mcp-gsheets npx mcp-gsheets@latest
|
|
63
|
+
```
|
|
60
64
|
|
|
61
|
-
|
|
65
|
+
After adding, edit your Claude Code config to add the required environment variables:
|
|
62
66
|
|
|
63
|
-
```
|
|
64
|
-
|
|
67
|
+
```json
|
|
68
|
+
{
|
|
69
|
+
"mcpServers": {
|
|
70
|
+
"mcp-gsheets": {
|
|
71
|
+
"command": "npx",
|
|
72
|
+
"args": ["mcp-gsheets@latest"],
|
|
73
|
+
"env": {
|
|
74
|
+
"GOOGLE_PROJECT_ID": "your-project-id",
|
|
75
|
+
"GOOGLE_APPLICATION_CREDENTIALS": "/absolute/path/to/service-account-key.json"
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
65
80
|
```
|
|
66
81
|
|
|
67
|
-
|
|
68
|
-
- Guide you through the configuration
|
|
69
|
-
- Automatically detect your Node.js installation (including nvm)
|
|
70
|
-
- Find your Claude Desktop config
|
|
71
|
-
- Create the proper JSON configuration
|
|
72
|
-
- Optionally create a .env file for development
|
|
82
|
+
</details>
|
|
73
83
|
|
|
74
|
-
|
|
84
|
+
<details>
|
|
85
|
+
<summary>Claude Desktop</summary>
|
|
75
86
|
|
|
76
|
-
|
|
87
|
+
Add to your Claude Desktop config:
|
|
77
88
|
- macOS: `~/Library/Application Support/Claude/claude_desktop_config.json`
|
|
78
89
|
- Windows: `%APPDATA%\Claude\claude_desktop_config.json`
|
|
79
90
|
- Linux: `~/.config/claude/claude_desktop_config.json`
|
|
@@ -82,8 +93,8 @@ If you prefer manual configuration, add to your Claude Desktop config:
|
|
|
82
93
|
{
|
|
83
94
|
"mcpServers": {
|
|
84
95
|
"mcp-gsheets": {
|
|
85
|
-
"command": "
|
|
86
|
-
"args": ["
|
|
96
|
+
"command": "npx",
|
|
97
|
+
"args": ["-y", "mcp-gsheets@latest"],
|
|
87
98
|
"env": {
|
|
88
99
|
"GOOGLE_PROJECT_ID": "your-project-id",
|
|
89
100
|
"GOOGLE_APPLICATION_CREDENTIALS": "/absolute/path/to/service-account-key.json"
|
|
@@ -93,16 +104,55 @@ If you prefer manual configuration, add to your Claude Desktop config:
|
|
|
93
104
|
}
|
|
94
105
|
```
|
|
95
106
|
|
|
96
|
-
|
|
107
|
+
</details>
|
|
108
|
+
|
|
109
|
+
<details>
|
|
110
|
+
<summary>Cursor</summary>
|
|
111
|
+
|
|
112
|
+
Go to `Cursor Settings` → `MCP` → `New MCP Server`. Use the config provided above.
|
|
113
|
+
|
|
114
|
+
</details>
|
|
115
|
+
|
|
116
|
+
<details>
|
|
117
|
+
<summary>Cline</summary>
|
|
118
|
+
|
|
119
|
+
Follow https://docs.cline.bot/mcp/configuring-mcp-servers and use the config provided above.
|
|
120
|
+
|
|
121
|
+
</details>
|
|
122
|
+
|
|
123
|
+
<details>
|
|
124
|
+
<summary>Other MCP Clients</summary>
|
|
97
125
|
|
|
98
|
-
|
|
126
|
+
For other MCP clients, use the standard configuration format shown above. Ensure the `command` is set to `npx` and include the environment variables for Google Cloud authentication.
|
|
127
|
+
|
|
128
|
+
</details>
|
|
129
|
+
|
|
130
|
+
### Google Cloud Setup
|
|
131
|
+
|
|
132
|
+
1. Go to [Google Cloud Console](https://console.cloud.google.com)
|
|
133
|
+
2. Create a new project or select existing
|
|
134
|
+
3. Enable Google Sheets API:
|
|
135
|
+
- Navigate to "APIs & Services" → "Library"
|
|
136
|
+
- Search for "Google Sheets API" and click "Enable"
|
|
137
|
+
4. Create Service Account:
|
|
138
|
+
- Go to "APIs & Services" → "Credentials"
|
|
139
|
+
- Click "Create Credentials" → "Service Account"
|
|
140
|
+
- Download the JSON key file
|
|
141
|
+
5. Share your spreadsheets:
|
|
142
|
+
- Open your Google Sheet
|
|
143
|
+
- Click Share and add the service account email (from JSON file)
|
|
144
|
+
- Grant "Editor" permissions
|
|
145
|
+
|
|
146
|
+
### Alternative: JSON String Authentication
|
|
147
|
+
|
|
148
|
+
Instead of using a file path for credentials, you can provide the service account credentials directly as a JSON string. This is useful for containerized environments, CI/CD pipelines, or when you want to avoid managing credential files.
|
|
99
149
|
|
|
100
150
|
```json
|
|
101
151
|
{
|
|
102
152
|
"mcpServers": {
|
|
103
153
|
"mcp-gsheets": {
|
|
104
|
-
"command": "
|
|
105
|
-
"args": ["
|
|
154
|
+
"command": "npx",
|
|
155
|
+
"args": ["-y", "mcp-gsheets@latest"],
|
|
106
156
|
"env": {
|
|
107
157
|
"GOOGLE_PROJECT_ID": "your-project-id",
|
|
108
158
|
"GOOGLE_SERVICE_ACCOUNT_KEY": "{\"type\":\"service_account\",\"project_id\":\"your-project\",\"private_key_id\":\"...\",\"private_key\":\"-----BEGIN PRIVATE KEY-----\\n...\\n-----END PRIVATE KEY-----\\n\",\"client_email\":\"...@....iam.gserviceaccount.com\",\"client_id\":\"...\",\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"token_uri\":\"https://oauth2.googleapis.com/token\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\",\"client_x509_cert_url\":\"...\"}"
|
|
@@ -118,7 +168,55 @@ Instead of using a file path, you can provide the service account credentials di
|
|
|
118
168
|
- Newlines in the private key must be represented as `\\n`
|
|
119
169
|
- If the JSON includes a `project_id`, you can omit `GOOGLE_PROJECT_ID`
|
|
120
170
|
|
|
121
|
-
|
|
171
|
+
## Local Development Setup
|
|
172
|
+
|
|
173
|
+
If you want to develop or contribute to this project, you can clone and build it locally:
|
|
174
|
+
|
|
175
|
+
```bash
|
|
176
|
+
# Clone the repository
|
|
177
|
+
git clone https://github.com/freema/mcp-gsheets.git
|
|
178
|
+
cd mcp-gsheets
|
|
179
|
+
|
|
180
|
+
# Install dependencies
|
|
181
|
+
npm install
|
|
182
|
+
|
|
183
|
+
# Build the project
|
|
184
|
+
npm run build
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
### Interactive Setup Script
|
|
188
|
+
|
|
189
|
+
Run the interactive setup script to configure your local MCP client:
|
|
190
|
+
|
|
191
|
+
```bash
|
|
192
|
+
npm run setup
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
This will:
|
|
196
|
+
- Guide you through the configuration
|
|
197
|
+
- Automatically detect your Node.js installation (including nvm)
|
|
198
|
+
- Find your Claude Desktop config
|
|
199
|
+
- Create the proper JSON configuration
|
|
200
|
+
- Optionally create a .env file for development
|
|
201
|
+
|
|
202
|
+
### Manual Local Configuration
|
|
203
|
+
|
|
204
|
+
If you prefer manual configuration with a local build, add to your MCP client config:
|
|
205
|
+
|
|
206
|
+
```json
|
|
207
|
+
{
|
|
208
|
+
"mcpServers": {
|
|
209
|
+
"mcp-gsheets": {
|
|
210
|
+
"command": "node",
|
|
211
|
+
"args": ["/absolute/path/to/mcp-gsheets/dist/index.js"],
|
|
212
|
+
"env": {
|
|
213
|
+
"GOOGLE_PROJECT_ID": "your-project-id",
|
|
214
|
+
"GOOGLE_APPLICATION_CREDENTIALS": "/absolute/path/to/service-account-key.json"
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
```
|
|
122
220
|
|
|
123
221
|
## 📦 Build & Development
|
|
124
222
|
|