@chrischall/microsoft-teams-mcp 0.8.7 → 0.9.0
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 +101 -26
- package/dist/auth-fetchproxy.js +2 -2
- package/dist/bridge-scope.js +4 -6
- package/dist/bundle.js +800 -135
- package/dist/chatsvc.js +52 -7
- package/dist/index.js +3 -1
- package/dist/sharepoint-auth.js +94 -40
- package/dist/sharepoint-token-cache.js +19 -17
- package/dist/sharepoint.js +46 -33
- package/dist/substrate.js +126 -11
- package/dist/tools/attachment.js +77 -31
- package/dist/tools/group-chat.js +385 -0
- package/dist/tools/healthcheck.js +4 -4
- package/dist/tools/people.js +236 -0
- package/dist/tools/send.js +3 -16
- package/dist/version.js +1 -1
- package/package.json +1 -1
- package/server.json +3 -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.9.0"
|
|
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.9.0",
|
|
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.9.0",
|
|
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
|
@@ -36,7 +36,9 @@ By default nothing here marks anything read. Reading a chat through this
|
|
|
36
36
|
server leaves your Teams unread badges exactly as they were — unless you ask
|
|
37
37
|
for it: `teams_mark_read`, or `mark_read: true` on `teams_list_messages`
|
|
38
38
|
/ `teams_list_unread_messages`, moves your read marker forward. The writes —
|
|
39
|
-
`teams_send_message`, `teams_react
|
|
39
|
+
`teams_send_message`, `teams_react`, marking read, and renaming a group chat
|
|
40
|
+
or adding and removing its members (`teams_rename_chat`,
|
|
41
|
+
`teams_add_chat_members`, `teams_remove_chat_members`) — go through the same
|
|
40
42
|
chat-service API and change nothing until you confirm (see
|
|
41
43
|
[Writes](#writes)).
|
|
42
44
|
|
|
@@ -47,7 +49,8 @@ and approving a grant replaces the stored list of header captures. So all of
|
|
|
47
49
|
this server's captures (chat service, SharePoint, Substrate search) declare the
|
|
48
50
|
**same** scope: the three domains `teams.cloud.microsoft`, `sharepoint.com` and
|
|
49
51
|
`substrate.office.com`, plus the chat-service and search captures and one
|
|
50
|
-
capture per SharePoint host the server has already captured from
|
|
52
|
+
capture per SharePoint host the server has already captured from (usually just
|
|
53
|
+
your own OneDrive host — see [SharePoint file download](#sharepoint-file-download)). Each capture
|
|
51
54
|
still reads only the one header it needs. The SharePoint hosts are remembered
|
|
52
55
|
in `~/.microsoft-teams-mcp/bridge-scope.json` (beside the SharePoint token
|
|
53
56
|
cache; not written with `TEAMS_TOKEN_CACHE=false`) once a capture from them
|
|
@@ -78,17 +81,28 @@ Two things follow from that:
|
|
|
78
81
|
`teams.cloud.microsoft`, `sharepoint.com` and `substrate.office.com`, and the
|
|
79
82
|
same list of header captures. So approving `microsoft-teams-mcp` once covers
|
|
80
83
|
all three, and moving between chats, files and search never asks again (see
|
|
81
|
-
[Pairing](#pairing)). The first
|
|
82
|
-
|
|
83
|
-
- **
|
|
84
|
-
from
|
|
85
|
-
(
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
84
|
+
[Pairing](#pairing)). The very first download asks once to grant the capture
|
|
85
|
+
from your OneDrive host.
|
|
86
|
+
- **One token serves every SharePoint host.** The SharePoint token is captured
|
|
87
|
+
from a request your Teams tab makes to your own OneDrive host
|
|
88
|
+
(`<tenant>-my.sharepoint.com`), and SharePoint accepts it on every host of the
|
|
89
|
+
tenant: colleagues' OneDrives in other regions and team sites alike. So you
|
|
90
|
+
never need to open a file in Teams before downloading it. The first download,
|
|
91
|
+
and the first after the short-lived token expires, may need you to reload a
|
|
92
|
+
signed-in Teams tab (the requests it makes while loading are what the token
|
|
93
|
+
is read from); after that the token is cached until it expires. If the bridge
|
|
94
|
+
has not yet granted a SharePoint host, the download says so: approve the
|
|
95
|
+
pending scope update for `microsoft-teams-mcp` in the ContextMint Bridge
|
|
96
|
+
popup (no need to remove or re-pair it) and retry.
|
|
97
|
+
- **A file your account cannot open** (SharePoint answers 403) comes back as
|
|
98
|
+
metadata and its open link rather than failing.
|
|
99
|
+
|
|
100
|
+
`ref` matches an attachment ignoring case, and a file without its extension
|
|
101
|
+
(`report` finds `report.csv`); a name that matches two attachments is refused
|
|
102
|
+
with both listed. `save: true` writes the attachment to a fresh file in the
|
|
103
|
+
same folder `teams_export_messages` uses — `TEAMS_OUTPUT_DIR`, else
|
|
104
|
+
`~/Downloads/microsoft-teams-mcp` — and returns its `path` instead of the
|
|
105
|
+
contents (a download link on a hosted install, whose disk you cannot reach).
|
|
92
106
|
|
|
93
107
|
## Substrate search
|
|
94
108
|
|
|
@@ -112,6 +126,12 @@ read only from the request header, never from page storage.
|
|
|
112
126
|
another capture for 10 minutes. `mode: "substrate"` fails instead;
|
|
113
127
|
`mode: "scan"` never touches Substrate.
|
|
114
128
|
|
|
129
|
+
- **It also finds people.** `teams_add_chat_members` and
|
|
130
|
+
`teams_remove_chat_members` use the same token to look a person up in your
|
|
131
|
+
organisation's directory (Substrate's people suggestions) when a name is not
|
|
132
|
+
in your chats, or when you pass an email address. A lookup is an explicit
|
|
133
|
+
request, so it always tries a fresh capture rather than honouring the
|
|
134
|
+
10-minute cooldown below.
|
|
115
135
|
- **It does not re-capture in a loop.** If a freshly captured token is still
|
|
116
136
|
refused (401), the same 10-minute cooldown applies, so `auto` goes straight
|
|
117
137
|
to the scan instead of waiting on the bridge every call.
|
|
@@ -190,9 +210,9 @@ Everything is optional — by default the token is captured from your browser.
|
|
|
190
210
|
| `TEAMS_TOKEN_CACHE` | `false` to keep the captured token in memory only. Defaults to on. |
|
|
191
211
|
| `TEAMS_TOKEN_FILE` | Where the captured token is cached. Defaults to `~/.microsoft-teams-mcp/token.json`. |
|
|
192
212
|
| `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. |
|
|
193
|
-
| `TEAMS_SHAREPOINT_TOKEN_FILE` | Where the captured SharePoint
|
|
213
|
+
| `TEAMS_SHAREPOINT_TOKEN_FILE` | Where the captured SharePoint token (one for every SharePoint host, used to download shared files) is cached. Defaults to `~/.microsoft-teams-mcp/sharepoint-tokens.json`. `TEAMS_TOKEN_CACHE=false` keeps them in memory too. |
|
|
194
214
|
| `TEAMS_TIME_ZONE` | Default IANA time zone (e.g. `America/New_York`) for the `tz` argument of `teams_list_messages` and `teams_list_unread_messages`: 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. |
|
|
195
|
-
| `TEAMS_OUTPUT_DIR` | Folder `teams_export_messages` (and `teams_get_transcript` with `save`) writes into (each export gets its own timestamped subfolder). Defaults to `~/Downloads/microsoft-teams-mcp`. When set, a per-call `dest` must lie inside it; when unset, `dest` must be under `~/Downloads`, `~/Documents` or `~/Desktop`. |
|
|
215
|
+
| `TEAMS_OUTPUT_DIR` | Folder `teams_export_messages` (and `teams_get_transcript` with `save`, and `teams_get_attachment` with `save` or for a file over 10 MiB) writes into (each export gets its own timestamped subfolder). Defaults to `~/Downloads/microsoft-teams-mcp`. When set, a per-call `dest` must lie inside it; when unset, `dest` must be under `~/Downloads`, `~/Documents` or `~/Desktop`. |
|
|
196
216
|
| `TEAMS_WS_PORT` | fetchproxy concentrator port. Defaults to `37149`, the fleet-wide shared port. |
|
|
197
217
|
| `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. |
|
|
198
218
|
| `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. |
|
|
@@ -457,9 +477,12 @@ Everything is optional — by default the token is captured from your browser.
|
|
|
457
477
|
- `teams_get_attachment` — one attachment of a message: an inline image is
|
|
458
478
|
returned as the image itself; a shared file is downloaded from SharePoint and
|
|
459
479
|
returned as its contents — an image as the image, anything else as an embedded
|
|
460
|
-
resource carrying the bytes.
|
|
461
|
-
|
|
462
|
-
|
|
480
|
+
resource carrying the bytes. `save: true` writes it to a fresh file under
|
|
481
|
+
`TEAMS_OUTPUT_DIR` (else `~/Downloads/microsoft-teams-mcp`) and returns its
|
|
482
|
+
`path` instead. `ref` matches ignoring case, and a file without its extension.
|
|
483
|
+
Shared-file download uses a separate, short-lived SharePoint token that serves
|
|
484
|
+
every SharePoint host, so the first download may need
|
|
485
|
+
[your Teams tab reloaded](#sharepoint-file-download) to capture it; a
|
|
463
486
|
file your account cannot open, or one that could not be fetched, comes back as
|
|
464
487
|
metadata and its open link instead of failing. The caption names the
|
|
465
488
|
conversation beside its id (`title`, plus `participants` for an untitled
|
|
@@ -579,6 +602,50 @@ Everything is optional — by default the token is captured from your browser.
|
|
|
579
602
|
`new_horizon_message_id`. The marker never moves backwards: when it is
|
|
580
603
|
already at or past the target, nothing is written (no confirmation is
|
|
581
604
|
asked) and `status` is `already_read`. Only you see your read marker.
|
|
605
|
+
- `teams_rename_chat` — rename a group chat (set its topic): `name` is
|
|
606
|
+
trimmed and must not be empty. Only group chats — 1:1s, meeting chats,
|
|
607
|
+
channels and the self-chat are refused. Teams posts a notice in the chat,
|
|
608
|
+
so everyone in it sees the rename. The preview shows the current and new
|
|
609
|
+
name; renaming to the current name writes nothing and asks nothing. The
|
|
610
|
+
chat is read back to verify the new name (`verified`).
|
|
611
|
+
- `teams_add_chat_members` — add `people` (1–20) to a group chat as
|
|
612
|
+
ordinary members. Each person is one of:
|
|
613
|
+
- an MRI (`8:orgid:…`) or a bare object id — used as given;
|
|
614
|
+
- an email address — looked up in your organisation's directory and taken
|
|
615
|
+
only when exactly one person there has that email or UPN (ignoring case);
|
|
616
|
+
- a display name — matched, ignoring case and with "Greg King" and
|
|
617
|
+
"King, Greg" the same, among the other person of each of your 1:1 chats
|
|
618
|
+
and the chat's recent senders (exact first, then substring; several is
|
|
619
|
+
refused). **Only when no one there matches** is the directory searched:
|
|
620
|
+
the one person whose name is exactly that is taken; failing an exact
|
|
621
|
+
match, the directory's *only* suggestion is taken when the name is whole
|
|
622
|
+
words of it ("Solomon" for "Solomon, Gary", never "Sol"). Anything else —
|
|
623
|
+
several exact matches, several suggestions, a partial word, nothing —
|
|
624
|
+
refuses, listing the candidates with their email and MRI.
|
|
625
|
+
|
|
626
|
+
The directory is Substrate's people suggestions
|
|
627
|
+
(`POST https://substrate.office.com/search/api/v1/suggestions`), reached
|
|
628
|
+
with the [Substrate token](#substrate-search) search already captures — no
|
|
629
|
+
new token or bridge scope, but the first lookup may need you to run any
|
|
630
|
+
search in the Teams search box so the token can be captured. Only people in
|
|
631
|
+
your organisation are found there (not distribution lists or personal
|
|
632
|
+
contacts). If the directory cannot be searched (no token yet, a capture
|
|
633
|
+
timeout, `TEAMS_DISABLE_FETCHPROXY`), the error says so and what to do;
|
|
634
|
+
passing the MRI always works. An ambiguous or unknown person refuses the
|
|
635
|
+
whole call. The preview lists everyone with their `source` (`id`, `chat`
|
|
636
|
+
or `directory`) and, for a directory hit, their `email`, so you can see
|
|
637
|
+
exactly who will be added. People already in the chat are reported as
|
|
638
|
+
`already_member` and not written (if everyone is, nothing is asked). Teams
|
|
639
|
+
posts a notice in the chat for each person added. The chat is read back,
|
|
640
|
+
and each person is reported `added`, `already_member`, `unknown` (Teams
|
|
641
|
+
did not confirm and the read-back does not show them) or `failed` (with
|
|
642
|
+
the error).
|
|
643
|
+
- `teams_remove_chat_members` — remove `people` (1–20, named as for
|
|
644
|
+
`teams_add_chat_members`) from a group chat; refuses to remove you (leave
|
|
645
|
+
the chat in Teams instead). People not in the chat are reported as
|
|
646
|
+
`not_member` and not written. Teams posts a notice in the chat for each
|
|
647
|
+
person removed, and they lose access to it. Each person is reported
|
|
648
|
+
`removed`, `not_member`, `unknown` or `failed`.
|
|
582
649
|
|
|
583
650
|
`teams_list_messages` and `teams_list_unread_messages` also write when — and only
|
|
584
651
|
when — you pass `mark_read: true` (see above). Every other tool is
|
|
@@ -586,13 +653,15 @@ read-only, and nothing marks anything read unless you ask it to.
|
|
|
586
653
|
|
|
587
654
|
## Writes
|
|
588
655
|
|
|
589
|
-
A post and a
|
|
590
|
-
marking read clears your unread badges, so each
|
|
656
|
+
A post, a reaction, a rename and a membership change are visible to everyone
|
|
657
|
+
in the conversation, and marking read clears your unread badges, so each
|
|
658
|
+
write asks you first. A
|
|
591
659
|
client that can show a confirmation prompt (Claude Code) shows one. On a
|
|
592
660
|
client that cannot, the first call changes nothing and returns a
|
|
593
661
|
`confirmation-required` preview — the conversation, the exact text, any
|
|
594
|
-
mentions, the quoted message, the reaction,
|
|
595
|
-
moves to and where it was,
|
|
662
|
+
mentions, the quoted message, the reaction, the message your read marker
|
|
663
|
+
moves to and where it was, a chat's current and new name, or who is added or
|
|
664
|
+
removed, with everything other people wrote (titles,
|
|
596
665
|
names, quoted text) fenced as untrusted — plus a `confirmToken`; only a
|
|
597
666
|
repeat call with that token writes. With `mark_read` on
|
|
598
667
|
`teams_list_messages` / `teams_list_unread_messages`, that first call returns just
|
|
@@ -612,8 +681,9 @@ itself, so keep `MCP_CONFIRM_MODE=ask-user` and approve each preview in chat
|
|
|
612
681
|
as the real guard on what gets posted.
|
|
613
682
|
|
|
614
683
|
**Try it in your own notes first.** The conversation `48:notes` (also by the
|
|
615
|
-
name `notes` or `self`) is your Teams self-chat ("notes to self"):
|
|
616
|
-
|
|
684
|
+
name `notes` or `self`) is your Teams self-chat ("notes to self"): sending,
|
|
685
|
+
reacting and marking read accept it (the group-chat tools do not — it has no
|
|
686
|
+
one else in it), `teams_list_messages` reads it, nobody else sees it, and
|
|
617
687
|
it is the safe place to see what a message or reaction will look like. Every
|
|
618
688
|
other `48:` system conversation (calendar and the like) is refused.
|
|
619
689
|
|
|
@@ -626,7 +696,10 @@ is `status: "unknown"` only when that does not show the change. A read-marker
|
|
|
626
696
|
move Teams does not confirm is `status: "unknown"` (`marked_read: false` with a
|
|
627
697
|
`mark_read_warning` from the read tools); moving it again to the same message
|
|
628
698
|
is harmless. Marking read (`PUT …/properties?name=consumptionhorizon`) was
|
|
629
|
-
verified live on `48:notes` on 2026-10-12.
|
|
699
|
+
verified live on `48:notes` on 2026-10-12. A rename or membership change
|
|
700
|
+
Teams does not confirm is settled the same way, by reading the chat back;
|
|
701
|
+
renaming, adding and removing (`/threads/{id}/properties?name=topic` and
|
|
702
|
+
`/threads/{id}/members/{mri}`) were verified live on 2026-11-09. Threaded channel replies, @mentions,
|
|
630
703
|
removing a reaction and the ✅ reaction's key follow Teams' documented or
|
|
631
704
|
inferred shapes but have not been verified against a live tenant yet.
|
|
632
705
|
|
|
@@ -745,7 +818,9 @@ instead.
|
|
|
745
818
|
(below), sent only to the file's own `*.sharepoint.com` host; the pre-signed
|
|
746
819
|
download link it returns is fetched with **no** token at all. Search uses a
|
|
747
820
|
third, Substrate token, sent only to
|
|
748
|
-
`https://substrate.office.com/searchservice/api/v2/query
|
|
821
|
+
`https://substrate.office.com/searchservice/api/v2/query` and, to look a
|
|
822
|
+
person up in the directory for the group-chat member tools,
|
|
823
|
+
`https://substrate.office.com/search/api/v1/suggestions`.
|
|
749
824
|
- **Shared files download from SharePoint.** They live in SharePoint, which
|
|
750
825
|
does not accept the chat-service token, so `teams_get_attachment` captures a
|
|
751
826
|
separate SharePoint token and fetches the file through SharePoint's v2.1
|
package/dist/auth-fetchproxy.js
CHANGED
|
@@ -63,9 +63,9 @@ export const createCaptureTransport = (opts) => createFetchproxyTransport(opts);
|
|
|
63
63
|
/**
|
|
64
64
|
* A capture transport factory that declares the one bridge scope
|
|
65
65
|
* (`withBridgeScope`), whichever single header the capture reads.
|
|
66
|
-
* `
|
|
66
|
+
* `sharePointHosts` are the hosts a SharePoint capture is about to try.
|
|
67
67
|
*/
|
|
68
|
-
export const bridgeScopedTransport = (env,
|
|
68
|
+
export const bridgeScopedTransport = (env, sharePointHosts = []) => (opts) => createCaptureTransport(withBridgeScope(opts, env, sharePointHosts));
|
|
69
69
|
/**
|
|
70
70
|
* Capture a chat-service access token from the user's signed-in Teams tab.
|
|
71
71
|
* Returns the bare token (no `Bearer ` prefix).
|
package/dist/bridge-scope.js
CHANGED
|
@@ -65,7 +65,7 @@ export function sharePointCaptureDecl(host) {
|
|
|
65
65
|
}
|
|
66
66
|
/**
|
|
67
67
|
* The capture headers every hello declares: the chat-service and search
|
|
68
|
-
* captures, then one per SharePoint host (deduplicated, sorted, and only
|
|
68
|
+
* captures, then one per granted SharePoint host (deduplicated, sorted, and only
|
|
69
69
|
* concrete SharePoint hosts), so the list is the same whichever capture runs.
|
|
70
70
|
*/
|
|
71
71
|
export function bridgeCaptureDecls(sharePointHosts) {
|
|
@@ -122,13 +122,11 @@ export function rememberSharePointHost(host, env = process.env) {
|
|
|
122
122
|
* The hello options of a capture transport, widened to the one scope: the
|
|
123
123
|
* domains and capture headers mcp-utils derived from the single capture are
|
|
124
124
|
* replaced with {@link BRIDGE_TRUST_DOMAINS} and {@link bridgeCaptureDecls}
|
|
125
|
-
* (plus `
|
|
125
|
+
* (plus `extraSharePointHosts`, the hosts a SharePoint capture is about to try).
|
|
126
126
|
* The verb set is unchanged — every capture is `capture_request_header`.
|
|
127
127
|
*/
|
|
128
|
-
export function withBridgeScope(opts, env,
|
|
129
|
-
const hosts = knownSharePointHosts(env);
|
|
130
|
-
if (extraSharePointHost !== undefined)
|
|
131
|
-
hosts.push(extraSharePointHost);
|
|
128
|
+
export function withBridgeScope(opts, env, extraSharePointHosts = []) {
|
|
129
|
+
const hosts = [...knownSharePointHosts(env), ...extraSharePointHosts];
|
|
132
130
|
return {
|
|
133
131
|
...opts,
|
|
134
132
|
domains: [...BRIDGE_TRUST_DOMAINS],
|