bn-google-workspace-mcp-server 0.0.1
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 +718 -0
- package/dist/debug-middleware.d.ts +12 -0
- package/dist/debug-middleware.d.ts.map +1 -0
- package/dist/debug-middleware.js +36 -0
- package/dist/debug-middleware.js.map +1 -0
- package/dist/google-api-client.d.ts +46 -0
- package/dist/google-api-client.d.ts.map +1 -0
- package/dist/google-api-client.js +76 -0
- package/dist/google-api-client.js.map +1 -0
- package/dist/helpers.d.ts +40 -0
- package/dist/helpers.d.ts.map +1 -0
- package/dist/helpers.js +171 -0
- package/dist/helpers.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +166 -0
- package/dist/index.js.map +1 -0
- package/dist/schemas.d.ts +303 -0
- package/dist/schemas.d.ts.map +1 -0
- package/dist/schemas.js +611 -0
- package/dist/schemas.js.map +1 -0
- package/dist/tool-loader.d.ts +35 -0
- package/dist/tool-loader.d.ts.map +1 -0
- package/dist/tool-loader.js +121 -0
- package/dist/tool-loader.js.map +1 -0
- package/dist/tool-registry.d.ts +44 -0
- package/dist/tool-registry.d.ts.map +1 -0
- package/dist/tool-registry.js +56 -0
- package/dist/tool-registry.js.map +1 -0
- package/dist/tools/calendar.d.ts +44 -0
- package/dist/tools/calendar.d.ts.map +1 -0
- package/dist/tools/calendar.js +76 -0
- package/dist/tools/calendar.js.map +1 -0
- package/dist/tools/chat.d.ts +29 -0
- package/dist/tools/chat.d.ts.map +1 -0
- package/dist/tools/chat.js +42 -0
- package/dist/tools/chat.js.map +1 -0
- package/dist/tools/docs.d.ts +29 -0
- package/dist/tools/docs.d.ts.map +1 -0
- package/dist/tools/docs.js +63 -0
- package/dist/tools/docs.js.map +1 -0
- package/dist/tools/drive.d.ts +45 -0
- package/dist/tools/drive.d.ts.map +1 -0
- package/dist/tools/drive.js +135 -0
- package/dist/tools/drive.js.map +1 -0
- package/dist/tools/forms.d.ts +30 -0
- package/dist/tools/forms.d.ts.map +1 -0
- package/dist/tools/forms.js +46 -0
- package/dist/tools/forms.js.map +1 -0
- package/dist/tools/gmail.d.ts +55 -0
- package/dist/tools/gmail.d.ts.map +1 -0
- package/dist/tools/gmail.js +112 -0
- package/dist/tools/gmail.js.map +1 -0
- package/dist/tools/index.d.ts +13 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +22 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/sheets.d.ts +40 -0
- package/dist/tools/sheets.d.ts.map +1 -0
- package/dist/tools/sheets.js +64 -0
- package/dist/tools/sheets.js.map +1 -0
- package/dist/tools/slides.d.ts +32 -0
- package/dist/tools/slides.d.ts.map +1 -0
- package/dist/tools/slides.js +46 -0
- package/dist/tools/slides.js.map +1 -0
- package/dist/tools/tasks.d.ts +43 -0
- package/dist/tools/tasks.d.ts.map +1 -0
- package/dist/tools/tasks.js +69 -0
- package/dist/tools/tasks.js.map +1 -0
- package/dist/types.d.ts +110 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/package.json +54 -0
- package/tools.json +379 -0
package/README.md
ADDED
|
@@ -0,0 +1,718 @@
|
|
|
1
|
+
# Google Workspace MCP Server
|
|
2
|
+
|
|
3
|
+
A comprehensive Model Context Protocol (MCP) server for Google Workspace services including Gmail, Drive, Calendar, Docs, Sheets, Slides, Forms, Tasks, and Chat with OAuth2 authentication.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **Gmail Operations**: List labels, search messages, send emails, get message content
|
|
8
|
+
- **Google Drive**: File management, content access, and file creation
|
|
9
|
+
- **Google Calendar**: Event management and calendar operations
|
|
10
|
+
- **Google Docs**: Document creation and content access
|
|
11
|
+
- **Google Sheets**: Spreadsheet operations, data reading and creation
|
|
12
|
+
- **Google Slides**: Presentation management and creation
|
|
13
|
+
- **Google Forms**: Form creation and management
|
|
14
|
+
- **Google Tasks**: Task list and task management
|
|
15
|
+
- **Google Chat**: Space management and messaging
|
|
16
|
+
- **OAuth2 Authentication**: Secure access via Google Access Tokens
|
|
17
|
+
- **Stateless Architecture**: Each request is independent with Bearer token authentication
|
|
18
|
+
- **TypeScript Implementation**: Built with TypeScript for type safety and maintainability
|
|
19
|
+
|
|
20
|
+
## Quick Start
|
|
21
|
+
|
|
22
|
+
### Installation
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
# Install dependencies
|
|
26
|
+
pnpm install
|
|
27
|
+
|
|
28
|
+
# Build the TypeScript project
|
|
29
|
+
pnpm run build
|
|
30
|
+
|
|
31
|
+
# Start the server
|
|
32
|
+
pnpm start
|
|
33
|
+
|
|
34
|
+
# Or run in development mode with auto-reload
|
|
35
|
+
pnpm run dev
|
|
36
|
+
|
|
37
|
+
# Run with debug logging enabled
|
|
38
|
+
pnpm run dev:debug
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### Docker
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
# Build the Docker image
|
|
45
|
+
docker build -t google-workspace-mcp .
|
|
46
|
+
|
|
47
|
+
# Run the container
|
|
48
|
+
docker run -p 30000:30000 google-workspace-mcp
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
The server provides these endpoints:
|
|
52
|
+
- **`POST /mcp`** - Main MCP endpoint for tool execution
|
|
53
|
+
- **`GET /health`** - Health check endpoint
|
|
54
|
+
|
|
55
|
+
### Authentication
|
|
56
|
+
|
|
57
|
+
All requests require a Google Access Token via Authorization header:
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
Authorization: Bearer ya29.your-google-access-token
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
[Set up Google OAuth2](https://developers.google.com/workspace/guides/auth-overview) and obtain access tokens with appropriate scopes.
|
|
64
|
+
|
|
65
|
+
## Tools
|
|
66
|
+
|
|
67
|
+
The server provides 25 tools for comprehensive Google Workspace API access. Each tool requires `Authorization: Bearer <token>` header.
|
|
68
|
+
|
|
69
|
+
### Gmail Tools
|
|
70
|
+
|
|
71
|
+
#### 1. gmail_list_labels
|
|
72
|
+
List all Gmail labels.
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
curl -X POST http://localhost:30000/mcp \
|
|
76
|
+
-H "Content-Type: application/json" \
|
|
77
|
+
-H "Accept: application/json, text/event-stream" \
|
|
78
|
+
-H "Authorization: Bearer ya29.your-google-access-token" \
|
|
79
|
+
-d '{
|
|
80
|
+
"jsonrpc": "2.0",
|
|
81
|
+
"id": "1",
|
|
82
|
+
"method": "tools/call",
|
|
83
|
+
"params": {
|
|
84
|
+
"name": "gmail_list_labels",
|
|
85
|
+
"arguments": {}
|
|
86
|
+
}
|
|
87
|
+
}'
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
#### 2. gmail_search_messages
|
|
91
|
+
Search Gmail messages.
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
curl -X POST http://localhost:30000/mcp \
|
|
95
|
+
-H "Content-Type: application/json" \
|
|
96
|
+
-H "Accept: application/json, text/event-stream" \
|
|
97
|
+
-H "Authorization: Bearer ya29.your-google-access-token" \
|
|
98
|
+
-d '{
|
|
99
|
+
"jsonrpc": "2.0",
|
|
100
|
+
"id": "2",
|
|
101
|
+
"method": "tools/call",
|
|
102
|
+
"params": {
|
|
103
|
+
"name": "gmail_search_messages",
|
|
104
|
+
"arguments": {
|
|
105
|
+
"query": "is:unread from:important@example.com",
|
|
106
|
+
"maxResults": 20
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}'
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
#### 3. gmail_get_message_content
|
|
113
|
+
Get detailed information about a specific Gmail message.
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
curl -X POST http://localhost:30000/mcp \
|
|
117
|
+
-H "Content-Type: application/json" \
|
|
118
|
+
-H "Accept: application/json, text/event-stream" \
|
|
119
|
+
-H "Authorization: Bearer ya29.your-google-access-token" \
|
|
120
|
+
-d '{
|
|
121
|
+
"jsonrpc": "2.0",
|
|
122
|
+
"id": "3",
|
|
123
|
+
"method": "tools/call",
|
|
124
|
+
"params": {
|
|
125
|
+
"name": "gmail_get_message_content",
|
|
126
|
+
"arguments": {
|
|
127
|
+
"messageId": "1234567890abcdef"
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}'
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
#### 4. gmail_send_message
|
|
134
|
+
Send a Gmail message.
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
curl -X POST http://localhost:30000/mcp \
|
|
138
|
+
-H "Content-Type: application/json" \
|
|
139
|
+
-H "Accept: application/json, text/event-stream" \
|
|
140
|
+
-H "Authorization: Bearer ya29.your-google-access-token" \
|
|
141
|
+
-d '{
|
|
142
|
+
"jsonrpc": "2.0",
|
|
143
|
+
"id": "4",
|
|
144
|
+
"method": "tools/call",
|
|
145
|
+
"params": {
|
|
146
|
+
"name": "gmail_send_message",
|
|
147
|
+
"arguments": {
|
|
148
|
+
"to": "recipient@example.com",
|
|
149
|
+
"subject": "Hello from Google Workspace MCP",
|
|
150
|
+
"body": "This email was sent via the MCP server!"
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}'
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
### Google Drive Tools
|
|
157
|
+
|
|
158
|
+
#### 5. drive_list_files
|
|
159
|
+
List Google Drive files.
|
|
160
|
+
|
|
161
|
+
```bash
|
|
162
|
+
curl -X POST http://localhost:30000/mcp \
|
|
163
|
+
-H "Content-Type: application/json" \
|
|
164
|
+
-H "Accept: application/json, text/event-stream" \
|
|
165
|
+
-H "Authorization: Bearer ya29.your-google-access-token" \
|
|
166
|
+
-d '{
|
|
167
|
+
"jsonrpc": "2.0",
|
|
168
|
+
"id": "5",
|
|
169
|
+
"method": "tools/call",
|
|
170
|
+
"params": {
|
|
171
|
+
"name": "drive_list_files",
|
|
172
|
+
"arguments": {
|
|
173
|
+
"query": "project",
|
|
174
|
+
"maxResults": 15
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
}'
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
#### 6. drive_get_file_content
|
|
181
|
+
Get Google Drive file content.
|
|
182
|
+
|
|
183
|
+
```bash
|
|
184
|
+
curl -X POST http://localhost:30000/mcp \
|
|
185
|
+
-H "Content-Type: application/json" \
|
|
186
|
+
-H "Accept: application/json, text/event-stream" \
|
|
187
|
+
-H "Authorization: Bearer ya29.your-google-access-token" \
|
|
188
|
+
-d '{
|
|
189
|
+
"jsonrpc": "2.0",
|
|
190
|
+
"id": "6",
|
|
191
|
+
"method": "tools/call",
|
|
192
|
+
"params": {
|
|
193
|
+
"name": "drive_get_file_content",
|
|
194
|
+
"arguments": {
|
|
195
|
+
"fileId": "1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms"
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
}'
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
#### 7. drive_create_file
|
|
202
|
+
Create a Google Drive file.
|
|
203
|
+
|
|
204
|
+
```bash
|
|
205
|
+
curl -X POST http://localhost:30000/mcp \
|
|
206
|
+
-H "Content-Type: application/json" \
|
|
207
|
+
-H "Accept: application/json, text/event-stream" \
|
|
208
|
+
-H "Authorization: Bearer ya29.your-google-access-token" \
|
|
209
|
+
-d '{
|
|
210
|
+
"jsonrpc": "2.0",
|
|
211
|
+
"id": "7",
|
|
212
|
+
"method": "tools/call",
|
|
213
|
+
"params": {
|
|
214
|
+
"name": "drive_create_file",
|
|
215
|
+
"arguments": {
|
|
216
|
+
"name": "my-document.txt",
|
|
217
|
+
"content": "Hello, this is my new document content!",
|
|
218
|
+
"parentFolderId": "1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms"
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
}'
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
### Google Calendar Tools
|
|
225
|
+
|
|
226
|
+
#### 8. calendar_list_events
|
|
227
|
+
List Google Calendar events.
|
|
228
|
+
|
|
229
|
+
```bash
|
|
230
|
+
curl -X POST http://localhost:30000/mcp \
|
|
231
|
+
-H "Content-Type: application/json" \
|
|
232
|
+
-H "Accept: application/json, text/event-stream" \
|
|
233
|
+
-H "Authorization: Bearer ya29.your-google-access-token" \
|
|
234
|
+
-d '{
|
|
235
|
+
"jsonrpc": "2.0",
|
|
236
|
+
"id": "8",
|
|
237
|
+
"method": "tools/call",
|
|
238
|
+
"params": {
|
|
239
|
+
"name": "calendar_list_events",
|
|
240
|
+
"arguments": {
|
|
241
|
+
"maxResults": 25
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
}'
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
#### 9. calendar_list_calendars
|
|
248
|
+
List Google Calendars.
|
|
249
|
+
|
|
250
|
+
```bash
|
|
251
|
+
curl -X POST http://localhost:30000/mcp \
|
|
252
|
+
-H "Content-Type: application/json" \
|
|
253
|
+
-H "Accept: application/json, text/event-stream" \
|
|
254
|
+
-H "Authorization: Bearer ya29.your-google-access-token" \
|
|
255
|
+
-d '{
|
|
256
|
+
"jsonrpc": "2.0",
|
|
257
|
+
"id": "9",
|
|
258
|
+
"method": "tools/call",
|
|
259
|
+
"params": {
|
|
260
|
+
"name": "calendar_list_calendars",
|
|
261
|
+
"arguments": {}
|
|
262
|
+
}
|
|
263
|
+
}'
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
#### 10. calendar_create_event
|
|
267
|
+
Create a Google Calendar event.
|
|
268
|
+
|
|
269
|
+
```bash
|
|
270
|
+
curl -X POST http://localhost:30000/mcp \
|
|
271
|
+
-H "Content-Type: application/json" \
|
|
272
|
+
-H "Accept: application/json, text/event-stream" \
|
|
273
|
+
-H "Authorization: Bearer ya29.your-google-access-token" \
|
|
274
|
+
-d '{
|
|
275
|
+
"jsonrpc": "2.0",
|
|
276
|
+
"id": "10",
|
|
277
|
+
"method": "tools/call",
|
|
278
|
+
"params": {
|
|
279
|
+
"name": "calendar_create_event",
|
|
280
|
+
"arguments": {
|
|
281
|
+
"summary": "Team Meeting",
|
|
282
|
+
"startTime": "2024-01-15T10:00:00-08:00",
|
|
283
|
+
"endTime": "2024-01-15T11:00:00-08:00"
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
}'
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
### Google Docs Tools
|
|
290
|
+
|
|
291
|
+
#### 11. docs_get_document
|
|
292
|
+
Get Google Docs document.
|
|
293
|
+
|
|
294
|
+
```bash
|
|
295
|
+
curl -X POST http://localhost:30000/mcp \
|
|
296
|
+
-H "Content-Type: application/json" \
|
|
297
|
+
-H "Accept: application/json, text/event-stream" \
|
|
298
|
+
-H "Authorization: Bearer ya29.your-google-access-token" \
|
|
299
|
+
-d '{
|
|
300
|
+
"jsonrpc": "2.0",
|
|
301
|
+
"id": "11",
|
|
302
|
+
"method": "tools/call",
|
|
303
|
+
"params": {
|
|
304
|
+
"name": "docs_get_document",
|
|
305
|
+
"arguments": {
|
|
306
|
+
"documentId": "1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms"
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
}'
|
|
310
|
+
```
|
|
311
|
+
|
|
312
|
+
#### 12. docs_create_document
|
|
313
|
+
Create a Google Docs document.
|
|
314
|
+
|
|
315
|
+
```bash
|
|
316
|
+
curl -X POST http://localhost:30000/mcp \
|
|
317
|
+
-H "Content-Type: application/json" \
|
|
318
|
+
-H "Accept: application/json, text/event-stream" \
|
|
319
|
+
-H "Authorization: Bearer ya29.your-google-access-token" \
|
|
320
|
+
-d '{
|
|
321
|
+
"jsonrpc": "2.0",
|
|
322
|
+
"id": "12",
|
|
323
|
+
"method": "tools/call",
|
|
324
|
+
"params": {
|
|
325
|
+
"name": "docs_create_document",
|
|
326
|
+
"arguments": {
|
|
327
|
+
"title": "My New Document",
|
|
328
|
+
"content": "This is the initial content of my document."
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
}'
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
### Google Sheets Tools
|
|
335
|
+
|
|
336
|
+
#### 13. sheets_get_spreadsheet
|
|
337
|
+
Get Google Sheets spreadsheet.
|
|
338
|
+
|
|
339
|
+
```bash
|
|
340
|
+
curl -X POST http://localhost:30000/mcp \
|
|
341
|
+
-H "Content-Type: application/json" \
|
|
342
|
+
-H "Accept: application/json, text/event-stream" \
|
|
343
|
+
-H "Authorization: Bearer ya29.your-google-access-token" \
|
|
344
|
+
-d '{
|
|
345
|
+
"jsonrpc": "2.0",
|
|
346
|
+
"id": "13",
|
|
347
|
+
"method": "tools/call",
|
|
348
|
+
"params": {
|
|
349
|
+
"name": "sheets_get_spreadsheet",
|
|
350
|
+
"arguments": {
|
|
351
|
+
"spreadsheetId": "1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms"
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
}'
|
|
355
|
+
```
|
|
356
|
+
|
|
357
|
+
#### 14. sheets_read_values
|
|
358
|
+
Read values from Google Sheets.
|
|
359
|
+
|
|
360
|
+
```bash
|
|
361
|
+
curl -X POST http://localhost:30000/mcp \
|
|
362
|
+
-H "Content-Type: application/json" \
|
|
363
|
+
-H "Accept: application/json, text/event-stream" \
|
|
364
|
+
-H "Authorization: Bearer ya29.your-google-access-token" \
|
|
365
|
+
-d '{
|
|
366
|
+
"jsonrpc": "2.0",
|
|
367
|
+
"id": "14",
|
|
368
|
+
"method": "tools/call",
|
|
369
|
+
"params": {
|
|
370
|
+
"name": "sheets_read_values",
|
|
371
|
+
"arguments": {
|
|
372
|
+
"spreadsheetId": "1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms",
|
|
373
|
+
"range": "A1:D10"
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
}'
|
|
377
|
+
```
|
|
378
|
+
|
|
379
|
+
#### 15. sheets_create_spreadsheet
|
|
380
|
+
Create a Google Sheets spreadsheet.
|
|
381
|
+
|
|
382
|
+
```bash
|
|
383
|
+
curl -X POST http://localhost:30000/mcp \
|
|
384
|
+
-H "Content-Type: application/json" \
|
|
385
|
+
-H "Accept: application/json, text/event-stream" \
|
|
386
|
+
-H "Authorization: Bearer ya29.your-google-access-token" \
|
|
387
|
+
-d '{
|
|
388
|
+
"jsonrpc": "2.0",
|
|
389
|
+
"id": "15",
|
|
390
|
+
"method": "tools/call",
|
|
391
|
+
"params": {
|
|
392
|
+
"name": "sheets_create_spreadsheet",
|
|
393
|
+
"arguments": {
|
|
394
|
+
"title": "My New Spreadsheet"
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
}'
|
|
398
|
+
```
|
|
399
|
+
|
|
400
|
+
### Google Slides Tools
|
|
401
|
+
|
|
402
|
+
#### 16. slides_get_presentation
|
|
403
|
+
Get Google Slides presentation.
|
|
404
|
+
|
|
405
|
+
```bash
|
|
406
|
+
curl -X POST http://localhost:30000/mcp \
|
|
407
|
+
-H "Content-Type: application/json" \
|
|
408
|
+
-H "Accept: application/json, text/event-stream" \
|
|
409
|
+
-H "Authorization: Bearer ya29.your-google-access-token" \
|
|
410
|
+
-d '{
|
|
411
|
+
"jsonrpc": "2.0",
|
|
412
|
+
"id": "16",
|
|
413
|
+
"method": "tools/call",
|
|
414
|
+
"params": {
|
|
415
|
+
"name": "slides_get_presentation",
|
|
416
|
+
"arguments": {
|
|
417
|
+
"presentationId": "1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms"
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
}'
|
|
421
|
+
```
|
|
422
|
+
|
|
423
|
+
#### 17. slides_create_presentation
|
|
424
|
+
Create a Google Slides presentation.
|
|
425
|
+
|
|
426
|
+
```bash
|
|
427
|
+
curl -X POST http://localhost:30000/mcp \
|
|
428
|
+
-H "Content-Type: application/json" \
|
|
429
|
+
-H "Accept: application/json, text/event-stream" \
|
|
430
|
+
-H "Authorization: Bearer ya29.your-google-access-token" \
|
|
431
|
+
-d '{
|
|
432
|
+
"jsonrpc": "2.0",
|
|
433
|
+
"id": "17",
|
|
434
|
+
"method": "tools/call",
|
|
435
|
+
"params": {
|
|
436
|
+
"name": "slides_create_presentation",
|
|
437
|
+
"arguments": {
|
|
438
|
+
"title": "My New Presentation"
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
}'
|
|
442
|
+
```
|
|
443
|
+
|
|
444
|
+
### Google Tasks Tools
|
|
445
|
+
|
|
446
|
+
#### 18. tasks_list_task_lists
|
|
447
|
+
List Google Tasks task lists.
|
|
448
|
+
|
|
449
|
+
```bash
|
|
450
|
+
curl -X POST http://localhost:30000/mcp \
|
|
451
|
+
-H "Content-Type: application/json" \
|
|
452
|
+
-H "Accept: application/json, text/event-stream" \
|
|
453
|
+
-H "Authorization: Bearer ya29.your-google-access-token" \
|
|
454
|
+
-d '{
|
|
455
|
+
"jsonrpc": "2.0",
|
|
456
|
+
"id": "18",
|
|
457
|
+
"method": "tools/call",
|
|
458
|
+
"params": {
|
|
459
|
+
"name": "tasks_list_task_lists",
|
|
460
|
+
"arguments": {}
|
|
461
|
+
}
|
|
462
|
+
}'
|
|
463
|
+
```
|
|
464
|
+
|
|
465
|
+
#### 19. tasks_list_tasks
|
|
466
|
+
List tasks from a Google Tasks list.
|
|
467
|
+
|
|
468
|
+
```bash
|
|
469
|
+
curl -X POST http://localhost:30000/mcp \
|
|
470
|
+
-H "Content-Type: application/json" \
|
|
471
|
+
-H "Accept: application/json, text/event-stream" \
|
|
472
|
+
-H "Authorization: Bearer ya29.your-google-access-token" \
|
|
473
|
+
-d '{
|
|
474
|
+
"jsonrpc": "2.0",
|
|
475
|
+
"id": "19",
|
|
476
|
+
"method": "tools/call",
|
|
477
|
+
"params": {
|
|
478
|
+
"name": "tasks_list_tasks",
|
|
479
|
+
"arguments": {
|
|
480
|
+
"taskListId": "@default"
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
}'
|
|
484
|
+
```
|
|
485
|
+
|
|
486
|
+
#### 20. tasks_create_task
|
|
487
|
+
Create a task in Google Tasks.
|
|
488
|
+
|
|
489
|
+
```bash
|
|
490
|
+
curl -X POST http://localhost:30000/mcp \
|
|
491
|
+
-H "Content-Type: application/json" \
|
|
492
|
+
-H "Accept: application/json, text/event-stream" \
|
|
493
|
+
-H "Authorization: Bearer ya29.your-google-access-token" \
|
|
494
|
+
-d '{
|
|
495
|
+
"jsonrpc": "2.0",
|
|
496
|
+
"id": "20",
|
|
497
|
+
"method": "tools/call",
|
|
498
|
+
"params": {
|
|
499
|
+
"name": "tasks_create_task",
|
|
500
|
+
"arguments": {
|
|
501
|
+
"taskListId": "@default",
|
|
502
|
+
"title": "Complete project documentation",
|
|
503
|
+
"notes": "Review and finalize all documentation for the project"
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
}'
|
|
507
|
+
```
|
|
508
|
+
|
|
509
|
+
### Google Forms Tools
|
|
510
|
+
|
|
511
|
+
#### 21. forms_create_form
|
|
512
|
+
Create a Google Form.
|
|
513
|
+
|
|
514
|
+
```bash
|
|
515
|
+
curl -X POST http://localhost:30000/mcp \
|
|
516
|
+
-H "Content-Type: application/json" \
|
|
517
|
+
-H "Accept: application/json, text/event-stream" \
|
|
518
|
+
-H "Authorization: Bearer ya29.your-google-access-token" \
|
|
519
|
+
-d '{
|
|
520
|
+
"jsonrpc": "2.0",
|
|
521
|
+
"id": "21",
|
|
522
|
+
"method": "tools/call",
|
|
523
|
+
"params": {
|
|
524
|
+
"name": "forms_create_form",
|
|
525
|
+
"arguments": {
|
|
526
|
+
"title": "Customer Feedback Survey"
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
}'
|
|
530
|
+
```
|
|
531
|
+
|
|
532
|
+
#### 22. forms_get_form
|
|
533
|
+
Get Google Form information.
|
|
534
|
+
|
|
535
|
+
```bash
|
|
536
|
+
curl -X POST http://localhost:30000/mcp \
|
|
537
|
+
-H "Content-Type: application/json" \
|
|
538
|
+
-H "Accept: application/json, text/event-stream" \
|
|
539
|
+
-H "Authorization: Bearer ya29.your-google-access-token" \
|
|
540
|
+
-d '{
|
|
541
|
+
"jsonrpc": "2.0",
|
|
542
|
+
"id": "22",
|
|
543
|
+
"method": "tools/call",
|
|
544
|
+
"params": {
|
|
545
|
+
"name": "forms_get_form",
|
|
546
|
+
"arguments": {
|
|
547
|
+
"formId": "1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms"
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
}'
|
|
551
|
+
```
|
|
552
|
+
|
|
553
|
+
### Google Chat Tools
|
|
554
|
+
|
|
555
|
+
#### 23. chat_list_spaces
|
|
556
|
+
List Google Chat spaces.
|
|
557
|
+
|
|
558
|
+
```bash
|
|
559
|
+
curl -X POST http://localhost:30000/mcp \
|
|
560
|
+
-H "Content-Type: application/json" \
|
|
561
|
+
-H "Accept: application/json, text/event-stream" \
|
|
562
|
+
-H "Authorization: Bearer ya29.your-google-access-token" \
|
|
563
|
+
-d '{
|
|
564
|
+
"jsonrpc": "2.0",
|
|
565
|
+
"id": "23",
|
|
566
|
+
"method": "tools/call",
|
|
567
|
+
"params": {
|
|
568
|
+
"name": "chat_list_spaces",
|
|
569
|
+
"arguments": {}
|
|
570
|
+
}
|
|
571
|
+
}'
|
|
572
|
+
```
|
|
573
|
+
|
|
574
|
+
#### 24. chat_send_message
|
|
575
|
+
Send a message to Google Chat.
|
|
576
|
+
|
|
577
|
+
```bash
|
|
578
|
+
curl -X POST http://localhost:30000/mcp \
|
|
579
|
+
-H "Content-Type: application/json" \
|
|
580
|
+
-H "Accept: application/json, text/event-stream" \
|
|
581
|
+
-H "Authorization: Bearer ya29.your-google-access-token" \
|
|
582
|
+
-d '{
|
|
583
|
+
"jsonrpc": "2.0",
|
|
584
|
+
"id": "24",
|
|
585
|
+
"method": "tools/call",
|
|
586
|
+
"params": {
|
|
587
|
+
"name": "chat_send_message",
|
|
588
|
+
"arguments": {
|
|
589
|
+
"spaceName": "spaces/AAAAxxxxxxx",
|
|
590
|
+
"text": "Hello from the Google Workspace MCP Server!"
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
}'
|
|
594
|
+
```
|
|
595
|
+
|
|
596
|
+
## List Available Tools
|
|
597
|
+
|
|
598
|
+
Get the complete list of available tools:
|
|
599
|
+
|
|
600
|
+
```bash
|
|
601
|
+
curl -X POST http://localhost:30000/mcp \
|
|
602
|
+
-H "Content-Type: application/json" \
|
|
603
|
+
-H "Accept: application/json, text/event-stream" \
|
|
604
|
+
-H "Authorization: Bearer ya29.your-google-access-token" \
|
|
605
|
+
-d '{
|
|
606
|
+
"jsonrpc": "2.0",
|
|
607
|
+
"id": "tools-list",
|
|
608
|
+
"method": "tools/list",
|
|
609
|
+
"params": {}
|
|
610
|
+
}'
|
|
611
|
+
```
|
|
612
|
+
|
|
613
|
+
## Project Structure
|
|
614
|
+
|
|
615
|
+
```
|
|
616
|
+
google-workspace/
|
|
617
|
+
├── package.json # NPM configuration
|
|
618
|
+
├── tsconfig.json # TypeScript configuration
|
|
619
|
+
├── Dockerfile # Container configuration
|
|
620
|
+
├── tools.json # Tool definitions for MCP
|
|
621
|
+
├── nodemon.json # Dev mode configuration
|
|
622
|
+
├── src/
|
|
623
|
+
│ ├── index.ts # Main server entry point
|
|
624
|
+
│ ├── schemas.ts # Zod schemas for all tools
|
|
625
|
+
│ ├── tool-registry.ts # Tool registration system
|
|
626
|
+
│ ├── tool-loader.ts # Tool definitions loader
|
|
627
|
+
│ ├── debug-middleware.ts # Debug logging
|
|
628
|
+
│ ├── types.ts # TypeScript interfaces
|
|
629
|
+
│ ├── helpers.ts # Utility functions
|
|
630
|
+
│ ├── google-api-client.ts # Google API service factories
|
|
631
|
+
│ └── tools/
|
|
632
|
+
│ ├── index.ts # Tool exports
|
|
633
|
+
│ ├── gmail.ts # Gmail tools
|
|
634
|
+
│ ├── drive.ts # Drive tools
|
|
635
|
+
│ ├── calendar.ts # Calendar tools
|
|
636
|
+
│ ├── docs.ts # Docs tools
|
|
637
|
+
│ ├── sheets.ts # Sheets tools
|
|
638
|
+
│ ├── slides.ts # Slides tools
|
|
639
|
+
│ ├── tasks.ts # Tasks tools
|
|
640
|
+
│ ├── forms.ts # Forms tools
|
|
641
|
+
│ └── chat.ts # Chat tools
|
|
642
|
+
└── dist/ # Compiled JavaScript
|
|
643
|
+
```
|
|
644
|
+
|
|
645
|
+
## Authentication Setup
|
|
646
|
+
|
|
647
|
+
1. **Create Google Cloud Project:**
|
|
648
|
+
- Go to [Google Cloud Console](https://console.cloud.google.com/)
|
|
649
|
+
- Create a new project or select existing
|
|
650
|
+
- Enable required APIs (Gmail, Drive, Calendar, etc.)
|
|
651
|
+
|
|
652
|
+
2. **Set up OAuth2:**
|
|
653
|
+
- Go to "Credentials" → "Create Credentials" → "OAuth 2.0 Client IDs"
|
|
654
|
+
- Configure OAuth consent screen
|
|
655
|
+
- Download client configuration
|
|
656
|
+
|
|
657
|
+
3. **Required Scopes:**
|
|
658
|
+
```
|
|
659
|
+
https://www.googleapis.com/auth/gmail.readonly
|
|
660
|
+
https://www.googleapis.com/auth/gmail.send
|
|
661
|
+
https://www.googleapis.com/auth/drive
|
|
662
|
+
https://www.googleapis.com/auth/calendar
|
|
663
|
+
https://www.googleapis.com/auth/documents
|
|
664
|
+
https://www.googleapis.com/auth/spreadsheets
|
|
665
|
+
https://www.googleapis.com/auth/presentations
|
|
666
|
+
https://www.googleapis.com/auth/tasks
|
|
667
|
+
https://www.googleapis.com/auth/forms.body
|
|
668
|
+
https://www.googleapis.com/auth/chat.spaces
|
|
669
|
+
```
|
|
670
|
+
|
|
671
|
+
4. **Get Access Token:**
|
|
672
|
+
- Use Google OAuth2 flow to obtain access tokens
|
|
673
|
+
- Pass tokens via `Authorization: Bearer` header
|
|
674
|
+
|
|
675
|
+
## Configuration
|
|
676
|
+
|
|
677
|
+
### Environment Variables
|
|
678
|
+
|
|
679
|
+
```bash
|
|
680
|
+
# Server Configuration
|
|
681
|
+
PORT=30000 # Server port (default: 30000)
|
|
682
|
+
DEBUG=true # Enable debug logging
|
|
683
|
+
|
|
684
|
+
# Tool Configuration
|
|
685
|
+
TOOLS_CONFIG_PATH=./tools.json # Custom path to tools.json
|
|
686
|
+
```
|
|
687
|
+
|
|
688
|
+
## Development
|
|
689
|
+
|
|
690
|
+
### Run in Development Mode
|
|
691
|
+
|
|
692
|
+
```bash
|
|
693
|
+
# Auto-reload on file changes
|
|
694
|
+
pnpm run dev
|
|
695
|
+
|
|
696
|
+
# With debug logging enabled
|
|
697
|
+
pnpm run dev:debug
|
|
698
|
+
```
|
|
699
|
+
|
|
700
|
+
### Build for Production
|
|
701
|
+
|
|
702
|
+
```bash
|
|
703
|
+
pnpm run build
|
|
704
|
+
pnpm start
|
|
705
|
+
```
|
|
706
|
+
|
|
707
|
+
## Error Handling
|
|
708
|
+
|
|
709
|
+
The server provides detailed error messages for common issues:
|
|
710
|
+
- **401**: Invalid or expired Google access token
|
|
711
|
+
- **403**: Insufficient permissions or missing scopes
|
|
712
|
+
- **404**: Resource not found (document, file, etc.)
|
|
713
|
+
- **429**: Rate limit exceeded
|
|
714
|
+
- **500**: Internal server errors
|
|
715
|
+
|
|
716
|
+
## License
|
|
717
|
+
|
|
718
|
+
This MCP server is licensed under the MIT License.
|