@alanse/mcp-server-google-workspace 1.0.0 → 1.0.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.
Files changed (155) hide show
  1. package/README.md +146 -17
  2. package/dist/auth.js +5 -0
  3. package/dist/lib/calendar-helpers.js +197 -0
  4. package/dist/lib/drive-helpers.js +263 -0
  5. package/dist/lib/gmail-helpers.js +204 -0
  6. package/dist/tools/calendar/acl/calendar_acl_insert.js +80 -0
  7. package/dist/tools/calendar/acl/calendar_acl_list.js +82 -0
  8. package/dist/tools/calendar/basic/calendar_create_event.js +113 -0
  9. package/dist/tools/calendar/basic/calendar_delete_event.js +52 -0
  10. package/dist/tools/calendar/basic/calendar_get_event.js +52 -0
  11. package/dist/tools/calendar/basic/calendar_list_events.js +86 -0
  12. package/dist/tools/calendar/basic/calendar_update_event.js +116 -0
  13. package/dist/tools/calendar/calendarlist/calendar_calendarlist_get.js +73 -0
  14. package/dist/tools/calendar/calendarlist/calendar_calendarlist_list.js +87 -0
  15. package/dist/tools/calendar/calendars/calendar_calendars_get.js +52 -0
  16. package/dist/tools/calendar/calendars/calendar_calendars_insert.js +66 -0
  17. package/dist/tools/calendar/calendars/calendar_calendars_update.js +85 -0
  18. package/dist/tools/calendar/colors/calendar_colors_get.js +46 -0
  19. package/dist/tools/calendar/events_advanced/calendar_events_instances.js +81 -0
  20. package/dist/tools/calendar/events_advanced/calendar_events_move.js +63 -0
  21. package/dist/tools/calendar/events_advanced/calendar_events_quickadd.js +52 -0
  22. package/dist/tools/calendar/freebusy/calendar_freebusy_query.js +69 -0
  23. package/dist/tools/calendar/settings/calendar_settings_list.js +81 -0
  24. package/dist/tools/drive/advanced/drive_empty_trash.js +56 -0
  25. package/dist/tools/drive/advanced/drive_export_file.js +158 -0
  26. package/dist/tools/drive/advanced/drive_list_revisions.js +80 -0
  27. package/dist/tools/drive/basic/drive_get_metadata.js +49 -0
  28. package/dist/tools/drive/basic/drive_list_files.js +76 -0
  29. package/dist/tools/drive/file/drive_copy_file.js +79 -0
  30. package/dist/tools/drive/file/drive_create_file.js +72 -0
  31. package/dist/tools/drive/file/drive_delete_file.js +48 -0
  32. package/dist/tools/drive/file/drive_move_file.js +79 -0
  33. package/dist/tools/drive/file/drive_rename_file.js +58 -0
  34. package/dist/tools/drive/file/drive_update_file.js +106 -0
  35. package/dist/tools/drive/file/drive_upload_file.js +80 -0
  36. package/dist/tools/drive/folder/drive_create_folder.js +67 -0
  37. package/dist/tools/drive/folder/drive_list_folder_contents.js +68 -0
  38. package/dist/tools/drive/folder/drive_move_to_folder.js +59 -0
  39. package/dist/tools/drive/permissions/drive_list_permissions.js +115 -0
  40. package/dist/tools/drive/permissions/drive_remove_permission.js +71 -0
  41. package/dist/tools/drive/permissions/drive_share_file.js +116 -0
  42. package/dist/tools/drive/permissions/drive_update_permission.js +79 -0
  43. package/dist/tools/gmail/basic/gmail_get_message.js +95 -0
  44. package/dist/tools/gmail/basic/gmail_get_thread.js +46 -0
  45. package/dist/tools/gmail/basic/gmail_list_labels.js +54 -0
  46. package/dist/tools/gmail/basic/gmail_search_messages.js +59 -0
  47. package/dist/tools/gmail/batch/gmail_batch_modify_labels.js +74 -0
  48. package/dist/tools/gmail/batch/gmail_get_messages_batch.js +120 -0
  49. package/dist/tools/gmail/batch/gmail_get_threads_batch.js +102 -0
  50. package/dist/tools/gmail/labels/gmail_manage_label.js +131 -0
  51. package/dist/tools/gmail/labels/gmail_modify_labels.js +65 -0
  52. package/dist/tools/gmail/send/gmail_draft_message.js +117 -0
  53. package/dist/tools/gmail/send/gmail_send_message.js +109 -0
  54. package/dist/tools/index.js +267 -3
  55. package/package.json +8 -3
  56. package/dist/tools/basic/gsheets_add_sheet.js +0 -65
  57. package/dist/tools/basic/gsheets_copy_sheet.js +0 -56
  58. package/dist/tools/basic/gsheets_copy_to.js +0 -113
  59. package/dist/tools/basic/gsheets_create_spreadsheet.js +0 -88
  60. package/dist/tools/basic/gsheets_delete_columns.js +0 -69
  61. package/dist/tools/basic/gsheets_delete_rows.js +0 -69
  62. package/dist/tools/basic/gsheets_delete_sheet.js +0 -56
  63. package/dist/tools/basic/gsheets_duplicate_sheet.js +0 -72
  64. package/dist/tools/basic/gsheets_insert_columns.js +0 -69
  65. package/dist/tools/basic/gsheets_insert_rows.js +0 -69
  66. package/dist/tools/basic/gsheets_list_sheets.js +0 -53
  67. package/dist/tools/basic/gsheets_read.js +0 -120
  68. package/dist/tools/basic/gsheets_rename_sheet.js +0 -64
  69. package/dist/tools/charts/gsheets_add_bubble.js +0 -176
  70. package/dist/tools/charts/gsheets_add_candlestick.js +0 -192
  71. package/dist/tools/charts/gsheets_add_chart.js +0 -162
  72. package/dist/tools/charts/gsheets_add_combo.js +0 -169
  73. package/dist/tools/charts/gsheets_add_histogram.js +0 -143
  74. package/dist/tools/charts/gsheets_add_org_chart.js +0 -160
  75. package/dist/tools/charts/gsheets_add_treemap.js +0 -177
  76. package/dist/tools/charts/gsheets_add_waterfall.js +0 -155
  77. package/dist/tools/charts/gsheets_delete_chart.js +0 -56
  78. package/dist/tools/charts/gsheets_update_chart.js +0 -118
  79. package/dist/tools/data/gsheets_append_data.js +0 -68
  80. package/dist/tools/data/gsheets_batch_clear.js +0 -53
  81. package/dist/tools/data/gsheets_batch_update.js +0 -81
  82. package/dist/tools/data/gsheets_clear_data.js +0 -53
  83. package/dist/tools/data/gsheets_create_filter.js +0 -81
  84. package/dist/tools/data/gsheets_find_replace.js +0 -124
  85. package/dist/tools/data/gsheets_set_data_validation.js +0 -153
  86. package/dist/tools/data/gsheets_sort_range.js +0 -102
  87. package/dist/tools/data/gsheets_update_cell.js +0 -44
  88. package/dist/tools/formatting/gsheets_auto_resize.js +0 -75
  89. package/dist/tools/formatting/gsheets_format_cells.js +0 -161
  90. package/dist/tools/formatting/gsheets_freeze_columns.js +0 -67
  91. package/dist/tools/formatting/gsheets_freeze_rows.js +0 -67
  92. package/dist/tools/formatting/gsheets_merge_cells.js +0 -85
  93. package/dist/tools/formatting/gsheets_set_number_format.js +0 -116
  94. package/dist/tools/formatting/gsheets_unmerge_cells.js +0 -79
  95. package/dist/tools/formatting/gsheets_update_borders.js +0 -212
  96. package/dist/tools/gdrive/gdrive_read_file.js +0 -77
  97. package/dist/tools/gdrive/gdrive_search.js +0 -71
  98. package/dist/tools/gdrive_read_file.js +0 -77
  99. package/dist/tools/gdrive_search.js +0 -71
  100. package/dist/tools/gsheets_add_bubble.js +0 -176
  101. package/dist/tools/gsheets_add_candlestick.js +0 -192
  102. package/dist/tools/gsheets_add_chart.js +0 -162
  103. package/dist/tools/gsheets_add_combo.js +0 -169
  104. package/dist/tools/gsheets_add_conditional_format.js +0 -175
  105. package/dist/tools/gsheets_add_histogram.js +0 -143
  106. package/dist/tools/gsheets_add_named_range.js +0 -87
  107. package/dist/tools/gsheets_add_org_chart.js +0 -160
  108. package/dist/tools/gsheets_add_protected_range.js +0 -127
  109. package/dist/tools/gsheets_add_sheet.js +0 -65
  110. package/dist/tools/gsheets_add_treemap.js +0 -177
  111. package/dist/tools/gsheets_add_waterfall.js +0 -155
  112. package/dist/tools/gsheets_append_data.js +0 -68
  113. package/dist/tools/gsheets_auto_resize.js +0 -75
  114. package/dist/tools/gsheets_batch_clear.js +0 -53
  115. package/dist/tools/gsheets_batch_update.js +0 -81
  116. package/dist/tools/gsheets_clear_data.js +0 -53
  117. package/dist/tools/gsheets_copy_sheet.js +0 -56
  118. package/dist/tools/gsheets_copy_to.js +0 -113
  119. package/dist/tools/gsheets_create_filter.js +0 -81
  120. package/dist/tools/gsheets_create_spreadsheet.js +0 -88
  121. package/dist/tools/gsheets_delete_chart.js +0 -56
  122. package/dist/tools/gsheets_delete_columns.js +0 -69
  123. package/dist/tools/gsheets_delete_named_range.js +0 -56
  124. package/dist/tools/gsheets_delete_protected_range.js +0 -56
  125. package/dist/tools/gsheets_delete_rows.js +0 -69
  126. package/dist/tools/gsheets_delete_sheet.js +0 -56
  127. package/dist/tools/gsheets_duplicate_sheet.js +0 -72
  128. package/dist/tools/gsheets_find_replace.js +0 -124
  129. package/dist/tools/gsheets_format_cells.js +0 -161
  130. package/dist/tools/gsheets_freeze_columns.js +0 -67
  131. package/dist/tools/gsheets_freeze_rows.js +0 -67
  132. package/dist/tools/gsheets_insert_columns.js +0 -69
  133. package/dist/tools/gsheets_insert_rows.js +0 -69
  134. package/dist/tools/gsheets_list_sheets.js +0 -53
  135. package/dist/tools/gsheets_merge_cells.js +0 -85
  136. package/dist/tools/gsheets_read.js +0 -120
  137. package/dist/tools/gsheets_rename_sheet.js +0 -64
  138. package/dist/tools/gsheets_set_data_validation.js +0 -153
  139. package/dist/tools/gsheets_set_number_format.js +0 -116
  140. package/dist/tools/gsheets_sort_range.js +0 -102
  141. package/dist/tools/gsheets_unmerge_cells.js +0 -79
  142. package/dist/tools/gsheets_update_borders.js +0 -212
  143. package/dist/tools/gsheets_update_cell.js +0 -44
  144. package/dist/tools/gsheets_update_chart.js +0 -118
  145. package/dist/tools/gsheets_update_named_range.js +0 -112
  146. package/dist/tools/gsheets_update_protected_range.js +0 -110
  147. package/dist/tools/protection/gsheets_add_conditional_format.js +0 -175
  148. package/dist/tools/protection/gsheets_add_named_range.js +0 -87
  149. package/dist/tools/protection/gsheets_add_protected_range.js +0 -127
  150. package/dist/tools/protection/gsheets_delete_named_range.js +0 -56
  151. package/dist/tools/protection/gsheets_delete_protected_range.js +0 -56
  152. package/dist/tools/protection/gsheets_update_named_range.js +0 -112
  153. package/dist/tools/protection/gsheets_update_protected_range.js +0 -110
  154. /package/dist/tools/drive/{drive_read_file.js → basic/drive_read_file.js} +0 -0
  155. /package/dist/tools/drive/{drive_search.js → basic/drive_search.js} +0 -0
@@ -0,0 +1,109 @@
1
+ import { google } from "googleapis";
2
+ import { ResponseFormatter } from "../../../lib/response-formatter.js";
3
+ import { prepareGmailMessage, generateGmailWebUrl, } from "../../../lib/gmail-helpers.js";
4
+ export const schema = {
5
+ name: "gmail_send_message",
6
+ description: "Send an email message via Gmail. Supports plain text or HTML body, CC/BCC recipients, and threading (replies). The message will be sent immediately.",
7
+ inputSchema: {
8
+ type: "object",
9
+ properties: {
10
+ to: {
11
+ type: "string",
12
+ description: "Recipient email address(es). Multiple addresses can be comma-separated.",
13
+ },
14
+ subject: {
15
+ type: "string",
16
+ description: "Email subject line",
17
+ },
18
+ body: {
19
+ type: "string",
20
+ description: "Email body content (plain text or HTML)",
21
+ },
22
+ bodyFormat: {
23
+ type: "string",
24
+ enum: ["plain", "html"],
25
+ description: "Body format type (default: plain)",
26
+ optional: true,
27
+ },
28
+ cc: {
29
+ type: "string",
30
+ description: "CC recipient(s). Multiple addresses can be comma-separated.",
31
+ optional: true,
32
+ },
33
+ bcc: {
34
+ type: "string",
35
+ description: "BCC recipient(s). Multiple addresses can be comma-separated.",
36
+ optional: true,
37
+ },
38
+ threadId: {
39
+ type: "string",
40
+ description: "Thread ID to reply to (makes this a reply in an existing conversation)",
41
+ optional: true,
42
+ },
43
+ inReplyTo: {
44
+ type: "string",
45
+ description: "Message-ID header of the message being replied to (for threading)",
46
+ optional: true,
47
+ },
48
+ references: {
49
+ type: "string",
50
+ description: "References header for email threading (space-separated Message-IDs)",
51
+ optional: true,
52
+ },
53
+ },
54
+ required: ["to", "subject", "body"],
55
+ },
56
+ };
57
+ export async function sendMessage(args) {
58
+ try {
59
+ const gmail = google.gmail("v1");
60
+ const { to, subject, body, bodyFormat = "plain", cc, bcc, threadId, inReplyTo, references, } = args;
61
+ // Prepare base64url encoded MIME message
62
+ const encodedMessage = prepareGmailMessage({
63
+ to,
64
+ subject,
65
+ body,
66
+ bodyFormat,
67
+ cc,
68
+ bcc,
69
+ inReplyTo,
70
+ references,
71
+ });
72
+ // Send the message
73
+ const response = await gmail.users.messages.send({
74
+ userId: "me",
75
+ requestBody: {
76
+ raw: encodedMessage,
77
+ threadId: threadId || undefined,
78
+ },
79
+ });
80
+ const sentMessage = response.data;
81
+ const messageId = sentMessage.id || "";
82
+ const sentThreadId = sentMessage.threadId || "";
83
+ let output = `✅ Message sent successfully!\n\n`;
84
+ output += `Message ID: ${messageId}\n`;
85
+ output += `Thread ID: ${sentThreadId}\n`;
86
+ output += `Web URL: ${generateGmailWebUrl(messageId)}\n\n`;
87
+ output += `📧 Details:\n`;
88
+ output += ` To: ${to}\n`;
89
+ if (cc)
90
+ output += ` CC: ${cc}\n`;
91
+ if (bcc)
92
+ output += ` BCC: ${bcc}\n`;
93
+ output += ` Subject: ${subject}\n`;
94
+ output += ` Format: ${bodyFormat}\n`;
95
+ if (threadId)
96
+ output += ` Reply to thread: ${threadId}\n`;
97
+ return ResponseFormatter.success({
98
+ messageId,
99
+ threadId: sentThreadId,
100
+ labelIds: sentMessage.labelIds || [],
101
+ to,
102
+ subject,
103
+ bodyFormat,
104
+ }, output);
105
+ }
106
+ catch (error) {
107
+ return ResponseFormatter.error(error);
108
+ }
109
+ }
@@ -1,6 +1,29 @@
1
- // Drive operations
2
- import { schema as driveSearchSchema, search } from './drive/drive_search.js';
3
- import { schema as driveReadFileSchema, readFile } from './drive/drive_read_file.js';
1
+ // Drive - Basic operations
2
+ import { schema as driveSearchSchema, search } from './drive/basic/drive_search.js';
3
+ import { schema as driveReadFileSchema, readFile } from './drive/basic/drive_read_file.js';
4
+ import { schema as driveListFilesSchema, listFiles } from './drive/basic/drive_list_files.js';
5
+ import { schema as driveGetMetadataSchema, getMetadata as driveGetMetadata } from './drive/basic/drive_get_metadata.js';
6
+ // Drive - File operations
7
+ import { schema as driveUploadFileSchema, uploadFile } from './drive/file/drive_upload_file.js';
8
+ import { schema as driveCreateFileSchema, createFile } from './drive/file/drive_create_file.js';
9
+ import { schema as driveDeleteFileSchema, deleteFile } from './drive/file/drive_delete_file.js';
10
+ import { schema as driveCopyFileSchema, copyFile } from './drive/file/drive_copy_file.js';
11
+ import { schema as driveMoveFileSchema, moveFile } from './drive/file/drive_move_file.js';
12
+ import { schema as driveRenameFileSchema, renameFile } from './drive/file/drive_rename_file.js';
13
+ import { schema as driveUpdateFileSchema, updateFile } from './drive/file/drive_update_file.js';
14
+ // Drive - Folder operations
15
+ import { schema as driveCreateFolderSchema, createFolder } from './drive/folder/drive_create_folder.js';
16
+ import { schema as driveListFolderContentsSchema, listFolderContents } from './drive/folder/drive_list_folder_contents.js';
17
+ import { schema as driveMoveToFolderSchema, moveToFolder } from './drive/folder/drive_move_to_folder.js';
18
+ // Drive - Permissions operations
19
+ import { schema as driveShareFileSchema, shareFile } from './drive/permissions/drive_share_file.js';
20
+ import { schema as driveListPermissionsSchema, listPermissions } from './drive/permissions/drive_list_permissions.js';
21
+ import { schema as driveUpdatePermissionSchema, updatePermission } from './drive/permissions/drive_update_permission.js';
22
+ import { schema as driveRemovePermissionSchema, removePermission } from './drive/permissions/drive_remove_permission.js';
23
+ // Drive - Advanced operations
24
+ import { schema as driveExportFileSchema, exportFile } from './drive/advanced/drive_export_file.js';
25
+ import { schema as driveListRevisionsSchema, listRevisions } from './drive/advanced/drive_list_revisions.js';
26
+ import { schema as driveEmptyTrashSchema, emptyTrash } from './drive/advanced/drive_empty_trash.js';
4
27
  // Basic operations
5
28
  import { schema as gsheetsReadSchema, readSheet } from './sheets/basic/gsheets_read.js';
6
29
  import { schema as gsheetsListSheetsSchema, listSheets } from './sheets/basic/gsheets_list_sheets.js';
@@ -88,7 +111,49 @@ import { schema as gdocsBatchUpdateSchema, batchUpdate as gdocsBatchUpdate } fro
88
111
  import { schema as gdocsMergeDocumentsSchema, mergeDocuments } from './docs/elements/gdocs_merge_documents.js';
89
112
  import { schema as gdocsExportSchema, exportDocument } from './docs/elements/gdocs_export.js';
90
113
  import { schema as gdocsSuggestModeSchema, suggestMode } from './docs/elements/gdocs_suggest_mode.js';
114
+ // Gmail - Basic operations
115
+ import { schema as gmailListLabelsSchema, listLabels } from './gmail/basic/gmail_list_labels.js';
116
+ import { schema as gmailSearchMessagesSchema, searchMessages } from './gmail/basic/gmail_search_messages.js';
117
+ import { schema as gmailGetMessageSchema, getMessage } from './gmail/basic/gmail_get_message.js';
118
+ import { schema as gmailGetThreadSchema, getThread } from './gmail/basic/gmail_get_thread.js';
119
+ // Gmail - Labels operations
120
+ import { schema as gmailModifyLabelsSchema, modifyLabels } from './gmail/labels/gmail_modify_labels.js';
121
+ import { schema as gmailManageLabelSchema, manageLabel } from './gmail/labels/gmail_manage_label.js';
122
+ // Gmail - Send operations
123
+ import { schema as gmailSendMessageSchema, sendMessage } from './gmail/send/gmail_send_message.js';
124
+ import { schema as gmailDraftMessageSchema, draftMessage } from './gmail/send/gmail_draft_message.js';
125
+ // Gmail - Batch operations
126
+ import { schema as gmailGetMessagesBatchSchema, getMessagesBatch } from './gmail/batch/gmail_get_messages_batch.js';
127
+ import { schema as gmailGetThreadsBatchSchema, getThreadsBatch } from './gmail/batch/gmail_get_threads_batch.js';
128
+ import { schema as gmailBatchModifyLabelsSchema, batchModifyLabels } from './gmail/batch/gmail_batch_modify_labels.js';
129
+ // Calendar - Basic operations
130
+ import { schema as calendarListEventsSchema, listEvents } from './calendar/basic/calendar_list_events.js';
131
+ import { schema as calendarGetEventSchema, getEvent } from './calendar/basic/calendar_get_event.js';
132
+ import { schema as calendarCreateEventSchema, createEvent } from './calendar/basic/calendar_create_event.js';
133
+ import { schema as calendarUpdateEventSchema, updateEvent } from './calendar/basic/calendar_update_event.js';
134
+ import { schema as calendarDeleteEventSchema, deleteEvent } from './calendar/basic/calendar_delete_event.js';
135
+ // Calendar - Free/busy operations
136
+ import { schema as calendarFreeBusyQuerySchema, queryFreeBusy } from './calendar/freebusy/calendar_freebusy_query.js';
137
+ // Calendar - CalendarList operations
138
+ import { schema as calendarListListSchema, listCalendarList } from './calendar/calendarlist/calendar_calendarlist_list.js';
139
+ import { schema as calendarListGetSchema, getCalendarListEntry } from './calendar/calendarlist/calendar_calendarlist_get.js';
140
+ // Calendar - Events advanced operations
141
+ import { schema as calendarEventsQuickAddSchema, quickAddEvent } from './calendar/events_advanced/calendar_events_quickadd.js';
142
+ import { schema as calendarEventsInstancesSchema, listEventInstances } from './calendar/events_advanced/calendar_events_instances.js';
143
+ import { schema as calendarEventsMoveSchema, moveEvent } from './calendar/events_advanced/calendar_events_move.js';
144
+ // Calendar - Colors operations
145
+ import { schema as calendarColorsGetSchema, getColors } from './calendar/colors/calendar_colors_get.js';
146
+ // Calendar - Calendars operations
147
+ import { schema as calendarCalendarsInsertSchema, insertCalendar } from './calendar/calendars/calendar_calendars_insert.js';
148
+ import { schema as calendarCalendarsGetSchema, getCalendar } from './calendar/calendars/calendar_calendars_get.js';
149
+ import { schema as calendarCalendarsUpdateSchema, updateCalendar } from './calendar/calendars/calendar_calendars_update.js';
150
+ // Calendar - ACL operations
151
+ import { schema as calendarAclListSchema, listAcl } from './calendar/acl/calendar_acl_list.js';
152
+ import { schema as calendarAclInsertSchema, insertAcl } from './calendar/acl/calendar_acl_insert.js';
153
+ // Calendar - Settings operations
154
+ import { schema as calendarSettingsListSchema, listSettings } from './calendar/settings/calendar_settings_list.js';
91
155
  export const tools = [
156
+ // Drive - Basic operations
92
157
  {
93
158
  ...driveSearchSchema,
94
159
  handler: search,
@@ -97,6 +162,87 @@ export const tools = [
97
162
  ...driveReadFileSchema,
98
163
  handler: readFile,
99
164
  },
165
+ {
166
+ ...driveListFilesSchema,
167
+ handler: listFiles,
168
+ },
169
+ {
170
+ ...driveGetMetadataSchema,
171
+ handler: driveGetMetadata,
172
+ },
173
+ // Drive - File operations
174
+ {
175
+ ...driveUploadFileSchema,
176
+ handler: uploadFile,
177
+ },
178
+ {
179
+ ...driveCreateFileSchema,
180
+ handler: createFile,
181
+ },
182
+ {
183
+ ...driveDeleteFileSchema,
184
+ handler: deleteFile,
185
+ },
186
+ {
187
+ ...driveCopyFileSchema,
188
+ handler: copyFile,
189
+ },
190
+ {
191
+ ...driveMoveFileSchema,
192
+ handler: moveFile,
193
+ },
194
+ {
195
+ ...driveRenameFileSchema,
196
+ handler: renameFile,
197
+ },
198
+ {
199
+ ...driveUpdateFileSchema,
200
+ handler: updateFile,
201
+ },
202
+ // Drive - Folder operations
203
+ {
204
+ ...driveCreateFolderSchema,
205
+ handler: createFolder,
206
+ },
207
+ {
208
+ ...driveListFolderContentsSchema,
209
+ handler: listFolderContents,
210
+ },
211
+ {
212
+ ...driveMoveToFolderSchema,
213
+ handler: moveToFolder,
214
+ },
215
+ // Drive - Permissions operations
216
+ {
217
+ ...driveShareFileSchema,
218
+ handler: shareFile,
219
+ },
220
+ {
221
+ ...driveListPermissionsSchema,
222
+ handler: listPermissions,
223
+ },
224
+ {
225
+ ...driveUpdatePermissionSchema,
226
+ handler: updatePermission,
227
+ },
228
+ {
229
+ ...driveRemovePermissionSchema,
230
+ handler: removePermission,
231
+ },
232
+ // Drive - Advanced operations
233
+ {
234
+ ...driveExportFileSchema,
235
+ handler: exportFile,
236
+ },
237
+ {
238
+ ...driveListRevisionsSchema,
239
+ handler: listRevisions,
240
+ },
241
+ {
242
+ ...driveEmptyTrashSchema,
243
+ handler: emptyTrash,
244
+ },
245
+ // Google Sheets - Basic operations
100
246
  {
101
247
  ...gsheetsUpdateCellSchema,
102
248
  handler: updateCell,
@@ -409,5 +555,123 @@ export const tools = [
409
555
  {
410
556
  ...gdocsSuggestModeSchema,
411
557
  handler: suggestMode,
558
+ },
559
+ // Gmail tools
560
+ {
561
+ ...gmailListLabelsSchema,
562
+ handler: listLabels,
563
+ },
564
+ {
565
+ ...gmailSearchMessagesSchema,
566
+ handler: searchMessages,
567
+ },
568
+ {
569
+ ...gmailGetMessageSchema,
570
+ handler: getMessage,
571
+ },
572
+ {
573
+ ...gmailGetThreadSchema,
574
+ handler: getThread,
575
+ },
576
+ {
577
+ ...gmailModifyLabelsSchema,
578
+ handler: modifyLabels,
579
+ },
580
+ {
581
+ ...gmailManageLabelSchema,
582
+ handler: manageLabel,
583
+ },
584
+ {
585
+ ...gmailSendMessageSchema,
586
+ handler: sendMessage,
587
+ },
588
+ {
589
+ ...gmailDraftMessageSchema,
590
+ handler: draftMessage,
591
+ },
592
+ {
593
+ ...gmailGetMessagesBatchSchema,
594
+ handler: getMessagesBatch,
595
+ },
596
+ {
597
+ ...gmailGetThreadsBatchSchema,
598
+ handler: getThreadsBatch,
599
+ },
600
+ {
601
+ ...gmailBatchModifyLabelsSchema,
602
+ handler: batchModifyLabels,
603
+ },
604
+ // Calendar tools
605
+ {
606
+ ...calendarListEventsSchema,
607
+ handler: listEvents,
608
+ },
609
+ {
610
+ ...calendarGetEventSchema,
611
+ handler: getEvent,
612
+ },
613
+ {
614
+ ...calendarCreateEventSchema,
615
+ handler: createEvent,
616
+ },
617
+ {
618
+ ...calendarUpdateEventSchema,
619
+ handler: updateEvent,
620
+ },
621
+ {
622
+ ...calendarDeleteEventSchema,
623
+ handler: deleteEvent,
624
+ },
625
+ {
626
+ ...calendarFreeBusyQuerySchema,
627
+ handler: queryFreeBusy,
628
+ },
629
+ {
630
+ ...calendarListListSchema,
631
+ handler: listCalendarList,
632
+ },
633
+ {
634
+ ...calendarListGetSchema,
635
+ handler: getCalendarListEntry,
636
+ },
637
+ {
638
+ ...calendarEventsQuickAddSchema,
639
+ handler: quickAddEvent,
640
+ },
641
+ {
642
+ ...calendarEventsInstancesSchema,
643
+ handler: listEventInstances,
644
+ },
645
+ {
646
+ ...calendarEventsMoveSchema,
647
+ handler: moveEvent,
648
+ },
649
+ {
650
+ ...calendarColorsGetSchema,
651
+ handler: getColors,
652
+ },
653
+ {
654
+ ...calendarCalendarsInsertSchema,
655
+ handler: insertCalendar,
656
+ },
657
+ {
658
+ ...calendarCalendarsGetSchema,
659
+ handler: getCalendar,
660
+ },
661
+ {
662
+ ...calendarCalendarsUpdateSchema,
663
+ handler: updateCalendar,
664
+ },
665
+ {
666
+ ...calendarAclListSchema,
667
+ handler: listAcl,
668
+ },
669
+ {
670
+ ...calendarAclInsertSchema,
671
+ handler: insertAcl,
672
+ },
673
+ {
674
+ ...calendarSettingsListSchema,
675
+ handler: listSettings,
412
676
  }
413
677
  ];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alanse/mcp-server-google-workspace",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "The most comprehensive MCP server for Google Workspace - Complete integration for Sheets (57 tools), Drive, and future Docs, Calendar, Forms support",
5
5
  "license": "Elastic-2.0",
6
6
  "author": "Alanse inc",
@@ -39,16 +39,21 @@
39
39
  "test": "vitest run",
40
40
  "test:watch": "vitest",
41
41
  "test:ui": "vitest --ui",
42
- "test:coverage": "vitest run --coverage"
42
+ "test:coverage": "vitest run --coverage",
43
+ "inspect": "npx @modelcontextprotocol/inspector node dist/index.js"
43
44
  },
44
45
  "dependencies": {
45
46
  "@google-cloud/local-auth": "^3.0.1",
46
47
  "@modelcontextprotocol/sdk": "0.5.0",
47
48
  "dotenv": "^16.5.0",
48
- "googleapis": "^144.0.0"
49
+ "googleapis": "^144.0.0",
50
+ "nodemailer": "^6.9.16",
51
+ "html-to-text": "^9.0.5"
49
52
  },
50
53
  "devDependencies": {
51
54
  "@types/node": "^22.9.3",
55
+ "@types/nodemailer": "^6.4.17",
56
+ "@types/html-to-text": "^9.0.4",
52
57
  "@vitest/ui": "^4.0.16",
53
58
  "shx": "^0.3.4",
54
59
  "typescript": "^5.6.2",
@@ -1,65 +0,0 @@
1
- import { google } from "googleapis";
2
- export const schema = {
3
- name: "gsheets_add_sheet",
4
- description: "Add a new sheet (tab) to a Google Spreadsheet",
5
- inputSchema: {
6
- type: "object",
7
- properties: {
8
- spreadsheetId: {
9
- type: "string",
10
- description: "The ID of the spreadsheet",
11
- },
12
- title: {
13
- type: "string",
14
- description: "The name of the new sheet",
15
- },
16
- index: {
17
- type: "number",
18
- description: "Optional position index (0-based) where the sheet should be inserted",
19
- },
20
- },
21
- required: ["spreadsheetId", "title"],
22
- },
23
- };
24
- export async function addSheet(args) {
25
- try {
26
- const sheets = google.sheets("v4");
27
- const request = {
28
- addSheet: {
29
- properties: {
30
- title: args.title,
31
- },
32
- },
33
- };
34
- if (args.index !== undefined) {
35
- request.addSheet.properties.index = args.index;
36
- }
37
- const response = await sheets.spreadsheets.batchUpdate({
38
- spreadsheetId: args.spreadsheetId,
39
- requestBody: {
40
- requests: [request],
41
- },
42
- });
43
- const addedSheet = response.data.replies?.[0]?.addSheet?.properties;
44
- return {
45
- content: [
46
- {
47
- type: "text",
48
- text: `Successfully added sheet "${addedSheet?.title}" (ID: ${addedSheet?.sheetId}, Index: ${addedSheet?.index})`,
49
- },
50
- ],
51
- isError: false,
52
- };
53
- }
54
- catch (error) {
55
- return {
56
- content: [
57
- {
58
- type: "text",
59
- text: `Error adding sheet: ${error.message}`,
60
- },
61
- ],
62
- isError: true,
63
- };
64
- }
65
- }
@@ -1,56 +0,0 @@
1
- import { google } from "googleapis";
2
- export const schema = {
3
- name: "gsheets_copy_sheet",
4
- description: "Copy a sheet to another spreadsheet or within the same spreadsheet",
5
- inputSchema: {
6
- type: "object",
7
- properties: {
8
- sourceSpreadsheetId: {
9
- type: "string",
10
- description: "The ID of the source spreadsheet",
11
- },
12
- sourceSheetId: {
13
- type: "number",
14
- description: "The ID of the sheet to copy",
15
- },
16
- destinationSpreadsheetId: {
17
- type: "string",
18
- description: "The ID of the destination spreadsheet",
19
- },
20
- },
21
- required: ["sourceSpreadsheetId", "sourceSheetId", "destinationSpreadsheetId"],
22
- },
23
- };
24
- export async function copySheet(args) {
25
- const sheets = google.sheets("v4");
26
- try {
27
- const response = await sheets.spreadsheets.sheets.copyTo({
28
- spreadsheetId: args.sourceSpreadsheetId,
29
- sheetId: args.sourceSheetId,
30
- requestBody: {
31
- destinationSpreadsheetId: args.destinationSpreadsheetId,
32
- },
33
- });
34
- const copiedSheet = response.data;
35
- return {
36
- content: [
37
- {
38
- type: "text",
39
- text: `Successfully copied sheet to destination. New sheet ID: ${copiedSheet.sheetId}, Title: "${copiedSheet.title}"`,
40
- },
41
- ],
42
- isError: false,
43
- };
44
- }
45
- catch (error) {
46
- return {
47
- content: [
48
- {
49
- type: "text",
50
- text: `Error copying sheet: ${error.message}`,
51
- },
52
- ],
53
- isError: true,
54
- };
55
- }
56
- }
@@ -1,113 +0,0 @@
1
- import { google } from "googleapis";
2
- export const schema = {
3
- name: "gsheets_copy_to",
4
- description: "Copy data from one range to another range using cut/paste",
5
- inputSchema: {
6
- type: "object",
7
- properties: {
8
- spreadsheetId: {
9
- type: "string",
10
- description: "The ID of the spreadsheet",
11
- },
12
- sourceSheetId: {
13
- type: "number",
14
- description: "The ID of the source sheet",
15
- },
16
- sourceStartRow: {
17
- type: "number",
18
- description: "Source starting row index (0-based)",
19
- },
20
- sourceStartColumn: {
21
- type: "number",
22
- description: "Source starting column index (0-based)",
23
- },
24
- sourceEndRow: {
25
- type: "number",
26
- description: "Source ending row index (exclusive, 0-based)",
27
- },
28
- sourceEndColumn: {
29
- type: "number",
30
- description: "Source ending column index (exclusive, 0-based)",
31
- },
32
- destinationSheetId: {
33
- type: "number",
34
- description: "The ID of the destination sheet",
35
- },
36
- destinationStartRow: {
37
- type: "number",
38
- description: "Destination starting row index (0-based)",
39
- },
40
- destinationStartColumn: {
41
- type: "number",
42
- description: "Destination starting column index (0-based)",
43
- },
44
- pasteType: {
45
- type: "string",
46
- enum: ["NORMAL", "VALUES", "FORMAT", "FORMULA"],
47
- description: "What to paste (default: NORMAL - all data)",
48
- },
49
- },
50
- required: [
51
- "spreadsheetId",
52
- "sourceSheetId",
53
- "sourceStartRow",
54
- "sourceStartColumn",
55
- "sourceEndRow",
56
- "sourceEndColumn",
57
- "destinationSheetId",
58
- "destinationStartRow",
59
- "destinationStartColumn",
60
- ],
61
- },
62
- };
63
- export async function copyTo(args) {
64
- const sheets = google.sheets("v4");
65
- try {
66
- await sheets.spreadsheets.batchUpdate({
67
- spreadsheetId: args.spreadsheetId,
68
- requestBody: {
69
- requests: [
70
- {
71
- copyPaste: {
72
- source: {
73
- sheetId: args.sourceSheetId,
74
- startRowIndex: args.sourceStartRow,
75
- endRowIndex: args.sourceEndRow,
76
- startColumnIndex: args.sourceStartColumn,
77
- endColumnIndex: args.sourceEndColumn,
78
- },
79
- destination: {
80
- sheetId: args.destinationSheetId,
81
- startRowIndex: args.destinationStartRow,
82
- startColumnIndex: args.destinationStartColumn,
83
- },
84
- pasteType: args.pasteType || "NORMAL",
85
- },
86
- },
87
- ],
88
- },
89
- });
90
- const sourceRange = `R${args.sourceStartRow}C${args.sourceStartColumn}:R${args.sourceEndRow - 1}C${args.sourceEndColumn - 1}`;
91
- const destRange = `R${args.destinationStartRow}C${args.destinationStartColumn}`;
92
- return {
93
- content: [
94
- {
95
- type: "text",
96
- text: `Successfully copied data from sheet ${args.sourceSheetId} (${sourceRange}) to sheet ${args.destinationSheetId} (${destRange})`,
97
- },
98
- ],
99
- isError: false,
100
- };
101
- }
102
- catch (error) {
103
- return {
104
- content: [
105
- {
106
- type: "text",
107
- text: `Error copying data: ${error.message}`,
108
- },
109
- ],
110
- isError: true,
111
- };
112
- }
113
- }