mcp-teams 0.3.33 → 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 +1 -1
- package/extension/background.js +27 -5
- package/extension/manifest.json +1 -1
- package/package.json +1 -1
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
|
|
package/extension/background.js
CHANGED
|
@@ -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
|
}
|
|
@@ -1062,6 +1065,7 @@ async function fetchMessages(id, opts) {
|
|
|
1062
1065
|
}
|
|
1063
1066
|
|
|
1064
1067
|
const MAX_PAGES = 20;
|
|
1068
|
+
const MESSAGES_ACCOUNT_CHANGED = ACCOUNT_CHANGED_WHILE("messages were read", "reads them as that account");
|
|
1065
1069
|
|
|
1066
1070
|
/** The conversation id chatsvc pages: the conversation, or one channel post's thread. */
|
|
1067
1071
|
const messagesTarget = (id, threadId) => (threadId ? `${id};messageid=${threadId}` : id);
|
|
@@ -1081,9 +1085,18 @@ async function fetchMessagePages(id, { limit, olderThan, includeSystem, threadId
|
|
|
1081
1085
|
const linkOf = new Map();
|
|
1082
1086
|
let counted = 0;
|
|
1083
1087
|
let pages = 0;
|
|
1088
|
+
// Every page is read as one account: the user of the first page's session (its oid; a 401
|
|
1089
|
+
// can bring the same user a session on another base), with no switch landing meanwhile.
|
|
1090
|
+
const switches = accountSwitches;
|
|
1091
|
+
let readAs; // the oid the pages are read as, from the first session used
|
|
1092
|
+
const sameAccount = (cap) => {
|
|
1093
|
+
if (readAs === undefined) readAs = cap.oid ?? null;
|
|
1094
|
+
if ((cap.oid ?? null) !== readAs) throw new Error(MESSAGES_ACCOUNT_CHANGED);
|
|
1095
|
+
};
|
|
1084
1096
|
while (path) {
|
|
1085
1097
|
if (pages === MAX_PAGES) return { raw, linkOf, first, next: path, capped: true, pages };
|
|
1086
|
-
const json = await api("chatsvc", path, { ctx });
|
|
1098
|
+
const json = await api("chatsvc", path, { ctx, onCapture: sameAccount });
|
|
1099
|
+
if (switches !== accountSwitches) throw new Error(MESSAGES_ACCOUNT_CHANGED);
|
|
1087
1100
|
pages++;
|
|
1088
1101
|
const msgs = json?.messages ?? [];
|
|
1089
1102
|
for (const m of msgs) {
|
|
@@ -1444,6 +1457,9 @@ const asConfirmed = (account) => async (cap) => {
|
|
|
1444
1457
|
if ((cap.oid ?? (await signedInAccount())) !== account) throw Object.assign(new Error(ACCOUNT_CHANGED), { accountChanged: true });
|
|
1445
1458
|
};
|
|
1446
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
|
+
|
|
1447
1463
|
/** Posts a confirmed message; `account`: who confirmed it (see asConfirmed). */
|
|
1448
1464
|
async function sendMessage({ conversation, newChat, people, text, threadId, subject }, account) {
|
|
1449
1465
|
if (newChat) {
|
|
@@ -1484,9 +1500,15 @@ async function sendMessage({ conversation, newChat, people, text, threadId, subj
|
|
|
1484
1500
|
postType: "Standard",
|
|
1485
1501
|
crossPostChannels: [],
|
|
1486
1502
|
};
|
|
1487
|
-
|
|
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 });
|
|
1488
1507
|
dropList(); // its last message changed: a list_chats right after must not show the old one
|
|
1489
|
-
|
|
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 };
|
|
1490
1512
|
}
|
|
1491
1513
|
|
|
1492
1514
|
// ------------------------------------------------------------ auto-send to self (autoSendTo)
|
package/extension/manifest.json
CHANGED
|
@@ -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.
|
|
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.
|
|
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": {
|