@chrischall/microsoft-teams-mcp 0.6.0 → 0.6.2
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/mcp.json +2 -2
- package/.claude-plugin/plugin.json +1 -1
- package/README.md +1 -0
- package/dist/auth-fetchproxy.js +25 -63
- package/dist/bundle.js +483 -367
- package/dist/capture-window.js +4 -19
- package/dist/chatsvc.js +14 -78
- package/dist/network-error.js +20 -107
- package/dist/sharepoint-auth.js +19 -64
- package/dist/sharepoint-token-cache.js +2 -12
- package/dist/sharepoint.js +7 -33
- package/dist/substrate-auth.js +14 -47
- package/dist/substrate-token-cache.js +2 -12
- package/dist/substrate.js +7 -23
- package/dist/token-cache.js +2 -11
- package/dist/tools/markread.js +2 -3
- package/dist/tools/react.js +2 -3
- package/dist/tools/send.js +11 -28
- package/dist/version.js +1 -1
- package/mint.yaml +15 -1
- package/package.json +3 -3
- package/server.json +16 -2
|
@@ -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.6.
|
|
10
|
+
"version": "0.6.2"
|
|
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.6.
|
|
18
|
+
"version": "0.6.2",
|
|
19
19
|
"author": {
|
|
20
20
|
"name": "Chris Hall"
|
|
21
21
|
},
|
package/.claude-plugin/mcp.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "microsoft-teams-mcp",
|
|
3
3
|
"displayName": "Microsoft Teams",
|
|
4
|
-
"version": "0.6.
|
|
4
|
+
"version": "0.6.2",
|
|
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
|
@@ -168,6 +168,7 @@ Everything is optional — by default the token is captured from your browser.
|
|
|
168
168
|
| `TEAMS_TOKEN_CACHE` | `false` to keep the captured token in memory only. Defaults to on. |
|
|
169
169
|
| `TEAMS_TOKEN_FILE` | Where the captured token is cached. Defaults to `~/.microsoft-teams-mcp/token.json`. |
|
|
170
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_SHAREPOINT_TOKEN_FILE` | Where the captured SharePoint tokens (one per host, used to download shared files) are cached. Defaults to `~/.microsoft-teams-mcp/sharepoint-tokens.json`. `TEAMS_TOKEN_CACHE=false` keeps them in memory too. |
|
|
171
172
|
| `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. |
|
|
172
173
|
| `TEAMS_WS_PORT` | fetchproxy concentrator port. Defaults to `37149`, the fleet-wide shared port. |
|
|
173
174
|
| `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. |
|
package/dist/auth-fetchproxy.js
CHANGED
|
@@ -26,10 +26,11 @@
|
|
|
26
26
|
* code that needs a token, as Outlook's client does, so a server run with
|
|
27
27
|
* `TEAMS_ACCESS_TOKEN` never has to load the bridge to boot.
|
|
28
28
|
*/
|
|
29
|
-
import {
|
|
29
|
+
import { captureBearerHeader, createFetchproxyTransport } from '@chrischall/mcp-utils/fetchproxy';
|
|
30
30
|
import { readPortEnv } from '@chrischall/mcp-utils';
|
|
31
|
-
import {
|
|
31
|
+
import { captureWindowMs } from './capture-window.js';
|
|
32
32
|
import { PACKAGE_NAME, VERSION } from './version.js';
|
|
33
|
+
export { stripBearer } from '@chrischall/mcp-utils/fetchproxy';
|
|
33
34
|
/**
|
|
34
35
|
* fetchproxy concentrator port — one for the whole fleet. `TEAMS_WS_PORT`
|
|
35
36
|
* overrides it for local development and for a hosted bridged registration
|
|
@@ -64,75 +65,36 @@ export const CAPTURE_DECL = {
|
|
|
64
65
|
*/
|
|
65
66
|
export const TRUST_DOMAINS = [CAPTURE_DECL.host];
|
|
66
67
|
/**
|
|
67
|
-
*
|
|
68
|
-
*
|
|
68
|
+
* Build the capture transport through this module's import binding, so a
|
|
69
|
+
* test's `vi.mock('@chrischall/mcp-utils/fetchproxy')` stub is the one used.
|
|
70
|
+
* Shared by the SharePoint and Substrate captures.
|
|
69
71
|
*/
|
|
70
|
-
const
|
|
71
|
-
/** Normalise a captured header to a bare token, dropping any `Bearer ` prefix. */
|
|
72
|
-
export function stripBearer(raw) {
|
|
73
|
-
const m = /^\s*Bearer\s+(.+)$/i.exec(raw);
|
|
74
|
-
return (m ? m[1] : raw).trim();
|
|
75
|
-
}
|
|
72
|
+
export const createCaptureTransport = (opts) => createFetchproxyTransport(opts);
|
|
76
73
|
/**
|
|
77
74
|
* Capture a chat-service access token from the user's signed-in Teams tab.
|
|
78
75
|
* Returns the bare token (no `Bearer ` prefix).
|
|
76
|
+
*
|
|
77
|
+
* `captureBearerHeader` declares only `capture_request_header` (beside the
|
|
78
|
+
* `fetch` base verb mcp-utils always keeps) — the same set as before the
|
|
79
|
+
* Activity feed left the page, so an existing pairing needs no re-approval —
|
|
80
|
+
* sets the bridge deadline to the capture window + 15 s, starts the transport
|
|
81
|
+
* (skipping `start()` makes the first verb throw "ensureConnected called before
|
|
82
|
+
* listen()", which reads exactly like a pairing problem), guards against a
|
|
83
|
+
* header too short to be a token, and closes the transport whatever happened.
|
|
79
84
|
*/
|
|
80
85
|
export async function captureTokenViaFetchproxy(env = process.env) {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
//
|
|
85
|
-
|
|
86
|
-
// base verb mcp-utils always keeps (the field replaces the server default).
|
|
87
|
-
// This is the same set as before the Activity feed left the page, so an
|
|
88
|
-
// existing pairing needs no re-approval.
|
|
89
|
-
...createBootstrapOpts({
|
|
90
|
-
domains: [...TRUST_DOMAINS],
|
|
91
|
-
bootstrap: { captureHeaders: [{ ...CAPTURE_DECL }] },
|
|
92
|
-
}),
|
|
86
|
+
return captureBearerHeader({
|
|
87
|
+
captures: [CAPTURE_DECL],
|
|
88
|
+
domains: TRUST_DOMAINS,
|
|
89
|
+
// Read per capture, not at import: see `capture-window.ts`.
|
|
90
|
+
windowMs: captureWindowMs(env),
|
|
93
91
|
port: getWsPort(),
|
|
94
|
-
// Both: the explicit deadline for every bridge version, and the declared
|
|
95
|
-
// window so mcp-utils' own derivation agrees with it.
|
|
96
|
-
fetchTimeoutMs: bridgeDeadlineMs(windowMs),
|
|
97
|
-
captureWindowMs: windowMs,
|
|
98
92
|
serverName: PACKAGE_NAME,
|
|
99
93
|
version: VERSION,
|
|
94
|
+
what: 'a Teams token',
|
|
95
|
+
guidance: 'Open a signed-in teams.cloud.microsoft tab and click into any chat — ' +
|
|
96
|
+
'that is what makes the page call the chat service; an idle tab never ' +
|
|
97
|
+
'does — then retry.',
|
|
98
|
+
createTransport: createCaptureTransport,
|
|
100
99
|
});
|
|
101
|
-
try {
|
|
102
|
-
// `start()` loads the identity keypair. It does not bind the port or dial —
|
|
103
|
-
// that stays lazy until the first verb — but skipping it makes the first
|
|
104
|
-
// verb throw "ensureConnected called before listen()", which reads exactly
|
|
105
|
-
// like a pairing problem and is not one.
|
|
106
|
-
await transport.start();
|
|
107
|
-
try {
|
|
108
|
-
const raw = await transport.server.captureRequestHeader({
|
|
109
|
-
...CAPTURE_DECL,
|
|
110
|
-
timeoutMs: windowMs,
|
|
111
|
-
});
|
|
112
|
-
if (typeof raw !== 'string') {
|
|
113
|
-
throw new Error(`${CAPTURE_DECL.host}: capture returned no header`);
|
|
114
|
-
}
|
|
115
|
-
const token = stripBearer(raw);
|
|
116
|
-
if (token.length < MIN_TOKEN_LENGTH) {
|
|
117
|
-
throw new Error(`${CAPTURE_DECL.host}: authorization header was present but too short to be a ` +
|
|
118
|
-
`token (${token.length} chars)`);
|
|
119
|
-
}
|
|
120
|
-
return token;
|
|
121
|
-
}
|
|
122
|
-
catch (e) {
|
|
123
|
-
const detail = e.message;
|
|
124
|
-
throw new Error(`could not capture a Teams token from the browser (${detail}). ` +
|
|
125
|
-
'Open a signed-in teams.cloud.microsoft tab and click into any chat — ' +
|
|
126
|
-
'that is what makes the page call the chat service; an idle tab never ' +
|
|
127
|
-
'does — then retry.');
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
finally {
|
|
131
|
-
try {
|
|
132
|
-
await transport.close();
|
|
133
|
-
}
|
|
134
|
-
catch {
|
|
135
|
-
/* the token, or the original failure, is what matters */
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
100
|
}
|