@chrischall/microsoft-teams-mcp 0.1.0 → 0.2.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 +17 -4
- package/dist/bundle.js +58 -29
- package/dist/client.js +46 -33
- package/dist/index.js +2 -1
- package/dist/tools/activity.js +22 -0
- package/dist/tools/errors.js +1 -2
- package/dist/tools/healthcheck.js +1 -1
- package/dist/version.js +1 -1
- package/mint.yaml +1 -1
- package/package.json +1 -1
- package/server.json +2 -2
- package/skills/teams-fpx/SKILL.md +30 -21
- package/skills/teams-fpx/references/dom-list-recipes.md +22 -7
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
},
|
|
8
8
|
"metadata": {
|
|
9
9
|
"description": "MCP server for Microsoft Teams — read your chats, teams, channels, and their currently open messages",
|
|
10
|
-
"version": "0.
|
|
10
|
+
"version": "0.2.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 your chats, teams, channels, and their currently open messages, via your signed-in browser session",
|
|
18
|
-
"version": "0.
|
|
18
|
+
"version": "0.2.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.2.0",
|
|
5
5
|
"description": "Microsoft Teams for Claude — read your chats, teams, channels, and their currently open messages, using your signed-in browser session",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Chris Hall",
|
package/README.md
CHANGED
|
@@ -14,8 +14,8 @@ WebSocket/registrar sync channel — there is no REST or GraphQL endpoint that
|
|
|
14
14
|
returns it. So this server does not capture a token and make plain server-side
|
|
15
15
|
requests the way an API-backed MCP would; instead every call routes through
|
|
16
16
|
the [fetchproxy](https://github.com/chrischall/fetchproxy) browser bridge and
|
|
17
|
-
reads the DOM your signed-in `teams.microsoft
|
|
18
|
-
|
|
17
|
+
reads the DOM your signed-in `teams.cloud.microsoft` tab has already
|
|
18
|
+
rendered. `teams.microsoft.com` (the old host) is not supported.
|
|
19
19
|
|
|
20
20
|
**That has one real consequence: this server can only read whichever chat or
|
|
21
21
|
channel is currently displayed in your browser tab.** The bridge can fetch
|
|
@@ -85,9 +85,22 @@ Everything is optional — this server needs no credentials of its own.
|
|
|
85
85
|
is currently open: sender, subject (when present), prose time (not
|
|
86
86
|
ISO-8601 — Teams doesn't expose one for these), message id, and text.
|
|
87
87
|
Threaded replies under a post are not included.
|
|
88
|
+
- `teams_get_activity` — the Activity feed (the bell icon in the left nav):
|
|
89
|
+
mentions, replies, reactions, and the like across every chat and channel,
|
|
90
|
+
each with its title, message preview, prose time, and location (the
|
|
91
|
+
team/channel or chat it happened in). Requires the Activity view open.
|
|
88
92
|
- `teams_healthcheck` — verifies the bridge can reach a signed-in tab.
|
|
89
93
|
|
|
90
|
-
All
|
|
94
|
+
All five data tools are read-only and take no arguments.
|
|
95
|
+
|
|
96
|
+
**No Calendar tool here.** Teams Web's Calendar renders inside an embedded
|
|
97
|
+
`outlook.office.com` iframe, which the fetchproxy bridge (DOM reads only
|
|
98
|
+
against the top-level tab, no iframe crossing) cannot reach — and isn't the
|
|
99
|
+
right place for it anyway. Use
|
|
100
|
+
[`office-outlook-mcp`](https://github.com/chrischall/office-outlook-mcp)'s
|
|
101
|
+
`outlook_list_events` / `outlook_get_event` / `outlook_list_calendars`
|
|
102
|
+
instead: real Outlook REST API calls via a captured token, with no
|
|
103
|
+
"must have it open" limitation at all.
|
|
91
104
|
|
|
92
105
|
## Things worth knowing
|
|
93
106
|
|
|
@@ -109,7 +122,7 @@ All four data tools are read-only and take no arguments.
|
|
|
109
122
|
- **Multiple open Teams tabs race.** The bridge reads whichever matching tab
|
|
110
123
|
answers first ("first responsive"), not necessarily the one you meant. If
|
|
111
124
|
results look like they're from the wrong chat/channel, close extra
|
|
112
|
-
`teams.microsoft
|
|
125
|
+
`teams.cloud.microsoft` tabs so only one remains.
|
|
113
126
|
- **Scope grows quietly.** If you see a `read_dom_list name not in declared
|
|
114
127
|
set` error, the extension's approved scope is behind the server's declared
|
|
115
128
|
one — this shouldn't happen in a released version, but if it does, revoke
|
package/dist/bundle.js
CHANGED
|
@@ -38315,7 +38315,7 @@ function toolAnnotations(opts = {}) {
|
|
|
38315
38315
|
|
|
38316
38316
|
// src/version.ts
|
|
38317
38317
|
var PACKAGE_NAME = "microsoft-teams-mcp";
|
|
38318
|
-
var VERSION = "0.
|
|
38318
|
+
var VERSION = "0.2.0";
|
|
38319
38319
|
|
|
38320
38320
|
// node_modules/@fetchproxy/protocol/dist/crypto.js
|
|
38321
38321
|
var subtle = globalThis.crypto.subtle;
|
|
@@ -43633,7 +43633,7 @@ function registerBridgeHealthcheckTool(args) {
|
|
|
43633
43633
|
}
|
|
43634
43634
|
|
|
43635
43635
|
// src/client.ts
|
|
43636
|
-
var DOMAINS = ["teams.
|
|
43636
|
+
var DOMAINS = ["teams.cloud.microsoft"];
|
|
43637
43637
|
var DEFAULT_WS_PORT = 37149;
|
|
43638
43638
|
function getWsPort() {
|
|
43639
43639
|
return readPortEnv("TEAMS_WS_PORT", DEFAULT_WS_PORT);
|
|
@@ -43685,6 +43685,17 @@ var CHANNEL_POSTS_SELECTOR = {
|
|
|
43685
43685
|
],
|
|
43686
43686
|
maxItems: 200
|
|
43687
43687
|
};
|
|
43688
|
+
var ACTIVITY_FEED_SELECTOR = {
|
|
43689
|
+
name: "activityFeed",
|
|
43690
|
+
itemSelector: '[data-tid="activity-feed-list-item"]',
|
|
43691
|
+
fields: [
|
|
43692
|
+
{ name: "title", selector: '[id^="activity-feed-item-title-"]' },
|
|
43693
|
+
{ name: "preview", selector: '[id^="activity-feed-item-message-preview-"]' },
|
|
43694
|
+
{ name: "time", selector: '[id^="activity-feed-item-timestamp-"]' },
|
|
43695
|
+
{ name: "location", selector: '[id^="activity-feed-item-location-"]' }
|
|
43696
|
+
],
|
|
43697
|
+
maxItems: 200
|
|
43698
|
+
};
|
|
43688
43699
|
var TeamsClient = class {
|
|
43689
43700
|
#transport;
|
|
43690
43701
|
#started = false;
|
|
@@ -43698,7 +43709,8 @@ var TeamsClient = class {
|
|
|
43698
43709
|
CHAT_MESSAGES_SELECTOR,
|
|
43699
43710
|
CHAT_LIST_SELECTOR,
|
|
43700
43711
|
TEAMS_AND_CHANNELS_SELECTOR,
|
|
43701
|
-
CHANNEL_POSTS_SELECTOR
|
|
43712
|
+
CHANNEL_POSTS_SELECTOR,
|
|
43713
|
+
ACTIVITY_FEED_SELECTOR
|
|
43702
43714
|
],
|
|
43703
43715
|
port: getWsPort(),
|
|
43704
43716
|
// stderr only — stdout is the JSON-RPC channel. Without this the
|
|
@@ -43723,32 +43735,24 @@ var TeamsClient = class {
|
|
|
43723
43735
|
await this.#transport.start();
|
|
43724
43736
|
this.#started = true;
|
|
43725
43737
|
}
|
|
43726
|
-
/**
|
|
43727
|
-
|
|
43728
|
-
* "no tab matching" failure. Only one domain will ever have a live tab —
|
|
43729
|
-
* `readDomList` (unlike `captureRequestHeader`) is a point-in-time DOM
|
|
43730
|
-
* read with no open capture window to race, so sequential try-then-fall-
|
|
43731
|
-
* through is correct here (not `Promise.any`).
|
|
43732
|
-
*/
|
|
43733
|
-
async #readDomListAnyDomain(name) {
|
|
43738
|
+
/** Reads a declared selector off the single supported domain's live tab. */
|
|
43739
|
+
async #readDomList(name) {
|
|
43734
43740
|
await this.#ensureStarted();
|
|
43735
|
-
|
|
43736
|
-
|
|
43737
|
-
|
|
43738
|
-
|
|
43739
|
-
|
|
43740
|
-
|
|
43741
|
-
|
|
43742
|
-
|
|
43741
|
+
try {
|
|
43742
|
+
return await this.#transport.server.readDomList({ name, domain: DOMAINS[0] });
|
|
43743
|
+
} catch (e) {
|
|
43744
|
+
const err = e;
|
|
43745
|
+
if (/no tab matching/i.test(err.message)) {
|
|
43746
|
+
throw new Error(
|
|
43747
|
+
`could not reach a signed-in Teams tab on ${DOMAINS[0]} (${err.message}). Open ${DOMAINS[0]} in a signed-in browser tab and retry.`
|
|
43748
|
+
);
|
|
43743
43749
|
}
|
|
43750
|
+
throw e;
|
|
43744
43751
|
}
|
|
43745
|
-
throw new Error(
|
|
43746
|
-
`could not reach a signed-in Teams tab on any of [${DOMAINS.join(", ")}] (${errors.join("; ")}). Open teams.microsoft.com in a signed-in browser tab and retry.`
|
|
43747
|
-
);
|
|
43748
43752
|
}
|
|
43749
43753
|
/** The chat-list sidebar, regardless of which chat is currently open. */
|
|
43750
43754
|
async listChats() {
|
|
43751
|
-
return await this.#
|
|
43755
|
+
return await this.#readDomList("chatList");
|
|
43752
43756
|
}
|
|
43753
43757
|
/**
|
|
43754
43758
|
* Messages from whichever chat is CURRENTLY DISPLAYED in the signed-in
|
|
@@ -43756,11 +43760,11 @@ var TeamsClient = class {
|
|
|
43756
43760
|
* module doc.
|
|
43757
43761
|
*/
|
|
43758
43762
|
async getOpenChatMessages() {
|
|
43759
|
-
return await this.#
|
|
43763
|
+
return await this.#readDomList("chatMessages");
|
|
43760
43764
|
}
|
|
43761
43765
|
/** The Teams-and-Channels sidebar, regardless of which channel is open. */
|
|
43762
43766
|
async listTeamsAndChannels() {
|
|
43763
|
-
return await this.#
|
|
43767
|
+
return await this.#readDomList("teamsAndChannels");
|
|
43764
43768
|
}
|
|
43765
43769
|
/**
|
|
43766
43770
|
* Top-level posts from whichever channel is CURRENTLY DISPLAYED in the
|
|
@@ -43769,7 +43773,11 @@ var TeamsClient = class {
|
|
|
43769
43773
|
* module doc.
|
|
43770
43774
|
*/
|
|
43771
43775
|
async getOpenChannelPosts() {
|
|
43772
|
-
return await this.#
|
|
43776
|
+
return await this.#readDomList("channelPosts");
|
|
43777
|
+
}
|
|
43778
|
+
/** The Activity feed (the bell icon in the left nav), regardless of which item is selected. */
|
|
43779
|
+
async getActivity() {
|
|
43780
|
+
return await this.#readDomList("activityFeed");
|
|
43773
43781
|
}
|
|
43774
43782
|
async close() {
|
|
43775
43783
|
await this.#transport.close();
|
|
@@ -43790,7 +43798,7 @@ function wrapBridgeError(err, action) {
|
|
|
43790
43798
|
const message = err instanceof Error ? err.message : String(err);
|
|
43791
43799
|
if (/no tab matching|could not reach a signed-in/i.test(message)) {
|
|
43792
43800
|
return new McpToolError(`Could not reach a signed-in Teams tab to ${action}.`, {
|
|
43793
|
-
hint: "Open teams.
|
|
43801
|
+
hint: "Open teams.cloud.microsoft in Chrome, make sure you are signed in, and retry."
|
|
43794
43802
|
});
|
|
43795
43803
|
}
|
|
43796
43804
|
if (/pair code|not granted|not in declared/i.test(message)) {
|
|
@@ -43877,12 +43885,33 @@ function registerChannelTools(server, client2) {
|
|
|
43877
43885
|
);
|
|
43878
43886
|
}
|
|
43879
43887
|
|
|
43888
|
+
// src/tools/activity.ts
|
|
43889
|
+
function registerActivityTools(server, client2) {
|
|
43890
|
+
server.registerTool(
|
|
43891
|
+
"teams_get_activity",
|
|
43892
|
+
{
|
|
43893
|
+
title: "Read the Activity feed",
|
|
43894
|
+
description: "List the rows in the Activity feed (the bell icon in the left nav) \u2014 mentions, replies, reactions, and the like across every chat and channel \u2014 each with its title, message preview, prose time (not ISO 8601), and location (the team/channel or chat it happened in). Requires the user's browser to have the Activity view open \u2014 if it returns nothing, ask them to click the bell icon in the left nav.",
|
|
43895
|
+
annotations: toolAnnotations({ readOnly: true }),
|
|
43896
|
+
inputSchema: {}
|
|
43897
|
+
},
|
|
43898
|
+
async () => {
|
|
43899
|
+
try {
|
|
43900
|
+
const rows = await client2.getActivity();
|
|
43901
|
+
return minifiedResult(rows);
|
|
43902
|
+
} catch (err) {
|
|
43903
|
+
throw wrapBridgeError(err, "read the Activity feed");
|
|
43904
|
+
}
|
|
43905
|
+
}
|
|
43906
|
+
);
|
|
43907
|
+
}
|
|
43908
|
+
|
|
43880
43909
|
// src/tools/healthcheck.ts
|
|
43881
43910
|
function registerHealthcheckTool(server, client2) {
|
|
43882
43911
|
registerBridgeHealthcheckTool({
|
|
43883
43912
|
server,
|
|
43884
43913
|
prefix: "teams",
|
|
43885
|
-
hostLabel: "teams.microsoft
|
|
43914
|
+
hostLabel: "teams.cloud.microsoft",
|
|
43886
43915
|
transport: client2.transport,
|
|
43887
43916
|
probePath: "chat list (read_dom_list against the currently open Teams tab)",
|
|
43888
43917
|
probeFn: async () => {
|
|
@@ -43900,7 +43929,7 @@ await runMcp({
|
|
|
43900
43929
|
version: VERSION,
|
|
43901
43930
|
banner: "[microsoft-teams-mcp] This project was developed and is maintained by AI. Use at your own discretion.",
|
|
43902
43931
|
deps: client,
|
|
43903
|
-
tools: [registerChatTools, registerChannelTools, registerHealthcheckTool]
|
|
43932
|
+
tools: [registerChatTools, registerChannelTools, registerActivityTools, registerHealthcheckTool]
|
|
43904
43933
|
});
|
|
43905
43934
|
/*! Bundled license information:
|
|
43906
43935
|
|
package/dist/client.js
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* endpoint that returns it, so the only way to read it is to read the DOM the
|
|
8
8
|
* page has already rendered. That rules out a captured-token-then-plain-fetch
|
|
9
9
|
* design: every read here goes through `read_dom_list` against the user's
|
|
10
|
-
* live, signed-in `teams.microsoft
|
|
10
|
+
* live, signed-in `teams.cloud.microsoft` tab.
|
|
11
11
|
*
|
|
12
12
|
* Consequence: this MCP can only read whichever chat or channel is
|
|
13
13
|
* CURRENTLY DISPLAYED in that tab. `@fetchproxy/server` has no capability to
|
|
@@ -23,12 +23,11 @@ import { createFetchproxyTransport, } from '@chrischall/mcp-utils/fetchproxy';
|
|
|
23
23
|
import { readPortEnv } from '@chrischall/mcp-utils';
|
|
24
24
|
import { PACKAGE_NAME, VERSION } from './version.js';
|
|
25
25
|
/**
|
|
26
|
-
* The
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
* live tab.
|
|
26
|
+
* The New Teams host this MCP reads from. `teams.microsoft.com` (the old
|
|
27
|
+
* host) is deliberately not supported — only `teams.cloud.microsoft` tabs
|
|
28
|
+
* are read.
|
|
30
29
|
*/
|
|
31
|
-
export const DOMAINS = ['teams.
|
|
30
|
+
export const DOMAINS = ['teams.cloud.microsoft'];
|
|
32
31
|
/**
|
|
33
32
|
* fetchproxy concentrator port — one for the whole fleet. `TEAMS_WS_PORT`
|
|
34
33
|
* overrides it for local development and for a hosted bridged registration
|
|
@@ -125,6 +124,27 @@ export const CHANNEL_POSTS_SELECTOR = {
|
|
|
125
124
|
],
|
|
126
125
|
maxItems: 200,
|
|
127
126
|
};
|
|
127
|
+
/**
|
|
128
|
+
* Top-level rows in the Activity feed (the bell icon in the left nav) —
|
|
129
|
+
* mentions, replies, reactions, and the like across every chat and channel.
|
|
130
|
+
* Always rendered once that nav section is open, regardless of which item
|
|
131
|
+
* is selected — same "sidebar, not detail pane" shape as `CHAT_LIST_SELECTOR`
|
|
132
|
+
* and `TEAMS_AND_CHANNELS_SELECTOR`. `location` is the team/channel or chat
|
|
133
|
+
* the activity happened in, prose-joined by Teams itself (e.g. "NS_MS
|
|
134
|
+
* Product CE > MS DevOps"). `time` is prose (e.g. "1:19 PM"), not ISO 8601 —
|
|
135
|
+
* Teams renders it that way here, unlike `chatMessages.time`.
|
|
136
|
+
*/
|
|
137
|
+
export const ACTIVITY_FEED_SELECTOR = {
|
|
138
|
+
name: 'activityFeed',
|
|
139
|
+
itemSelector: '[data-tid="activity-feed-list-item"]',
|
|
140
|
+
fields: [
|
|
141
|
+
{ name: 'title', selector: '[id^="activity-feed-item-title-"]' },
|
|
142
|
+
{ name: 'preview', selector: '[id^="activity-feed-item-message-preview-"]' },
|
|
143
|
+
{ name: 'time', selector: '[id^="activity-feed-item-timestamp-"]' },
|
|
144
|
+
{ name: 'location', selector: '[id^="activity-feed-item-location-"]' },
|
|
145
|
+
],
|
|
146
|
+
maxItems: 200,
|
|
147
|
+
};
|
|
128
148
|
export class TeamsClient {
|
|
129
149
|
#transport;
|
|
130
150
|
#started = false;
|
|
@@ -141,6 +161,7 @@ export class TeamsClient {
|
|
|
141
161
|
CHAT_LIST_SELECTOR,
|
|
142
162
|
TEAMS_AND_CHANNELS_SELECTOR,
|
|
143
163
|
CHANNEL_POSTS_SELECTOR,
|
|
164
|
+
ACTIVITY_FEED_SELECTOR,
|
|
144
165
|
],
|
|
145
166
|
port: getWsPort(),
|
|
146
167
|
// stderr only — stdout is the JSON-RPC channel. Without this the
|
|
@@ -164,36 +185,24 @@ export class TeamsClient {
|
|
|
164
185
|
await this.#transport.start();
|
|
165
186
|
this.#started = true;
|
|
166
187
|
}
|
|
167
|
-
/**
|
|
168
|
-
|
|
169
|
-
* "no tab matching" failure. Only one domain will ever have a live tab —
|
|
170
|
-
* `readDomList` (unlike `captureRequestHeader`) is a point-in-time DOM
|
|
171
|
-
* read with no open capture window to race, so sequential try-then-fall-
|
|
172
|
-
* through is correct here (not `Promise.any`).
|
|
173
|
-
*/
|
|
174
|
-
async #readDomListAnyDomain(name) {
|
|
188
|
+
/** Reads a declared selector off the single supported domain's live tab. */
|
|
189
|
+
async #readDomList(name) {
|
|
175
190
|
await this.#ensureStarted();
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
// Only a "no tab on this domain" failure is worth trying the next
|
|
185
|
-
// domain for. Anything else (scope rejection, bridge down) is the
|
|
186
|
-
// same for every domain and should surface immediately.
|
|
187
|
-
if (!/no tab matching/i.test(err.message))
|
|
188
|
-
throw e;
|
|
191
|
+
try {
|
|
192
|
+
return await this.#transport.server.readDomList({ name, domain: DOMAINS[0] });
|
|
193
|
+
}
|
|
194
|
+
catch (e) {
|
|
195
|
+
const err = e;
|
|
196
|
+
if (/no tab matching/i.test(err.message)) {
|
|
197
|
+
throw new Error(`could not reach a signed-in Teams tab on ${DOMAINS[0]} (${err.message}). ` +
|
|
198
|
+
`Open ${DOMAINS[0]} in a signed-in browser tab and retry.`);
|
|
189
199
|
}
|
|
200
|
+
throw e;
|
|
190
201
|
}
|
|
191
|
-
throw new Error(`could not reach a signed-in Teams tab on any of [${DOMAINS.join(', ')}] (${errors.join('; ')}). ` +
|
|
192
|
-
'Open teams.microsoft.com in a signed-in browser tab and retry.');
|
|
193
202
|
}
|
|
194
203
|
/** The chat-list sidebar, regardless of which chat is currently open. */
|
|
195
204
|
async listChats() {
|
|
196
|
-
return (await this.#
|
|
205
|
+
return (await this.#readDomList('chatList'));
|
|
197
206
|
}
|
|
198
207
|
/**
|
|
199
208
|
* Messages from whichever chat is CURRENTLY DISPLAYED in the signed-in
|
|
@@ -201,11 +210,11 @@ export class TeamsClient {
|
|
|
201
210
|
* module doc.
|
|
202
211
|
*/
|
|
203
212
|
async getOpenChatMessages() {
|
|
204
|
-
return (await this.#
|
|
213
|
+
return (await this.#readDomList('chatMessages'));
|
|
205
214
|
}
|
|
206
215
|
/** The Teams-and-Channels sidebar, regardless of which channel is open. */
|
|
207
216
|
async listTeamsAndChannels() {
|
|
208
|
-
return (await this.#
|
|
217
|
+
return (await this.#readDomList('teamsAndChannels'));
|
|
209
218
|
}
|
|
210
219
|
/**
|
|
211
220
|
* Top-level posts from whichever channel is CURRENTLY DISPLAYED in the
|
|
@@ -214,7 +223,11 @@ export class TeamsClient {
|
|
|
214
223
|
* module doc.
|
|
215
224
|
*/
|
|
216
225
|
async getOpenChannelPosts() {
|
|
217
|
-
return (await this.#
|
|
226
|
+
return (await this.#readDomList('channelPosts'));
|
|
227
|
+
}
|
|
228
|
+
/** The Activity feed (the bell icon in the left nav), regardless of which item is selected. */
|
|
229
|
+
async getActivity() {
|
|
230
|
+
return (await this.#readDomList('activityFeed'));
|
|
218
231
|
}
|
|
219
232
|
async close() {
|
|
220
233
|
await this.#transport.close();
|
package/dist/index.js
CHANGED
|
@@ -4,6 +4,7 @@ import { VERSION } from './version.js';
|
|
|
4
4
|
import { TeamsClient } from './client.js';
|
|
5
5
|
import { registerChatTools } from './tools/chat.js';
|
|
6
6
|
import { registerChannelTools } from './tools/channels.js';
|
|
7
|
+
import { registerActivityTools } from './tools/activity.js';
|
|
7
8
|
import { registerHealthcheckTool } from './tools/healthcheck.js';
|
|
8
9
|
loadDotenvSafely();
|
|
9
10
|
/**
|
|
@@ -19,5 +20,5 @@ await runMcp({
|
|
|
19
20
|
version: VERSION,
|
|
20
21
|
banner: '[microsoft-teams-mcp] This project was developed and is maintained by AI. Use at your own discretion.',
|
|
21
22
|
deps: client,
|
|
22
|
-
tools: [registerChatTools, registerChannelTools, registerHealthcheckTool],
|
|
23
|
+
tools: [registerChatTools, registerChannelTools, registerActivityTools, registerHealthcheckTool],
|
|
23
24
|
});
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { minifiedResult, toolAnnotations } from '@chrischall/mcp-utils';
|
|
2
|
+
import { wrapBridgeError } from './errors.js';
|
|
3
|
+
export function registerActivityTools(server, client) {
|
|
4
|
+
server.registerTool('teams_get_activity', {
|
|
5
|
+
title: 'Read the Activity feed',
|
|
6
|
+
description: 'List the rows in the Activity feed (the bell icon in the left nav) — mentions, ' +
|
|
7
|
+
'replies, reactions, and the like across every chat and channel — each with its ' +
|
|
8
|
+
'title, message preview, prose time (not ISO 8601), and location (the team/channel ' +
|
|
9
|
+
'or chat it happened in). Requires the user\'s browser to have the Activity view ' +
|
|
10
|
+
'open — if it returns nothing, ask them to click the bell icon in the left nav.',
|
|
11
|
+
annotations: toolAnnotations({ readOnly: true }),
|
|
12
|
+
inputSchema: {},
|
|
13
|
+
}, async () => {
|
|
14
|
+
try {
|
|
15
|
+
const rows = await client.getActivity();
|
|
16
|
+
return minifiedResult(rows);
|
|
17
|
+
}
|
|
18
|
+
catch (err) {
|
|
19
|
+
throw wrapBridgeError(err, 'read the Activity feed');
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
}
|
package/dist/tools/errors.js
CHANGED
|
@@ -4,8 +4,7 @@ export function wrapBridgeError(err, action) {
|
|
|
4
4
|
const message = err instanceof Error ? err.message : String(err);
|
|
5
5
|
if (/no tab matching|could not reach a signed-in/i.test(message)) {
|
|
6
6
|
return new McpToolError(`Could not reach a signed-in Teams tab to ${action}.`, {
|
|
7
|
-
hint: 'Open teams.
|
|
8
|
-
'signed in, and retry.',
|
|
7
|
+
hint: 'Open teams.cloud.microsoft in Chrome, make sure you are signed in, and retry.',
|
|
9
8
|
});
|
|
10
9
|
}
|
|
11
10
|
if (/pair code|not granted|not in declared/i.test(message)) {
|
|
@@ -3,7 +3,7 @@ export function registerHealthcheckTool(server, client) {
|
|
|
3
3
|
registerBridgeHealthcheckTool({
|
|
4
4
|
server,
|
|
5
5
|
prefix: 'teams',
|
|
6
|
-
hostLabel: 'teams.microsoft
|
|
6
|
+
hostLabel: 'teams.cloud.microsoft',
|
|
7
7
|
transport: client.transport,
|
|
8
8
|
probePath: 'chat list (read_dom_list against the currently open Teams tab)',
|
|
9
9
|
probeFn: async () => {
|
package/dist/version.js
CHANGED
package/mint.yaml
CHANGED
|
@@ -36,7 +36,7 @@ egress:
|
|
|
36
36
|
# Empty on purpose: this is a pure browser-bridge MCP. Every Teams request
|
|
37
37
|
# (the read_dom_list calls in src/client.ts) is made by the user's
|
|
38
38
|
# signed-in tab via the fetchproxy extension, never by this process — there
|
|
39
|
-
# is no direct mode and no bootstrap that dials teams.microsoft
|
|
39
|
+
# is no direct mode and no bootstrap that dials teams.cloud.microsoft
|
|
40
40
|
# server-side. The only socket the process opens is the loopback
|
|
41
41
|
# concentrator the extension connects TO.
|
|
42
42
|
allow: []
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chrischall/microsoft-teams-mcp",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"mcpName": "io.github.chrischall/microsoft-teams-mcp",
|
|
5
5
|
"description": "Microsoft Teams MCP server for Claude — developed and maintained by AI (Claude Code)",
|
|
6
6
|
"author": "Claude Code (AI) <https://www.anthropic.com/claude>",
|
package/server.json
CHANGED
|
@@ -6,12 +6,12 @@
|
|
|
6
6
|
"url": "https://github.com/chrischall/microsoft-teams-mcp",
|
|
7
7
|
"source": "github"
|
|
8
8
|
},
|
|
9
|
-
"version": "0.
|
|
9
|
+
"version": "0.2.0",
|
|
10
10
|
"packages": [
|
|
11
11
|
{
|
|
12
12
|
"registryType": "npm",
|
|
13
13
|
"identifier": "@chrischall/microsoft-teams-mcp",
|
|
14
|
-
"version": "0.
|
|
14
|
+
"version": "0.2.0",
|
|
15
15
|
"transport": {
|
|
16
16
|
"type": "stdio"
|
|
17
17
|
},
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: teams-fpx
|
|
3
3
|
description: >-
|
|
4
|
-
Read Microsoft Teams data (chats, teams, channels,
|
|
5
|
-
channel is currently open) from a shell with the fpx CLI
|
|
4
|
+
Read Microsoft Teams data (chats, teams, channels, the Activity feed, and
|
|
5
|
+
whichever chat or channel is currently open) from a shell with the fpx CLI
|
|
6
|
+
(@fetchproxy/cli)
|
|
6
7
|
instead of running the microsoft-teams-mcp server. Teams' data lives only
|
|
7
8
|
in a client-side sync cache with no REST/GraphQL endpoint, so this reads
|
|
8
9
|
the rendered DOM of a signed-in browser tab via fpx's read_dom_list
|
|
@@ -19,20 +20,29 @@ web app renders straight from that cache. There is nothing to `curl` or POST
|
|
|
19
20
|
a GraphQL query to. The only way to read it is to read what the page has
|
|
20
21
|
already rendered, which is what `fpx dom-list` does: it asks the Transporter
|
|
21
22
|
extension to run a declared `querySelectorAll` + per-item field extraction
|
|
22
|
-
against your signed-in `teams.microsoft
|
|
23
|
-
rows.
|
|
23
|
+
against your signed-in `teams.cloud.microsoft` tab and hands back structured
|
|
24
|
+
rows. `teams.microsoft.com` (the old host) is not supported.
|
|
24
25
|
|
|
25
26
|
**This means the same limitation the MCP has applies here: you can only read
|
|
26
27
|
whichever chat or channel is currently open in the browser.** There is no
|
|
27
28
|
way to switch conversations from the CLI — open the one you want in Teams
|
|
28
29
|
first. Reading channels also needs the **Teams-and-Channels** nav section
|
|
29
|
-
open (the "Teams" icon in the left rail), not Chat.
|
|
30
|
+
open (the "Teams" icon in the left rail), not Chat. The Activity feed
|
|
31
|
+
doesn't have this limitation — it's a sidebar list, always rendered once
|
|
32
|
+
that nav section (the bell icon) is open, regardless of which item is
|
|
33
|
+
selected.
|
|
34
|
+
|
|
35
|
+
**No Calendar selector.** Teams Web's Calendar renders inside an embedded
|
|
36
|
+
`outlook.office.com` iframe — `read_dom_list` only ever reads the top-level
|
|
37
|
+
tab's DOM, so it's unreachable from here (and from the MCP) no matter what.
|
|
38
|
+
Use the `office-outlook-mcp` repo's `outlook-fpx` skill or MCP instead —
|
|
39
|
+
Outlook's calendar is a real REST API, not a DOM read.
|
|
30
40
|
|
|
31
41
|
## One-time setup
|
|
32
42
|
|
|
33
43
|
```sh
|
|
34
44
|
npm install -g @fetchproxy/cli # provides `fpx`, needs 2.1.0+ (read_dom_list)
|
|
35
|
-
fpx profile add teams --domain teams.
|
|
45
|
+
fpx profile add teams --domain teams.cloud.microsoft
|
|
36
46
|
fpx profile declare teams --dom-list-selector \
|
|
37
47
|
'chatList=[data-testid="list-item"]::title:[id^="title-chat-list-item_"],preview:[data-testid="comfy-message"],time:[id^="time-chat-list-item_"],conversationKey:@data-fui-tree-item-value,itemType:@data-item-type&max=200'
|
|
38
48
|
fpx profile declare teams --dom-list-selector \
|
|
@@ -41,30 +51,29 @@ fpx profile declare teams --dom-list-selector \
|
|
|
41
51
|
'teamsAndChannels=[data-item-type="team"], [data-item-type="channel"]::title:[id^="title-"][id*="-list-item-"],teamName:[id^="preview-channel-list-item-"],time:[id^="time-"][id*="-list-item-"],conversationKey:@data-fui-tree-item-value,itemType:@data-item-type&max=300'
|
|
42
52
|
fpx profile declare teams --dom-list-selector \
|
|
43
53
|
'channelPosts=[data-tid="channel-pane-message"]::sender:[id^="author-"],subject:[id^="subject-line-"],time:time[data-tid="timestamp"]@aria-label,messageId:time[data-tid="timestamp"]@id,text:[id^="content-"]&max=200'
|
|
54
|
+
fpx profile declare teams --dom-list-selector \
|
|
55
|
+
'activityFeed=[data-tid="activity-feed-list-item"]::title:[id^="activity-feed-item-title-"],preview:[id^="activity-feed-item-message-preview-"],time:[id^="activity-feed-item-timestamp-"],location:[id^="activity-feed-item-location-"]&max=200'
|
|
44
56
|
```
|
|
45
57
|
|
|
46
58
|
Each `--dom-list-selector` flag declares a DIFFERENT named selector on the
|
|
47
|
-
same profile — run all
|
|
59
|
+
same profile — run all five, not just one. Requirements: the
|
|
48
60
|
**Transporter** browser extension installed, with an open
|
|
49
|
-
`teams.
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
61
|
+
`teams.cloud.microsoft` tab you're signed into. The first `dom-list` call
|
|
62
|
+
prints a pair code — approve it in the Transporter popup; the grant persists
|
|
63
|
+
until the declared scope changes again (each `declare` above widens it
|
|
64
|
+
once).
|
|
53
65
|
|
|
54
66
|
## Core calls
|
|
55
67
|
|
|
56
68
|
```sh
|
|
57
|
-
fpx dom-list chatList -p teams --storage-domain teams.microsoft
|
|
58
|
-
fpx dom-list chatMessages -p teams --storage-domain teams.microsoft
|
|
59
|
-
fpx dom-list teamsAndChannels -p teams --storage-domain teams.microsoft
|
|
60
|
-
fpx dom-list channelPosts -p teams --storage-domain teams.microsoft
|
|
69
|
+
fpx dom-list chatList -p teams --storage-domain teams.cloud.microsoft | jq
|
|
70
|
+
fpx dom-list chatMessages -p teams --storage-domain teams.cloud.microsoft | jq
|
|
71
|
+
fpx dom-list teamsAndChannels -p teams --storage-domain teams.cloud.microsoft | jq
|
|
72
|
+
fpx dom-list channelPosts -p teams --storage-domain teams.cloud.microsoft | jq
|
|
73
|
+
fpx dom-list activityFeed -p teams --storage-domain teams.cloud.microsoft | jq
|
|
61
74
|
```
|
|
62
75
|
|
|
63
|
-
|
|
64
|
-
domain (this one does) — it tells fpx which declared domain's tab to target.
|
|
65
|
-
Use `teams.cloud.microsoft` instead if that's where your signed-in tab lives.
|
|
66
|
-
|
|
67
|
-
Ready-to-run recipes (jq filters for all four selectors) are in
|
|
76
|
+
Ready-to-run recipes (jq filters for all five selectors) are in
|
|
68
77
|
`references/dom-list-recipes.md`.
|
|
69
78
|
|
|
70
79
|
## Exit codes
|
|
@@ -89,7 +98,7 @@ Ready-to-run recipes (jq filters for all four selectors) are in
|
|
|
89
98
|
- `channelPosts.time` is prose ("Tuesday, August 4, 2026 7:50 AM"), not
|
|
90
99
|
ISO 8601 — Teams' channel-post timestamp carries no `datetime` attribute,
|
|
91
100
|
unlike `chatMessages.time`.
|
|
92
|
-
- If your browser has more than one `teams.microsoft
|
|
101
|
+
- If your browser has more than one `teams.cloud.microsoft` tab open, the
|
|
93
102
|
bridge reads whichever answers first, not necessarily the one you meant —
|
|
94
103
|
close extras.
|
|
95
104
|
- This project is developed and maintained by AI (Claude).
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
# fpx dom-list recipes for Teams
|
|
2
2
|
|
|
3
|
-
Every command needs `-p teams --storage-domain teams.microsoft
|
|
4
|
-
`teams.cloud.microsoft`, matching whichever host your signed-in tab is on).
|
|
3
|
+
Every command needs `-p teams --storage-domain teams.cloud.microsoft`.
|
|
5
4
|
|
|
6
5
|
## Chat list (sidebar, Chat nav section)
|
|
7
6
|
|
|
8
7
|
```sh
|
|
9
|
-
fpx dom-list chatList -p teams --storage-domain teams.microsoft
|
|
8
|
+
fpx dom-list chatList -p teams --storage-domain teams.cloud.microsoft \
|
|
10
9
|
| jq -r '.[] | "\(.time)\t\(.title)\t\(.preview)"'
|
|
11
10
|
```
|
|
12
11
|
|
|
@@ -19,7 +18,7 @@ in the Chat rail).
|
|
|
19
18
|
## Currently open chat's messages
|
|
20
19
|
|
|
21
20
|
```sh
|
|
22
|
-
fpx dom-list chatMessages -p teams --storage-domain teams.microsoft
|
|
21
|
+
fpx dom-list chatMessages -p teams --storage-domain teams.cloud.microsoft \
|
|
23
22
|
| jq -r '.[] | "\(.time)\t\(.sender // "(same as above)")\t\(.text)"'
|
|
24
23
|
```
|
|
25
24
|
|
|
@@ -32,7 +31,7 @@ the browser first, then run this.
|
|
|
32
31
|
## Teams and channels (sidebar, Teams nav section — a DIFFERENT view from Chat)
|
|
33
32
|
|
|
34
33
|
```sh
|
|
35
|
-
fpx dom-list teamsAndChannels -p teams --storage-domain teams.microsoft
|
|
34
|
+
fpx dom-list teamsAndChannels -p teams --storage-domain teams.cloud.microsoft \
|
|
36
35
|
| jq -r '.[] | select(.itemType == "channel") | "\(.teamName)\t\(.title)"'
|
|
37
36
|
```
|
|
38
37
|
|
|
@@ -48,7 +47,7 @@ usual reason.
|
|
|
48
47
|
## Currently open channel's posts
|
|
49
48
|
|
|
50
49
|
```sh
|
|
51
|
-
fpx dom-list channelPosts -p teams --storage-domain teams.microsoft
|
|
50
|
+
fpx dom-list channelPosts -p teams --storage-domain teams.cloud.microsoft \
|
|
52
51
|
| jq -r '.[] | "\(.time)\t\(.sender)\t\(.subject // "")\t\(.text)"'
|
|
53
52
|
```
|
|
54
53
|
|
|
@@ -59,8 +58,24 @@ replies under a post are not captured, only the top-level posts.
|
|
|
59
58
|
|
|
60
59
|
Reads whatever channel is CURRENTLY OPEN — open it in the browser first.
|
|
61
60
|
|
|
61
|
+
## Activity feed (sidebar, Activity nav section — the bell icon)
|
|
62
|
+
|
|
63
|
+
```sh
|
|
64
|
+
fpx dom-list activityFeed -p teams --storage-domain teams.cloud.microsoft \
|
|
65
|
+
| jq -r '.[] | "\(.time)\t\(.title)\t\(.location)"'
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Fields: `title` (e.g. "Sanderson, Xi mentioned MS DevOps"), `preview`
|
|
69
|
+
(message text), `time` (prose, e.g. `1:19 PM` — NOT ISO 8601), `location`
|
|
70
|
+
(the team/channel or chat the activity happened in, e.g. "NS_MS Product CE
|
|
71
|
+
> MS DevOps").
|
|
72
|
+
|
|
73
|
+
Unlike the other three "currently open" reads, this is a sidebar list — it's
|
|
74
|
+
always populated once the Activity view is open, regardless of which item
|
|
75
|
+
is selected (same shape as `chatList`/`teamsAndChannels`).
|
|
76
|
+
|
|
62
77
|
## Multiple tabs
|
|
63
78
|
|
|
64
|
-
If more than one `teams.microsoft
|
|
79
|
+
If more than one `teams.cloud.microsoft` tab is open, the bridge picks
|
|
65
80
|
whichever answers first — results can come from a tab you didn't mean.
|
|
66
81
|
Close extras before relying on output.
|