mcp-google-multi 6.1.1-beta.1 → 6.1.2-alpha.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.
@@ -12,7 +12,7 @@ function statusOf(error) {
12
12
  const n = typeof c === 'string' ? Number(c) : c;
13
13
  return Number.isFinite(n) ? n : undefined;
14
14
  }
15
- /** gaxios 7 is fetch-based, so response.headers is a Headers instance with no
15
+ /** gaxios 7 and 8 are fetch-based, so response.headers is a Headers instance with no
16
16
  * index signature; the plain-object form still appears in tests and in mocks. */
17
17
  function headerOf(error, name) {
18
18
  const h = error?.response?.headers;
@@ -10,6 +10,8 @@ interface ReplyDerivation {
10
10
  inReplyTo: string;
11
11
  references: string;
12
12
  sourceFound: boolean;
13
+ /** Gmail thread of the reply source; without it the reply starts a new thread on the sender's side. */
14
+ threadId?: string;
13
15
  to?: string;
14
16
  cc?: string;
15
17
  subject?: string;
@@ -144,6 +144,7 @@ function getOwnAddresses(gmail, account, primaryEmail) {
144
144
  * report sourceFound:false so the caller can decide. */
145
145
  export async function resolveReply(gmail, account, primaryEmail, replyToMessageId, replyAll) {
146
146
  let headers;
147
+ let threadId;
147
148
  try {
148
149
  const meta = await gmail.users.messages.get({
149
150
  userId: 'me',
@@ -152,6 +153,7 @@ export async function resolveReply(gmail, account, primaryEmail, replyToMessageI
152
153
  metadataHeaders: ['From', 'To', 'Cc', 'Subject', 'Message-ID', 'References'],
153
154
  });
154
155
  headers = meta.data.payload?.headers;
156
+ threadId = meta.data.threadId ?? undefined;
155
157
  }
156
158
  catch {
157
159
  // Degrade to the API id rather than blocking the send.
@@ -184,6 +186,7 @@ export async function resolveReply(gmail, account, primaryEmail, replyToMessageI
184
186
  return {
185
187
  ...threading,
186
188
  sourceFound: true,
189
+ threadId,
187
190
  to: derivedTo || undefined,
188
191
  cc: derivedCc,
189
192
  subject: deriveReplySubject(getHeader(headers, 'Subject')),
@@ -722,8 +725,10 @@ export function registerGmailTools(server, deps = {}) {
722
725
  userId: 'me',
723
726
  requestBody: { raw: encoded },
724
727
  };
725
- if (replyToThreadId) {
726
- sendParams.requestBody.threadId = replyToThreadId;
728
+ // An explicit replyToThreadId wins; otherwise keep the reply in the source's thread.
729
+ const sendThreadId = replyToThreadId ?? reply?.threadId;
730
+ if (sendThreadId) {
731
+ sendParams.requestBody.threadId = sendThreadId;
727
732
  }
728
733
  const res = await gmail.users.messages.send(sendParams);
729
734
  return {
@@ -854,8 +859,9 @@ export function registerGmailTools(server, deps = {}) {
854
859
  message: { raw: encoded },
855
860
  },
856
861
  };
857
- if (replyToThreadId) {
858
- draftParams.requestBody.message.threadId = replyToThreadId;
862
+ const draftThreadId = replyToThreadId ?? reply?.threadId;
863
+ if (draftThreadId) {
864
+ draftParams.requestBody.message.threadId = draftThreadId;
859
865
  }
860
866
  const res = await gmail.users.drafts.create(draftParams);
861
867
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mcp-google-multi",
3
- "version": "6.1.1-beta.1",
3
+ "version": "6.1.2-alpha.1",
4
4
  "mcpName": "io.github.bakissation/mcp-google-multi",
5
5
  "description": "Local MCP server for Google Workspace (Gmail, Drive, Calendar, Sheets, Docs, Contacts, Tasks, Meet, Search Console, +Forms/Chat/Admin) across multiple accounts — OAuth-only, encrypted token storage, deny-by-default writes.",
6
6
  "type": "module",