mcp-teams 0.3.34 → 0.3.35

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 CHANGED
@@ -55,7 +55,7 @@ Teams reports the call's length, not each person's time in it, so attendance lis
55
55
 
56
56
  The AI can only **request** a send. The extension then opens its own window showing where the message goes (for a new chat: who will be in it, and its title), the post it replies to and the message itself. The message is posted, and a new chat created, only if you click **Send** there. Closing the window, clicking *Don't send*, or waiting 5 minutes all mean nothing is posted.
57
57
 
58
- If the AI stops waiting (it cancels, times out or loses its connection) while the window is open, the window closes and nothing is posted. If you had already clicked *Send* but no answer came back, the AI is told the message may have been posted and to check the chat before sending again, so it doesn't post twice.
58
+ If the AI stops waiting (it cancels, times out or loses its connection) while the window is open, the window closes and nothing is posted. If you had already clicked *Send* but no answer came back, the AI is told the message may have been posted and to check the chat before sending again, so it doesn't post twice. If Teams accepted the message but its answer, or the time in it, can't be read, the send is still reported as sent, with `time: null` and a `timeNote` saying the time isn't confirmed.
59
59
 
60
60
  Extensions older than 0.2.13 can't close that window, so a send that would open it in one is refused: `send_message` says nothing was sent and asks to update the extension. With several browsers, a send goes through when the browser picked for it is 0.2.13 or newer. If the bridge is held by another AI session running a version from before this check, that server doesn't check the browser it picks, so this session's sends are refused unless every connected browser is 0.2.13 or newer. The server keeps the installed folder up to date, so `reload_extension` (or reloading it on the Extensions page) is usually enough; run `npx mcp-teams setup` if it was loaded from another folder.
61
61
 
@@ -663,9 +663,11 @@ async function sendTo(key, tab, findTab, url, method, headers, body, ctx, wait,
663
663
  * full URL on it). Returns the parsed JSON (null for an empty answer). While Teams throttles
664
664
  * the service, the call waits that out if it fits the deadline; `wait: false` (for lookups
665
665
  * that can be done without) fails at once as busy instead. `repeatable`: a POST that only
666
- * reads (a search, a profile lookup), sent again after a 429 like a GET.
666
+ * reads (a search, a profile lookup), sent again after a 429 like a GET. `unreadable`: what a
667
+ * 2xx answer that isn't JSON returns instead of failing; for a post that went through whatever
668
+ * its answer says (a message), where an error would invite posting it again.
667
669
  */
668
- async function api(service, path, { method = "GET", body, raw = false, withLocation = false, ctx = null, wait = true, repeatable = method === "GET", onCapture } = {}) {
670
+ async function api(service, path, { method = "GET", body, raw = false, withLocation = false, ctx = null, wait = true, repeatable = method === "GET", onCapture, unreadable } = {}) {
669
671
  ctx?.check();
670
672
  let cap = await getCapture(service);
671
673
  // Opening a tab or waiting for a session can take a minute; a withdrawn request stops waiting.
@@ -710,6 +712,7 @@ async function api(service, path, { method = "GET", body, raw = false, withLocat
710
712
  try {
711
713
  return JSON.parse(res.text);
712
714
  } catch {
715
+ if (unreadable !== undefined) return unreadable;
713
716
  throw new Error(`Teams returned something that isn't JSON (${service}, HTTP ${res.status}).`);
714
717
  }
715
718
  }
@@ -1454,6 +1457,9 @@ const asConfirmed = (account) => async (cap) => {
1454
1457
  if ((cap.oid ?? (await signedInAccount())) !== account) throw Object.assign(new Error(ACCOUNT_CHANGED), { accountChanged: true });
1455
1458
  };
1456
1459
 
1460
+ const UNREADABLE = Symbol("unreadable answer");
1461
+ const TIME_UNCONFIRMED = "Posted: Teams accepted the message, but its answer couldn't be read, so the time isn't confirmed.";
1462
+
1457
1463
  /** Posts a confirmed message; `account`: who confirmed it (see asConfirmed). */
1458
1464
  async function sendMessage({ conversation, newChat, people, text, threadId, subject }, account) {
1459
1465
  if (newChat) {
@@ -1494,9 +1500,15 @@ async function sendMessage({ conversation, newChat, people, text, threadId, subj
1494
1500
  postType: "Standard",
1495
1501
  crossPostChannels: [],
1496
1502
  };
1497
- const r = await api("chatsvc", `/v1/users/ME/conversations/${encodeURIComponent(target)}/messages`, { method: "POST", body, onCapture: asConfirmed(account) });
1503
+ // Teams took the message (2xx) even when its answer can't be read: reported as sent, so
1504
+ // nothing invites posting it again, with its time marked as unconfirmed. The same holds when
1505
+ // the answer's time isn't a date.
1506
+ const r = await api("chatsvc", `/v1/users/ME/conversations/${encodeURIComponent(target)}/messages`, { method: "POST", body, onCapture: asConfirmed(account), unreadable: UNREADABLE });
1498
1507
  dropList(); // its last message changed: a list_chats right after must not show the old one
1499
- return { sent: true, conversation: conversation.title ?? conversation.id, time: r?.OriginalArrivalTime ? new Date(r.OriginalArrivalTime).toISOString() : null };
1508
+ const sent = { sent: true, conversation: conversation.title ?? conversation.id };
1509
+ const at = r && r !== UNREADABLE && r.OriginalArrivalTime ? new Date(r.OriginalArrivalTime) : null;
1510
+ if (r === UNREADABLE || (at && Number.isNaN(at.getTime()))) return { ...sent, time: null, timeNote: TIME_UNCONFIRMED };
1511
+ return { ...sent, time: at ? at.toISOString() : null };
1500
1512
  }
1501
1513
 
1502
1514
  // ------------------------------------------------------------ auto-send to self (autoSendTo)
@@ -2,7 +2,7 @@
2
2
  "manifest_version": 3,
3
3
  "key": "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvoz9Wexl4ZqY9YtEyBZsu/Qi5Ft5EjNUNB8b30wgt3AR8TjXI5UumcPQFBIm7ZfvBsjgrh6tBJlygsgFbZ5cB1EiI+WSz/2Wcqwz4eowKMXXPvGuDGrO+2O2zbSpTG19/MwTljI+g0TLfn8Vkoqd8z9MskKk+vCZjjV0Jk8QjVEdHypgM7H8zTuUM06SO12IIZMdeE3IURzf35zbjlfPPkJiDWoo3wB9nxAvLd57xrQhPUB/lGtCJk9mS3SY+/VwOlG5kJ9WS/RCHXcs5Qs7huIlKIatmFz7YiducvTR3DKBbjqbMTyqHzXkmkUmJRqzsYtgtKcz0C0cjFOt6uNdhwIDAQAB",
4
4
  "name": "mcp-teams bridge",
5
- "version": "0.3.34",
5
+ "version": "0.3.35",
6
6
  "description": "Lets AI assistants (via the mcp-teams MCP server) read and search Microsoft Teams chats, channels and meeting transcripts and, with your explicit confirmation, post messages.",
7
7
  "minimum_chrome_version": "116",
8
8
  "icons": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mcp-teams",
3
- "version": "0.3.34",
3
+ "version": "0.3.35",
4
4
  "description": "MCP server that lets AI assistants work with Microsoft Teams (web) through a Chrome/Edge extension bridge",
5
5
  "keywords": ["mcp", "model-context-protocol", "teams", "microsoft-teams", "microsoft-365", "chat", "claude", "chrome-extension"],
6
6
  "repository": {