@chrischall/microsoft-teams-mcp 0.8.5 → 0.8.7
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 +4 -3
- package/dist/bridge-scope.js +8 -1
- package/dist/bundle.js +333 -54
- package/dist/sharepoint-auth.js +3 -3
- package/dist/sharepoint.js +1 -1
- package/dist/tools/attachment.js +9 -4
- package/dist/version.js +1 -1
- package/package.json +10 -10
- package/server.json +2 -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.8.
|
|
10
|
+
"version": "0.8.7"
|
|
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.8.
|
|
18
|
+
"version": "0.8.7",
|
|
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.8.
|
|
4
|
+
"version": "0.8.7",
|
|
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
|
@@ -83,8 +83,9 @@ Two things follow from that:
|
|
|
83
83
|
- **Open the file once per SharePoint host.** The SharePoint token is captured
|
|
84
84
|
from the browser's own request to the file's SharePoint host, is short-lived
|
|
85
85
|
(~53 minutes), and is scoped to one host family. So the first file from a
|
|
86
|
-
given host in a session may need you to
|
|
87
|
-
|
|
86
|
+
given host in a session may need you to reload a signed-in Teams tab (the
|
|
87
|
+
requests it makes while loading are what the token is read from; opening a
|
|
88
|
+
file does not reliably make one); after that the token is
|
|
88
89
|
cached and refreshed until it expires. A file your account cannot open, or on
|
|
89
90
|
a SharePoint host your token does not cover, comes back as metadata and its
|
|
90
91
|
open link rather than failing.
|
|
@@ -458,7 +459,7 @@ Everything is optional — by default the token is captured from your browser.
|
|
|
458
459
|
returned as its contents — an image as the image, anything else as an embedded
|
|
459
460
|
resource carrying the bytes. Shared-file download uses a separate, short-lived
|
|
460
461
|
SharePoint token captured per SharePoint host, so the first file from a given
|
|
461
|
-
host may need [
|
|
462
|
+
host may need [your Teams tab reloaded](#sharepoint-file-download) to mint it; a
|
|
462
463
|
file your account cannot open, or one that could not be fetched, comes back as
|
|
463
464
|
metadata and its open link instead of failing. The caption names the
|
|
464
465
|
conversation beside its id (`title`, plus `participants` for an untitled
|
package/dist/bridge-scope.js
CHANGED
|
@@ -129,5 +129,12 @@ export function withBridgeScope(opts, env, extraSharePointHost) {
|
|
|
129
129
|
const hosts = knownSharePointHosts(env);
|
|
130
130
|
if (extraSharePointHost !== undefined)
|
|
131
131
|
hosts.push(extraSharePointHost);
|
|
132
|
-
return {
|
|
132
|
+
return {
|
|
133
|
+
...opts,
|
|
134
|
+
domains: [...BRIDGE_TRUST_DOMAINS],
|
|
135
|
+
// Only Teams needs a page: the SharePoint and search captures read requests
|
|
136
|
+
// the Teams tab makes, so a tab on those domains would do nothing.
|
|
137
|
+
tabDomains: [CAPTURE_DECL.host],
|
|
138
|
+
captureHeaders: bridgeCaptureDecls(hosts),
|
|
139
|
+
};
|
|
133
140
|
}
|
package/dist/bundle.js
CHANGED
|
@@ -38523,7 +38523,7 @@ var init_version = __esm({
|
|
|
38523
38523
|
"src/version.ts"() {
|
|
38524
38524
|
"use strict";
|
|
38525
38525
|
PACKAGE_NAME = "microsoft-teams-mcp";
|
|
38526
|
-
VERSION = "0.8.
|
|
38526
|
+
VERSION = "0.8.7";
|
|
38527
38527
|
}
|
|
38528
38528
|
});
|
|
38529
38529
|
|
|
@@ -39574,6 +39574,38 @@ var init_capability_availability = __esm({
|
|
|
39574
39574
|
}
|
|
39575
39575
|
});
|
|
39576
39576
|
|
|
39577
|
+
// node_modules/@fetchproxy/protocol/dist/binary-fetch.js
|
|
39578
|
+
function parseResponseTooLarge(error62) {
|
|
39579
|
+
const declared = TOO_LARGE_DECLARED_RE.exec(error62);
|
|
39580
|
+
if (declared)
|
|
39581
|
+
return { limitBytes: Number(declared[2]), declaredBytes: Number(declared[1]) };
|
|
39582
|
+
const streamed = TOO_LARGE_STREAMED_RE.exec(error62);
|
|
39583
|
+
if (streamed)
|
|
39584
|
+
return { limitBytes: Number(streamed[1]), declaredBytes: null };
|
|
39585
|
+
return null;
|
|
39586
|
+
}
|
|
39587
|
+
function isBase64Body(s) {
|
|
39588
|
+
return s.length % 4 === 0 && BASE64_RE.test(s);
|
|
39589
|
+
}
|
|
39590
|
+
var FETCH_RESPONSE_TYPE_BASE64, EXTENSION_FEATURE_FETCH_BASE64, KNOWN_EXTENSION_FEATURES, MAX_EXTENSION_FEATURES, MAX_EXTENSION_FEATURE_LENGTH, HOSTED_RELAY_MESSAGE_BYTES, MAX_BINARY_RESPONSE_BYTES, RESPONSE_TOO_LARGE_CODE, TOO_LARGE_DECLARED_RE, TOO_LARGE_STREAMED_RE, BASE64_RE;
|
|
39591
|
+
var init_binary_fetch = __esm({
|
|
39592
|
+
"node_modules/@fetchproxy/protocol/dist/binary-fetch.js"() {
|
|
39593
|
+
FETCH_RESPONSE_TYPE_BASE64 = "base64";
|
|
39594
|
+
EXTENSION_FEATURE_FETCH_BASE64 = "fetch_base64";
|
|
39595
|
+
KNOWN_EXTENSION_FEATURES = /* @__PURE__ */ new Set([
|
|
39596
|
+
EXTENSION_FEATURE_FETCH_BASE64
|
|
39597
|
+
]);
|
|
39598
|
+
MAX_EXTENSION_FEATURES = 32;
|
|
39599
|
+
MAX_EXTENSION_FEATURE_LENGTH = 64;
|
|
39600
|
+
HOSTED_RELAY_MESSAGE_BYTES = 32 * 1024 * 1024;
|
|
39601
|
+
MAX_BINARY_RESPONSE_BYTES = 16 * 1024 * 1024;
|
|
39602
|
+
RESPONSE_TOO_LARGE_CODE = "response_too_large";
|
|
39603
|
+
TOO_LARGE_DECLARED_RE = /^response body too large: content-length (\d{1,16}) exceeds the (\d{1,16})-byte binary cap/;
|
|
39604
|
+
TOO_LARGE_STREAMED_RE = /^response body too large: more than the (\d{1,16})-byte binary cap was received/;
|
|
39605
|
+
BASE64_RE = /^[A-Za-z0-9+/]*={0,2}$/;
|
|
39606
|
+
}
|
|
39607
|
+
});
|
|
39608
|
+
|
|
39577
39609
|
// node_modules/@fetchproxy/protocol/dist/json-pointer.js
|
|
39578
39610
|
function matchesDeclaredKey(requested, declared) {
|
|
39579
39611
|
for (const decl of declared) {
|
|
@@ -39785,7 +39817,7 @@ function assertString(x, label) {
|
|
|
39785
39817
|
}
|
|
39786
39818
|
function assertBase64(x, label) {
|
|
39787
39819
|
assertString(x, label);
|
|
39788
|
-
if (!
|
|
39820
|
+
if (!BASE64_RE2.test(x))
|
|
39789
39821
|
throw new ProtocolError3(`${label}: invalid base64`);
|
|
39790
39822
|
}
|
|
39791
39823
|
function base64ByteLength(s) {
|
|
@@ -40189,6 +40221,17 @@ function validateFrame(raw) {
|
|
|
40189
40221
|
}
|
|
40190
40222
|
throw new ProtocolError3(`unknown frame type: ${String(t)}`);
|
|
40191
40223
|
}
|
|
40224
|
+
function assertTabDomains(value, domains, label) {
|
|
40225
|
+
if (!Array.isArray(value))
|
|
40226
|
+
throw new ProtocolError3(`${label}: expected array`);
|
|
40227
|
+
if (value.length === 0)
|
|
40228
|
+
throw new ProtocolError3(`${label}: must be non-empty`);
|
|
40229
|
+
for (const d of value) {
|
|
40230
|
+
if (typeof d !== "string" || !domains.includes(d)) {
|
|
40231
|
+
throw new ProtocolError3(`${label}: ${JSON.stringify(d)} is not one of the declared domains [${domains.join(", ")}]`);
|
|
40232
|
+
}
|
|
40233
|
+
}
|
|
40234
|
+
}
|
|
40192
40235
|
function validateHello(raw) {
|
|
40193
40236
|
if (raw.protocolVersion !== PROTOCOL_VERSION) {
|
|
40194
40237
|
throw new ProtocolError3(`hello.protocolVersion: must be ${PROTOCOL_VERSION}`);
|
|
@@ -40265,6 +40308,9 @@ function validateHello(raw) {
|
|
|
40265
40308
|
}
|
|
40266
40309
|
if (raw.accepts !== void 0)
|
|
40267
40310
|
assertAcceptsList(raw.accepts);
|
|
40311
|
+
if (raw.tabDomains !== void 0) {
|
|
40312
|
+
assertTabDomains(raw.tabDomains, raw.domains, "hello.tabDomains");
|
|
40313
|
+
}
|
|
40268
40314
|
if (raw.graphqlOps !== void 0) {
|
|
40269
40315
|
assertGraphqlOpsArray(raw.graphqlOps, "hello.graphqlOps");
|
|
40270
40316
|
}
|
|
@@ -40291,6 +40337,8 @@ function validateHello(raw) {
|
|
|
40291
40337
|
if (raw.unavailableCapabilities !== void 0) {
|
|
40292
40338
|
assertUnavailableCapabilities(raw.unavailableCapabilities);
|
|
40293
40339
|
}
|
|
40340
|
+
if (raw.features !== void 0)
|
|
40341
|
+
assertExtensionFeatures(raw.features);
|
|
40294
40342
|
return raw;
|
|
40295
40343
|
}
|
|
40296
40344
|
throw new ProtocolError3(`hello.role: must be 'server' or 'extension', got ${String(role)}`);
|
|
@@ -40355,6 +40403,22 @@ function assertAcceptsList(accepts) {
|
|
|
40355
40403
|
}
|
|
40356
40404
|
}
|
|
40357
40405
|
}
|
|
40406
|
+
function assertExtensionFeatures(list) {
|
|
40407
|
+
const label = "hello.features";
|
|
40408
|
+
if (!Array.isArray(list))
|
|
40409
|
+
throw new ProtocolError3(`${label}: expected array`);
|
|
40410
|
+
if (list.length > MAX_EXTENSION_FEATURES) {
|
|
40411
|
+
throw new ProtocolError3(`${label}: at most ${MAX_EXTENSION_FEATURES} entries, got ${list.length}`);
|
|
40412
|
+
}
|
|
40413
|
+
for (const f of list) {
|
|
40414
|
+
if (typeof f !== "string") {
|
|
40415
|
+
throw new ProtocolError3(`${label}: entry must be string, got ${typeof f}`);
|
|
40416
|
+
}
|
|
40417
|
+
if (f.length < 1 || f.length > MAX_EXTENSION_FEATURE_LENGTH) {
|
|
40418
|
+
throw new ProtocolError3(`${label}: entry must be 1-${MAX_EXTENSION_FEATURE_LENGTH} characters, got ${f.length}`);
|
|
40419
|
+
}
|
|
40420
|
+
}
|
|
40421
|
+
}
|
|
40358
40422
|
function assertUnavailableCapabilities(list) {
|
|
40359
40423
|
const label = "hello.unavailableCapabilities";
|
|
40360
40424
|
if (!Array.isArray(list))
|
|
@@ -40558,6 +40622,11 @@ function validateInnerRequest(raw) {
|
|
|
40558
40622
|
throw new ProtocolError3("inner.init.credentials: must be 'include' or 'omit'");
|
|
40559
40623
|
}
|
|
40560
40624
|
}
|
|
40625
|
+
if (raw.init.responseType !== void 0) {
|
|
40626
|
+
if (raw.init.responseType !== FETCH_RESPONSE_TYPE_BASE64) {
|
|
40627
|
+
throw new ProtocolError3("inner.init.responseType: must be 'base64' when present");
|
|
40628
|
+
}
|
|
40629
|
+
}
|
|
40561
40630
|
return raw;
|
|
40562
40631
|
}
|
|
40563
40632
|
if (raw.op === "read_cookies") {
|
|
@@ -40862,6 +40931,16 @@ function validateInnerResponse(raw) {
|
|
|
40862
40931
|
assertPositiveInt(raw.status, "inner.status");
|
|
40863
40932
|
assertString(raw.url, "inner.url");
|
|
40864
40933
|
assertString(raw.body, "inner.body");
|
|
40934
|
+
if (raw.bodyEncoding !== void 0) {
|
|
40935
|
+
if (raw.bodyEncoding !== "base64") {
|
|
40936
|
+
throw new ProtocolError3("inner.bodyEncoding: must be 'base64' when present");
|
|
40937
|
+
}
|
|
40938
|
+
if (!isBase64Body(raw.body)) {
|
|
40939
|
+
throw new ProtocolError3("inner.body: not standard padded base64 under bodyEncoding base64");
|
|
40940
|
+
}
|
|
40941
|
+
}
|
|
40942
|
+
if (raw.headers !== void 0)
|
|
40943
|
+
assertStringMap(raw.headers, "inner.headers");
|
|
40865
40944
|
return raw;
|
|
40866
40945
|
}
|
|
40867
40946
|
if (op === "read_cookies") {
|
|
@@ -40980,11 +41059,12 @@ function validateInnerResponse(raw) {
|
|
|
40980
41059
|
}
|
|
40981
41060
|
throw new ProtocolError3(`inner.ok: must be boolean, got ${typeof raw.ok}`);
|
|
40982
41061
|
}
|
|
40983
|
-
var ProtocolError3, FORBIDDEN_KEYS,
|
|
41062
|
+
var ProtocolError3, FORBIDDEN_KEYS, BASE64_RE2, SCOPE_KEY_RE, SCOPE_KEY_GLOB_RE, HEADER_NAME_RE, HOSTNAME_RE, CAPTURE_PATH_RE, DOM_SELECTOR_RE, DOM_ATTRIBUTE_RE, GRAPHQL_OP_NAME_RE, PAIR_CODE_RE, DISPLAY_FORBIDDEN_RE, ACCOUNT_KEY_FIELDS, ACCOUNT_ATTEST_FIELDS, TYPE_ONLY_FIELDS, BRIDGE_ROLE_FIELDS, BRIDGE_ROLE_SERVING_FIELDS, KNOWN_RESPONSE_OPS;
|
|
40984
41063
|
var init_validate = __esm({
|
|
40985
41064
|
"node_modules/@fetchproxy/protocol/dist/validate.js"() {
|
|
40986
41065
|
init_frames();
|
|
40987
41066
|
init_capability_availability();
|
|
41067
|
+
init_binary_fetch();
|
|
40988
41068
|
init_mcp_id();
|
|
40989
41069
|
init_account_attest();
|
|
40990
41070
|
init_json_pointer();
|
|
@@ -40997,7 +41077,7 @@ var init_validate = __esm({
|
|
|
40997
41077
|
}
|
|
40998
41078
|
};
|
|
40999
41079
|
FORBIDDEN_KEYS = /* @__PURE__ */ new Set(["__proto__", "constructor", "prototype"]);
|
|
41000
|
-
|
|
41080
|
+
BASE64_RE2 = /^[A-Za-z0-9+/]*={0,2}$/;
|
|
41001
41081
|
SCOPE_KEY_RE = /^[A-Za-z0-9_.\-]{1,256}$/;
|
|
41002
41082
|
SCOPE_KEY_GLOB_RE = /^[A-Za-z0-9_.\-]{1,256}\*?$/;
|
|
41003
41083
|
HEADER_NAME_RE = /^[A-Za-z0-9_\-]{1,128}$/;
|
|
@@ -41161,6 +41241,7 @@ var init_dist3 = __esm({
|
|
|
41161
41241
|
init_account_attest();
|
|
41162
41242
|
init_awaiting_approval();
|
|
41163
41243
|
init_capability_availability();
|
|
41244
|
+
init_binary_fetch();
|
|
41164
41245
|
init_validate();
|
|
41165
41246
|
init_room_frames();
|
|
41166
41247
|
init_crypto();
|
|
@@ -41184,7 +41265,30 @@ function sessionInfoFromHello(hello) {
|
|
|
41184
41265
|
known.add(c);
|
|
41185
41266
|
}
|
|
41186
41267
|
}
|
|
41187
|
-
|
|
41268
|
+
const features = /* @__PURE__ */ new Set();
|
|
41269
|
+
const rawFeatures = hello.features;
|
|
41270
|
+
if (Array.isArray(rawFeatures)) {
|
|
41271
|
+
for (const f of rawFeatures) {
|
|
41272
|
+
if (typeof f === "string" && KNOWN_EXTENSION_FEATURES.has(f))
|
|
41273
|
+
features.add(f);
|
|
41274
|
+
}
|
|
41275
|
+
}
|
|
41276
|
+
return {
|
|
41277
|
+
platform: hello.platform,
|
|
41278
|
+
unavailableCapabilities: [...known].sort(),
|
|
41279
|
+
features: [...features].sort()
|
|
41280
|
+
};
|
|
41281
|
+
}
|
|
41282
|
+
function featureForRequest(inner) {
|
|
41283
|
+
if (inner.type !== "request" || inner.op !== "fetch")
|
|
41284
|
+
return null;
|
|
41285
|
+
return inner.init.responseType === "base64" ? EXTENSION_FEATURE_FETCH_BASE64 : null;
|
|
41286
|
+
}
|
|
41287
|
+
function missingFeatureFor(inner, info) {
|
|
41288
|
+
const feature = featureForRequest(inner);
|
|
41289
|
+
if (feature === null || info === null)
|
|
41290
|
+
return null;
|
|
41291
|
+
return info.features.includes(feature) ? null : feature;
|
|
41188
41292
|
}
|
|
41189
41293
|
function capabilitiesForRequest(inner) {
|
|
41190
41294
|
if (inner.type !== "request")
|
|
@@ -41294,6 +41398,7 @@ var require_constants = __commonJS({
|
|
|
41294
41398
|
var require_buffer_util = __commonJS({
|
|
41295
41399
|
"node_modules/ws/lib/buffer-util.js"(exports, module) {
|
|
41296
41400
|
"use strict";
|
|
41401
|
+
var { websocketMask, websocketUnmask } = __require("http");
|
|
41297
41402
|
var { EMPTY_BUFFER } = require_constants();
|
|
41298
41403
|
var FastBuffer = Buffer[Symbol.species];
|
|
41299
41404
|
function concat(list, totalLength) {
|
|
@@ -41348,7 +41453,16 @@ var require_buffer_util = __commonJS({
|
|
|
41348
41453
|
toBuffer,
|
|
41349
41454
|
unmask: _unmask
|
|
41350
41455
|
};
|
|
41351
|
-
if (
|
|
41456
|
+
if (websocketMask) {
|
|
41457
|
+
module.exports.mask = function(source, mask, output2, offset, length) {
|
|
41458
|
+
if (length < 24) _mask(source, mask, output2, offset, length);
|
|
41459
|
+
else websocketMask(source, mask, output2, offset, length);
|
|
41460
|
+
};
|
|
41461
|
+
module.exports.unmask = function(buffer, mask) {
|
|
41462
|
+
if (buffer.length < 24) _unmask(buffer, mask);
|
|
41463
|
+
else websocketUnmask(buffer, mask);
|
|
41464
|
+
};
|
|
41465
|
+
} else if (false) {
|
|
41352
41466
|
try {
|
|
41353
41467
|
const bufferUtil = null;
|
|
41354
41468
|
module.exports.mask = function(source, mask, output2, offset, length) {
|
|
@@ -42411,6 +42525,7 @@ var require_receiver = __commonJS({
|
|
|
42411
42525
|
unmask(data, this._mask);
|
|
42412
42526
|
}
|
|
42413
42527
|
}
|
|
42528
|
+
this._mask = void 0;
|
|
42414
42529
|
if (this._opcode > 7) {
|
|
42415
42530
|
this.controlMessage(data, cb);
|
|
42416
42531
|
return;
|
|
@@ -42743,12 +42858,15 @@ var require_sender = __commonJS({
|
|
|
42743
42858
|
target[2] = target[3] = 0;
|
|
42744
42859
|
target.writeUIntBE(dataLength, 4, 6);
|
|
42745
42860
|
}
|
|
42746
|
-
if (!options.mask)
|
|
42861
|
+
if (!options.mask) {
|
|
42862
|
+
return dataLength ? [target, data] : [target];
|
|
42863
|
+
}
|
|
42747
42864
|
target[1] |= 128;
|
|
42748
42865
|
target[offset - 4] = mask[0];
|
|
42749
42866
|
target[offset - 3] = mask[1];
|
|
42750
42867
|
target[offset - 2] = mask[2];
|
|
42751
42868
|
target[offset - 1] = mask[3];
|
|
42869
|
+
if (!dataLength) return [target];
|
|
42752
42870
|
if (skipMasking) return [target, data];
|
|
42753
42871
|
if (merge2) {
|
|
42754
42872
|
applyMask(data, mask, target, offset, dataLength);
|
|
@@ -43505,6 +43623,7 @@ var require_websocket = __commonJS({
|
|
|
43505
43623
|
var https = __require("https");
|
|
43506
43624
|
var http = __require("http");
|
|
43507
43625
|
var net = __require("net");
|
|
43626
|
+
var querystring = __require("querystring");
|
|
43508
43627
|
var tls = __require("tls");
|
|
43509
43628
|
var { randomBytes: randomBytes8, createHash: createHash5 } = __require("crypto");
|
|
43510
43629
|
var { Duplex, Readable } = __require("stream");
|
|
@@ -44031,10 +44150,9 @@ var require_websocket = __commonJS({
|
|
|
44031
44150
|
throw new SyntaxError(`Invalid URL: ${address}`);
|
|
44032
44151
|
}
|
|
44033
44152
|
}
|
|
44034
|
-
if (parsedUrl.protocol === "http:") {
|
|
44035
|
-
parsedUrl
|
|
44036
|
-
|
|
44037
|
-
parsedUrl.protocol = "wss:";
|
|
44153
|
+
if (parsedUrl.protocol === "http:" || parsedUrl.protocol === "https:") {
|
|
44154
|
+
parsedUrl = new URL2(parsedUrl);
|
|
44155
|
+
parsedUrl.protocol = parsedUrl.protocol === "http:" ? "ws:" : "wss:";
|
|
44038
44156
|
}
|
|
44039
44157
|
websocket._url = parsedUrl.href;
|
|
44040
44158
|
const isSecure = parsedUrl.protocol === "wss:";
|
|
@@ -44103,12 +44221,19 @@ var require_websocket = __commonJS({
|
|
|
44103
44221
|
}
|
|
44104
44222
|
}
|
|
44105
44223
|
if (parsedUrl.username || parsedUrl.password) {
|
|
44106
|
-
|
|
44224
|
+
const username = querystring.unescape(parsedUrl.username);
|
|
44225
|
+
const password = querystring.unescape(parsedUrl.password);
|
|
44226
|
+
opts.auth = `${username}:${password}`;
|
|
44107
44227
|
}
|
|
44108
44228
|
if (isIpcUrl) {
|
|
44109
|
-
const
|
|
44110
|
-
|
|
44111
|
-
|
|
44229
|
+
const i = opts.path.indexOf(":");
|
|
44230
|
+
if (i === -1) {
|
|
44231
|
+
opts.socketPath = opts.path;
|
|
44232
|
+
opts.path = "";
|
|
44233
|
+
} else {
|
|
44234
|
+
opts.socketPath = opts.path.slice(0, i);
|
|
44235
|
+
opts.path = opts.path.slice(i + 1);
|
|
44236
|
+
}
|
|
44112
44237
|
}
|
|
44113
44238
|
let req;
|
|
44114
44239
|
if (opts.followRedirects) {
|
|
@@ -44303,8 +44428,13 @@ var require_websocket = __commonJS({
|
|
|
44303
44428
|
function receiverOnConclude(code2, reason2) {
|
|
44304
44429
|
const websocket = this[kWebSocket];
|
|
44305
44430
|
websocket._closeFrameReceived = true;
|
|
44306
|
-
websocket._closeMessage = reason2;
|
|
44307
44431
|
websocket._closeCode = code2;
|
|
44432
|
+
if (reason2.length === 0) {
|
|
44433
|
+
websocket._closeMessage = EMPTY_BUFFER;
|
|
44434
|
+
} else {
|
|
44435
|
+
websocket._closeMessage = Buffer.allocUnsafeSlow(reason2.length);
|
|
44436
|
+
websocket._closeMessage.set(reason2);
|
|
44437
|
+
}
|
|
44308
44438
|
if (websocket._socket[kWebSocket] === void 0) return;
|
|
44309
44439
|
websocket._socket.removeListener("data", socketOnData);
|
|
44310
44440
|
process.nextTick(resume, websocket._socket);
|
|
@@ -44988,6 +45118,8 @@ async function buildServerHello(opts) {
|
|
|
44988
45118
|
};
|
|
44989
45119
|
if (opts.accepts && opts.accepts.length > 0)
|
|
44990
45120
|
hello.accepts = [...opts.accepts];
|
|
45121
|
+
if (opts.tabDomains && opts.tabDomains.length > 0)
|
|
45122
|
+
hello.tabDomains = [...opts.tabDomains];
|
|
44991
45123
|
if (opts.cookieKeys && opts.cookieKeys.length > 0) {
|
|
44992
45124
|
hello.cookieKeys = [...opts.cookieKeys];
|
|
44993
45125
|
}
|
|
@@ -45825,7 +45957,8 @@ async function startHost(opts) {
|
|
|
45825
45957
|
sessionStoragePointers: opts.ownSessionStoragePointers,
|
|
45826
45958
|
domSelectors: opts.ownDomSelectors,
|
|
45827
45959
|
domListSelectors: opts.ownDomListSelectors,
|
|
45828
|
-
graphqlOps: opts.ownGraphqlOps
|
|
45960
|
+
graphqlOps: opts.ownGraphqlOps,
|
|
45961
|
+
tabDomains: opts.ownTabDomains
|
|
45829
45962
|
};
|
|
45830
45963
|
const generateSessionKeypair = opts.generateSessionKeypair ?? generateX25519;
|
|
45831
45964
|
let extensionWs = null;
|
|
@@ -46411,6 +46544,7 @@ async function startPeer(opts) {
|
|
|
46411
46544
|
localStoragePointers: opts.localStoragePointers,
|
|
46412
46545
|
sessionStoragePointers: opts.sessionStoragePointers,
|
|
46413
46546
|
graphqlOps: opts.graphqlOps,
|
|
46547
|
+
tabDomains: opts.tabDomains,
|
|
46414
46548
|
// 2.5.0: let a host ≥2.5.0 tell us when the extension leaves, so
|
|
46415
46549
|
// `extensionConnected()` / `sessionLinked()` can go back to false.
|
|
46416
46550
|
// 2.6.0: `hello-rejected` for the same reason, from the extension.
|
|
@@ -46789,6 +46923,8 @@ var init_peer = __esm({
|
|
|
46789
46923
|
function classifyFetchError(error62, code2) {
|
|
46790
46924
|
if (code2 === CAPABILITY_UNAVAILABLE_CODE)
|
|
46791
46925
|
return "capability_unavailable";
|
|
46926
|
+
if (code2 === RESPONSE_TOO_LARGE_CODE)
|
|
46927
|
+
return "body_too_large";
|
|
46792
46928
|
if (/^(in-page )?fetch threw:/.test(error62)) {
|
|
46793
46929
|
return "tab_fetch_failed";
|
|
46794
46930
|
}
|
|
@@ -46888,6 +47024,13 @@ function protocolErrorFrom(error62, op, response) {
|
|
|
46888
47024
|
platform: unavailable?.platform ?? null
|
|
46889
47025
|
});
|
|
46890
47026
|
}
|
|
47027
|
+
const tooLarge = parseResponseTooLarge(error62);
|
|
47028
|
+
if (tooLarge !== null || response?.code === RESPONSE_TOO_LARGE_CODE) {
|
|
47029
|
+
return new FetchproxyResponseTooLargeError(error62, {
|
|
47030
|
+
limitBytes: tooLarge?.limitBytes ?? null,
|
|
47031
|
+
declaredBytes: tooLarge?.declaredBytes ?? null
|
|
47032
|
+
});
|
|
47033
|
+
}
|
|
46891
47034
|
if (error62 === "timeout")
|
|
46892
47035
|
return new FetchproxyWaitedError(error62, op);
|
|
46893
47036
|
if (SCOPE_REJECTION.test(error62))
|
|
@@ -46922,6 +47065,13 @@ function assertSubdomainLabel(label) {
|
|
|
46922
47065
|
throw new Error(`FetchproxyServer: subdomain must be a DNS label like "www" or "api" (or dot-separated like "auth.api"), got ${JSON.stringify(label)}`);
|
|
46923
47066
|
}
|
|
46924
47067
|
}
|
|
47068
|
+
function assertExpectedStatus(response, expected, asHttp = () => response) {
|
|
47069
|
+
if (expected === void 0)
|
|
47070
|
+
return;
|
|
47071
|
+
const matched = Array.isArray(expected) ? expected.includes(response.status) : response.status === expected;
|
|
47072
|
+
if (!matched)
|
|
47073
|
+
throw new FetchproxyHttpError(asHttp());
|
|
47074
|
+
}
|
|
46925
47075
|
function assertUrlInDomains(field, url2, domains) {
|
|
46926
47076
|
let parsed;
|
|
46927
47077
|
try {
|
|
@@ -46966,7 +47116,7 @@ function isResendableRequest(inner) {
|
|
|
46966
47116
|
return true;
|
|
46967
47117
|
}
|
|
46968
47118
|
}
|
|
46969
|
-
var FetchproxyProtocolError, FetchproxyHttpError, FetchproxyBridgeDownError, FetchproxyHintedError, FetchproxyScopeError, FetchproxyNoTabError, FetchproxyTabOpeningError, FetchproxyWaitedError, FetchproxyCapabilityUnavailableError, SCOPE_REJECTION, NO_TAB_REJECTION, TAB_OPENING_REJECTION, VERB_DEADLINE_GRACE_MS, FetchproxyTimeoutError, TIMEOUT_NOT_RESENT_NOTE, SUBDOMAIN_LABEL_RE, DEFAULT_JSON_OK_STATUSES, TIMEOUT_RETRY_SAFE_METHODS, FetchproxyServer;
|
|
47119
|
+
var FetchproxyProtocolError, FetchproxyHttpError, FetchproxyBridgeDownError, FetchproxyHintedError, FetchproxyScopeError, FetchproxyNoTabError, FetchproxyTabOpeningError, FetchproxyWaitedError, FetchproxyCapabilityUnavailableError, FetchproxyExtensionUpdateRequiredError, FetchproxyResponseTooLargeError, SCOPE_REJECTION, NO_TAB_REJECTION, TAB_OPENING_REJECTION, VERB_DEADLINE_GRACE_MS, FetchproxyTimeoutError, TIMEOUT_NOT_RESENT_NOTE, SUBDOMAIN_LABEL_RE, DEFAULT_JSON_OK_STATUSES, TIMEOUT_RETRY_SAFE_METHODS, FetchproxyServer;
|
|
46970
47120
|
var init_ws_server = __esm({
|
|
46971
47121
|
"node_modules/@fetchproxy/server/dist/ws-server.js"() {
|
|
46972
47122
|
init_dist3();
|
|
@@ -47069,6 +47219,28 @@ var init_ws_server = __esm({
|
|
|
47069
47219
|
this.platform = info.platform;
|
|
47070
47220
|
}
|
|
47071
47221
|
};
|
|
47222
|
+
FetchproxyExtensionUpdateRequiredError = class extends FetchproxyHintedError {
|
|
47223
|
+
/** The feature the extension lacks (`'fetch_base64'`). */
|
|
47224
|
+
feature;
|
|
47225
|
+
constructor(originalError, info) {
|
|
47226
|
+
super(originalError, `this MCP needs the browser extension to support "${info.feature}" (binary downloads through the bridge), and the ContextMint Bridge build it is paired with does not. Update ContextMint Bridge (Chrome Web Store / App Store, or rebuild a sideloaded copy and reload it), then retry. Nothing is wrong with the MCP or your pairing, and re-pairing will not change it.`);
|
|
47227
|
+
this.name = "FetchproxyExtensionUpdateRequiredError";
|
|
47228
|
+
this.feature = info.feature;
|
|
47229
|
+
}
|
|
47230
|
+
};
|
|
47231
|
+
FetchproxyResponseTooLargeError = class extends FetchproxyHintedError {
|
|
47232
|
+
/** The cap the extension enforced, in bytes, when it said; else `null`. */
|
|
47233
|
+
limitBytes;
|
|
47234
|
+
/** The response's `content-length`, when the refusal came from it; else `null`. */
|
|
47235
|
+
declaredBytes;
|
|
47236
|
+
constructor(originalError, info) {
|
|
47237
|
+
const cap = info.limitBytes ?? MAX_BINARY_RESPONSE_BYTES;
|
|
47238
|
+
super(originalError, `the file is larger than the ${cap}-byte cap one bridge response can carry, so the extension refused it rather than send a frame the bridge cannot deliver. This is not a version or pairing problem: fetch a smaller rendition if the site offers one, or download it directly in the browser.`);
|
|
47239
|
+
this.name = "FetchproxyResponseTooLargeError";
|
|
47240
|
+
this.limitBytes = info.limitBytes;
|
|
47241
|
+
this.declaredBytes = info.declaredBytes;
|
|
47242
|
+
}
|
|
47243
|
+
};
|
|
47072
47244
|
SCOPE_REJECTION = /not in declared/;
|
|
47073
47245
|
NO_TAB_REJECTION = /no tab matching (?!.*(content script loaded|one is still opening))/;
|
|
47074
47246
|
TAB_OPENING_REJECTION = /no tab matching .*one is still opening/;
|
|
@@ -47235,6 +47407,9 @@ var init_ws_server = __esm({
|
|
|
47235
47407
|
throw new Error(`FetchproxyServer: opts.domains entry ${JSON.stringify(d)} is a public suffix \u2014 declare a registrable domain (e.g. "example.${d}"), not the suffix every site under it shares`);
|
|
47236
47408
|
}
|
|
47237
47409
|
}
|
|
47410
|
+
if (opts.tabDomains !== void 0) {
|
|
47411
|
+
assertTabDomains(opts.tabDomains, opts.domains, "FetchproxyServer: opts.tabDomains");
|
|
47412
|
+
}
|
|
47238
47413
|
let capabilities;
|
|
47239
47414
|
if (opts.capabilities === void 0) {
|
|
47240
47415
|
capabilities = ["fetch"];
|
|
@@ -47305,6 +47480,7 @@ var init_ws_server = __esm({
|
|
|
47305
47480
|
name: d.name,
|
|
47306
47481
|
operationName: d.operationName
|
|
47307
47482
|
})),
|
|
47483
|
+
...opts.tabDomains !== void 0 ? { tabDomains: [...opts.tabDomains] } : {},
|
|
47308
47484
|
// 0.8.0+: timer + lazy-revive default to ON. Every realty MCP
|
|
47309
47485
|
// adapter was about to set these to the same numbers anyway; the
|
|
47310
47486
|
// back-door is `0` (explicit opt-out) if a caller genuinely wants
|
|
@@ -47434,6 +47610,7 @@ var init_ws_server = __esm({
|
|
|
47434
47610
|
ownDomSelectors: this.opts.domSelectors,
|
|
47435
47611
|
ownDomListSelectors: this.opts.domListSelectors,
|
|
47436
47612
|
ownGraphqlOps: this.opts.graphqlOps,
|
|
47613
|
+
ownTabDomains: this.opts.tabDomains,
|
|
47437
47614
|
onPairCode: this.opts.onPairCode,
|
|
47438
47615
|
extensionTrust: this.extensionTrust()
|
|
47439
47616
|
});
|
|
@@ -47467,6 +47644,7 @@ var init_ws_server = __esm({
|
|
|
47467
47644
|
domSelectors: this.opts.domSelectors,
|
|
47468
47645
|
domListSelectors: this.opts.domListSelectors,
|
|
47469
47646
|
graphqlOps: this.opts.graphqlOps,
|
|
47647
|
+
tabDomains: this.opts.tabDomains,
|
|
47470
47648
|
extensionTrust: this.extensionTrust(),
|
|
47471
47649
|
requireExtensionIdentity: this.opts.requireExtensionIdentity
|
|
47472
47650
|
});
|
|
@@ -47751,6 +47929,15 @@ var init_ws_server = __esm({
|
|
|
47751
47929
|
cause: err
|
|
47752
47930
|
};
|
|
47753
47931
|
}
|
|
47932
|
+
if (err instanceof FetchproxyExtensionUpdateRequiredError) {
|
|
47933
|
+
return {
|
|
47934
|
+
ok: false,
|
|
47935
|
+
error: err.originalError,
|
|
47936
|
+
kind: "extension_update_required",
|
|
47937
|
+
retryAttempted: false,
|
|
47938
|
+
cause: err
|
|
47939
|
+
};
|
|
47940
|
+
}
|
|
47754
47941
|
return {
|
|
47755
47942
|
ok: false,
|
|
47756
47943
|
error: err instanceof Error ? err.message : String(err),
|
|
@@ -47897,7 +48084,10 @@ var init_ws_server = __esm({
|
|
|
47897
48084
|
if (result.kind === "capability_unavailable") {
|
|
47898
48085
|
return protocolErrorFrom(result.error, void 0, { code: CAPABILITY_UNAVAILABLE_CODE, op });
|
|
47899
48086
|
}
|
|
47900
|
-
|
|
48087
|
+
if (result.kind === "extension_update_required" && result.cause instanceof FetchproxyExtensionUpdateRequiredError) {
|
|
48088
|
+
return result.cause;
|
|
48089
|
+
}
|
|
48090
|
+
return protocolErrorFrom(result.error, void 0, result.code !== void 0 ? { code: result.code, op } : void 0);
|
|
47901
48091
|
}
|
|
47902
48092
|
/**
|
|
47903
48093
|
* Convenience wrapper around `fetch()`. Builds the URL from a path
|
|
@@ -47917,6 +48107,88 @@ var init_ws_server = __esm({
|
|
|
47917
48107
|
* the declared domains exactly.
|
|
47918
48108
|
*/
|
|
47919
48109
|
async request(method, path, opts = {}) {
|
|
48110
|
+
const init = this.resolveRequestInit("request", method, path, opts);
|
|
48111
|
+
const result = await this.fetch(init, opts.retryOnTimeout !== void 0 ? { retryOnTimeout: opts.retryOnTimeout } : {});
|
|
48112
|
+
if (!result.ok)
|
|
48113
|
+
this.throwFetchFailure(result, init.url, method, opts.retryOnTimeout);
|
|
48114
|
+
const response = {
|
|
48115
|
+
status: result.status,
|
|
48116
|
+
body: result.body,
|
|
48117
|
+
url: result.url
|
|
48118
|
+
};
|
|
48119
|
+
assertExpectedStatus(response, opts.expectStatus);
|
|
48120
|
+
return response;
|
|
48121
|
+
}
|
|
48122
|
+
/**
|
|
48123
|
+
* #460: like `request()`, but the response body comes back as BYTES,
|
|
48124
|
+
* intact — a PDF, an office file, an image — together with the relayed
|
|
48125
|
+
* `content-type` / `content-length` / `content-disposition` headers and the
|
|
48126
|
+
* final URL after redirects.
|
|
48127
|
+
*
|
|
48128
|
+
* The extension runs it from its background worker rather than a tab, so a
|
|
48129
|
+
* file host that sends no CORS headers is still readable, and it follows
|
|
48130
|
+
* redirects. Both the request URL and the FINAL URL must be inside the
|
|
48131
|
+
* declared `domains` — the extension enforces that, and so does this method
|
|
48132
|
+
* on the answer. To read a signed file host, declare it.
|
|
48133
|
+
*
|
|
48134
|
+
* Bodies are capped at `MAX_BINARY_RESPONSE_BYTES` (16 MiB): over it the
|
|
48135
|
+
* extension refuses with `FetchproxyResponseTooLargeError`. An extension
|
|
48136
|
+
* that predates binary fetch is refused with
|
|
48137
|
+
* `FetchproxyExtensionUpdateRequiredError` — locally when its hello says so,
|
|
48138
|
+
* and on the answer when it replied in text anyway.
|
|
48139
|
+
*/
|
|
48140
|
+
async requestBytes(method, path, opts = {}) {
|
|
48141
|
+
const init = {
|
|
48142
|
+
...this.resolveRequestInit("requestBytes", method, path, opts),
|
|
48143
|
+
responseType: "base64"
|
|
48144
|
+
};
|
|
48145
|
+
const result = await this.fetch(init, opts.retryOnTimeout !== void 0 ? { retryOnTimeout: opts.retryOnTimeout } : {});
|
|
48146
|
+
if (!result.ok)
|
|
48147
|
+
this.throwFetchFailure(result, init.url, method, opts.retryOnTimeout);
|
|
48148
|
+
if (result.bodyEncoding !== "base64") {
|
|
48149
|
+
throw new FetchproxyExtensionUpdateRequiredError("the paired ContextMint Bridge extension answered a binary request as text", { feature: EXTENSION_FEATURE_FETCH_BASE64 });
|
|
48150
|
+
}
|
|
48151
|
+
try {
|
|
48152
|
+
assertUrlInDomains("requestBytes final url", result.url, this.opts.domains);
|
|
48153
|
+
} catch (err) {
|
|
48154
|
+
throw new FetchproxyProtocolError(err.message);
|
|
48155
|
+
}
|
|
48156
|
+
if (!isBase64Body(result.body)) {
|
|
48157
|
+
throw new FetchproxyProtocolError("requestBytes: the extension sent a body that is not base64");
|
|
48158
|
+
}
|
|
48159
|
+
const decoded = Buffer.from(result.body, "base64");
|
|
48160
|
+
const response = {
|
|
48161
|
+
status: result.status,
|
|
48162
|
+
url: result.url,
|
|
48163
|
+
headers: { ...result.headers ?? {} },
|
|
48164
|
+
bytes: new Uint8Array(decoded.buffer, decoded.byteOffset, decoded.byteLength)
|
|
48165
|
+
};
|
|
48166
|
+
assertExpectedStatus(response, opts.expectStatus, () => ({
|
|
48167
|
+
status: response.status,
|
|
48168
|
+
url: response.url,
|
|
48169
|
+
// FetchproxyHttpError carries an HttpResponse; a binary body has no
|
|
48170
|
+
// honest text form, so the bytes stay on the BinaryResponse.
|
|
48171
|
+
body: ""
|
|
48172
|
+
}));
|
|
48173
|
+
return response;
|
|
48174
|
+
}
|
|
48175
|
+
/** #460: `requestBytes('GET', path, opts)`. */
|
|
48176
|
+
getBytes(path, opts = {}) {
|
|
48177
|
+
return this.requestBytes("GET", path, opts);
|
|
48178
|
+
}
|
|
48179
|
+
/**
|
|
48180
|
+
* Resolve `path` + options into the wire `FetchInit` — URL building, the
|
|
48181
|
+
* declared-domain guard, the relay tab. Shared by `request()` and
|
|
48182
|
+
* `requestBytes()` so the two can never disagree about which URLs are
|
|
48183
|
+
* reachable.
|
|
48184
|
+
*
|
|
48185
|
+
* Path resolution:
|
|
48186
|
+
* - Absolute URL (`https://...`) → used as-is (still guarded against
|
|
48187
|
+
* leaving the declared domain set).
|
|
48188
|
+
* - Relative path → joined with `https://${subdomain}.${baseDomain}`
|
|
48189
|
+
* (or `https://${baseDomain}` if no subdomain is given).
|
|
48190
|
+
*/
|
|
48191
|
+
resolveRequestInit(caller, method, path, opts) {
|
|
47920
48192
|
if (opts.subdomain !== void 0)
|
|
47921
48193
|
assertSubdomainLabel(opts.subdomain);
|
|
47922
48194
|
const baseDomain = this.resolveBaseDomain(opts.domain);
|
|
@@ -47926,24 +48198,24 @@ var init_ws_server = __esm({
|
|
|
47926
48198
|
try {
|
|
47927
48199
|
host = new URL(path).host;
|
|
47928
48200
|
} catch {
|
|
47929
|
-
throw new Error(`FetchproxyServer
|
|
48201
|
+
throw new Error(`FetchproxyServer.${caller}: absolute path is not a valid URL: ${JSON.stringify(path)}`);
|
|
47930
48202
|
}
|
|
47931
48203
|
} else {
|
|
47932
48204
|
host = opts.subdomain ? `${opts.subdomain}.${baseDomain}` : baseDomain;
|
|
47933
48205
|
}
|
|
47934
48206
|
const url2 = isAbsolute6 ? path : `https://${host}${path}`;
|
|
47935
|
-
assertUrlInDomains(
|
|
48207
|
+
assertUrlInDomains(`${caller} url`, url2, this.opts.domains);
|
|
47936
48208
|
let tabUrl = `https://${host}/`;
|
|
47937
48209
|
if (opts.viaTab !== void 0) {
|
|
47938
48210
|
try {
|
|
47939
48211
|
new URL(opts.viaTab);
|
|
47940
48212
|
} catch {
|
|
47941
|
-
throw new Error(`FetchproxyServer
|
|
48213
|
+
throw new Error(`FetchproxyServer.${caller}: viaTab is not a valid URL: ${JSON.stringify(opts.viaTab)}`);
|
|
47942
48214
|
}
|
|
47943
48215
|
assertUrlInDomains("viaTab", opts.viaTab, this.opts.domains);
|
|
47944
48216
|
tabUrl = opts.viaTab;
|
|
47945
48217
|
}
|
|
47946
|
-
|
|
48218
|
+
return {
|
|
47947
48219
|
url: url2,
|
|
47948
48220
|
method,
|
|
47949
48221
|
tabUrl,
|
|
@@ -47958,29 +48230,16 @@ var init_ws_server = __esm({
|
|
|
47958
48230
|
// every version before this option existed.
|
|
47959
48231
|
...opts.credentials === "omit" ? { credentials: "omit" } : {}
|
|
47960
48232
|
};
|
|
47961
|
-
|
|
47962
|
-
|
|
47963
|
-
|
|
47964
|
-
|
|
47965
|
-
|
|
47966
|
-
if (result.kind === "capability_unavailable" && result.cause instanceof FetchproxyCapabilityUnavailableError) {
|
|
47967
|
-
throw result.cause;
|
|
47968
|
-
}
|
|
47969
|
-
throw this._typedErrorFor(result, init.url, "fetch", result.retryAttempted ?? false, isRetrySafeOnTimeout(method, opts.retryOnTimeout));
|
|
48233
|
+
}
|
|
48234
|
+
/** Turn a failed `fetch()` envelope into the throw `request()` has always made. */
|
|
48235
|
+
throwFetchFailure(result, url2, method, retryOnTimeout) {
|
|
48236
|
+
if (result.kind === "session_not_ready" && result.cause instanceof Error) {
|
|
48237
|
+
throw result.cause;
|
|
47970
48238
|
}
|
|
47971
|
-
|
|
47972
|
-
|
|
47973
|
-
body: result.body,
|
|
47974
|
-
url: result.url
|
|
47975
|
-
};
|
|
47976
|
-
if (opts.expectStatus !== void 0) {
|
|
47977
|
-
const expected = opts.expectStatus;
|
|
47978
|
-
const matched = Array.isArray(expected) ? expected.includes(response.status) : response.status === expected;
|
|
47979
|
-
if (!matched) {
|
|
47980
|
-
throw new FetchproxyHttpError(response);
|
|
47981
|
-
}
|
|
48239
|
+
if (result.kind === "capability_unavailable" && result.cause instanceof FetchproxyCapabilityUnavailableError) {
|
|
48240
|
+
throw result.cause;
|
|
47982
48241
|
}
|
|
47983
|
-
|
|
48242
|
+
throw this._typedErrorFor(result, url2, "fetch", result.retryAttempted ?? false, isRetrySafeOnTimeout(method, retryOnTimeout));
|
|
47984
48243
|
}
|
|
47985
48244
|
/** Issue a GET against `path` (resolved via `request()` rules). */
|
|
47986
48245
|
get(path, opts = {}) {
|
|
@@ -48781,6 +49040,10 @@ var init_ws_server = __esm({
|
|
|
48781
49040
|
status: inner.status,
|
|
48782
49041
|
url: inner.url,
|
|
48783
49042
|
body: inner.body,
|
|
49043
|
+
// #460: carried only when present, so a text answer's envelope
|
|
49044
|
+
// has exactly the keys it always had.
|
|
49045
|
+
...inner.bodyEncoding !== void 0 ? { bodyEncoding: inner.bodyEncoding } : {},
|
|
49046
|
+
...inner.headers !== void 0 ? { headers: { ...inner.headers } } : {},
|
|
48784
49047
|
retryAttempted: false
|
|
48785
49048
|
});
|
|
48786
49049
|
} else {
|
|
@@ -48797,7 +49060,8 @@ var init_ws_server = __esm({
|
|
|
48797
49060
|
ok: false,
|
|
48798
49061
|
error: inner.error,
|
|
48799
49062
|
kind: classifyFetchError(inner.error, inner.code),
|
|
48800
|
-
retryAttempted: false
|
|
49063
|
+
retryAttempted: false,
|
|
49064
|
+
...inner.code !== void 0 ? { code: inner.code } : {}
|
|
48801
49065
|
});
|
|
48802
49066
|
}
|
|
48803
49067
|
return;
|
|
@@ -49101,6 +49365,7 @@ var init_ws_server = __esm({
|
|
|
49101
49365
|
pairCode,
|
|
49102
49366
|
extensionConnected: false,
|
|
49103
49367
|
unavailableCapabilities: [],
|
|
49368
|
+
features: [],
|
|
49104
49369
|
platform: null
|
|
49105
49370
|
};
|
|
49106
49371
|
}
|
|
@@ -49112,6 +49377,7 @@ var init_ws_server = __esm({
|
|
|
49112
49377
|
pairCode,
|
|
49113
49378
|
extensionConnected,
|
|
49114
49379
|
unavailableCapabilities: info ? [...info.unavailableCapabilities] : [],
|
|
49380
|
+
features: info ? [...info.features] : [],
|
|
49115
49381
|
platform: info?.platform ?? null
|
|
49116
49382
|
};
|
|
49117
49383
|
}
|
|
@@ -49125,9 +49391,13 @@ var init_ws_server = __esm({
|
|
|
49125
49391
|
*/
|
|
49126
49392
|
refuseIfUnavailable(inner, info) {
|
|
49127
49393
|
const cap = unavailableCapabilityFor(inner, info);
|
|
49128
|
-
if (cap
|
|
49129
|
-
|
|
49130
|
-
|
|
49394
|
+
if (cap !== null && info !== null) {
|
|
49395
|
+
throw new FetchproxyCapabilityUnavailableError(capabilityUnavailableMessage(cap, info.platform), { capability: cap, platform: info.platform });
|
|
49396
|
+
}
|
|
49397
|
+
const feature = missingFeatureFor(inner, info);
|
|
49398
|
+
if (feature !== null) {
|
|
49399
|
+
throw new FetchproxyExtensionUpdateRequiredError(`the paired ContextMint Bridge extension does not support "${feature}"`, { feature });
|
|
49400
|
+
}
|
|
49131
49401
|
}
|
|
49132
49402
|
/**
|
|
49133
49403
|
* 0.5.2+: throw `FetchproxyProtocolError` with the actionable pair-code
|
|
@@ -49228,6 +49498,7 @@ var init_dist4 = __esm({
|
|
|
49228
49498
|
init_deadline();
|
|
49229
49499
|
init_parse_html();
|
|
49230
49500
|
init_batch();
|
|
49501
|
+
init_dist3();
|
|
49231
49502
|
init_extension_trust();
|
|
49232
49503
|
init_extension_pins();
|
|
49233
49504
|
init_identity();
|
|
@@ -49729,7 +50000,14 @@ function rememberSharePointHost(host, env = process.env) {
|
|
|
49729
50000
|
function withBridgeScope(opts, env, extraSharePointHost) {
|
|
49730
50001
|
const hosts = knownSharePointHosts(env);
|
|
49731
50002
|
if (extraSharePointHost !== void 0) hosts.push(extraSharePointHost);
|
|
49732
|
-
return {
|
|
50003
|
+
return {
|
|
50004
|
+
...opts,
|
|
50005
|
+
domains: [...BRIDGE_TRUST_DOMAINS],
|
|
50006
|
+
// Only Teams needs a page: the SharePoint and search captures read requests
|
|
50007
|
+
// the Teams tab makes, so a tab on those domains would do nothing.
|
|
50008
|
+
tabDomains: [CAPTURE_DECL.host],
|
|
50009
|
+
captureHeaders: bridgeCaptureDecls(hosts)
|
|
50010
|
+
};
|
|
49733
50011
|
}
|
|
49734
50012
|
var CAPTURE_DECL, SUBSTRATE_CAPTURE_DECL, BRIDGE_TRUST_DOMAINS;
|
|
49735
50013
|
var init_bridge_scope = __esm({
|
|
@@ -49834,7 +50112,7 @@ async function captureSharePointTokenViaFetchproxy(host, env = process.env) {
|
|
|
49834
50112
|
serverName: PACKAGE_NAME,
|
|
49835
50113
|
version: VERSION,
|
|
49836
50114
|
what: `a SharePoint token for ${host}`,
|
|
49837
|
-
guidance: `
|
|
50115
|
+
guidance: `Reload your signed-in Teams tab and retry while it loads \u2014 that makes the page call ${host} with the SharePoint token we capture. Opening a file does not reliably do this.`,
|
|
49838
50116
|
createTransport: bridgeScopedTransport(env, host)
|
|
49839
50117
|
});
|
|
49840
50118
|
rememberSharePointHost(host, env);
|
|
@@ -51098,7 +51376,7 @@ var SharePointClient = class {
|
|
|
51098
51376
|
throw new McpToolError("SharePoint rejected the access token (401) even after a fresh capture.", {
|
|
51099
51377
|
status,
|
|
51100
51378
|
kind: "credential_rejected",
|
|
51101
|
-
hint: "
|
|
51379
|
+
hint: "Reload your signed-in Teams tab to mint a fresh SharePoint token, and retry while it loads."
|
|
51102
51380
|
});
|
|
51103
51381
|
}
|
|
51104
51382
|
if (status === 429) {
|
|
@@ -54767,13 +55045,13 @@ function registerExportTools(server, deps2, opts = {}) {
|
|
|
54767
55045
|
// src/tools/attachment.ts
|
|
54768
55046
|
var MAX_RAW_MESSAGES4 = 4e3;
|
|
54769
55047
|
var MAX_FILE_BYTES = 25 * 1024 * 1024;
|
|
54770
|
-
var FILE_HINT = "A shared file is downloaded from SharePoint and returned as its contents (an image as an image, anything else as an embedded resource; over 10 MiB as a download link, or a saved file on a local install). The first file from a given SharePoint host may need
|
|
55048
|
+
var FILE_HINT = "A shared file is downloaded from SharePoint and returned as its contents (an image as an image, anything else as an embedded resource; over 10 MiB as a download link, or a saved file on a local install). The first file from a given SharePoint host may need your Teams tab reloaded to mint a short-lived token; a file your account cannot open comes back as metadata and its link.";
|
|
54771
55049
|
function registerAttachmentTools(server, { chatsvc, sharepoint }) {
|
|
54772
55050
|
server.registerTool(
|
|
54773
55051
|
"teams_get_attachment",
|
|
54774
55052
|
{
|
|
54775
55053
|
title: "Get a Teams message attachment",
|
|
54776
|
-
description: `Fetch one attachment of a Teams chat or channel message, as listed by teams_list_messages / teams_list_unread_messages. An inline image (attachments.images[].ref) is returned as the image itself. A shared file (attachments.files[].name) is downloaded from SharePoint and returned as its contents: an image as the image, anything else as an embedded resource carrying the bytes. Anything over 10 MiB comes back instead as a signed, expiring download link (downloadUrl) on a hosted install, or saved to a fresh file (path) under ${EXPORT_OUTPUT_ENV}, else ~/Downloads/${EXPORT_SERVER_NAME}, on a local one; the caption's via says which. The first file from a given SharePoint host in a session may need
|
|
55054
|
+
description: `Fetch one attachment of a Teams chat or channel message, as listed by teams_list_messages / teams_list_unread_messages. An inline image (attachments.images[].ref) is returned as the image itself. A shared file (attachments.files[].name) is downloaded from SharePoint and returned as its contents: an image as the image, anything else as an embedded resource carrying the bytes. Anything over 10 MiB comes back instead as a signed, expiring download link (downloadUrl) on a hosted install, or saved to a fresh file (path) under ${EXPORT_OUTPUT_ENV}, else ~/Downloads/${EXPORT_SERVER_NAME}, on a local one; the caption's via says which. The first file from a given SharePoint host in a session may need your Teams tab reloaded to mint a short-lived token; a file your account cannot open, or one that could not be fetched, comes back as metadata and its open link instead of failing. Its caption names the conversation beside its id: title (as teams_list_conversations names it \u2014 an untitled group chat by its participants, a 1:1 by the other person) and participants. Does not mark anything read.` + UNTRUSTED_DESCRIPTION_SUFFIX2,
|
|
54777
55055
|
annotations: toolAnnotations({ readOnly: true, openWorld: true }),
|
|
54778
55056
|
_meta: workMeta("other", { aliases: ["attachment", "image", "file", "screenshot"] }),
|
|
54779
55057
|
inputSchema: {
|
|
@@ -54923,7 +55201,8 @@ function degradeHint(err, host) {
|
|
|
54923
55201
|
return err.hint !== void 0 ? `${err.message} ${err.hint}` : err.message;
|
|
54924
55202
|
}
|
|
54925
55203
|
if (err instanceof McpToolError && err.hint !== void 0) return err.hint;
|
|
54926
|
-
|
|
55204
|
+
if (err instanceof Error && err.message !== "") return err.message;
|
|
55205
|
+
return `Couldn't mint a SharePoint token for ${host} \u2014 reload your signed-in Teams tab and retry while it loads (that page load is where the token is captured from).`;
|
|
54927
55206
|
}
|
|
54928
55207
|
|
|
54929
55208
|
// src/tools/send.ts
|
package/dist/sharepoint-auth.js
CHANGED
|
@@ -104,9 +104,9 @@ export async function captureSharePointTokenViaFetchproxy(host, env = process.en
|
|
|
104
104
|
serverName: PACKAGE_NAME,
|
|
105
105
|
version: VERSION,
|
|
106
106
|
what: `a SharePoint token for ${host}`,
|
|
107
|
-
guidance: `
|
|
108
|
-
`
|
|
109
|
-
'
|
|
107
|
+
guidance: `Reload your signed-in Teams tab and retry while it loads — that makes the ` +
|
|
108
|
+
`page call ${host} with the SharePoint token we capture. Opening a file does ` +
|
|
109
|
+
'not reliably do this.',
|
|
110
110
|
createTransport: bridgeScopedTransport(env, host),
|
|
111
111
|
});
|
|
112
112
|
// Granted and captured: every later hello declares this host too.
|
package/dist/sharepoint.js
CHANGED
|
@@ -254,7 +254,7 @@ export class SharePointClient {
|
|
|
254
254
|
throw new McpToolError('SharePoint rejected the access token (401) even after a fresh capture.', {
|
|
255
255
|
status,
|
|
256
256
|
kind: 'credential_rejected',
|
|
257
|
-
hint: '
|
|
257
|
+
hint: 'Reload your signed-in Teams tab to mint a fresh SharePoint token, and retry while it loads.',
|
|
258
258
|
});
|
|
259
259
|
}
|
|
260
260
|
if (status === 429) {
|
package/dist/tools/attachment.js
CHANGED
|
@@ -25,7 +25,7 @@ export const MAX_FILE_BYTES = 25 * 1024 * 1024;
|
|
|
25
25
|
const FILE_HINT = 'A shared file is downloaded from SharePoint and returned as its contents (an image as an image, ' +
|
|
26
26
|
'anything else as an embedded resource; over 10 MiB as a download link, or a saved file on a local ' +
|
|
27
27
|
'install). The first file from a given SharePoint host may need ' +
|
|
28
|
-
'
|
|
28
|
+
'your Teams tab reloaded to mint a short-lived token; a file your account cannot open comes back as ' +
|
|
29
29
|
'metadata and its link.';
|
|
30
30
|
export function registerAttachmentTools(server, { chatsvc, sharepoint }) {
|
|
31
31
|
server.registerTool('teams_get_attachment', {
|
|
@@ -38,7 +38,7 @@ export function registerAttachmentTools(server, { chatsvc, sharepoint }) {
|
|
|
38
38
|
'expiring download link (downloadUrl) on a hosted install, or saved to a fresh file (path) under ' +
|
|
39
39
|
`${EXPORT_OUTPUT_ENV}, else ~/Downloads/${EXPORT_SERVER_NAME}, on a local one; the caption's via ` +
|
|
40
40
|
'says which. The first file from a given SharePoint host in a ' +
|
|
41
|
-
'session may need
|
|
41
|
+
'session may need your Teams tab reloaded to mint a short-lived token; a file your account ' +
|
|
42
42
|
'cannot open, or one that could not be fetched, comes back as metadata and its open link ' +
|
|
43
43
|
'instead of failing. Its caption names the conversation beside its id: title (as teams_list_conversations ' +
|
|
44
44
|
'names it — an untitled group chat by its participants, a 1:1 by the other person) and participants. ' +
|
|
@@ -241,6 +241,11 @@ export function degradeHint(err, host) {
|
|
|
241
241
|
}
|
|
242
242
|
if (err instanceof McpToolError && err.hint !== undefined)
|
|
243
243
|
return err.hint;
|
|
244
|
-
|
|
245
|
-
|
|
244
|
+
// A capture failure is a plain Error whose message holds the only record of
|
|
245
|
+
// why (a refused bridge scope, a timeout) and what to do about it. Keep it:
|
|
246
|
+
// "open the file" cannot fix a refusal.
|
|
247
|
+
if (err instanceof Error && err.message !== '')
|
|
248
|
+
return err.message;
|
|
249
|
+
return (`Couldn't mint a SharePoint token for ${host} — reload your signed-in Teams tab and retry while ` +
|
|
250
|
+
'it loads (that page load is where the token is captured from).');
|
|
246
251
|
}
|
package/dist/version.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chrischall/microsoft-teams-mcp",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.7",
|
|
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>",
|
|
@@ -46,18 +46,18 @@
|
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
48
|
"@chrischall/mcp-utils": "^3.7.2",
|
|
49
|
-
"@fetchproxy/server": "^3.
|
|
50
|
-
"@modelcontextprotocol/server": "^2.
|
|
51
|
-
"dotenv": "^18.0.
|
|
52
|
-
"zod": "^4.6.
|
|
49
|
+
"@fetchproxy/server": "^3.8.0",
|
|
50
|
+
"@modelcontextprotocol/server": "^2.4.0",
|
|
51
|
+
"dotenv": "^18.0.10",
|
|
52
|
+
"zod": "^4.6.7"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
|
-
"@modelcontextprotocol/client": "^2.
|
|
56
|
-
"@types/node": "^26.
|
|
57
|
-
"@vitest/coverage-v8": "^5.
|
|
58
|
-
"esbuild": "^0.28.
|
|
55
|
+
"@modelcontextprotocol/client": "^2.4.0",
|
|
56
|
+
"@types/node": "^26.6.6",
|
|
57
|
+
"@vitest/coverage-v8": "^5.1.0",
|
|
58
|
+
"esbuild": "^0.28.2",
|
|
59
59
|
"typescript": "^7.0.2",
|
|
60
|
-
"vitest": "^5.
|
|
60
|
+
"vitest": "^5.1.0"
|
|
61
61
|
},
|
|
62
62
|
"allowScripts": {
|
|
63
63
|
"esbuild": false,
|
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.8.
|
|
9
|
+
"version": "0.8.7",
|
|
10
10
|
"packages": [
|
|
11
11
|
{
|
|
12
12
|
"registryType": "npm",
|
|
13
13
|
"identifier": "@chrischall/microsoft-teams-mcp",
|
|
14
|
-
"version": "0.8.
|
|
14
|
+
"version": "0.8.7",
|
|
15
15
|
"transport": {
|
|
16
16
|
"type": "stdio"
|
|
17
17
|
},
|