mcp-teams 0.3.40 → 0.3.42
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/dist/build.json +1 -1
- package/extension/background.js +50 -14
- package/extension/manifest.json +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -110,7 +110,7 @@ A server that is already running keeps its code when the copy on disk changes (`
|
|
|
110
110
|
| `port` | `TEAMS_MCP_PORT` | `47393` (also set it in the extension popup) |
|
|
111
111
|
| `autoSendTo` | — | `[]`: every send shows the confirmation window |
|
|
112
112
|
|
|
113
|
-
`autoSendTo` is a list of your own email addresses (or UPNs), compared without regard to case or surrounding spaces, e.g. `"autoSendTo": ["you@example.com"]`. With it, `send_message` posts without the confirmation window when the message goes to you alone: your notes-to-self chat, a chat whose only member is you, or `to` with just your own address. The extension decides this itself after resolving the target: it looks up your profile and posts without asking only if one of your own addresses is on the list. Anything else (other people, group chats you are in, meetings, channels, a chat or profile it can't look up) shows the window as usual. The result then says `autoSent: true`. A send that began before Teams had shown who is signed in never goes without the window.
|
|
113
|
+
`autoSendTo` is a list of your own email addresses (or UPNs), compared without regard to case or surrounding spaces, e.g. `"autoSendTo": ["you@example.com"]`. With it, `send_message` posts without the confirmation window when the message goes to you alone: your notes-to-self chat, a chat whose only member is you, or `to` with just your own address. The extension decides this itself after resolving the target: it looks up your profile and posts without asking only if one of your own addresses is on the list. Anything else (other people, group chats you are in, meetings, channels, a chat or profile it can't look up) shows the window as usual. The result then says `autoSent: true`. A send that began before Teams had shown who is signed in never goes without the window. A `to` send then first waits for Teams' session, as any lookup does, and so learns who is signed in. Every send in that case shows the window only when its lookups reveal the account, and the window is for that account. Otherwise it is refused ("Teams hasn't shown who is signed in yet"): reload the Teams tab and send again. A send whose lookups spanned a switch of the signed-in account (even a switch back) posts nothing and opens no window ("changed while this send was being prepared"): check who is signed in and send again. A value that isn't a list of email addresses stops the server with an error. Restart the AI session after changing it.
|
|
114
114
|
|
|
115
115
|
## Security notes
|
|
116
116
|
|
package/dist/build.json
CHANGED
package/extension/background.js
CHANGED
|
@@ -1392,10 +1392,21 @@ export const handlers = {
|
|
|
1392
1392
|
if (to?.length) {
|
|
1393
1393
|
if (conversation) throw new Error("Give either a conversation or people (to), not both.");
|
|
1394
1394
|
if (threadId || subject) throw new Error("reply_to and subject are for channels; a new chat takes people and an optional title.");
|
|
1395
|
-
|
|
1396
|
-
|
|
1395
|
+
// A cold start: the chat list waits for Teams' session (at most as long as any lookup does),
|
|
1396
|
+
// which shows who is signed in. That account, read once, is "me" for the rest, and the send
|
|
1397
|
+
// goes only through the window, unless a switch landed meanwhile.
|
|
1398
|
+
let who = account;
|
|
1399
|
+
if (!who) {
|
|
1400
|
+
await teamsAndChats(false, ctx).catch(() => ctx?.check());
|
|
1401
|
+
who = await signedInAccount();
|
|
1402
|
+
if (switches !== accountSwitches) return { sent: false, reason: ACCOUNT_CHANGED_BEFORE };
|
|
1403
|
+
if (!who) throw new Error(NOT_SHOWN);
|
|
1404
|
+
}
|
|
1405
|
+
const me = `8:orgid:${who}`;
|
|
1397
1406
|
if (allow.length && !title && (await sendsToMeAlone(to, me, allow, ctx))) {
|
|
1398
|
-
return
|
|
1407
|
+
if (switches !== accountSwitches) return { sent: false, reason: ACCOUNT_CHANGED_BEFORE };
|
|
1408
|
+
const note = { conversation: NOTES_TO_SELF, text: String(text) };
|
|
1409
|
+
return account ? sendWithoutConfirming(note, ctx, account) : askUserToConfirm(note, ctx, who);
|
|
1399
1410
|
}
|
|
1400
1411
|
const people = await resolvePeople(to, me, ctx);
|
|
1401
1412
|
if (title && people.length < 2) throw new Error("A title is only for group chats (two or more people besides you).");
|
|
@@ -1403,7 +1414,8 @@ export const handlers = {
|
|
|
1403
1414
|
const request = existing
|
|
1404
1415
|
? { conversation: { id: existing.id, kind: existing.kind, title: existing.title }, people, text: String(text), existingChat: true }
|
|
1405
1416
|
: { conversation: null, newChat: { members: people.map((p) => p.mri), title: title ?? null }, people, text: String(text) };
|
|
1406
|
-
|
|
1417
|
+
if (switches !== accountSwitches) return { sent: false, reason: ACCOUNT_CHANGED_BEFORE };
|
|
1418
|
+
return askUserToConfirm(request, ctx, who);
|
|
1407
1419
|
}
|
|
1408
1420
|
const conv = await resolve(conversation, ctx);
|
|
1409
1421
|
if (threadId && conv.kind !== "channel") throw new Error("reply_to is only for channel posts; in a chat, just send the message.");
|
|
@@ -1415,8 +1427,12 @@ export const handlers = {
|
|
|
1415
1427
|
}
|
|
1416
1428
|
const request = { conversation: conv, text: String(text), threadId: threadId ?? null, subject: subject ?? null, replyingTo };
|
|
1417
1429
|
// Without an account known from the start, the decision to send goes to the user (the window).
|
|
1418
|
-
if (account
|
|
1419
|
-
|
|
1430
|
+
if (account) {
|
|
1431
|
+
const alone = allow.length && !threadId && !subject && (await isMeAlone(conv, `8:orgid:${account}`, allow, ctx));
|
|
1432
|
+
// Lookups that spanned a switch (even one back to this account) may have been another account's.
|
|
1433
|
+
if (switches !== accountSwitches) return { sent: false, reason: ACCOUNT_CHANGED_BEFORE };
|
|
1434
|
+
return alone ? sendWithoutConfirming(request, ctx, account) : askUserToConfirm(request, ctx, account);
|
|
1435
|
+
}
|
|
1420
1436
|
// A cold start: the lookups may have shown who is signed in. The window rests on that account,
|
|
1421
1437
|
// unless a switch landed since the send began, when they may have been another account's.
|
|
1422
1438
|
const shown = await signedInAccount();
|
|
@@ -1557,7 +1573,10 @@ async function myAddressesOrNone(me, ctx) {
|
|
|
1557
1573
|
});
|
|
1558
1574
|
}
|
|
1559
1575
|
|
|
1560
|
-
/**
|
|
1576
|
+
/**
|
|
1577
|
+
* `to` is just me (my MRI, or one of my own addresses), and one of my addresses is allowed.
|
|
1578
|
+
* `me`: the MRI of the account the send rests on, read once by requestSend (see isMeAlone).
|
|
1579
|
+
*/
|
|
1561
1580
|
async function sendsToMeAlone(to, me, allow, ctx) {
|
|
1562
1581
|
if (to.length !== 1) return false;
|
|
1563
1582
|
const q = String(to[0]).trim().toLowerCase();
|
|
@@ -1568,10 +1587,11 @@ async function sendsToMeAlone(to, me, allow, ctx) {
|
|
|
1568
1587
|
return mine.some((a) => allow.includes(a));
|
|
1569
1588
|
}
|
|
1570
1589
|
|
|
1571
|
-
/**
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1590
|
+
/**
|
|
1591
|
+
* The resolved conversation reaches me alone, and one of my addresses is allowed. `me`: the MRI
|
|
1592
|
+
* of the account the send started with, which the judgement is for (never read again here).
|
|
1593
|
+
*/
|
|
1594
|
+
async function isMeAlone(conv, me, allow, ctx) {
|
|
1575
1595
|
let alone = conv.id === NOTES_TO_SELF.id;
|
|
1576
1596
|
if (!alone && conv.kind !== "channel" && conv.kind !== "meeting") {
|
|
1577
1597
|
// Members from a fresh list: a chat that has anyone else in it is never auto-sent.
|
|
@@ -1806,6 +1826,21 @@ function reconnectNow() {
|
|
|
1806
1826
|
retryMs = RETRY_MIN_MS;
|
|
1807
1827
|
}
|
|
1808
1828
|
|
|
1829
|
+
let reconnecting = true; // false only after stopReconnecting()
|
|
1830
|
+
|
|
1831
|
+
/**
|
|
1832
|
+
* For tests only (nothing in the extension calls it): the worker never connects again, and no
|
|
1833
|
+
* retry or watchdog is left waiting. A test's teardown calls it before the hub's connections end
|
|
1834
|
+
* and its fake chrome goes, since a retry would otherwise run connect() without chrome.
|
|
1835
|
+
*/
|
|
1836
|
+
export function stopReconnecting() {
|
|
1837
|
+
reconnecting = false;
|
|
1838
|
+
clearTimeout(retryTimer);
|
|
1839
|
+
retryTimer = null;
|
|
1840
|
+
clearTimeout(watchdog?.timer);
|
|
1841
|
+
watchdog = null;
|
|
1842
|
+
}
|
|
1843
|
+
|
|
1809
1844
|
/**
|
|
1810
1845
|
* The pairing token: one saved under Advanced, else the one setup wrote into this
|
|
1811
1846
|
* folder (pairing.json, only in the installed copy). Null when there is none.
|
|
@@ -1827,7 +1862,7 @@ async function pairingToken(saved) {
|
|
|
1827
1862
|
* the port gets nothing.
|
|
1828
1863
|
*/
|
|
1829
1864
|
async function connect() {
|
|
1830
|
-
if (starting || (ws && (ws.readyState === WebSocket.OPEN || ws.readyState === WebSocket.CONNECTING))) return;
|
|
1865
|
+
if (!reconnecting || starting || (ws && (ws.readyState === WebSocket.OPEN || ws.readyState === WebSocket.CONNECTING))) return;
|
|
1831
1866
|
clearTimeout(retryTimer);
|
|
1832
1867
|
retryTimer = null;
|
|
1833
1868
|
starting = true;
|
|
@@ -1843,7 +1878,8 @@ async function connect() {
|
|
|
1843
1878
|
} finally {
|
|
1844
1879
|
starting = false;
|
|
1845
1880
|
}
|
|
1846
|
-
|
|
1881
|
+
// stopReconnecting() may have run while the storage read was waiting.
|
|
1882
|
+
if (ws || !reconnecting) return;
|
|
1847
1883
|
state = "connecting";
|
|
1848
1884
|
const socket = new WebSocket(`ws://127.0.0.1:${port || DEFAULT_PORT}`);
|
|
1849
1885
|
ws = socket;
|
|
@@ -1912,7 +1948,7 @@ async function connect() {
|
|
|
1912
1948
|
// When a server session ends, another one takes over the port within a second:
|
|
1913
1949
|
// retry soon, backing off to the alarm's pace.
|
|
1914
1950
|
clearTimeout(retryTimer);
|
|
1915
|
-
retryTimer = setTimeout(connect, retryMs);
|
|
1951
|
+
retryTimer = reconnecting ? setTimeout(connect, retryMs) : null;
|
|
1916
1952
|
retryMs = Math.min(retryMs * 2, RETRY_MAX_MS);
|
|
1917
1953
|
if (state === "unauthorized" && !authed && lastError) {
|
|
1918
1954
|
// refuse() said why.
|
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.42",
|
|
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.42",
|
|
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": {
|