@chrischall/microsoft-teams-mcp 0.1.0 → 0.2.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/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.com` tab.
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 two hosts Teams Web actually serves from. A tenant's tab may be on
27
- * either; `readDomListAnyDomain` tries both in order and falls through to
28
- * the next on a "no tab matching" failure, since only one will ever have a
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.microsoft.com', 'teams.cloud.microsoft'];
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
- * Try each declared domain in turn, falling through to the next on a
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
- const errors = [];
177
- for (const domain of DOMAINS) {
178
- try {
179
- return await this.#transport.server.readDomList({ name, domain });
180
- }
181
- catch (e) {
182
- const err = e;
183
- errors.push(`${domain}: ${err.message}`);
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.#readDomListAnyDomain('chatList'));
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.#readDomListAnyDomain('chatMessages'));
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.#readDomListAnyDomain('teamsAndChannels'));
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.#readDomListAnyDomain('channelPosts'));
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
+ }
@@ -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.microsoft.com (or teams.cloud.microsoft) in Chrome, make sure you are ' +
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.com',
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
@@ -10,4 +10,4 @@
10
10
  * line below and nowhere else — not even in prose.
11
11
  */
12
12
  export const PACKAGE_NAME = 'microsoft-teams-mcp';
13
- export const VERSION = '0.1.0'; // x-release-please-version
13
+ export const VERSION = '0.2.1'; // x-release-please-version
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.com
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.1.0",
3
+ "version": "0.2.1",
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>",
@@ -45,12 +45,12 @@
45
45
  "typecheck": "tsc -p tsconfig.check.json"
46
46
  },
47
47
  "dependencies": {
48
- "@chrischall/mcp-utils": "^2.2.1",
49
- "@fetchproxy/protocol": "^3.1.0",
50
- "@fetchproxy/server": "^3.1.0",
48
+ "@chrischall/mcp-utils": "^2.4.0",
49
+ "@fetchproxy/protocol": "^3.2.0",
50
+ "@fetchproxy/server": "^3.2.0",
51
51
  "@modelcontextprotocol/server": "^2.0.0",
52
52
  "dotenv": "^18.0.1",
53
- "zod": "^4.6.2"
53
+ "zod": "^4.6.5"
54
54
  },
55
55
  "devDependencies": {
56
56
  "@modelcontextprotocol/client": "^2.0.0",
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.1.0",
9
+ "version": "0.2.1",
10
10
  "packages": [
11
11
  {
12
12
  "registryType": "npm",
13
13
  "identifier": "@chrischall/microsoft-teams-mcp",
14
- "version": "0.1.0",
14
+ "version": "0.2.1",
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, and whichever chat or
5
- channel is currently open) from a shell with the fpx CLI (@fetchproxy/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.com` tab and hands back structured
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.microsoft.com --domain teams.cloud.microsoft
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 four, not just one. Requirements: the
59
+ same profile — run all five, not just one. Requirements: the
48
60
  **Transporter** browser extension installed, with an open
49
- `teams.microsoft.com` (or `teams.cloud.microsoft`) tab you're signed into.
50
- The first `dom-list` call prints a pair code — approve it in the Transporter
51
- popup; the grant persists until the declared scope changes again (each
52
- `declare` above widens it once).
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.com | jq
58
- fpx dom-list chatMessages -p teams --storage-domain teams.microsoft.com | jq
59
- fpx dom-list teamsAndChannels -p teams --storage-domain teams.microsoft.com | jq
60
- fpx dom-list channelPosts -p teams --storage-domain teams.microsoft.com | jq
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
- `--storage-domain` is required whenever a profile declares more than one
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.com` tab open, the
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.com` (or
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.com \
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.com \
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.com \
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.com \
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.com` tab is open, the bridge picks
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.