gmcp 0.5.2 → 0.6.0

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/dist/auth-cli.js CHANGED
@@ -6,7 +6,7 @@ import {
6
6
  getTokensFromCode,
7
7
  loadCredentials,
8
8
  saveTokens
9
- } from "./shared/chunk-0d6s6z48.js";
9
+ } from "./shared/chunk-tv10xf39.js";
10
10
  import"./shared/chunk-3s189drz.js";
11
11
 
12
12
  // src/auth-cli.ts
package/dist/index.js CHANGED
@@ -7,7 +7,7 @@ import {
7
7
  createAuthenticatedClient,
8
8
  getEnvConfig,
9
9
  getHeader
10
- } from "./shared/chunk-0d6s6z48.js";
10
+ } from "./shared/chunk-tv10xf39.js";
11
11
  import"./shared/chunk-3s189drz.js";
12
12
 
13
13
  // src/index.ts
@@ -15,17 +15,17 @@ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
15
15
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
16
16
 
17
17
  // src/calendar.ts
18
- import { google } from "googleapis";
19
- function parseCalendar(calendar) {
18
+ import { calendar } from "@googleapis/calendar";
19
+ function parseCalendar(calendarEntry) {
20
20
  return {
21
- id: calendar.id || "",
22
- summary: calendar.summary || "",
23
- description: calendar.description ?? undefined,
24
- timeZone: calendar.timeZone ?? undefined,
25
- primary: calendar.primary ?? undefined,
26
- backgroundColor: calendar.backgroundColor ?? undefined,
27
- foregroundColor: calendar.foregroundColor ?? undefined,
28
- accessRole: calendar.accessRole ?? undefined
21
+ id: calendarEntry.id || "",
22
+ summary: calendarEntry.summary || "",
23
+ description: calendarEntry.description ?? undefined,
24
+ timeZone: calendarEntry.timeZone ?? undefined,
25
+ primary: calendarEntry.primary ?? undefined,
26
+ backgroundColor: calendarEntry.backgroundColor ?? undefined,
27
+ foregroundColor: calendarEntry.foregroundColor ?? undefined,
28
+ accessRole: calendarEntry.accessRole ?? undefined
29
29
  };
30
30
  }
31
31
  var ALL_DAY_DATE_REGEX = /^\d{4}-\d{2}-\d{2}$/;
@@ -82,13 +82,13 @@ function parseEvent(event) {
82
82
  };
83
83
  }
84
84
  function createCalendarClient(auth, logger) {
85
- const calendar = google.calendar({ version: "v3", auth });
85
+ const calendarClient = calendar({ version: "v3", auth });
86
86
  return {
87
87
  async listCalendars(showHidden = false) {
88
88
  const startTime = Date.now();
89
89
  logger?.debug({ showHidden }, "listCalendars start");
90
90
  try {
91
- const response = await calendar.calendarList.list({
91
+ const response = await calendarClient.calendarList.list({
92
92
  showHidden
93
93
  });
94
94
  const calendars = response.data.items || [];
@@ -107,7 +107,7 @@ function createCalendarClient(auth, logger) {
107
107
  const startTime = Date.now();
108
108
  logger?.debug({ calendarId, timeMin, timeMax, maxResults, query }, "listEvents start");
109
109
  try {
110
- const response = await calendar.events.list({
110
+ const response = await calendarClient.events.list({
111
111
  calendarId,
112
112
  timeMin,
113
113
  timeMax,
@@ -137,7 +137,7 @@ function createCalendarClient(auth, logger) {
137
137
  const startTime = Date.now();
138
138
  logger?.debug({ calendarId, eventId }, "getEvent start");
139
139
  try {
140
- const response = await calendar.events.get({
140
+ const response = await calendarClient.events.get({
141
141
  calendarId,
142
142
  eventId
143
143
  });
@@ -176,7 +176,7 @@ function createCalendarClient(auth, logger) {
176
176
  }
177
177
  };
178
178
  }
179
- const response = await calendar.events.insert({
179
+ const response = await calendarClient.events.insert({
180
180
  calendarId,
181
181
  requestBody: eventResource,
182
182
  conferenceDataVersion: addMeet ? 1 : undefined
@@ -203,7 +203,7 @@ function createCalendarClient(auth, logger) {
203
203
  }
204
204
 
205
205
  // src/gmail.ts
206
- import { google as google2 } from "googleapis";
206
+ import { gmail } from "@googleapis/gmail";
207
207
 
208
208
  // src/constants.ts
209
209
  var EMAIL_FETCH_BATCH_SIZE = 10;
@@ -332,13 +332,13 @@ function parseLabel(label) {
332
332
  };
333
333
  }
334
334
  function createGmailClient(auth, logger) {
335
- const gmail = google2.gmail({ version: "v1", auth });
335
+ const gmailClient = gmail({ version: "v1", auth });
336
336
  return {
337
337
  async searchEmails(query, maxResults = 10, includeBody = false, pageToken) {
338
338
  const startTime = Date.now();
339
339
  logger?.debug({ query, maxResults, includeBody, pageToken }, "searchEmails start");
340
340
  try {
341
- const listResponse = await gmail.users.messages.list({
341
+ const listResponse = await gmailClient.users.messages.list({
342
342
  userId: "me",
343
343
  q: query,
344
344
  maxResults,
@@ -354,7 +354,7 @@ function createGmailClient(auth, logger) {
354
354
  const batch = validMessages.slice(i, i + EMAIL_FETCH_BATCH_SIZE);
355
355
  const batchEmails = await Promise.all(batch.map(async (message) => {
356
356
  const messageId = message.id ?? "";
357
- const details = await gmail.users.messages.get({
357
+ const details = await gmailClient.users.messages.get({
358
358
  userId: "me",
359
359
  id: messageId,
360
360
  format: includeBody ? "full" : "metadata",
@@ -389,7 +389,7 @@ function createGmailClient(auth, logger) {
389
389
  const startTime = Date.now();
390
390
  logger?.debug({ messageId, includeBody }, "getMessage start");
391
391
  try {
392
- const response = await gmail.users.messages.get({
392
+ const response = await gmailClient.users.messages.get({
393
393
  userId: "me",
394
394
  id: messageId,
395
395
  format: includeBody ? "full" : "metadata",
@@ -409,7 +409,7 @@ function createGmailClient(auth, logger) {
409
409
  },
410
410
  async getThread(threadId, includeBody = false) {
411
411
  try {
412
- const response = await gmail.users.threads.get({
412
+ const response = await gmailClient.users.threads.get({
413
413
  userId: "me",
414
414
  id: threadId,
415
415
  format: includeBody ? "full" : "metadata",
@@ -423,7 +423,7 @@ function createGmailClient(auth, logger) {
423
423
  },
424
424
  async listAttachments(messageId) {
425
425
  try {
426
- const response = await gmail.users.messages.get({
426
+ const response = await gmailClient.users.messages.get({
427
427
  userId: "me",
428
428
  id: messageId,
429
429
  format: "full"
@@ -454,7 +454,7 @@ function createGmailClient(auth, logger) {
454
454
  },
455
455
  async getAttachment(messageId, attachmentId) {
456
456
  try {
457
- const response = await gmail.users.messages.attachments.get({
457
+ const response = await gmailClient.users.messages.attachments.get({
458
458
  userId: "me",
459
459
  messageId,
460
460
  id: attachmentId
@@ -472,7 +472,7 @@ function createGmailClient(auth, logger) {
472
472
  },
473
473
  async modifyLabels(messageId, addLabelIds, removeLabelIds) {
474
474
  try {
475
- const response = await gmail.users.messages.modify({
475
+ const response = await gmailClient.users.messages.modify({
476
476
  userId: "me",
477
477
  id: messageId,
478
478
  requestBody: {
@@ -493,7 +493,7 @@ function createGmailClient(auth, logger) {
493
493
  removeLabelCount: removeLabelIds?.length || 0
494
494
  }, "batchModifyLabels start");
495
495
  try {
496
- await gmail.users.messages.batchModify({
496
+ await gmailClient.users.messages.batchModify({
497
497
  userId: "me",
498
498
  requestBody: {
499
499
  ids: messageIds,
@@ -527,7 +527,7 @@ function createGmailClient(auth, logger) {
527
527
  bcc
528
528
  });
529
529
  const encodedMessage = encodeMessage(mimeMessage);
530
- const response = await gmail.users.messages.send({
530
+ const response = await gmailClient.users.messages.send({
531
531
  userId: "me",
532
532
  requestBody: {
533
533
  raw: encodedMessage
@@ -568,7 +568,7 @@ function createGmailClient(auth, logger) {
568
568
  references: `<${messageId}>`
569
569
  });
570
570
  const encodedMessage = encodeMessage(mimeMessage);
571
- const response = await gmail.users.messages.send({
571
+ const response = await gmailClient.users.messages.send({
572
572
  userId: "me",
573
573
  requestBody: {
574
574
  raw: encodedMessage,
@@ -595,7 +595,7 @@ function createGmailClient(auth, logger) {
595
595
  bcc
596
596
  });
597
597
  const encodedMessage = encodeMessage(mimeMessage);
598
- const response = await gmail.users.drafts.create({
598
+ const response = await gmailClient.users.drafts.create({
599
599
  userId: "me",
600
600
  requestBody: {
601
601
  message: {
@@ -616,7 +616,7 @@ function createGmailClient(auth, logger) {
616
616
  },
617
617
  async listLabels() {
618
618
  try {
619
- const response = await gmail.users.labels.list({
619
+ const response = await gmailClient.users.labels.list({
620
620
  userId: "me"
621
621
  });
622
622
  const labels = response.data.labels || [];
@@ -627,7 +627,7 @@ function createGmailClient(auth, logger) {
627
627
  },
628
628
  async getLabel(labelId) {
629
629
  try {
630
- const response = await gmail.users.labels.get({
630
+ const response = await gmailClient.users.labels.get({
631
631
  userId: "me",
632
632
  id: labelId
633
633
  });
@@ -638,7 +638,7 @@ function createGmailClient(auth, logger) {
638
638
  },
639
639
  async createLabel(name, messageListVisibility, labelListVisibility, backgroundColor, textColor) {
640
640
  try {
641
- const response = await gmail.users.labels.create({
641
+ const response = await gmailClient.users.labels.create({
642
642
  userId: "me",
643
643
  requestBody: {
644
644
  name,
@@ -654,7 +654,7 @@ function createGmailClient(auth, logger) {
654
654
  },
655
655
  async updateLabel(labelId, name, messageListVisibility, labelListVisibility, backgroundColor, textColor) {
656
656
  try {
657
- const response = await gmail.users.labels.update({
657
+ const response = await gmailClient.users.labels.update({
658
658
  userId: "me",
659
659
  id: labelId,
660
660
  requestBody: {
@@ -672,7 +672,7 @@ function createGmailClient(auth, logger) {
672
672
  },
673
673
  async deleteLabel(labelId) {
674
674
  try {
675
- await gmail.users.labels.delete({
675
+ await gmailClient.users.labels.delete({
676
676
  userId: "me",
677
677
  id: labelId
678
678
  });
@@ -682,7 +682,7 @@ function createGmailClient(auth, logger) {
682
682
  },
683
683
  async deleteEmail(messageId) {
684
684
  try {
685
- await gmail.users.messages.delete({
685
+ await gmailClient.users.messages.delete({
686
686
  userId: "me",
687
687
  id: messageId
688
688
  });
@@ -1079,18 +1079,18 @@ function calendarListToMarkdown(data) {
1079
1079
  if (data.calendars.length === 0) {
1080
1080
  sections.push({ p: "No calendars found." });
1081
1081
  } else {
1082
- for (const calendar of data.calendars) {
1083
- sections.push({ h2: calendar.summary });
1082
+ for (const calendar2 of data.calendars) {
1083
+ sections.push({ h2: calendar2.summary });
1084
1084
  const details = [
1085
- `**ID:** ${calendar.id}`,
1086
- `**Timezone:** ${calendar.timezone || "Not set"}`,
1087
- `**Access Role:** ${calendar.access_role || "Unknown"}`
1085
+ `**ID:** ${calendar2.id}`,
1086
+ `**Timezone:** ${calendar2.timezone || "Not set"}`,
1087
+ `**Access Role:** ${calendar2.access_role || "Unknown"}`
1088
1088
  ];
1089
- if (calendar.primary) {
1089
+ if (calendar2.primary) {
1090
1090
  details.push("**Primary:** Yes");
1091
1091
  }
1092
- if (calendar.description) {
1093
- details.push(`**Description:** ${calendar.description}`);
1092
+ if (calendar2.description) {
1093
+ details.push(`**Description:** ${calendar2.description}`);
1094
1094
  }
1095
1095
  sections.push({ ul: details });
1096
1096
  }
@@ -1,5 +1,5 @@
1
1
  // src/auth.ts
2
- import { google } from "googleapis";
2
+ import { OAuth2Client } from "google-auth-library";
3
3
 
4
4
  // src/errors.ts
5
5
  class GmcpError extends Error {
@@ -143,7 +143,7 @@ async function saveTokens(path, tokens) {
143
143
  }
144
144
  function createOAuth2Client(credentials) {
145
145
  const { client_id, client_secret, redirect_uris } = credentials.installed;
146
- return new google.auth.OAuth2(client_id, client_secret, redirect_uris[0]);
146
+ return new OAuth2Client(client_id, client_secret, redirect_uris[0]);
147
147
  }
148
148
  function getAuthUrl(oauth2Client, scopes) {
149
149
  return oauth2Client.generateAuthUrl({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gmcp",
3
- "version": "0.5.2",
3
+ "version": "0.6.0",
4
4
  "description": "GMCP Server for Google Workspace with OAuth2 authentication",
5
5
  "module": "src/index.ts",
6
6
  "main": "dist/index.js",
@@ -51,7 +51,9 @@
51
51
  "@inquirer/prompts": "^8.2.0",
52
52
  "@modelcontextprotocol/sdk": "^1.25.3",
53
53
  "@stricli/core": "^1.2.5",
54
- "googleapis": "^170.1.0",
54
+ "@googleapis/calendar": "^14.2.0",
55
+ "@googleapis/gmail": "^15.0.0",
56
+ "google-auth-library": "^10.2.0",
55
57
  "json2md": "^2.0.3",
56
58
  "kleur": "^4.1.5",
57
59
  "pino": "^10.3.0",
@@ -64,7 +66,7 @@
64
66
  "@changesets/cli": "^2.29.8",
65
67
  "@types/bun": "latest",
66
68
  "@types/json2md": "^1.5.4",
67
- "bunup": "^0.16.20",
69
+ "bunup": "^0.16.21",
68
70
  "lefthook": "^2.0.16",
69
71
  "msw": "^2.12.7",
70
72
  "ultracite": "7.1.1",