@chrischall/microsoft-teams-mcp 0.4.0 → 0.5.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.
- package/.claude-plugin/marketplace.json +2 -2
- package/.claude-plugin/plugin.json +1 -1
- package/README.md +344 -32
- package/dist/bundle.js +2216 -474
- package/dist/chatsvc.js +81 -9
- package/dist/index.js +10 -1
- package/dist/model.js +119 -15
- package/dist/network-error.js +124 -0
- package/dist/sharepoint.js +13 -3
- package/dist/substrate-auth.js +104 -0
- package/dist/substrate-token-cache.js +64 -0
- package/dist/substrate.js +326 -0
- package/dist/tools/attachment.js +5 -0
- package/dist/tools/changes.js +241 -0
- package/dist/tools/channels.js +5 -3
- package/dist/tools/chat-search.js +65 -0
- package/dist/tools/chat.js +89 -14
- package/dist/tools/confirm.js +50 -7
- package/dist/tools/conversation.js +326 -102
- package/dist/tools/cursor.js +43 -0
- package/dist/tools/format.js +135 -0
- package/dist/tools/healthcheck.js +7 -2
- package/dist/tools/listing.js +74 -10
- package/dist/tools/markread.js +246 -0
- package/dist/tools/roots.js +73 -0
- package/dist/tools/search.js +426 -0
- package/dist/tools/timezone.js +38 -0
- package/dist/tools/unread.js +140 -39
- package/dist/version.js +1 -1
- package/mint.yaml +16 -2
- package/package.json +1 -1
- package/server.json +10 -3
- package/skills/teams-fpx/SKILL.md +6 -3
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
},
|
|
8
8
|
"metadata": {
|
|
9
9
|
"description": "MCP server for Microsoft Teams — read any chat or channel, your unread messages, and their attachments, and send messages and reactions (each confirmed first)",
|
|
10
|
-
"version": "0.
|
|
10
|
+
"version": "0.5.1"
|
|
11
11
|
},
|
|
12
12
|
"plugins": [
|
|
13
13
|
{
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"displayName": "Microsoft Teams",
|
|
16
16
|
"source": "./",
|
|
17
17
|
"description": "MCP server for Microsoft Teams — read any chat or channel, your unread messages, and their attachments, and send messages and reactions (each confirmed first), via your signed-in browser session",
|
|
18
|
-
"version": "0.
|
|
18
|
+
"version": "0.5.1",
|
|
19
19
|
"author": {
|
|
20
20
|
"name": "Chris Hall"
|
|
21
21
|
},
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "microsoft-teams-mcp",
|
|
3
3
|
"displayName": "Microsoft Teams",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.5.1",
|
|
5
5
|
"description": "Microsoft Teams for Claude — read any chat or channel, your unread messages, and their attachments, and send messages and reactions (each confirmed first), using your signed-in browser session",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Chris Hall",
|
package/README.md
CHANGED
|
@@ -32,10 +32,13 @@ it like any chat — no Activity view (or any view) needs to be open, and
|
|
|
32
32
|
nothing reads the page. The bridge is used for one thing only: capturing the
|
|
33
33
|
token.
|
|
34
34
|
|
|
35
|
-
|
|
36
|
-
your Teams unread badges exactly as they were
|
|
37
|
-
|
|
38
|
-
|
|
35
|
+
By default nothing here marks anything read. Reading a chat through this
|
|
36
|
+
server leaves your Teams unread badges exactly as they were — unless you ask
|
|
37
|
+
for it: `teams_mark_read`, or `mark_read: true` on `teams_read_conversation`
|
|
38
|
+
/ `teams_get_unread`, moves your read marker forward. The writes —
|
|
39
|
+
`teams_send_message`, `teams_react` and marking read — go through the same
|
|
40
|
+
chat-service API and change nothing until you confirm (see
|
|
41
|
+
[Writes](#writes)).
|
|
39
42
|
|
|
40
43
|
## SharePoint file download
|
|
41
44
|
|
|
@@ -63,6 +66,48 @@ how the chat-service token is captured:
|
|
|
63
66
|
a SharePoint host your token does not cover, comes back as metadata and its
|
|
64
67
|
open link rather than failing.
|
|
65
68
|
|
|
69
|
+
## Substrate search
|
|
70
|
+
|
|
71
|
+
`teams_search_messages` searches the way the Teams search box does: through
|
|
72
|
+
**Microsoft Substrate** (`POST https://substrate.office.com/searchservice/api/v2/query`).
|
|
73
|
+
Substrate does not accept the chat-service token either, so search captures a
|
|
74
|
+
**third token** — off the request the Teams tab makes to
|
|
75
|
+
`substrate.office.com/searchservice/*` when you run a search there — and caches it
|
|
76
|
+
in `~/.microsoft-teams-mcp/substrate-token.json`. As with the other two, it is
|
|
77
|
+
read only from the request header, never from page storage.
|
|
78
|
+
|
|
79
|
+
- **A one-time re-pair.** The search path declares its own trust scope,
|
|
80
|
+
`substrate.office.com`, which the ContextMint Bridge grant has to cover. If you
|
|
81
|
+
paired `microsoft-teams-mcp` before this feature, revoke and re-pair it in the
|
|
82
|
+
bridge popup once. The chat-service and SharePoint captures are untouched.
|
|
83
|
+
- **Run a search in Teams once.** The token is read off the Teams tab's own
|
|
84
|
+
search request, so the first search may need you to type anything into the
|
|
85
|
+
Teams search box and press Enter while the capture waits
|
|
86
|
+
(`TEAMS_CAPTURE_TIMEOUT`, default 30s).
|
|
87
|
+
- **It falls back to scanning.** In the default `mode: "auto"`, when no Substrate
|
|
88
|
+
token can be captured or the search fails, the tool scans recent conversations
|
|
89
|
+
instead (`source: "scan"`, with a `fallback_reason`), and does not wait on
|
|
90
|
+
another capture for 10 minutes. `mode: "substrate"` fails instead;
|
|
91
|
+
`mode: "scan"` never touches Substrate.
|
|
92
|
+
|
|
93
|
+
- **It does not re-capture in a loop.** If a freshly captured token is still
|
|
94
|
+
refused (401), the same 10-minute cooldown applies, so `auto` goes straight
|
|
95
|
+
to the scan instead of waiting on the bridge every call.
|
|
96
|
+
|
|
97
|
+
> **Verified live 2026-10-12.** A token captured off the Teams tab's own
|
|
98
|
+
> search request (it lives about 1.4 hours) was replayed from Node against
|
|
99
|
+
> read-only queries such as `deploy`. Confirmed: the request body (`cvid`, `logicalId`
|
|
100
|
+
> and a `scenario` are required; the sort is `{ Field: "Time", SortDirection:
|
|
101
|
+
> "Desc" }`), that no header beyond the bearer is needed, the response fields
|
|
102
|
+
> (conversation in `ClientThreadId`, a channel root in `ClientConversationId`'s
|
|
103
|
+
> `;messageid=`, the message id in `InternetMessageId`, sender name and SMTP
|
|
104
|
+
> address but no MRI, a plain-text `Preview` of at most ~255 characters, an
|
|
105
|
+
> approximate `Total`), paging by `from`/`size` (up to 200), and that
|
|
106
|
+
> `conversation` and `since` can be sent server-side as `ClientThreadId:"…"`
|
|
107
|
+
> and an unquoted `sent>=…`. `from` stays client-side: Substrate's own `from:`
|
|
108
|
+
> matches word prefixes, not "display name contains". A redacted response is
|
|
109
|
+
> in `tests/fixtures/substrate-query-response.json`.
|
|
110
|
+
|
|
66
111
|
## Install
|
|
67
112
|
|
|
68
113
|
```sh
|
|
@@ -122,6 +167,8 @@ Everything is optional — by default the token is captured from your browser.
|
|
|
122
167
|
| `TEAMS_CAPTURE_TIMEOUT` | Seconds to wait for the Teams tab to issue a chat-service request. Defaults to `30`. The bridge deadline is derived from it (window + 15s). |
|
|
123
168
|
| `TEAMS_TOKEN_CACHE` | `false` to keep the captured token in memory only. Defaults to on. |
|
|
124
169
|
| `TEAMS_TOKEN_FILE` | Where the captured token is cached. Defaults to `~/.microsoft-teams-mcp/token.json`. |
|
|
170
|
+
| `TEAMS_SUBSTRATE_TOKEN_FILE` | Where the captured Substrate search token is cached. Defaults to `~/.microsoft-teams-mcp/substrate-token.json`. `TEAMS_TOKEN_CACHE=false` keeps it in memory too. |
|
|
171
|
+
| `TEAMS_TIME_ZONE` | Default IANA time zone (e.g. `America/New_York`) for the `tz` argument of `teams_read_conversation` and `teams_get_unread`: each message then carries `time_local` (ISO 8601 with offset) next to its UTC `time`. Unset means no `time_local` unless `tz` is passed; a name `Intl` does not know is reported as an error. |
|
|
125
172
|
| `TEAMS_WS_PORT` | fetchproxy concentrator port. Defaults to `37149`, the fleet-wide shared port. |
|
|
126
173
|
| `FETCHPROXY_WS_HOST` | Bind interface for the bridge (default `127.0.0.1`; a literal IP only, anything else is ignored). Keep on loopback — it exists for ONE topology: a hosted child in its own network namespace. |
|
|
127
174
|
| `FETCHPROXY_IDENTITY_DIR` | Where to store the long-term fetchproxy identity keypair (default `~/.fetchproxy/identity/`; an absolute path only, anything else is ignored). Exists for a host that runs a separate child per caller, so they can share one identity. |
|
|
@@ -134,8 +181,17 @@ Everything is optional — by default the token is captured from your browser.
|
|
|
134
181
|
recent activity first: id, kind,
|
|
135
182
|
title, unread hint, ISO-8601 last-activity time, last-message preview and
|
|
136
183
|
sender. `unread_only` (exact — see below), `since_days` (with
|
|
137
|
-
`unread_only`; default 14), `
|
|
138
|
-
`
|
|
184
|
+
`unread_only`; default 14), `older_unread` (with `unread_only`; lists what
|
|
185
|
+
`since_days` left out — see below), `query` (title, a participant's name, or the
|
|
186
|
+
last-message preview), `search_messages`,
|
|
187
|
+
`since` / `until` (ISO 8601 date-times: keep chats whose last activity is
|
|
188
|
+
at or after / at or before them; a chat with no last activity is left out
|
|
189
|
+
when either is given), `sort` and `limit` (default 50, max 500; keeps the
|
|
190
|
+
head of the sort order). `sort` is `activity` (default — favorites, pinned,
|
|
191
|
+
then most recent; with `unread_only`, most recent), `activity_only` (most
|
|
192
|
+
recent first, ignoring favorites and pinned) or `title` (alphabetical,
|
|
193
|
+
case-insensitive — this titles every untitled chat in the listing before
|
|
194
|
+
`limit` applies, so it reads more than the other orders). A group chat with no topic is titled after
|
|
139
195
|
who is in it — `Group chat: <up to three recent senders other than you,
|
|
140
196
|
most recent first>` plus `+N` for more, with every recent sender in
|
|
141
197
|
`participants` — rather than after whoever posted last, so chats that
|
|
@@ -148,41 +204,216 @@ Everything is optional — by default the token is captured from your browser.
|
|
|
148
204
|
last one, `(1:1 chat)` if they wrote nothing recently. `query` matches such
|
|
149
205
|
chats by their participants, never by the made-up `Group chat:` or
|
|
150
206
|
`(1:1 chat)` titles, so `group` or `chat` does not hit every untitled chat.
|
|
207
|
+
With a `query`, every row carries `match_reason` — the first of `id` (an
|
|
208
|
+
exact id), `title`, `team`, `participant` (an untitled chat's participant,
|
|
209
|
+
including a 1:1's other person) or `message` that applies. `message` means
|
|
210
|
+
the query was found in what was said, not in what the chat is called: by
|
|
211
|
+
default only the last-message preview the listing already carries is
|
|
212
|
+
checked (no extra reads). `search_messages: true` (needs `query`) also
|
|
213
|
+
reads the last 50 messages of every chat no name or preview matched, four
|
|
214
|
+
at a time, and returns the ones where a message a person wrote contains
|
|
215
|
+
the query, with the newest such message as `matched_message` (`id`,
|
|
216
|
+
`time`, `sender`, `text` cut to a window around the match). It is one read
|
|
217
|
+
per chat, so narrow a large listing with `since` / `until` or
|
|
218
|
+
`unread_only`; chats whose read failed are counted in
|
|
219
|
+
`messages_not_searched`.
|
|
151
220
|
Conversations the chat service marks favorite or pinned carry
|
|
152
221
|
`favorite: true` / `pinned: true` and lead the plain listing (favorites,
|
|
153
222
|
then pinned); `unread_only` keeps most-recent-first order but carries the
|
|
154
223
|
flags. Note the new Teams **Favorites section for chats** is kept by a
|
|
155
224
|
different Teams service this MCP does not read, so a chat you put there is
|
|
156
225
|
not flagged (verified live 2026-10-10) — the flags mostly reflect favorited
|
|
157
|
-
channels and pinned conversations.
|
|
226
|
+
channels and pinned conversations. A chat you muted in Teams carries
|
|
227
|
+
`muted: true`.
|
|
158
228
|
- `teams_list_teams_and_channels` — every channel you are in, by team then
|
|
159
229
|
title, with the same fields — favorite and pinned channels first, flagged
|
|
160
230
|
as in `teams_list_chats`. Channels you have hidden in Teams are listed
|
|
161
231
|
after the rest with `hidden: true`, and left out of `unread_only` unless
|
|
162
232
|
`include_hidden` is set. `unread_only`, `include_hidden`, `since_days`
|
|
163
|
-
(with `unread_only`; default 14), `query` (channel or team name
|
|
233
|
+
(with `unread_only`; default 14), `query` (channel or team name, or the
|
|
234
|
+
last-message preview; each match carries `match_reason`, as in
|
|
235
|
+
`teams_list_chats`) and
|
|
164
236
|
`limit` (default 50, max 500).
|
|
165
237
|
- `teams_read_conversation` — read any chat or channel by id or name,
|
|
166
|
-
oldest first: sender, ISO
|
|
167
|
-
and attachments. A channel comes back as threads (root post + replies).
|
|
168
|
-
|
|
169
|
-
|
|
238
|
+
oldest first: sender, time (UTC, ISO 8601), text, subject, edited/deleted
|
|
239
|
+
flags and attachments. A channel comes back as threads (root post + replies).
|
|
240
|
+
A thread whose root post is older than the window (a reply came in after
|
|
241
|
+
`since`, `limit` or `after_message_id` cut the read) still shows its root:
|
|
242
|
+
it is fetched by id and marked `outside_window: true` — context only, not
|
|
243
|
+
counted in `unread_count` or `message_count` and never the `next_cursor`.
|
|
244
|
+
Up to 25 roots are fetched per call (shared by every conversation it
|
|
245
|
+
reads, newest threads first); one past that, or one that cannot be
|
|
246
|
+
fetched, is `{ id, missing: true }`.
|
|
247
|
+
`unread_only`, `since` (ISO 8601), `limit` (default 50, max 500, newest
|
|
248
|
+
kept) and `tz` (an IANA time zone such as `America/New_York`, default
|
|
249
|
+
`TEAMS_TIME_ZONE`), which adds `time_local` — the same instant in that zone,
|
|
250
|
+
ISO 8601 with its offset — next to each message's `time`. Message text is
|
|
251
|
+
never truncated, and a table's cells are separated by ` | `, one row per
|
|
252
|
+
line. The resolved `conversation` carries `match_reason` (`id`, `title`,
|
|
253
|
+
`team` or `participant`); a name never resolves by what was said in a
|
|
254
|
+
chat, since `teams_send_message` and `teams_react` name their target the
|
|
255
|
+
same way. An ambiguous name is not an error here: the result is
|
|
256
|
+
`{ambiguous: true, query, match_count, candidates, hint}` — up to 10
|
|
257
|
+
candidates, each with `id`, `title`, `kind`, `team` (channels),
|
|
258
|
+
`lastActivity` and `match_reason` — and no messages, so you can read again
|
|
259
|
+
by one candidate's id (`teams_send_message` and `teams_react` still refuse
|
|
260
|
+
an ambiguous name outright, since a write never guesses); an
|
|
170
261
|
untitled group chat can be named by one of its participants, and a 1:1 by
|
|
171
262
|
the other person (this, and the same naming in `teams_send_message` /
|
|
172
263
|
`teams_react`, titles every untitled chat first).
|
|
173
264
|
`48:notes` — or the name `notes` / `self` — is your notes self-chat.
|
|
265
|
+
`after_message_id` returns only messages newer than that id (the read
|
|
266
|
+
stops at the first message at or before it, alongside `unread_only`,
|
|
267
|
+
`since` and `limit`); every result carries `next_cursor` — the newest
|
|
268
|
+
returned message's id, or the `after_message_id` you passed when nothing
|
|
269
|
+
is new — so passing it back as `after_message_id` reads only what arrived
|
|
270
|
+
since. `after_message_id` takes message ids only: to read what
|
|
271
|
+
`teams_get_changes` counted, pass that row's `after_message_id`, not its
|
|
272
|
+
`next_cursor`. See [Cursors](#cursors-only-what-is-new).
|
|
273
|
+
`format` sets how much comes back: `full` (default, everything above),
|
|
274
|
+
`compact` (each message only `id`, `time`, `time_local`, `sender`, `text`,
|
|
275
|
+
plus `subject` when set — no reactions, attachments or edited/deleted
|
|
276
|
+
flags — and the conversation only `id`, `kind`, `title`, `team`) or
|
|
277
|
+
`summary` (no messages: `message_count`, `newest_time` and, for a channel,
|
|
278
|
+
one `{ root_id, subject, reply_count, newest_time }` per thread, with
|
|
279
|
+
`root_outside_window: true` or `root_missing: true` for a root from
|
|
280
|
+
outside the window).
|
|
281
|
+
`conversation` may also be an array of up to 20 ids or names: the result
|
|
282
|
+
is then `{ conversations: [...], errors, fetched_at }`, one single-read
|
|
283
|
+
result per conversation (the other arguments apply to each), read four at
|
|
284
|
+
a time; an ambiguous name takes its place in `conversations` as the same
|
|
285
|
+
`{ambiguous: true, query, match_count, candidates, hint}` object a single
|
|
286
|
+
read returns, one that cannot be resolved or read is listed in `errors`
|
|
287
|
+
with its reason, and the rest still come back. A single string returns
|
|
288
|
+
exactly the shape above.
|
|
289
|
+
By default it does not mark anything read; `mark_read: true` also moves
|
|
290
|
+
your read marker up to the newest message returned (never backwards;
|
|
291
|
+
`outside_window` roots do not count) and reports `marked_read` — a write,
|
|
292
|
+
so it asks you to confirm first. With an array, each conversation read is
|
|
293
|
+
marked up to its own newest message, and one confirmation covers them all.
|
|
294
|
+
It never marks a message you were not given: `mark_read` with
|
|
295
|
+
`format: "summary"` is refused (`compact` is fine), and when `limit` or
|
|
296
|
+
`since` cut off unread messages older than those returned, that
|
|
297
|
+
conversation's marker stays put and it reports
|
|
298
|
+
`marked_read: { skipped: "truncated" | "since", hint }` (a `limit` that cut
|
|
299
|
+
only messages you had already read still marks). An empty read, or an
|
|
300
|
+
`after_message_id` with nothing new, marks nothing (`marked_read: false`).
|
|
174
301
|
- `teams_get_unread` — every unread message across your chats and channels,
|
|
175
302
|
grouped by conversation, most recent first. Filter by `kinds` (`chat`,
|
|
176
303
|
`channel`, `meeting`, `oneOnOne`) or `query` (title, channel or team
|
|
177
|
-
name,
|
|
304
|
+
name, an untitled chat's participant name, or the last-message preview —
|
|
305
|
+
each conversation then carries `match_reason`, as in `teams_list_chats`);
|
|
306
|
+
`per_conversation_limit`
|
|
178
307
|
(default 50) and `max_conversations` (default 20 returned with their
|
|
179
308
|
messages — the rest are named, with their `unread_count`, in
|
|
180
309
|
`more_unread_conversations`). Hidden channels are left out unless
|
|
181
|
-
`include_hidden
|
|
182
|
-
|
|
183
|
-
|
|
310
|
+
`include_hidden`; chats you muted in Teams (`muted: true`) are left out
|
|
311
|
+
unread and counted in `muted_skipped` unless `include_muted`. Only
|
|
312
|
+
conversations with unread messages from the last `since_days` (default 14,
|
|
313
|
+
max 3650) are returned; older ones are counted in `older_unread_skipped`,
|
|
314
|
+
and `older_unread: true` also lists them (see below). An untitled group chat or 1:1 is titled after
|
|
184
315
|
its participants, as in `teams_list_chats` — in `conversations`, in
|
|
185
|
-
`more_unread_conversations` and in `errors`.
|
|
316
|
+
`more_unread_conversations` and in `errors`. By default it does not mark
|
|
317
|
+
anything read; `mark_read: true` also moves the read marker of each
|
|
318
|
+
conversation returned with its messages (not `more_unread_conversations`)
|
|
319
|
+
up to its newest unread message returned, and reports `marked_read` per
|
|
320
|
+
conversation (with `mark_read_warning` when that move failed). One
|
|
321
|
+
confirmation covers every move. It never marks a message you were not
|
|
322
|
+
given: `mark_read` with `format: "summary"` is refused (`compact` is
|
|
323
|
+
fine), a conversation `per_conversation_limit` cut keeps its marker and
|
|
324
|
+
reports `marked_read: { skipped: "truncated", hint }`, and `outside_window`
|
|
325
|
+
roots never count. `tz` (default
|
|
326
|
+
`TEAMS_TIME_ZONE`) adds each message's `time_local`, as in
|
|
327
|
+
`teams_read_conversation`. A channel's unread replies come grouped under
|
|
328
|
+
their root post; a root you had already read is fetched and marked
|
|
329
|
+
`outside_window: true` (not unread, not counted), up to 25 per call as in
|
|
330
|
+
`teams_read_conversation`, else `{ id, missing: true }`. `cursors` — `{ "<conversation id>": "<message id>" }`
|
|
331
|
+
— returns, per conversation, only unread messages newer than its cursor
|
|
332
|
+
(each read stops at the later of the read marker and the cursor; a
|
|
333
|
+
conversation with nothing past its cursor is left out). Each returned
|
|
334
|
+
conversation carries `next_cursor`, and the result carries `next_cursors`:
|
|
335
|
+
the cursors you passed, updated with every returned conversation's
|
|
336
|
+
`next_cursor` — pass it back as `cursors` next time.
|
|
337
|
+
`format` (`full`, `compact` or `summary`) trims each conversation as in
|
|
338
|
+
`teams_read_conversation`; every format keeps the conversation `id`,
|
|
339
|
+
`unread_count` and `next_cursor`.
|
|
340
|
+
- `teams_get_changes` — which chats and channels got new messages since a
|
|
341
|
+
cursor: counts, not messages. Each changed conversation comes back with its
|
|
342
|
+
summary, `new_message_count` (real messages only — call recordings and other
|
|
343
|
+
system events, and deleted messages, are not counted),
|
|
344
|
+
`new_from_others_count`, `newest_time` and, for a channel, `threads`: one
|
|
345
|
+
`{ root_id, new_root, new_reply_count }` per thread the new messages landed
|
|
346
|
+
in, including a thread whose root post is older than the cursor, and
|
|
347
|
+
`after_message_id` — the value to pass to `teams_read_conversation` as
|
|
348
|
+
`after_message_id` to read exactly the messages counted (a message id is
|
|
349
|
+
its arrival ms, so this is the cursor time written as an id). Without
|
|
350
|
+
`cursor` it looks back 24 hours. `next_cursor` is an opaque token (base64url
|
|
351
|
+
of `{"t": <epoch ms>}`; `cursor` also takes a plain ISO 8601 time) — pass it
|
|
352
|
+
back to see only what arrived since. It is at-least-once: a conversation can
|
|
353
|
+
come back twice, but none is skipped, and it stays put when a read failed
|
|
354
|
+
(`errors`). `kinds` and `include_hidden` filter as in `teams_get_unread` —
|
|
355
|
+
use the same ones with a cursor as the call that returned it; `limit`
|
|
356
|
+
(default 50, max 200) caps the conversations returned, the rest are named in
|
|
357
|
+
`more_conversations` (each with its `after_message_id` too). Then read what
|
|
358
|
+
changed with `teams_read_conversation`, handing on the row's
|
|
359
|
+
`after_message_id` — **not** `next_cursor`, which is a time token that only
|
|
360
|
+
`teams_get_changes` accepts (`teams_read_conversation` rejects it, and
|
|
361
|
+
`teams_get_changes` rejects a message id):
|
|
362
|
+
|
|
363
|
+
```jsonc
|
|
364
|
+
// first call: the last 24 hours
|
|
365
|
+
teams_get_changes({})
|
|
366
|
+
// → { since, total_new_messages: 5, conversations: [
|
|
367
|
+
// { conversation: { id: "19:…@thread.tacv2", kind: "channel", title: "Design", … },
|
|
368
|
+
// new_message_count: 3, new_from_others_count: 3, newest_time: "…",
|
|
369
|
+
// after_message_id: "1791728801361",
|
|
370
|
+
// threads: [{ root_id: "1791803726629", new_root: false, new_reply_count: 2 }, …] }, … ],
|
|
371
|
+
// next_cursor: "eyJ0IjoxNzkxODE1MjAxMzYxfQ", next_cursor_time: "…", fetched_at }
|
|
372
|
+
// read the messages it counted in one conversation: hand on the row's after_message_id
|
|
373
|
+
teams_read_conversation({ conversation: "19:…@thread.tacv2", after_message_id: "1791728801361" })
|
|
374
|
+
// later: only what arrived since — next_cursor goes back to teams_get_changes only
|
|
375
|
+
teams_get_changes({ cursor: "eyJ0IjoxNzkxODE1MjAxMzYxfQ" })
|
|
376
|
+
```
|
|
377
|
+
|
|
378
|
+
A channel reply moves only the listing's `lastUpdatedMessageId` (its
|
|
379
|
+
`lastMessage` stays on the newest root post), so that is what nominates a
|
|
380
|
+
channel; each conversation is then read newest *change* first down to the
|
|
381
|
+
cursor, since an old message edited after it is served ahead of new ones.
|
|
382
|
+
A hidden channel's listing entry stops moving altogether, so with
|
|
383
|
+
`include_hidden` every hidden channel is read.
|
|
384
|
+
- `teams_search_messages` — find messages by text across your chats and
|
|
385
|
+
channels, newest first: each hit names its conversation (id, title, kind,
|
|
386
|
+
team) and carries the message's id, ISO-8601 time, sender, `fromMe` (scan
|
|
387
|
+
only), plain text, subject and `replyTo` (a channel reply's root) — read it in context
|
|
388
|
+
with `teams_read_conversation`. `conversation` narrows to one chat or
|
|
389
|
+
channel (id or name, as in `teams_read_conversation`), `from` to senders
|
|
390
|
+
whose display name contains it, `since` (ISO 8601; default the last 30 days)
|
|
391
|
+
sets how far back to look, `limit` caps the hits (default 25, max 200;
|
|
392
|
+
`total_hits` and `truncated` say when there were more). `source` says which
|
|
393
|
+
path answered:
|
|
394
|
+
- `"substrate"` (the default, `mode: "auto"`) — Teams' own search through
|
|
395
|
+
[Microsoft Substrate](#substrate-search): matched the way the Teams search
|
|
396
|
+
box matches (words ANDed with stemming, so `deploy` also finds
|
|
397
|
+
"deployed"; `"quoted phrases"`; `OR`), across all of your conversations
|
|
398
|
+
rather than the most recent ones. `conversation` and `since` are sent to
|
|
399
|
+
Substrate itself; `from` is applied to what it returns, 50 results a page,
|
|
400
|
+
up to 10 pages. Its text is Substrate's plain-text preview of the message
|
|
401
|
+
(at most ~255 characters), so every hit is marked `excerpt: true`, and its
|
|
402
|
+
hits carry no `fromMe` (Substrate does not say who you are on a hit).
|
|
403
|
+
`substrate` reports the pages read and how many results the filters
|
|
404
|
+
dropped. A conversation missing from your listing is named by its id.
|
|
405
|
+
- `"scan"` — when Substrate is unavailable or fails (`fallback_reason` says
|
|
406
|
+
why), or with `mode: "scan"`. Every word of `query` must appear (any
|
|
407
|
+
order, ignoring case; `"quoted words"` match as a phrase); the
|
|
408
|
+
`max_conversations` (default 100, max 500) most recently active
|
|
409
|
+
conversations with activity since the cutoff are read back to it, four at
|
|
410
|
+
a time, and `scan` reports how many were read, how many the window or the
|
|
411
|
+
cap left out, and any read only partly (1,000 messages each). Live, 100
|
|
412
|
+
conversations took about 15 seconds — narrow with `conversation` or
|
|
413
|
+
`since` when you can. Channels hidden in Teams are skipped unless named;
|
|
414
|
+
deleted messages and system events never match.
|
|
415
|
+
|
|
416
|
+
`mode: "substrate"` uses only Substrate and fails rather than falling back.
|
|
186
417
|
- `teams_get_attachment` — one attachment of a message: an inline image is
|
|
187
418
|
returned as the image itself; a shared file is downloaded from SharePoint and
|
|
188
419
|
returned as its contents — an image as the image, anything else as an embedded
|
|
@@ -201,14 +432,15 @@ Everything is optional — by default the token is captured from your browser.
|
|
|
201
432
|
`teams_read_conversation` to read it in context. Filter with
|
|
202
433
|
`unread_only`, `kinds` and `since_days` (default 14, max 3650); `limit`
|
|
203
434
|
(default 50, max 200). Read from the chat service, so the Activity view
|
|
204
|
-
does not need to be open; it never marks anything read
|
|
435
|
+
does not need to be open; it never marks anything read (`teams_mark_read`
|
|
436
|
+
marks chats and channels read, not the Activity feed).
|
|
205
437
|
- `teams_healthcheck` — resolves the token the way every tool does
|
|
206
438
|
(capturing one on a cold start) and probes the chat service with one
|
|
207
439
|
conversations listing. Reports where the token came from and when it
|
|
208
440
|
expires (both `null` when no token is held, e.g. after a failed capture)
|
|
209
441
|
and how many conversations the listing returned — never the token.
|
|
210
442
|
|
|
211
|
-
**Write** (
|
|
443
|
+
**Write** (each asks you to confirm first — see [Writes](#writes)):
|
|
212
444
|
|
|
213
445
|
- `teams_send_message` — post as you to any chat or channel, by id or name.
|
|
214
446
|
`text` is plain text: it is escaped, newlines are kept, and `:key:`
|
|
@@ -225,18 +457,32 @@ Everything is optional — by default the token is captured from your browser.
|
|
|
225
457
|
reaction key (`fire`, `1f389_partypopper`). The message is read back to
|
|
226
458
|
verify the change (`verified: null` when it is not found again). It writes only that message's reaction — never your
|
|
227
459
|
recent-reactions list or any other preference.
|
|
228
|
-
|
|
229
|
-
|
|
460
|
+
- `teams_mark_read` — mark a chat or channel read in Teams, clearing its
|
|
461
|
+
unread badge: moves your read marker (the conversation's
|
|
462
|
+
`consumptionhorizon`) up to `up_to_message_id`, or by default up to the
|
|
463
|
+
newest message in the conversation. Returns the conversation,
|
|
464
|
+
`previous_horizon_message_id` (`null` if you never opened it) and
|
|
465
|
+
`new_horizon_message_id`. The marker never moves backwards: when it is
|
|
466
|
+
already at or past the target, nothing is written (no confirmation is
|
|
467
|
+
asked) and `status` is `already_read`. Only you see your read marker.
|
|
468
|
+
|
|
469
|
+
`teams_read_conversation` and `teams_get_unread` also write when — and only
|
|
470
|
+
when — you pass `mark_read: true` (see above). Every other tool is
|
|
471
|
+
read-only, and nothing marks anything read unless you ask it to.
|
|
230
472
|
|
|
231
473
|
## Writes
|
|
232
474
|
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
475
|
+
A post and a reaction are visible to everyone in the conversation, and
|
|
476
|
+
marking read clears your unread badges, so each write asks you first. A
|
|
477
|
+
client that can show a confirmation prompt (Claude Code) shows one. On a
|
|
478
|
+
client that cannot, the first call changes nothing and returns a
|
|
236
479
|
`confirmation-required` preview — the conversation, the exact text, any
|
|
237
|
-
mentions, the quoted message
|
|
238
|
-
|
|
239
|
-
|
|
480
|
+
mentions, the quoted message, the reaction, or the message your read marker
|
|
481
|
+
moves to and where it was, with everything other people wrote (titles,
|
|
482
|
+
names, quoted text) fenced as untrusted — plus a `confirmToken`; only a
|
|
483
|
+
repeat call with that token writes. With `mark_read` on
|
|
484
|
+
`teams_read_conversation` / `teams_get_unread`, that first call returns just
|
|
485
|
+
the preview (no messages); the repeat call reads and marks. The token is single-use, expires, and is
|
|
240
486
|
bound to the exact arguments: change anything between the two calls and it
|
|
241
487
|
is refused with a fresh preview.
|
|
242
488
|
|
|
@@ -252,8 +498,8 @@ itself, so keep `MCP_CONFIRM_MODE=ask-user` and approve each preview in chat
|
|
|
252
498
|
as the real guard on what gets posted.
|
|
253
499
|
|
|
254
500
|
**Try it in your own notes first.** The conversation `48:notes` (also by the
|
|
255
|
-
name `notes` or `self`) is your Teams self-chat ("notes to self"):
|
|
256
|
-
|
|
501
|
+
name `notes` or `self`) is your Teams self-chat ("notes to self"): every write
|
|
502
|
+
accepts it, `teams_read_conversation` reads it, nobody else sees it, and
|
|
257
503
|
it is the safe place to see what a message or reaction will look like. Every
|
|
258
504
|
other `48:` system conversation (calendar and the like) is refused.
|
|
259
505
|
|
|
@@ -262,7 +508,11 @@ timeout, a dropped connection or a 5xx after the request went out), the
|
|
|
262
508
|
result is `status: "unknown"` — the message may already be there, so read the
|
|
263
509
|
conversation before sending again. A 4xx is a refusal and stays an error. A
|
|
264
510
|
reaction Teams does not confirm is settled by reading the message back, and
|
|
265
|
-
is `status: "unknown"` only when that does not show the change.
|
|
511
|
+
is `status: "unknown"` only when that does not show the change. A read-marker
|
|
512
|
+
move Teams does not confirm is `status: "unknown"` (`marked_read: false` with a
|
|
513
|
+
`mark_read_warning` from the read tools); moving it again to the same message
|
|
514
|
+
is harmless. Marking read (`PUT …/properties?name=consumptionhorizon`) was
|
|
515
|
+
verified live on `48:notes` on 2026-10-12. Threaded channel replies, @mentions,
|
|
266
516
|
removing a reaction and the ✅ reaction's key follow Teams' documented or
|
|
267
517
|
inferred shapes but have not been verified against a live tenant yet.
|
|
268
518
|
|
|
@@ -274,6 +524,37 @@ instead.
|
|
|
274
524
|
|
|
275
525
|
## Things worth knowing
|
|
276
526
|
|
|
527
|
+
- **Corporate networks.** The server talks to several hosts:
|
|
528
|
+
`teams.cloud.microsoft` (chats), the regional `*.asm.skype.com` image store
|
|
529
|
+
(inline images), `*.sharepoint.com` (shared files) and
|
|
530
|
+
`substrate.office.com` (search). If one is unreachable while the others
|
|
531
|
+
work, the error names that host and the network cause (`ENOTFOUND`,
|
|
532
|
+
`ECONNREFUSED`, a certificate code, …) with a hint, instead of a bare
|
|
533
|
+
"fetch failed". An inline image the image store cannot be reached for is
|
|
534
|
+
retried through the Teams gateway (`us-prod.asyncgw.teams.microsoft.com`),
|
|
535
|
+
which serves the same bytes and is often allowed where `*.asm.skype.com` is
|
|
536
|
+
not. Two settings fix most other cases, because Node reads neither the
|
|
537
|
+
system keychain nor the system proxy:
|
|
538
|
+
- TLS inspection: `NODE_EXTRA_CA_CERTS=/path/to/corporate-root-ca.pem`.
|
|
539
|
+
- A required proxy: `HTTPS_PROXY=<proxy URL>` together with
|
|
540
|
+
`NODE_USE_ENV_PROXY=1` (Node 22.21+ / 24.5+).
|
|
541
|
+
- <a id="cursors-only-what-is-new"></a>**Cursors: only what is new.** A
|
|
542
|
+
message id is its arrival time in epoch milliseconds, so "newer than the
|
|
543
|
+
last message I saw" is a numeric comparison and a cursor is just that
|
|
544
|
+
message's id — `next_cursor` is a plain id string, passed back unchanged as
|
|
545
|
+
`after_message_id` (`teams_read_conversation`) or inside `cursors`
|
|
546
|
+
(`teams_get_unread`). The server keeps no state and **no cache**: every
|
|
547
|
+
call reads Teams live, and `fetched_at` (ISO 8601, UTC) says when. There is
|
|
548
|
+
no refresh flag because there is nothing to refresh. A cursor never moves
|
|
549
|
+
the read marker; with `limit` / `per_conversation_limit` the newest
|
|
550
|
+
messages are kept and `next_cursor` jumps to the newest, so check
|
|
551
|
+
`truncated` before assuming nothing was skipped. **Two cursor kinds:**
|
|
552
|
+
`teams_get_changes` has its own *time* cursor (an opaque token, or an ISO
|
|
553
|
+
8601 time) that goes back only to `teams_get_changes`; it is not a message
|
|
554
|
+
id. Each of its conversation rows carries the message-id cursor to hand on,
|
|
555
|
+
`after_message_id`, for `teams_read_conversation` (or `teams_get_unread`'s
|
|
556
|
+
`cursors`). Each tool rejects the other kind.
|
|
557
|
+
|
|
277
558
|
- **Results are framed as untrusted.** Every data tool returns
|
|
278
559
|
`{ untrusted_content: true, note, ... }` and says in its description that
|
|
279
560
|
the text is written by other Teams users. Message bodies, previews and
|
|
@@ -304,14 +585,28 @@ instead.
|
|
|
304
585
|
you never open. A candidate with no activity at all inside the window is
|
|
305
586
|
not even read. Whatever the window leaves out is counted in
|
|
306
587
|
`older_unread_skipped` (with a hint to widen `since_days`), never dropped
|
|
307
|
-
silently. `
|
|
588
|
+
silently. `older_unread: true` (on `teams_get_unread`, and on
|
|
589
|
+
`teams_list_chats` with `unread_only`) also lists them in
|
|
590
|
+
`older_unread_conversations` — `id`, `kind`, `title`, `team` (a channel's),
|
|
591
|
+
`lastActivity`, most recent first — with an `unread_count` for each one
|
|
592
|
+
whose messages were already read to place it outside the window; one with
|
|
593
|
+
no activity at all inside the window is not read just to count it, and
|
|
594
|
+
carries `unread_count_known: false` instead (its news past the marker may
|
|
595
|
+
be only system events). Muted chats: the conversation listing marks a chat
|
|
596
|
+
you muted with `properties.alerts: "false"` (verified live 2026-10-12: 8 of
|
|
597
|
+
1,435 conversations, every other one `"true"` or absent), surfaced as
|
|
598
|
+
`muted: true`. `teams_get_unread` leaves them out without reading them and
|
|
599
|
+
counts them in `muted_skipped`; `include_muted` adds them back. The list
|
|
600
|
+
tools' `unread_only` still includes them. `teams_read_conversation` is not windowed: it takes an explicit
|
|
308
601
|
`since` and `limit`. This server only reads the marker; it never moves it.
|
|
309
602
|
- **The token only goes to Teams.** The chat-service token is sent to the
|
|
310
603
|
chat-service base and, for inline images, only to https hosts under
|
|
311
604
|
`.asm.skype.com` (Teams' own image store) — an image link pointing anywhere
|
|
312
605
|
else is refused. Shared-file download uses a **separate** SharePoint token
|
|
313
606
|
(below), sent only to the file's own `*.sharepoint.com` host; the pre-signed
|
|
314
|
-
download link it returns is fetched with **no** token at all.
|
|
607
|
+
download link it returns is fetched with **no** token at all. Search uses a
|
|
608
|
+
third, Substrate token, sent only to
|
|
609
|
+
`https://substrate.office.com/searchservice/api/v2/query`.
|
|
315
610
|
- **Shared files download from SharePoint.** They live in SharePoint, which
|
|
316
611
|
does not accept the chat-service token, so `teams_get_attachment` captures a
|
|
317
612
|
separate SharePoint token and fetches the file through SharePoint's v2.1
|
|
@@ -320,6 +615,23 @@ instead.
|
|
|
320
615
|
extension's approved scope is behind the server's declared one — revoke
|
|
321
616
|
and re-pair `microsoft-teams-mcp` in the ContextMint Bridge popup.
|
|
322
617
|
|
|
618
|
+
## Upgrading from 0.4
|
|
619
|
+
|
|
620
|
+
0.5 only adds arguments and fields, except for these changes in behaviour:
|
|
621
|
+
|
|
622
|
+
- **Ambiguous names in `teams_read_conversation`:** a name that matches
|
|
623
|
+
several conversations used to fail with an error listing the candidates. It
|
|
624
|
+
now succeeds with `{ ambiguous: true, query, match_count, candidates, hint }`
|
|
625
|
+
and no messages. Check for `ambiguous` before reading `messages` or
|
|
626
|
+
`threads`. Send, react and attachment still fail on an ambiguous name.
|
|
627
|
+
- **Muted chats in `teams_get_unread`:** chats you muted in Teams are left out
|
|
628
|
+
and counted in `muted_skipped`. Pass `include_muted: true` for the old
|
|
629
|
+
behaviour.
|
|
630
|
+
- **Read tools are no longer annotated read-only:** `teams_read_conversation`
|
|
631
|
+
and `teams_get_unread` take an opt-in `mark_read` flag, so they are published
|
|
632
|
+
with `readOnly: false`. A client that auto-approves only read-only tools may
|
|
633
|
+
now ask before each read. Without `mark_read` they still never write.
|
|
634
|
+
|
|
323
635
|
## Upgrading from 0.3
|
|
324
636
|
|
|
325
637
|
0.4 moves every tool onto the Teams chat-service API, and several outputs
|