@vineethnkrishnan/google-workspace-mcp 0.1.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/build/common/types.d.ts +77 -0
- package/build/common/types.js +3 -0
- package/build/common/types.js.map +1 -0
- package/build/common/utils.d.ts +38 -0
- package/build/common/utils.js +165 -0
- package/build/common/utils.js.map +1 -0
- package/build/index.d.ts +2 -0
- package/build/index.js +111 -0
- package/build/index.js.map +1 -0
- package/build/services/auth.service.d.ts +6 -0
- package/build/services/auth.service.js +20 -0
- package/build/services/auth.service.js.map +1 -0
- package/build/services/calendar.service.d.ts +10 -0
- package/build/services/calendar.service.js +81 -0
- package/build/services/calendar.service.js.map +1 -0
- package/build/services/drive.service.d.ts +10 -0
- package/build/services/drive.service.js +67 -0
- package/build/services/drive.service.js.map +1 -0
- package/build/services/gmail.service.d.ts +10 -0
- package/build/services/gmail.service.js +87 -0
- package/build/services/gmail.service.js.map +1 -0
- package/build/services/sheets.service.d.ts +10 -0
- package/build/services/sheets.service.js +83 -0
- package/build/services/sheets.service.js.map +1 -0
- package/build/tools/calendar.tools.d.ts +31 -0
- package/build/tools/calendar.tools.js +62 -0
- package/build/tools/calendar.tools.js.map +1 -0
- package/build/tools/drive.tools.d.ts +31 -0
- package/build/tools/drive.tools.js +60 -0
- package/build/tools/drive.tools.js.map +1 -0
- package/build/tools/gmail.tools.d.ts +31 -0
- package/build/tools/gmail.tools.js +60 -0
- package/build/tools/gmail.tools.js.map +1 -0
- package/build/tools/sheets.tools.d.ts +30 -0
- package/build/tools/sheets.tools.js +46 -0
- package/build/tools/sheets.tools.js.map +1 -0
- package/package.json +47 -0
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GmailService = void 0;
|
|
4
|
+
const utils_1 = require("../common/utils");
|
|
5
|
+
class GmailService {
|
|
6
|
+
auth;
|
|
7
|
+
baseUrl = "https://gmail.googleapis.com/gmail/v1/users/me";
|
|
8
|
+
constructor(auth) {
|
|
9
|
+
this.auth = auth;
|
|
10
|
+
}
|
|
11
|
+
async request(path, params) {
|
|
12
|
+
const token = await this.auth.getAccessToken();
|
|
13
|
+
const url = new URL(`${this.baseUrl}${path}`);
|
|
14
|
+
if (params) {
|
|
15
|
+
for (const [key, value] of Object.entries(params)) {
|
|
16
|
+
if (value !== undefined && value !== null && value !== "") {
|
|
17
|
+
url.searchParams.set(key, String(value));
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
const response = await fetch(url.toString(), {
|
|
22
|
+
headers: {
|
|
23
|
+
Authorization: `Bearer ${token}`,
|
|
24
|
+
"Content-Type": "application/json",
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
if (!response.ok) {
|
|
28
|
+
const errorBody = await response.text().catch(() => "");
|
|
29
|
+
switch (response.status) {
|
|
30
|
+
case 401:
|
|
31
|
+
throw new Error("Gmail authentication failed. Your access token may be expired.");
|
|
32
|
+
case 403:
|
|
33
|
+
throw new Error("Gmail access denied. Token may lack the gmail.readonly scope.");
|
|
34
|
+
case 404:
|
|
35
|
+
throw new Error("Gmail resource not found. Check the message ID.");
|
|
36
|
+
case 429:
|
|
37
|
+
throw new Error("Gmail API rate limit exceeded. Try again later.");
|
|
38
|
+
default:
|
|
39
|
+
throw new Error(`Gmail API error (${response.status}): ${errorBody || response.statusText}`);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return response.json();
|
|
43
|
+
}
|
|
44
|
+
async listMessages(query, maxResults = 10) {
|
|
45
|
+
const params = { maxResults };
|
|
46
|
+
if (query)
|
|
47
|
+
params.q = query;
|
|
48
|
+
const data = await this.request("/messages", params);
|
|
49
|
+
if (!data.messages || data.messages.length === 0) {
|
|
50
|
+
return { messages: [], resultSizeEstimate: 0 };
|
|
51
|
+
}
|
|
52
|
+
// Fetch snippet for each message via minimal format
|
|
53
|
+
const messages = await Promise.all(data.messages.map(async (msg) => {
|
|
54
|
+
const detail = await this.request(`/messages/${msg.id}`, {
|
|
55
|
+
format: "metadata",
|
|
56
|
+
metadataHeaders: "From,To,Subject,Date",
|
|
57
|
+
});
|
|
58
|
+
return {
|
|
59
|
+
id: detail.id,
|
|
60
|
+
threadId: detail.threadId,
|
|
61
|
+
snippet: detail.snippet ?? "",
|
|
62
|
+
headers: (0, utils_1.simplifyEmailHeaders)(detail.payload?.headers),
|
|
63
|
+
};
|
|
64
|
+
}));
|
|
65
|
+
return { messages, resultSizeEstimate: data.resultSizeEstimate ?? messages.length };
|
|
66
|
+
}
|
|
67
|
+
async getMessage(messageId) {
|
|
68
|
+
const message = await this.request(`/messages/${messageId}`, {
|
|
69
|
+
format: "full",
|
|
70
|
+
});
|
|
71
|
+
const headers = (0, utils_1.simplifyEmailHeaders)(message.payload?.headers);
|
|
72
|
+
const body = (0, utils_1.extractEmailBody)(message.payload);
|
|
73
|
+
return {
|
|
74
|
+
id: message.id,
|
|
75
|
+
threadId: message.threadId,
|
|
76
|
+
labelIds: message.labelIds ?? [],
|
|
77
|
+
headers,
|
|
78
|
+
body,
|
|
79
|
+
snippet: message.snippet ?? "",
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
async searchMessages(query, maxResults = 10) {
|
|
83
|
+
return this.listMessages(query, maxResults);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
exports.GmailService = GmailService;
|
|
87
|
+
//# sourceMappingURL=gmail.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gmail.service.js","sourceRoot":"","sources":["../../src/services/gmail.service.ts"],"names":[],"mappings":";;;AAEA,2CAAyE;AAEzE,MAAa,YAAY;IAGH;IAFZ,OAAO,GAAG,gDAAgD,CAAC;IAEnE,YAAoB,IAAuB;QAAvB,SAAI,GAAJ,IAAI,CAAmB;IAAG,CAAC;IAEvC,KAAK,CAAC,OAAO,CAAI,IAAY,EAAE,MAAwC;Q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AAE,CAAC;IACtF,CAAC;IAED,KAAK,CAAC,UAAU,CAAC,SAAiB;QAChC,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,OAAO,CAAe,aAAa,SAAS,EAAE,EAAE;YACzE,MAAM,EAAE,MAAM;SACf,CAAC,CAAC;QAEH,MAAM,OAAO,GAAG,IAAA,4BAAoB,EAAC,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QAC/D,MAAM,IAAI,GAAG,IAAA,wBAAgB,EAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QAE/C,OAAO;YACL,EAAE,EAAE,OAAO,CAAC,EAAE;YACd,QAAQ,EAAE,OAAO,CAAC,QAAQ;YAC1B,QAAQ,EAAE,OAAO,CAAC,QAAQ,IAAI,EAAE;YAChC,OAAO;YACP,IAAI;YACJ,OAAO,EAAE,OAAO,CAAC,OAAO,IAAI,EAAE;SAC/B,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,cAAc,CAAC,KAAa,EAAE,aAAqB,EAAE;QACzD,OAAO,IAAI,CAAC,YAAY,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;IAC9C,CAAC;CACF;AAlGD,oCAkGC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { GoogleAuthService } from "./auth.service";
|
|
2
|
+
export declare class SheetsService {
|
|
3
|
+
private auth;
|
|
4
|
+
private baseUrl;
|
|
5
|
+
constructor(auth: GoogleAuthService);
|
|
6
|
+
private request;
|
|
7
|
+
getSpreadsheet(spreadsheetId: string): Promise<unknown>;
|
|
8
|
+
getSheetValues(spreadsheetId: string, range: string): Promise<unknown>;
|
|
9
|
+
listSheets(spreadsheetId: string): Promise<unknown>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SheetsService = void 0;
|
|
4
|
+
class SheetsService {
|
|
5
|
+
auth;
|
|
6
|
+
baseUrl = "https://sheets.googleapis.com/v4/spreadsheets";
|
|
7
|
+
constructor(auth) {
|
|
8
|
+
this.auth = auth;
|
|
9
|
+
}
|
|
10
|
+
async request(path, params) {
|
|
11
|
+
const token = await this.auth.getAccessToken();
|
|
12
|
+
const url = new URL(`${this.baseUrl}${path}`);
|
|
13
|
+
if (params) {
|
|
14
|
+
for (const [key, value] of Object.entries(params)) {
|
|
15
|
+
if (value !== undefined && value !== null && value !== "") {
|
|
16
|
+
url.searchParams.set(key, String(value));
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
const response = await fetch(url.toString(), {
|
|
21
|
+
headers: {
|
|
22
|
+
Authorization: `Bearer ${token}`,
|
|
23
|
+
"Content-Type": "application/json",
|
|
24
|
+
},
|
|
25
|
+
});
|
|
26
|
+
if (!response.ok) {
|
|
27
|
+
const errorBody = await response.text().catch(() => "");
|
|
28
|
+
switch (response.status) {
|
|
29
|
+
case 401:
|
|
30
|
+
throw new Error("Sheets authentication failed. Your access token may be expired.");
|
|
31
|
+
case 403:
|
|
32
|
+
throw new Error("Sheets access denied. Token may lack the spreadsheets.readonly scope.");
|
|
33
|
+
case 404:
|
|
34
|
+
throw new Error("Spreadsheet not found. Check the spreadsheet ID.");
|
|
35
|
+
case 429:
|
|
36
|
+
throw new Error("Sheets API rate limit exceeded. Try again later.");
|
|
37
|
+
default:
|
|
38
|
+
throw new Error(`Sheets API error (${response.status}): ${errorBody || response.statusText}`);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return response.json();
|
|
42
|
+
}
|
|
43
|
+
async getSpreadsheet(spreadsheetId) {
|
|
44
|
+
const data = await this.request(`/${spreadsheetId}`, {
|
|
45
|
+
fields: "spreadsheetId,properties.title,sheets.properties",
|
|
46
|
+
});
|
|
47
|
+
return {
|
|
48
|
+
spreadsheetId: data.spreadsheetId,
|
|
49
|
+
title: data.properties?.title ?? "(untitled)",
|
|
50
|
+
sheets: (data.sheets ?? []).map((sheet) => ({
|
|
51
|
+
sheetId: sheet.properties?.sheetId,
|
|
52
|
+
title: sheet.properties?.title ?? "(untitled)",
|
|
53
|
+
index: sheet.properties?.index ?? 0,
|
|
54
|
+
rowCount: sheet.properties?.gridProperties?.rowCount ?? 0,
|
|
55
|
+
columnCount: sheet.properties?.gridProperties?.columnCount ?? 0,
|
|
56
|
+
})),
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
async getSheetValues(spreadsheetId, range) {
|
|
60
|
+
const encodedRange = encodeURIComponent(range);
|
|
61
|
+
const data = await this.request(`/${spreadsheetId}/values/${encodedRange}`);
|
|
62
|
+
return {
|
|
63
|
+
range: data.range ?? range,
|
|
64
|
+
values: data.values ?? [],
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
async listSheets(spreadsheetId) {
|
|
68
|
+
const data = await this.request(`/${spreadsheetId}`, {
|
|
69
|
+
fields: "sheets.properties",
|
|
70
|
+
});
|
|
71
|
+
return {
|
|
72
|
+
sheets: (data.sheets ?? []).map((sheet) => ({
|
|
73
|
+
sheetId: sheet.properties?.sheetId,
|
|
74
|
+
title: sheet.properties?.title ?? "(untitled)",
|
|
75
|
+
index: sheet.properties?.index ?? 0,
|
|
76
|
+
rowCount: sheet.properties?.gridProperties?.rowCount ?? 0,
|
|
77
|
+
columnCount: sheet.properties?.gridProperties?.columnCount ?? 0,
|
|
78
|
+
})),
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
exports.SheetsService = SheetsService;
|
|
83
|
+
//# sourceMappingURL=sheets.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sheets.service.js","sourceRoot":"","sources":["../../src/services/sheets.service.ts"],"names":[],"mappings":";;;AAEA,MAAa,aAAa;IAGJ;IAFZ,OAAO,GAAG,+CAA+C,CAAC;IAElE,YAAoB,IAAuB;QAAvB,SAAI,GAAJ,IAAI,CAAmB;IAAG,CAAC;IAEvC,KAAK,CAAC,OAAO,CAA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AE;SAC1B,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,UAAU,CAAC,aAAqB;QACpC,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,OAAO,CAS5B,IAAI,aAAa,EAAE,EAAE;YACtB,MAAM,EAAE,mBAAmB;SAC5B,CAAC,CAAC;QAEH,OAAO;YACL,MAAM,EAAE,CAAC,IAAI,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;gBAC1C,OAAO,EAAE,KAAK,CAAC,UAAU,EAAE,OAAO;gBAClC,KAAK,EAAE,KAAK,CAAC,UAAU,EAAE,KAAK,IAAI,YAAY;gBAC9C,KAAK,EAAE,KAAK,CAAC,UAAU,EAAE,KAAK,IAAI,CAAC;gBACnC,QAAQ,EAAE,KAAK,CAAC,UAAU,EAAE,cAAc,EAAE,QAAQ,IAAI,CAAC;gBACzD,WAAW,EAAE,KAAK,CAAC,UAAU,EAAE,cAAc,EAAE,WAAW,IAAI,CAAC;aAChE,CAAC,CAAC;SACJ,CAAC;IACJ,CAAC;CACF;AAhHD,sCAgHC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { CalendarService } from "../services/calendar.service";
|
|
3
|
+
export declare const CalendarToolSchemas: {
|
|
4
|
+
list_calendars: {
|
|
5
|
+
description: string;
|
|
6
|
+
schema: z.ZodObject<{}, z.core.$strip>;
|
|
7
|
+
};
|
|
8
|
+
list_events: {
|
|
9
|
+
description: string;
|
|
10
|
+
schema: z.ZodObject<{
|
|
11
|
+
calendar_id: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
12
|
+
time_min: z.ZodOptional<z.ZodString>;
|
|
13
|
+
time_max: z.ZodOptional<z.ZodString>;
|
|
14
|
+
max_results: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
15
|
+
}, z.core.$strip>;
|
|
16
|
+
};
|
|
17
|
+
get_event: {
|
|
18
|
+
description: string;
|
|
19
|
+
schema: z.ZodObject<{
|
|
20
|
+
calendar_id: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
21
|
+
event_id: z.ZodString;
|
|
22
|
+
}, z.core.$strip>;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
export declare class CalendarTools {
|
|
26
|
+
private calendarService;
|
|
27
|
+
constructor(calendarService: CalendarService);
|
|
28
|
+
list_calendars(_args: z.infer<typeof CalendarToolSchemas.list_calendars.schema>): Promise<import("../common/types").McpToolResponse>;
|
|
29
|
+
list_events(args: z.infer<typeof CalendarToolSchemas.list_events.schema>): Promise<import("../common/types").McpToolResponse>;
|
|
30
|
+
get_event(args: z.infer<typeof CalendarToolSchemas.get_event.schema>): Promise<import("../common/types").McpToolResponse>;
|
|
31
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CalendarTools = exports.CalendarToolSchemas = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const utils_1 = require("../common/utils");
|
|
6
|
+
exports.CalendarToolSchemas = {
|
|
7
|
+
list_calendars: {
|
|
8
|
+
description: "Lists all calendars the user has access to, including shared and subscribed calendars. Returns calendar ID, name, description, and access role.",
|
|
9
|
+
schema: zod_1.z.object({}),
|
|
10
|
+
},
|
|
11
|
+
list_events: {
|
|
12
|
+
description: "Lists events within a time range from a calendar. Defaults to primary calendar. Returns title, start/end times, attendees, location, and meeting link. Times must be in RFC3339 format (e.g., '2025-01-01T00:00:00Z').",
|
|
13
|
+
schema: zod_1.z.object({
|
|
14
|
+
calendar_id: zod_1.z
|
|
15
|
+
.string()
|
|
16
|
+
.optional()
|
|
17
|
+
.default("primary")
|
|
18
|
+
.describe("Calendar ID (defaults to 'primary')."),
|
|
19
|
+
time_min: zod_1.z
|
|
20
|
+
.string()
|
|
21
|
+
.optional()
|
|
22
|
+
.describe("Start of time range in RFC3339 format (e.g., '2025-01-01T00:00:00Z')."),
|
|
23
|
+
time_max: zod_1.z.string().optional().describe("End of time range in RFC3339 format."),
|
|
24
|
+
max_results: zod_1.z
|
|
25
|
+
.number()
|
|
26
|
+
.optional()
|
|
27
|
+
.default(10)
|
|
28
|
+
.describe("Maximum number of events to return (default 10, max 250)."),
|
|
29
|
+
}),
|
|
30
|
+
},
|
|
31
|
+
get_event: {
|
|
32
|
+
description: "Retrieves full event details including description, attendees with RSVP status, recurrence rules, and conferencing info.",
|
|
33
|
+
schema: zod_1.z.object({
|
|
34
|
+
calendar_id: zod_1.z
|
|
35
|
+
.string()
|
|
36
|
+
.optional()
|
|
37
|
+
.default("primary")
|
|
38
|
+
.describe("Calendar ID (defaults to 'primary')."),
|
|
39
|
+
event_id: zod_1.z.string().describe("The calendar event ID."),
|
|
40
|
+
}),
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
class CalendarTools {
|
|
44
|
+
calendarService;
|
|
45
|
+
constructor(calendarService) {
|
|
46
|
+
this.calendarService = calendarService;
|
|
47
|
+
}
|
|
48
|
+
async list_calendars(_args) {
|
|
49
|
+
const result = await this.calendarService.listCalendars();
|
|
50
|
+
return (0, utils_1.formatMcpResponse)(result);
|
|
51
|
+
}
|
|
52
|
+
async list_events(args) {
|
|
53
|
+
const result = await this.calendarService.listEvents(args.calendar_id, args.time_min, args.time_max, args.max_results);
|
|
54
|
+
return (0, utils_1.formatMcpResponse)(result);
|
|
55
|
+
}
|
|
56
|
+
async get_event(args) {
|
|
57
|
+
const result = await this.calendarService.getEvent(args.calendar_id, args.event_id);
|
|
58
|
+
return (0, utils_1.formatMcpResponse)(result);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
exports.CalendarTools = CalendarTools;
|
|
62
|
+
//# sourceMappingURL=calendar.tools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"calendar.tools.js","sourceRoot":"","sources":["../../src/tools/calendar.tools.ts"],"names":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AC1D,OAAO,IAAA,yBAAiB,EAAC,MAAM,CAAC,CAAC;IACnC,CAAC;IAED,KAAK,CAAC,WAAW,CAAC,IAA4D;QAC5E,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,eAAe,CAAC,UAAU,CAClD,IAAI,CAAC,WAAW,EAChB,IAAI,CAAC,QAAQ,EACb,IAAI,CAAC,QAAQ,EACb,IAAI,CAAC,WAAW,CACjB,CAAC;QACF,OAAO,IAAA,yBAAiB,EAAC,MAAM,CAAC,CAAC;IACnC,CAAC;IAED,KAAK,CAAC,SAAS,CAAC,IAA0D;QACxE,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,eAAe,CAAC,QAAQ,CAAC,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;QACpF,OAAO,IAAA,yBAAiB,EAAC,MAAM,CAAC,CAAC;IACnC,CAAC;CACF;AAtBD,sCAsBC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { DriveService } from "../services/drive.service";
|
|
3
|
+
export declare const DriveToolSchemas: {
|
|
4
|
+
list_files: {
|
|
5
|
+
description: string;
|
|
6
|
+
schema: z.ZodObject<{
|
|
7
|
+
query: z.ZodOptional<z.ZodString>;
|
|
8
|
+
max_results: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
9
|
+
}, z.core.$strip>;
|
|
10
|
+
};
|
|
11
|
+
get_file: {
|
|
12
|
+
description: string;
|
|
13
|
+
schema: z.ZodObject<{
|
|
14
|
+
file_id: z.ZodString;
|
|
15
|
+
}, z.core.$strip>;
|
|
16
|
+
};
|
|
17
|
+
search_files: {
|
|
18
|
+
description: string;
|
|
19
|
+
schema: z.ZodObject<{
|
|
20
|
+
query: z.ZodString;
|
|
21
|
+
max_results: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
22
|
+
}, z.core.$strip>;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
export declare class DriveTools {
|
|
26
|
+
private driveService;
|
|
27
|
+
constructor(driveService: DriveService);
|
|
28
|
+
list_files(args: z.infer<typeof DriveToolSchemas.list_files.schema>): Promise<import("../common/types").McpToolResponse>;
|
|
29
|
+
get_file(args: z.infer<typeof DriveToolSchemas.get_file.schema>): Promise<import("../common/types").McpToolResponse>;
|
|
30
|
+
search_files(args: z.infer<typeof DriveToolSchemas.search_files.schema>): Promise<import("../common/types").McpToolResponse>;
|
|
31
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DriveTools = exports.DriveToolSchemas = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const utils_1 = require("../common/utils");
|
|
6
|
+
exports.DriveToolSchemas = {
|
|
7
|
+
list_files: {
|
|
8
|
+
description: "Lists files in Google Drive. Supports Drive search query syntax for filtering (e.g., \"name contains 'report'\", \"mimeType='application/pdf'\"). Returns name, type, owner, modified date, and sharing link.",
|
|
9
|
+
schema: zod_1.z.object({
|
|
10
|
+
query: zod_1.z
|
|
11
|
+
.string()
|
|
12
|
+
.optional()
|
|
13
|
+
.describe("Drive search query (e.g., \"name contains 'Q4 Report'\", \"mimeType='application/pdf'\")."),
|
|
14
|
+
max_results: zod_1.z
|
|
15
|
+
.number()
|
|
16
|
+
.optional()
|
|
17
|
+
.default(10)
|
|
18
|
+
.describe("Maximum number of files to return (default 10, max 100)."),
|
|
19
|
+
}),
|
|
20
|
+
},
|
|
21
|
+
get_file: {
|
|
22
|
+
description: "Retrieves full metadata for a Google Drive file including size, permissions, version history, and parent folders.",
|
|
23
|
+
schema: zod_1.z.object({
|
|
24
|
+
file_id: zod_1.z.string().describe("The Google Drive file ID."),
|
|
25
|
+
}),
|
|
26
|
+
},
|
|
27
|
+
search_files: {
|
|
28
|
+
description: "Searches files in Google Drive using Drive search query syntax (e.g., \"name contains 'Q4 Report'\", \"mimeType='application/pdf'\", \"'user@company.com' in writers\"). Returns matching files with name, type, owner, and modified date.",
|
|
29
|
+
schema: zod_1.z.object({
|
|
30
|
+
query: zod_1.z
|
|
31
|
+
.string()
|
|
32
|
+
.describe("Drive search query (required). Supports full Drive search syntax."),
|
|
33
|
+
max_results: zod_1.z
|
|
34
|
+
.number()
|
|
35
|
+
.optional()
|
|
36
|
+
.default(10)
|
|
37
|
+
.describe("Maximum number of files to return (default 10, max 100)."),
|
|
38
|
+
}),
|
|
39
|
+
},
|
|
40
|
+
};
|
|
41
|
+
class DriveTools {
|
|
42
|
+
driveService;
|
|
43
|
+
constructor(driveService) {
|
|
44
|
+
this.driveService = driveService;
|
|
45
|
+
}
|
|
46
|
+
async list_files(args) {
|
|
47
|
+
const result = await this.driveService.listFiles(args.query, args.max_results);
|
|
48
|
+
return (0, utils_1.formatMcpResponse)(result);
|
|
49
|
+
}
|
|
50
|
+
async get_file(args) {
|
|
51
|
+
const result = await this.driveService.getFile(args.file_id);
|
|
52
|
+
return (0, utils_1.formatMcpResponse)(result);
|
|
53
|
+
}
|
|
54
|
+
async search_files(args) {
|
|
55
|
+
const result = await this.driveService.searchFiles(args.query, args.max_results);
|
|
56
|
+
return (0, utils_1.formatMcpResponse)(result);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
exports.DriveTools = DriveTools;
|
|
60
|
+
//# sourceMappingURL=drive.tools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"drive.tools.js","sourceRoot":"","sources":["../../src/tools/drive.tools.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AAExB,2CAAoD;AAEvC,QAAA,gBAAgB,GAAG;IAC9B,UAAU,EAAE;QACV,WAAW,EACT,+MAA+M;QACjN,MAAM,EAAE,OAAC,CAAC,MAAM,CAAC;YACf,KAAK,EAAE,OAAC;iBACL,MAAM,EAAE;iBACR,QAAQ,EAAE;iBACV,QAAQ,CACP,2FAA2F,CAC5F;YACH,WAAW,EAAE,OAAC;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AAK,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;QACjF,OAAO,IAAA,yBAAiB,EAAC,MAAM,CAAC,CAAC;IACnC,CAAC;CACF;AAjBD,gCAiBC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { GmailService } from "../services/gmail.service";
|
|
3
|
+
export declare const GmailToolSchemas: {
|
|
4
|
+
list_messages: {
|
|
5
|
+
description: string;
|
|
6
|
+
schema: z.ZodObject<{
|
|
7
|
+
query: z.ZodOptional<z.ZodString>;
|
|
8
|
+
max_results: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
9
|
+
}, z.core.$strip>;
|
|
10
|
+
};
|
|
11
|
+
get_message: {
|
|
12
|
+
description: string;
|
|
13
|
+
schema: z.ZodObject<{
|
|
14
|
+
message_id: z.ZodString;
|
|
15
|
+
}, z.core.$strip>;
|
|
16
|
+
};
|
|
17
|
+
search_messages: {
|
|
18
|
+
description: string;
|
|
19
|
+
schema: z.ZodObject<{
|
|
20
|
+
query: z.ZodString;
|
|
21
|
+
max_results: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
22
|
+
}, z.core.$strip>;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
export declare class GmailTools {
|
|
26
|
+
private gmailService;
|
|
27
|
+
constructor(gmailService: GmailService);
|
|
28
|
+
list_messages(args: z.infer<typeof GmailToolSchemas.list_messages.schema>): Promise<import("../common/types").McpToolResponse>;
|
|
29
|
+
get_message(args: z.infer<typeof GmailToolSchemas.get_message.schema>): Promise<import("../common/types").McpToolResponse>;
|
|
30
|
+
search_messages(args: z.infer<typeof GmailToolSchemas.search_messages.schema>): Promise<import("../common/types").McpToolResponse>;
|
|
31
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GmailTools = exports.GmailToolSchemas = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const utils_1 = require("../common/utils");
|
|
6
|
+
exports.GmailToolSchemas = {
|
|
7
|
+
list_messages: {
|
|
8
|
+
description: "Lists recent messages in the user's Gmail mailbox. Returns message ID, subject, from, date, and snippet. Supports optional Gmail search query syntax.",
|
|
9
|
+
schema: zod_1.z.object({
|
|
10
|
+
query: zod_1.z
|
|
11
|
+
.string()
|
|
12
|
+
.optional()
|
|
13
|
+
.describe("Gmail search query (e.g., 'is:unread', 'from:boss@company.com')."),
|
|
14
|
+
max_results: zod_1.z
|
|
15
|
+
.number()
|
|
16
|
+
.optional()
|
|
17
|
+
.default(10)
|
|
18
|
+
.describe("Maximum number of messages to return (default 10, max 100)."),
|
|
19
|
+
}),
|
|
20
|
+
},
|
|
21
|
+
get_message: {
|
|
22
|
+
description: "Retrieves a specific Gmail message including decoded body (plain text), headers (From, To, Subject, Date), labels, and snippet. Use when you have a specific message ID.",
|
|
23
|
+
schema: zod_1.z.object({
|
|
24
|
+
message_id: zod_1.z.string().describe("The Gmail message ID."),
|
|
25
|
+
}),
|
|
26
|
+
},
|
|
27
|
+
search_messages: {
|
|
28
|
+
description: "Searches Gmail messages using Gmail search syntax (e.g., 'from:boss@company.com is:unread', 'subject:invoice after:2025/01/01', 'has:attachment filename:pdf'). Returns matching messages with ID, subject, from, date, and snippet.",
|
|
29
|
+
schema: zod_1.z.object({
|
|
30
|
+
query: zod_1.z
|
|
31
|
+
.string()
|
|
32
|
+
.describe("Gmail search query (required). Supports full Gmail search syntax."),
|
|
33
|
+
max_results: zod_1.z
|
|
34
|
+
.number()
|
|
35
|
+
.optional()
|
|
36
|
+
.default(10)
|
|
37
|
+
.describe("Maximum number of messages to return (default 10, max 100)."),
|
|
38
|
+
}),
|
|
39
|
+
},
|
|
40
|
+
};
|
|
41
|
+
class GmailTools {
|
|
42
|
+
gmailService;
|
|
43
|
+
constructor(gmailService) {
|
|
44
|
+
this.gmailService = gmailService;
|
|
45
|
+
}
|
|
46
|
+
async list_messages(args) {
|
|
47
|
+
const result = await this.gmailService.listMessages(args.query, args.max_results);
|
|
48
|
+
return (0, utils_1.formatMcpResponse)(result);
|
|
49
|
+
}
|
|
50
|
+
async get_message(args) {
|
|
51
|
+
const result = await this.gmailService.getMessage(args.message_id);
|
|
52
|
+
return (0, utils_1.formatMcpResponse)(result);
|
|
53
|
+
}
|
|
54
|
+
async search_messages(args) {
|
|
55
|
+
const result = await this.gmailService.searchMessages(args.query, args.max_results);
|
|
56
|
+
return (0, utils_1.formatMcpResponse)(result);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
exports.GmailTools = GmailTools;
|
|
60
|
+
//# sourceMappingURL=gmail.tools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gmail.tools.js","sourceRoot":"","sources":["../../src/tools/gmail.tools.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AAExB,2CAAoD;AAEvC,QAAA,gBAAgB,GAAG;IAC9B,aAAa,EAAE;QACb,WAAW,EACT,uJAAuJ;QACzJ,MAAM,EAAE,OAAC,CAAC,MAAM,CAAC;YACf,KAAK,EAAE,OAAC;iBACL,MAAM,EAAE;iBACR,QAAQ,EAAE;iBACV,QAAQ,CAAC,kEAAkE,CAAC;YAC/E,WAAW,EAAE,OAAC;iBACX,MAAM,EAAE;iBACR,QAAQ,EAAE;iBACV,OAAO,CAAC,EAAE,CAAC;iBACX,QAAQ,CAAC,6DAA6D,CAAC;SAC3E,CAAC;KACH;IACD,WAAW,EAAE;QACX,WAAW,EACT,0KAA0K;QAC5K,MAAM,EAAE,OAAC,CAAC,MAAM,CAAC;YACf,UAAU,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,uBAAuB,CAAC;SACzD,CAAC;KACH;IACD,eAAe,EAAE;QACf,WAAW,EACT,sOAAsO;QACxO,MAAM,EAAE,OAAC,CAAC,MAAM,CAAC;YACf,KAAK,EAAE,OAAC;iBACL,MAAM,EAAE;iBACR,QAAQ,CAAC,mEAAmE,CAAC;YAChF,WAAW,EAAE,OAAC;iBACX,MAAM,EAAE;iBACR,QAAQ,EAAE;iBACV,OAAO,CAAC,EAAE,CAAC;iBACX,QAAQ,CAAC,6DAA6D,CAAC;SAC3E,CAAC;KACH;CACF,CAAC;AAEF,MAAa,UAAU;IACD;IAApB,YAAoB,YAA0B;QAA1B,iBAAY,GAAZ,YAAY,CAAc;IAAG,CAAC;IAElD,KAAK,CAAC,aAAa,CAAC,IAA2D;QAC7E,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC,YAAY,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;QAClF,OAAO,IAAA,yBAAiB,EAAC,MAAM,CAAC,CAAC;IACnC,CAAC;IAED,KAAK,CAAC,WAAW,CAAC,IAAyD;QACzE,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QACnE,OAAO,IAAA,yBAAiB,EAAC,MAAM,CAAC,CAAC;IACnC,CAAC;IAED,KAAK,CAAC,eAAe,CAAC,IAA6D;QACjF,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC,cAAc,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;QACpF,OAAO,IAAA,yBAAiB,EAAC,MAAM,CAAC,CAAC;IACnC,CAAC;CACF;AAjBD,gCAiBC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { SheetsService } from "../services/sheets.service";
|
|
3
|
+
export declare const SheetsToolSchemas: {
|
|
4
|
+
get_spreadsheet: {
|
|
5
|
+
description: string;
|
|
6
|
+
schema: z.ZodObject<{
|
|
7
|
+
spreadsheet_id: z.ZodString;
|
|
8
|
+
}, z.core.$strip>;
|
|
9
|
+
};
|
|
10
|
+
get_sheet_values: {
|
|
11
|
+
description: string;
|
|
12
|
+
schema: z.ZodObject<{
|
|
13
|
+
spreadsheet_id: z.ZodString;
|
|
14
|
+
range: z.ZodString;
|
|
15
|
+
}, z.core.$strip>;
|
|
16
|
+
};
|
|
17
|
+
list_sheets: {
|
|
18
|
+
description: string;
|
|
19
|
+
schema: z.ZodObject<{
|
|
20
|
+
spreadsheet_id: z.ZodString;
|
|
21
|
+
}, z.core.$strip>;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
export declare class SheetsTools {
|
|
25
|
+
private sheetsService;
|
|
26
|
+
constructor(sheetsService: SheetsService);
|
|
27
|
+
get_spreadsheet(args: z.infer<typeof SheetsToolSchemas.get_spreadsheet.schema>): Promise<import("../common/types").McpToolResponse>;
|
|
28
|
+
get_sheet_values(args: z.infer<typeof SheetsToolSchemas.get_sheet_values.schema>): Promise<import("../common/types").McpToolResponse>;
|
|
29
|
+
list_sheets(args: z.infer<typeof SheetsToolSchemas.list_sheets.schema>): Promise<import("../common/types").McpToolResponse>;
|
|
30
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SheetsTools = exports.SheetsToolSchemas = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const utils_1 = require("../common/utils");
|
|
6
|
+
exports.SheetsToolSchemas = {
|
|
7
|
+
get_spreadsheet: {
|
|
8
|
+
description: "Retrieves spreadsheet metadata including title, sheet names, and sheet dimensions (row/column counts).",
|
|
9
|
+
schema: zod_1.z.object({
|
|
10
|
+
spreadsheet_id: zod_1.z.string().describe("The Google Sheets spreadsheet ID."),
|
|
11
|
+
}),
|
|
12
|
+
},
|
|
13
|
+
get_sheet_values: {
|
|
14
|
+
description: "Reads cell values for a given A1 notation range (e.g., 'Sheet1!A1:D50'). Returns values as a 2D array.",
|
|
15
|
+
schema: zod_1.z.object({
|
|
16
|
+
spreadsheet_id: zod_1.z.string().describe("The Google Sheets spreadsheet ID."),
|
|
17
|
+
range: zod_1.z.string().describe("A1 notation range (e.g., 'Sheet1!A1:D50', 'A1:Z100')."),
|
|
18
|
+
}),
|
|
19
|
+
},
|
|
20
|
+
list_sheets: {
|
|
21
|
+
description: "Lists all sheets (tabs) in a spreadsheet with their names, indices, and row/column counts.",
|
|
22
|
+
schema: zod_1.z.object({
|
|
23
|
+
spreadsheet_id: zod_1.z.string().describe("The Google Sheets spreadsheet ID."),
|
|
24
|
+
}),
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
class SheetsTools {
|
|
28
|
+
sheetsService;
|
|
29
|
+
constructor(sheetsService) {
|
|
30
|
+
this.sheetsService = sheetsService;
|
|
31
|
+
}
|
|
32
|
+
async get_spreadsheet(args) {
|
|
33
|
+
const result = await this.sheetsService.getSpreadsheet(args.spreadsheet_id);
|
|
34
|
+
return (0, utils_1.formatMcpResponse)(result);
|
|
35
|
+
}
|
|
36
|
+
async get_sheet_values(args) {
|
|
37
|
+
const result = await this.sheetsService.getSheetValues(args.spreadsheet_id, args.range);
|
|
38
|
+
return (0, utils_1.formatMcpResponse)(result);
|
|
39
|
+
}
|
|
40
|
+
async list_sheets(args) {
|
|
41
|
+
const result = await this.sheetsService.listSheets(args.spreadsheet_id);
|
|
42
|
+
return (0, utils_1.formatMcpResponse)(result);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
exports.SheetsTools = SheetsTools;
|
|
46
|
+
//# sourceMappingURL=sheets.tools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sheets.tools.js","sourceRoot":"","sources":["../../src/tools/sheets.tools.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AAExB,2CAAoD;AAEvC,QAAA,iBAAiB,GAAG;IAC/B,eAAe,EAAE;QACf,WAAW,EACT,wGAAwG;QAC1G,MAAM,EAAE,OAAC,CAAC,MAAM,CAAC;YACf,cAAc,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,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@ -0,0 +1,47 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@vineethnkrishnan/google-workspace-mcp",
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "A read-only MCP server for Google Workspace APIs (Gmail, Calendar, Drive, Sheets), enabling AI assistants to search emails, check calendars, find files, and read spreadsheets.",
|
|
5
|
+
"main": "build/index.js",
|
|
6
|
+
"bin": {
|
|
7
|
+
"google-workspace-mcp": "build/index.js"
|
|
8
|
+
},
|
|
9
|
+
"files": [
|
|
10
|
+
"build/"
|
|
11
|
+
],
|
|
12
|
+
"scripts": {
|
|
13
|
+
"build": "tsc",
|
|
14
|
+
"start": "node build/index.js",
|
|
15
|
+
"test": "jest --coverage"
|
|
16
|
+
},
|
|
17
|
+
"publishConfig": {
|
|
18
|
+
"access": "public"
|
|
19
|
+
},
|
|
20
|
+
"keywords": [
|
|
21
|
+
"mcp",
|
|
22
|
+
"google-workspace",
|
|
23
|
+
"gmail",
|
|
24
|
+
"google-calendar",
|
|
25
|
+
"google-drive",
|
|
26
|
+
"google-sheets",
|
|
27
|
+
"ai",
|
|
28
|
+
"model-context-protocol"
|
|
29
|
+
],
|
|
30
|
+
"author": "Vineeth Krishnan",
|
|
31
|
+
"license": "MIT",
|
|
32
|
+
"type": "commonjs",
|
|
33
|
+
"engines": {
|
|
34
|
+
"node": ">=20"
|
|
35
|
+
},
|
|
36
|
+
"dependencies": {
|
|
37
|
+
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
38
|
+
"zod": "^4.3.6"
|
|
39
|
+
},
|
|
40
|
+
"devDependencies": {
|
|
41
|
+
"@types/jest": "^30.0.0",
|
|
42
|
+
"@types/node": "^25.5.0",
|
|
43
|
+
"jest": "^30.3.0",
|
|
44
|
+
"ts-jest": "^29.4.6",
|
|
45
|
+
"typescript": "^5.7.0"
|
|
46
|
+
}
|
|
47
|
+
}
|