@chrischall/microsoft-teams-mcp 0.9.0 → 0.11.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 +79 -10
- package/dist/bridge-scope.js +13 -3
- package/dist/bundle.js +701 -113
- package/dist/chatsvc.js +49 -0
- package/dist/index.js +6 -1
- package/dist/recap-auth.js +44 -0
- package/dist/recap-token-cache.js +50 -0
- package/dist/recap.js +325 -0
- package/dist/substrate.js +2 -1
- package/dist/tools/group-chat.js +144 -12
- package/dist/tools/people.js +8 -4
- package/dist/tools/recap.js +122 -0
- package/dist/version.js +1 -1
- package/mint.yaml +9 -0
- package/package.json +1 -1
- package/server.json +17 -3
package/dist/bundle.js
CHANGED
|
@@ -347,8 +347,8 @@ function defineLazy(object2, key, getter) {
|
|
|
347
347
|
configurable: true
|
|
348
348
|
});
|
|
349
349
|
}
|
|
350
|
-
function objectClone(
|
|
351
|
-
return Object.create(Object.getPrototypeOf(
|
|
350
|
+
function objectClone(obj3) {
|
|
351
|
+
return Object.create(Object.getPrototypeOf(obj3), Object.getOwnPropertyDescriptors(obj3));
|
|
352
352
|
}
|
|
353
353
|
function assignProp(target, prop, value) {
|
|
354
354
|
Object.defineProperty(target, prop, {
|
|
@@ -419,10 +419,10 @@ function mergeDefs(...defs) {
|
|
|
419
419
|
function cloneDef(schema) {
|
|
420
420
|
return mergeDefs(schema._zod.def);
|
|
421
421
|
}
|
|
422
|
-
function getElementAtPath(
|
|
422
|
+
function getElementAtPath(obj3, path) {
|
|
423
423
|
if (!path)
|
|
424
|
-
return
|
|
425
|
-
return path.reduce((acc, key) => acc?.[key],
|
|
424
|
+
return obj3;
|
|
425
|
+
return path.reduce((acc, key) => acc?.[key], obj3);
|
|
426
426
|
}
|
|
427
427
|
function promiseAllObject(promisesObj) {
|
|
428
428
|
const keys = Object.keys(promisesObj);
|
|
@@ -437,14 +437,14 @@ function promiseAllObject(promisesObj) {
|
|
|
437
437
|
}
|
|
438
438
|
function randomString(length = 10) {
|
|
439
439
|
const chars = "abcdefghijklmnopqrstuvwxyz";
|
|
440
|
-
let
|
|
440
|
+
let str4 = "";
|
|
441
441
|
for (let i = 0; i < length; i++) {
|
|
442
|
-
|
|
442
|
+
str4 += chars[Math.floor(Math.random() * chars.length)];
|
|
443
443
|
}
|
|
444
|
-
return
|
|
444
|
+
return str4;
|
|
445
445
|
}
|
|
446
|
-
function esc(
|
|
447
|
-
return JSON.stringify(
|
|
446
|
+
function esc(str4) {
|
|
447
|
+
return JSON.stringify(str4);
|
|
448
448
|
}
|
|
449
449
|
function slugify(input2) {
|
|
450
450
|
return input2.toLowerCase().trim().replace(/[^\w\s-]/g, "").replace(/[\s_-]+/g, "-").replace(/^-+|-+$/g, "");
|
|
@@ -488,8 +488,8 @@ function numKeys(data) {
|
|
|
488
488
|
}
|
|
489
489
|
return keyCount;
|
|
490
490
|
}
|
|
491
|
-
function escapeRegex(
|
|
492
|
-
return
|
|
491
|
+
function escapeRegex(str4) {
|
|
492
|
+
return str4.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
493
493
|
}
|
|
494
494
|
function clone(inst, def, params) {
|
|
495
495
|
const cl = new inst._zod.constr(def ?? inst._zod.def);
|
|
@@ -743,13 +743,13 @@ function getSizableOrigin(input2) {
|
|
|
743
743
|
return "file";
|
|
744
744
|
return "unknown";
|
|
745
745
|
}
|
|
746
|
-
function codePointLength(
|
|
747
|
-
const units =
|
|
748
|
-
if (!highSurrogate.test(
|
|
746
|
+
function codePointLength(str4) {
|
|
747
|
+
const units = str4.length;
|
|
748
|
+
if (!highSurrogate.test(str4))
|
|
749
749
|
return units;
|
|
750
750
|
let count = units;
|
|
751
751
|
for (let i = 0; i < units - 1; i++) {
|
|
752
|
-
if ((
|
|
752
|
+
if ((str4.charCodeAt(i) & 64512) === 55296 && (str4.charCodeAt(i + 1) & 64512) === 56320) {
|
|
753
753
|
count--;
|
|
754
754
|
i++;
|
|
755
755
|
}
|
|
@@ -776,9 +776,9 @@ function parsedType(data) {
|
|
|
776
776
|
if (Array.isArray(data)) {
|
|
777
777
|
return "array";
|
|
778
778
|
}
|
|
779
|
-
const
|
|
780
|
-
if (
|
|
781
|
-
return
|
|
779
|
+
const obj3 = data;
|
|
780
|
+
if (obj3 && Object.getPrototypeOf(obj3) !== Object.prototype && "constructor" in obj3 && obj3.constructor) {
|
|
781
|
+
return obj3.constructor.name;
|
|
782
782
|
}
|
|
783
783
|
}
|
|
784
784
|
}
|
|
@@ -796,8 +796,8 @@ function issue(...args) {
|
|
|
796
796
|
}
|
|
797
797
|
return { ...iss };
|
|
798
798
|
}
|
|
799
|
-
function cleanEnum(
|
|
800
|
-
return Object.entries(
|
|
799
|
+
function cleanEnum(obj3) {
|
|
800
|
+
return Object.entries(obj3).filter(([k, _]) => {
|
|
801
801
|
return Number.isNaN(Number.parseInt(k, 10));
|
|
802
802
|
}).map((el) => el[1]);
|
|
803
803
|
}
|
|
@@ -1194,15 +1194,15 @@ function _getMessage() {
|
|
|
1194
1194
|
function _setMessage(value) {
|
|
1195
1195
|
this._zod.message = value;
|
|
1196
1196
|
}
|
|
1197
|
-
function node(
|
|
1198
|
-
if (!Object.prototype.hasOwnProperty.call(
|
|
1197
|
+
function node(obj3, key, make) {
|
|
1198
|
+
if (!Object.prototype.hasOwnProperty.call(obj3, key)) {
|
|
1199
1199
|
if (key === "__proto__") {
|
|
1200
|
-
Object.defineProperty(
|
|
1200
|
+
Object.defineProperty(obj3, key, { value: make(), writable: true, enumerable: true, configurable: true });
|
|
1201
1201
|
} else {
|
|
1202
|
-
|
|
1202
|
+
obj3[key] = make();
|
|
1203
1203
|
}
|
|
1204
1204
|
}
|
|
1205
|
-
return
|
|
1205
|
+
return obj3[key];
|
|
1206
1206
|
}
|
|
1207
1207
|
function flattenError(error62, mapper = (issue2) => issue2.message) {
|
|
1208
1208
|
const fieldErrors = {};
|
|
@@ -24348,12 +24348,12 @@ function isZodV4Schema(v) {
|
|
|
24348
24348
|
function looksLikeZodV3(v) {
|
|
24349
24349
|
return typeof v === "object" && v !== null && !("_zod" in v) && "_def" in v && typeof v._def?.typeName === "string";
|
|
24350
24350
|
}
|
|
24351
|
-
function isZodRawShape(
|
|
24352
|
-
if (typeof
|
|
24353
|
-
if (isStandardSchema(
|
|
24354
|
-
const proto = Object.getPrototypeOf(
|
|
24351
|
+
function isZodRawShape(obj3) {
|
|
24352
|
+
if (typeof obj3 !== "object" || obj3 === null) return false;
|
|
24353
|
+
if (isStandardSchema(obj3)) return false;
|
|
24354
|
+
const proto = Object.getPrototypeOf(obj3);
|
|
24355
24355
|
if (proto !== Object.prototype && proto !== null) return false;
|
|
24356
|
-
return Object.values(
|
|
24356
|
+
return Object.values(obj3).every((v) => isZodV4Schema(v));
|
|
24357
24357
|
}
|
|
24358
24358
|
function normalizeRawShapeSchema(schema) {
|
|
24359
24359
|
if (schema === void 0) return void 0;
|
|
@@ -26208,7 +26208,7 @@ var init_src_DdvbAHrR = __esm({
|
|
|
26208
26208
|
var index = header.indexOf(";");
|
|
26209
26209
|
var type = index !== -1 ? header.slice(0, index).trim() : header.trim();
|
|
26210
26210
|
if (!TYPE_REGEXP.test(type)) throw new TypeError("invalid media type");
|
|
26211
|
-
var
|
|
26211
|
+
var obj3 = new ContentType(type.toLowerCase());
|
|
26212
26212
|
if (index !== -1) {
|
|
26213
26213
|
var key;
|
|
26214
26214
|
var match;
|
|
@@ -26223,16 +26223,16 @@ var init_src_DdvbAHrR = __esm({
|
|
|
26223
26223
|
value = value.slice(1, -1);
|
|
26224
26224
|
if (value.indexOf("\\") !== -1) value = value.replace(QESC_REGEXP, "$1");
|
|
26225
26225
|
}
|
|
26226
|
-
|
|
26226
|
+
obj3.parameters[key] = value;
|
|
26227
26227
|
}
|
|
26228
26228
|
if (index !== header.length) throw new TypeError("invalid parameter format");
|
|
26229
26229
|
}
|
|
26230
|
-
return
|
|
26230
|
+
return obj3;
|
|
26231
26231
|
}
|
|
26232
|
-
function getcontenttype(
|
|
26232
|
+
function getcontenttype(obj3) {
|
|
26233
26233
|
var header;
|
|
26234
|
-
if (typeof
|
|
26235
|
-
else if (typeof
|
|
26234
|
+
if (typeof obj3.getHeader === "function") header = obj3.getHeader("content-type");
|
|
26235
|
+
else if (typeof obj3.headers === "object") header = obj3.headers && obj3.headers["content-type"];
|
|
26236
26236
|
if (typeof header !== "string") throw new TypeError("content-type header is missing from object");
|
|
26237
26237
|
return header;
|
|
26238
26238
|
}
|
|
@@ -26357,7 +26357,7 @@ var init_ajvProvider_DyjnscPj = __esm({
|
|
|
26357
26357
|
}
|
|
26358
26358
|
exports._ = _;
|
|
26359
26359
|
const plus = new _Code("+");
|
|
26360
|
-
function
|
|
26360
|
+
function str4(strs, ...args) {
|
|
26361
26361
|
const expr = [safeStringify(strs[0])];
|
|
26362
26362
|
let i = 0;
|
|
26363
26363
|
while (i < args.length) {
|
|
@@ -26368,7 +26368,7 @@ var init_ajvProvider_DyjnscPj = __esm({
|
|
|
26368
26368
|
optimize(expr);
|
|
26369
26369
|
return new _Code(expr);
|
|
26370
26370
|
}
|
|
26371
|
-
exports.str =
|
|
26371
|
+
exports.str = str4;
|
|
26372
26372
|
function addCodeArg(code2, arg) {
|
|
26373
26373
|
if (arg instanceof _Code) code2.push(...arg._items);
|
|
26374
26374
|
else if (arg instanceof Name) code2.push(arg);
|
|
@@ -26401,7 +26401,7 @@ var init_ajvProvider_DyjnscPj = __esm({
|
|
|
26401
26401
|
if (typeof b == "string" && b[0] === '"' && !(a instanceof Name)) return `"${a}${b.slice(1)}`;
|
|
26402
26402
|
}
|
|
26403
26403
|
function strConcat(c1, c2) {
|
|
26404
|
-
return c2.emptyStr() ? c1 : c1.emptyStr() ? c2 :
|
|
26404
|
+
return c2.emptyStr() ? c1 : c1.emptyStr() ? c2 : str4`${c1}${c2}`;
|
|
26405
26405
|
}
|
|
26406
26406
|
exports.strConcat = strConcat;
|
|
26407
26407
|
function interpolate(x) {
|
|
@@ -27082,10 +27082,10 @@ var init_ajvProvider_DyjnscPj = __esm({
|
|
|
27082
27082
|
}
|
|
27083
27083
|
return this._for(new ForIter("of", varKind, name, iterable), () => forBody(name));
|
|
27084
27084
|
}
|
|
27085
|
-
forIn(nameOrPrefix,
|
|
27086
|
-
if (this.opts.ownProperties) return this.forOf(nameOrPrefix, (0, code_1._)`Object.keys(${
|
|
27085
|
+
forIn(nameOrPrefix, obj3, forBody, varKind = this.opts.es5 ? scope_1.varKinds.var : scope_1.varKinds.const) {
|
|
27086
|
+
if (this.opts.ownProperties) return this.forOf(nameOrPrefix, (0, code_1._)`Object.keys(${obj3})`, forBody);
|
|
27087
27087
|
const name = this._scope.toName(nameOrPrefix);
|
|
27088
|
-
return this._for(new ForIter("in", varKind, name,
|
|
27088
|
+
return this._for(new ForIter("in", varKind, name, obj3), () => forBody(name));
|
|
27089
27089
|
}
|
|
27090
27090
|
endFor() {
|
|
27091
27091
|
return this._endBlockNode(For);
|
|
@@ -27280,21 +27280,21 @@ var init_ajvProvider_DyjnscPj = __esm({
|
|
|
27280
27280
|
return (0, codegen_1._)`${topSchemaRef}${schemaPath}${(0, codegen_1.getProperty)(keyword)}`;
|
|
27281
27281
|
}
|
|
27282
27282
|
exports.schemaRefOrVal = schemaRefOrVal;
|
|
27283
|
-
function unescapeFragment(
|
|
27284
|
-
return unescapeJsonPointer(decodeURIComponent(
|
|
27283
|
+
function unescapeFragment(str4) {
|
|
27284
|
+
return unescapeJsonPointer(decodeURIComponent(str4));
|
|
27285
27285
|
}
|
|
27286
27286
|
exports.unescapeFragment = unescapeFragment;
|
|
27287
|
-
function escapeFragment(
|
|
27288
|
-
return encodeURIComponent(escapeJsonPointer(
|
|
27287
|
+
function escapeFragment(str4) {
|
|
27288
|
+
return encodeURIComponent(escapeJsonPointer(str4));
|
|
27289
27289
|
}
|
|
27290
27290
|
exports.escapeFragment = escapeFragment;
|
|
27291
|
-
function escapeJsonPointer(
|
|
27292
|
-
if (typeof
|
|
27293
|
-
return
|
|
27291
|
+
function escapeJsonPointer(str4) {
|
|
27292
|
+
if (typeof str4 == "number") return `${str4}`;
|
|
27293
|
+
return str4.replace(/~/g, "~0").replace(/\//g, "~1");
|
|
27294
27294
|
}
|
|
27295
27295
|
exports.escapeJsonPointer = escapeJsonPointer;
|
|
27296
|
-
function unescapeJsonPointer(
|
|
27297
|
-
return
|
|
27296
|
+
function unescapeJsonPointer(str4) {
|
|
27297
|
+
return str4.replace(/~1/g, "/").replace(/~0/g, "~");
|
|
27298
27298
|
}
|
|
27299
27299
|
exports.unescapeJsonPointer = unescapeJsonPointer;
|
|
27300
27300
|
function eachItem(xs, f) {
|
|
@@ -28180,8 +28180,8 @@ var init_ajvProvider_DyjnscPj = __esm({
|
|
|
28180
28180
|
post(schema, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex);
|
|
28181
28181
|
}
|
|
28182
28182
|
}
|
|
28183
|
-
function escapeJsonPtr(
|
|
28184
|
-
return
|
|
28183
|
+
function escapeJsonPtr(str4) {
|
|
28184
|
+
return str4.replace(/~/g, "~0").replace(/\//g, "~1");
|
|
28185
28185
|
}
|
|
28186
28186
|
}));
|
|
28187
28187
|
require_resolve = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
@@ -28613,9 +28613,9 @@ var init_ajvProvider_DyjnscPj = __esm({
|
|
|
28613
28613
|
ok(cond) {
|
|
28614
28614
|
if (!this.allErrors) this.gen.if(cond);
|
|
28615
28615
|
}
|
|
28616
|
-
setParams(
|
|
28617
|
-
if (assign) Object.assign(this.params,
|
|
28618
|
-
else this.params =
|
|
28616
|
+
setParams(obj3, assign) {
|
|
28617
|
+
if (assign) Object.assign(this.params, obj3);
|
|
28618
|
+
else this.params = obj3;
|
|
28619
28619
|
}
|
|
28620
28620
|
block$data(valid, codeBlock, $dataValid = codegen_1.nil) {
|
|
28621
28621
|
this.gen.block(() => {
|
|
@@ -29126,9 +29126,9 @@ var init_ajvProvider_DyjnscPj = __esm({
|
|
|
29126
29126
|
isIPV6: true
|
|
29127
29127
|
};
|
|
29128
29128
|
}
|
|
29129
|
-
function findToken(
|
|
29129
|
+
function findToken(str4, token) {
|
|
29130
29130
|
let ind = 0;
|
|
29131
|
-
for (let i = 0; i <
|
|
29131
|
+
for (let i = 0; i < str4.length; i++) if (str4[i] === token) ind++;
|
|
29132
29132
|
return ind;
|
|
29133
29133
|
}
|
|
29134
29134
|
function removeDotSegments(path) {
|
|
@@ -29943,7 +29943,7 @@ var init_ajvProvider_DyjnscPj = __esm({
|
|
|
29943
29943
|
const util_1 = require_util();
|
|
29944
29944
|
const $dataRefSchema = require_data();
|
|
29945
29945
|
const uri_1 = require_uri();
|
|
29946
|
-
const defaultRegExp = (
|
|
29946
|
+
const defaultRegExp = (str4, flags) => new RegExp(str4, flags);
|
|
29947
29947
|
defaultRegExp.code = "new RegExp";
|
|
29948
29948
|
const META_IGNORE_OPTIONS = [
|
|
29949
29949
|
"removeAdditional",
|
|
@@ -30649,16 +30649,16 @@ var init_ajvProvider_DyjnscPj = __esm({
|
|
|
30649
30649
|
}));
|
|
30650
30650
|
require_ucs2length = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
30651
30651
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30652
|
-
function ucs2length(
|
|
30653
|
-
const len =
|
|
30652
|
+
function ucs2length(str4) {
|
|
30653
|
+
const len = str4.length;
|
|
30654
30654
|
let length = 0;
|
|
30655
30655
|
let pos = 0;
|
|
30656
30656
|
let value;
|
|
30657
30657
|
while (pos < len) {
|
|
30658
30658
|
length++;
|
|
30659
|
-
value =
|
|
30659
|
+
value = str4.charCodeAt(pos++);
|
|
30660
30660
|
if (value >= 55296 && value <= 56319 && pos < len) {
|
|
30661
|
-
value =
|
|
30661
|
+
value = str4.charCodeAt(pos);
|
|
30662
30662
|
if ((value & 64512) === 56320) pos++;
|
|
30663
30663
|
}
|
|
30664
30664
|
}
|
|
@@ -33353,7 +33353,7 @@ var init_ajvProvider_DyjnscPj = __esm({
|
|
|
33353
33353
|
function isLeapYear(year) {
|
|
33354
33354
|
return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);
|
|
33355
33355
|
}
|
|
33356
|
-
const
|
|
33356
|
+
const DATE2 = /^(\d\d\d\d)-(\d\d)-(\d\d)$/;
|
|
33357
33357
|
const DAYS = [
|
|
33358
33358
|
0,
|
|
33359
33359
|
31,
|
|
@@ -33369,8 +33369,8 @@ var init_ajvProvider_DyjnscPj = __esm({
|
|
|
33369
33369
|
30,
|
|
33370
33370
|
31
|
|
33371
33371
|
];
|
|
33372
|
-
function date5(
|
|
33373
|
-
const matches =
|
|
33372
|
+
function date5(str4) {
|
|
33373
|
+
const matches = DATE2.exec(str4);
|
|
33374
33374
|
if (!matches) return false;
|
|
33375
33375
|
const year = +matches[1];
|
|
33376
33376
|
const month = +matches[2];
|
|
@@ -33385,8 +33385,8 @@ var init_ajvProvider_DyjnscPj = __esm({
|
|
|
33385
33385
|
}
|
|
33386
33386
|
const TIME = /^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;
|
|
33387
33387
|
function getTime(strictTimeZone) {
|
|
33388
|
-
return function time3(
|
|
33389
|
-
const matches = TIME.exec(
|
|
33388
|
+
return function time3(str4) {
|
|
33389
|
+
const matches = TIME.exec(str4);
|
|
33390
33390
|
if (!matches) return false;
|
|
33391
33391
|
const hr = +matches[1];
|
|
33392
33392
|
const min = +matches[2];
|
|
@@ -33423,8 +33423,8 @@ var init_ajvProvider_DyjnscPj = __esm({
|
|
|
33423
33423
|
const DATE_TIME_SEPARATOR = /t|\s/i;
|
|
33424
33424
|
function getDateTime(strictTimeZone) {
|
|
33425
33425
|
const time3 = getTime(strictTimeZone);
|
|
33426
|
-
return function date_time(
|
|
33427
|
-
const dateTime =
|
|
33426
|
+
return function date_time(str4) {
|
|
33427
|
+
const dateTime = str4.split(DATE_TIME_SEPARATOR);
|
|
33428
33428
|
return dateTime.length === 2 && date5(dateTime[0]) && time3(dateTime[1]);
|
|
33429
33429
|
};
|
|
33430
33430
|
}
|
|
@@ -33445,13 +33445,13 @@ var init_ajvProvider_DyjnscPj = __esm({
|
|
|
33445
33445
|
}
|
|
33446
33446
|
const NOT_URI_FRAGMENT = /\/|:/;
|
|
33447
33447
|
const URI = /^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;
|
|
33448
|
-
function uri(
|
|
33449
|
-
return NOT_URI_FRAGMENT.test(
|
|
33448
|
+
function uri(str4) {
|
|
33449
|
+
return NOT_URI_FRAGMENT.test(str4) && URI.test(str4);
|
|
33450
33450
|
}
|
|
33451
33451
|
const BYTE = /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;
|
|
33452
|
-
function byte(
|
|
33452
|
+
function byte(str4) {
|
|
33453
33453
|
BYTE.lastIndex = 0;
|
|
33454
|
-
return BYTE.test(
|
|
33454
|
+
return BYTE.test(str4);
|
|
33455
33455
|
}
|
|
33456
33456
|
const MIN_INT32 = -(2 ** 31);
|
|
33457
33457
|
const MAX_INT32 = 2 ** 31 - 1;
|
|
@@ -33465,10 +33465,10 @@ var init_ajvProvider_DyjnscPj = __esm({
|
|
|
33465
33465
|
return true;
|
|
33466
33466
|
}
|
|
33467
33467
|
const Z_ANCHOR = /[^\\]\\Z/;
|
|
33468
|
-
function regex(
|
|
33469
|
-
if (Z_ANCHOR.test(
|
|
33468
|
+
function regex(str4) {
|
|
33469
|
+
if (Z_ANCHOR.test(str4)) return false;
|
|
33470
33470
|
try {
|
|
33471
|
-
new RegExp(
|
|
33471
|
+
new RegExp(str4);
|
|
33472
33472
|
return true;
|
|
33473
33473
|
} catch (e) {
|
|
33474
33474
|
return false;
|
|
@@ -36098,9 +36098,9 @@ function redactValues(text, values, opts = {}) {
|
|
|
36098
36098
|
return out;
|
|
36099
36099
|
}
|
|
36100
36100
|
function truncateErrorMessage(text, max = DEFAULT_ERROR_MESSAGE_MAX, opts = {}) {
|
|
36101
|
-
const
|
|
36101
|
+
const str4 = text === null || text === void 0 ? "" : String(text);
|
|
36102
36102
|
const cap = Math.max(ERROR_REDACTION_INPUT_MAX, max);
|
|
36103
|
-
const capped =
|
|
36103
|
+
const capped = str4.length > cap ? str4.slice(0, cap) : str4;
|
|
36104
36104
|
const scrubbed = opts.values !== void 0 ? redactValues(capped, opts.values, opts.placeholder !== void 0 ? { placeholder: opts.placeholder } : {}) : capped;
|
|
36105
36105
|
const redacted = redactSecrets(scrubbed);
|
|
36106
36106
|
if (redacted.length <= max)
|
|
@@ -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.
|
|
38526
|
+
VERSION = "0.11.0";
|
|
38527
38527
|
}
|
|
38528
38528
|
});
|
|
38529
38529
|
|
|
@@ -43636,7 +43636,7 @@ var require_websocket = __commonJS({
|
|
|
43636
43636
|
BINARY_TYPES,
|
|
43637
43637
|
CLOSE_TIMEOUT,
|
|
43638
43638
|
EMPTY_BUFFER,
|
|
43639
|
-
GUID:
|
|
43639
|
+
GUID: GUID4,
|
|
43640
43640
|
kForOnEventAttribute,
|
|
43641
43641
|
kListener,
|
|
43642
43642
|
kStatusCode,
|
|
@@ -44312,7 +44312,7 @@ var require_websocket = __commonJS({
|
|
|
44312
44312
|
abortHandshake(websocket, socket, "Invalid Upgrade header");
|
|
44313
44313
|
return;
|
|
44314
44314
|
}
|
|
44315
|
-
const digest = createHash5("sha1").update(key +
|
|
44315
|
+
const digest = createHash5("sha1").update(key + GUID4).digest("base64");
|
|
44316
44316
|
if (res.headers["sec-websocket-accept"] !== digest) {
|
|
44317
44317
|
abortHandshake(websocket, socket, "Invalid Sec-WebSocket-Accept header");
|
|
44318
44318
|
return;
|
|
@@ -44691,7 +44691,7 @@ var require_websocket_server = __commonJS({
|
|
|
44691
44691
|
var PerMessageDeflate2 = require_permessage_deflate();
|
|
44692
44692
|
var subprotocol2 = require_subprotocol();
|
|
44693
44693
|
var WebSocket2 = require_websocket();
|
|
44694
|
-
var { CLOSE_TIMEOUT, GUID:
|
|
44694
|
+
var { CLOSE_TIMEOUT, GUID: GUID4, kWebSocket } = require_constants();
|
|
44695
44695
|
var keyRegex = /^[+/0-9A-Za-z]{22}==$/;
|
|
44696
44696
|
var RUNNING = 0;
|
|
44697
44697
|
var CLOSING = 1;
|
|
@@ -44993,7 +44993,7 @@ var require_websocket_server = __commonJS({
|
|
|
44993
44993
|
);
|
|
44994
44994
|
}
|
|
44995
44995
|
if (this._state > RUNNING) return abortHandshake(socket, 503);
|
|
44996
|
-
const digest = createHash5("sha1").update(key +
|
|
44996
|
+
const digest = createHash5("sha1").update(key + GUID4).digest("base64");
|
|
44997
44997
|
const headers = [
|
|
44998
44998
|
"HTTP/1.1 101 Switching Protocols",
|
|
44999
44999
|
"Upgrade: websocket",
|
|
@@ -49964,7 +49964,7 @@ function sharePointCaptureDecl(host) {
|
|
|
49964
49964
|
}
|
|
49965
49965
|
function bridgeCaptureDecls(sharePointHosts) {
|
|
49966
49966
|
const hosts = [...new Set([...sharePointHosts].map((h) => h.toLowerCase()).filter(isSharePointHost))].sort();
|
|
49967
|
-
return [{ ...CAPTURE_DECL }, { ...SUBSTRATE_CAPTURE_DECL }, ...hosts.map(sharePointCaptureDecl)];
|
|
49967
|
+
return [{ ...CAPTURE_DECL }, { ...SUBSTRATE_CAPTURE_DECL }, { ...RECAP_CAPTURE_DECL }, ...hosts.map(sharePointCaptureDecl)];
|
|
49968
49968
|
}
|
|
49969
49969
|
function bridgeScopePath(env = process.env) {
|
|
49970
49970
|
return join10(dirname5(sharePointTokenCachePath(env)), "bridge-scope.json");
|
|
@@ -50008,7 +50008,7 @@ function withBridgeScope(opts, env, extraSharePointHosts = []) {
|
|
|
50008
50008
|
captureHeaders: bridgeCaptureDecls(hosts)
|
|
50009
50009
|
};
|
|
50010
50010
|
}
|
|
50011
|
-
var CAPTURE_DECL, SUBSTRATE_CAPTURE_DECL, BRIDGE_TRUST_DOMAINS;
|
|
50011
|
+
var CAPTURE_DECL, SUBSTRATE_CAPTURE_DECL, RECAP_CAPTURE_DECL, BRIDGE_TRUST_DOMAINS;
|
|
50012
50012
|
var init_bridge_scope = __esm({
|
|
50013
50013
|
"src/bridge-scope.ts"() {
|
|
50014
50014
|
"use strict";
|
|
@@ -50026,6 +50026,11 @@ var init_bridge_scope = __esm({
|
|
|
50026
50026
|
path: "/searchservice/*",
|
|
50027
50027
|
headerName: "authorization"
|
|
50028
50028
|
};
|
|
50029
|
+
RECAP_CAPTURE_DECL = {
|
|
50030
|
+
host: "teams.cloud.microsoft",
|
|
50031
|
+
path: "/api/mcps/*",
|
|
50032
|
+
headerName: "authorization"
|
|
50033
|
+
};
|
|
50029
50034
|
BRIDGE_TRUST_DOMAINS = [CAPTURE_DECL.host, "sharepoint.com", SUBSTRATE_CAPTURE_DECL.host];
|
|
50030
50035
|
}
|
|
50031
50036
|
});
|
|
@@ -50200,6 +50205,38 @@ var init_substrate_auth = __esm({
|
|
|
50200
50205
|
}
|
|
50201
50206
|
});
|
|
50202
50207
|
|
|
50208
|
+
// src/recap-auth.ts
|
|
50209
|
+
var recap_auth_exports = {};
|
|
50210
|
+
__export(recap_auth_exports, {
|
|
50211
|
+
RECAP_CAPTURE_DECL: () => RECAP_CAPTURE_DECL,
|
|
50212
|
+
captureRecapTokenViaFetchproxy: () => captureRecapTokenViaFetchproxy
|
|
50213
|
+
});
|
|
50214
|
+
async function captureRecapTokenViaFetchproxy(env = process.env) {
|
|
50215
|
+
return captureBearerHeader({
|
|
50216
|
+
// The one bridge scope every capture of this server declares (`bridge-scope.ts`).
|
|
50217
|
+
captures: [{ ...RECAP_CAPTURE_DECL }],
|
|
50218
|
+
domains: [...BRIDGE_TRUST_DOMAINS],
|
|
50219
|
+
windowMs: captureWindowMs(env),
|
|
50220
|
+
port: getWsPort(),
|
|
50221
|
+
serverName: PACKAGE_NAME,
|
|
50222
|
+
version: VERSION,
|
|
50223
|
+
what: "a Teams meeting-recap token",
|
|
50224
|
+
guidance: "In a signed-in teams.cloud.microsoft tab, open any meeting chat and click its Recap tab \u2014 that is what makes Teams call its meeting-recap service, where the token is read from \u2014 then retry. If the ContextMint Bridge asks to re-pair microsoft-teams-mcp, approve it once: the recap capture is new to its scope.",
|
|
50225
|
+
createTransport: bridgeScopedTransport(env)
|
|
50226
|
+
});
|
|
50227
|
+
}
|
|
50228
|
+
var init_recap_auth = __esm({
|
|
50229
|
+
"src/recap-auth.ts"() {
|
|
50230
|
+
"use strict";
|
|
50231
|
+
init_fetchproxy();
|
|
50232
|
+
init_capture_window();
|
|
50233
|
+
init_auth_fetchproxy();
|
|
50234
|
+
init_bridge_scope();
|
|
50235
|
+
init_version();
|
|
50236
|
+
init_bridge_scope();
|
|
50237
|
+
}
|
|
50238
|
+
});
|
|
50239
|
+
|
|
50203
50240
|
// src/index.ts
|
|
50204
50241
|
init_dist2();
|
|
50205
50242
|
init_version();
|
|
@@ -50459,11 +50496,11 @@ function fileAttachments(raw) {
|
|
|
50459
50496
|
if (f === null || typeof f !== "object") continue;
|
|
50460
50497
|
const o = f;
|
|
50461
50498
|
const info = o.fileInfo && typeof o.fileInfo === "object" ? o.fileInfo : {};
|
|
50462
|
-
const
|
|
50463
|
-
const name =
|
|
50464
|
-
const type =
|
|
50465
|
-
const openUrl =
|
|
50466
|
-
const url2 =
|
|
50499
|
+
const str4 = (v) => typeof v === "string" && v !== "" ? v : void 0;
|
|
50500
|
+
const name = str4(o.fileName) ?? str4(o.title) ?? "(file)";
|
|
50501
|
+
const type = str4(o.fileType) ?? str4(o.type);
|
|
50502
|
+
const openUrl = str4(o.openUrl) ?? str4(info.shareUrl);
|
|
50503
|
+
const url2 = str4(o.objectUrl) ?? str4(info.fileUrl);
|
|
50467
50504
|
out.push({
|
|
50468
50505
|
name,
|
|
50469
50506
|
...type !== void 0 ? { type } : {},
|
|
@@ -50762,6 +50799,7 @@ function outcomeUnknown(method, e, hint) {
|
|
|
50762
50799
|
var SEND_OUTCOME_HINT = "The message may already have been posted \u2014 check the conversation (teams_list_messages) before retrying; do not resend blindly.";
|
|
50763
50800
|
var REACTION_OUTCOME_HINT = "The reaction change may already have been applied \u2014 check the message (teams_list_messages) before retrying.";
|
|
50764
50801
|
var THREAD_OUTCOME_HINT = "The change to the chat may already have been applied \u2014 check the chat (its name and members) before retrying.";
|
|
50802
|
+
var CREATE_OUTCOME_HINT = "A chat may already have been created \u2014 check teams_list_conversations before retrying; a blind retry would create a second chat (and a chat cannot be deleted).";
|
|
50765
50803
|
var HORIZON_OUTCOME_HINT = "The read marker may already have moved \u2014 check the conversation (teams_list_messages) before retrying; moving it again to the same message is harmless.";
|
|
50766
50804
|
var ChatServiceClient = class {
|
|
50767
50805
|
#baseUrl;
|
|
@@ -51019,6 +51057,55 @@ var ChatServiceClient = class {
|
|
|
51019
51057
|
async removeMember(id, mri) {
|
|
51020
51058
|
await this.#writeThread("DELETE", `${this.#threadUrl(id)}/members/${encodeURIComponent(mri)}`);
|
|
51021
51059
|
}
|
|
51060
|
+
/**
|
|
51061
|
+
* Start a group chat: `POST /threads` with every member as `Admin` (Teams
|
|
51062
|
+
* makes every group-chat member Admin) and `{ threadType: "chat" }` plus the
|
|
51063
|
+
* topic when there is one (verified live 2026-11-09: 201, `{}`, and the new
|
|
51064
|
+
* id in `Location`). The signed-in user is always the first member.
|
|
51065
|
+
*
|
|
51066
|
+
* Not idempotent: an answer lost after sending (a timeout, a dropped
|
|
51067
|
+
* connection, a 5xx) is a `WriteOutcomeUnknownError` — the chat may exist,
|
|
51068
|
+
* and a retry would make a second one. A success without a readable
|
|
51069
|
+
* `Location` is an error too: the chat was probably made, its id unknown.
|
|
51070
|
+
*/
|
|
51071
|
+
async createGroupChat(memberMris, topic) {
|
|
51072
|
+
this.#requireConfigured();
|
|
51073
|
+
const me = await this.meMri();
|
|
51074
|
+
const others = memberMris.filter((m) => m.toLowerCase() !== me.toLowerCase());
|
|
51075
|
+
const body = {
|
|
51076
|
+
members: [me, ...others].map((id2) => ({ id: id2, role: "Admin" })),
|
|
51077
|
+
properties: {
|
|
51078
|
+
threadType: "chat",
|
|
51079
|
+
...topic ? { topic } : {},
|
|
51080
|
+
fixedRoster: false,
|
|
51081
|
+
uniquerosterthread: false
|
|
51082
|
+
}
|
|
51083
|
+
};
|
|
51084
|
+
const { status, headers } = await this.#send(`${this.#baseUrl}/threads`, "text", void 0, {
|
|
51085
|
+
method: "POST",
|
|
51086
|
+
body,
|
|
51087
|
+
hint: CREATE_OUTCOME_HINT
|
|
51088
|
+
});
|
|
51089
|
+
this.#checkWriteStatus("POST", status, CREATE_OUTCOME_HINT);
|
|
51090
|
+
const raw = /\/threads\/([^/?#]+)\/?(?:[?#].*)?$/.exec(headers.get("location") ?? "")?.[1];
|
|
51091
|
+
let id;
|
|
51092
|
+
try {
|
|
51093
|
+
id = raw !== void 0 ? decodeURIComponent(raw) : void 0;
|
|
51094
|
+
} catch {
|
|
51095
|
+
id = void 0;
|
|
51096
|
+
}
|
|
51097
|
+
if (!id) {
|
|
51098
|
+
throw new McpToolError(
|
|
51099
|
+
`Teams answered HTTP ${status} to creating the group chat, so it was probably created, but its id was not returned.`,
|
|
51100
|
+
{
|
|
51101
|
+
status,
|
|
51102
|
+
kind: "http",
|
|
51103
|
+
hint: "Find the new chat in teams_list_conversations (it has no messages yet) before trying again \u2014 do not retry blindly."
|
|
51104
|
+
}
|
|
51105
|
+
);
|
|
51106
|
+
}
|
|
51107
|
+
return { id };
|
|
51108
|
+
}
|
|
51022
51109
|
#threadUrl(id) {
|
|
51023
51110
|
return `${this.#baseUrl}/threads/${encodeURIComponent(id)}`;
|
|
51024
51111
|
}
|
|
@@ -51808,6 +51895,299 @@ function checkStatus(status, lookup) {
|
|
|
51808
51895
|
});
|
|
51809
51896
|
}
|
|
51810
51897
|
|
|
51898
|
+
// src/recap.ts
|
|
51899
|
+
init_dist2();
|
|
51900
|
+
init_session();
|
|
51901
|
+
|
|
51902
|
+
// src/recap-token-cache.ts
|
|
51903
|
+
init_session();
|
|
51904
|
+
init_dist2();
|
|
51905
|
+
init_token_cache();
|
|
51906
|
+
function recapTokenCachePath(env = process.env) {
|
|
51907
|
+
return resolveStateFile({
|
|
51908
|
+
env,
|
|
51909
|
+
envVar: "TEAMS_RECAP_TOKEN_FILE",
|
|
51910
|
+
subdir: ".microsoft-teams-mcp",
|
|
51911
|
+
fileName: "recap-token.json"
|
|
51912
|
+
});
|
|
51913
|
+
}
|
|
51914
|
+
function createRecapTokenCache(env = process.env) {
|
|
51915
|
+
if (!parseBoolEnv("TEAMS_TOKEN_CACHE", { env, default: true })) return null;
|
|
51916
|
+
if (parseBoolEnv("TEAMS_DISABLE_FETCHPROXY", { env })) return null;
|
|
51917
|
+
const file2 = createFileStatePersistence({
|
|
51918
|
+
filePath: recapTokenCachePath(env),
|
|
51919
|
+
boundTo: "fetchproxy",
|
|
51920
|
+
validate: (raw) => isBearerTokens(raw) ? raw : null
|
|
51921
|
+
});
|
|
51922
|
+
return {
|
|
51923
|
+
load: () => file2.load(),
|
|
51924
|
+
save(tokens) {
|
|
51925
|
+
try {
|
|
51926
|
+
file2.save(tokens);
|
|
51927
|
+
} catch (err) {
|
|
51928
|
+
reportCacheWriteFailure(err);
|
|
51929
|
+
}
|
|
51930
|
+
},
|
|
51931
|
+
clear() {
|
|
51932
|
+
try {
|
|
51933
|
+
file2.clear();
|
|
51934
|
+
} catch (err) {
|
|
51935
|
+
reportCacheWriteFailure(err);
|
|
51936
|
+
}
|
|
51937
|
+
}
|
|
51938
|
+
};
|
|
51939
|
+
}
|
|
51940
|
+
|
|
51941
|
+
// src/recap.ts
|
|
51942
|
+
var DEFAULT_MCPS_REGION = "us";
|
|
51943
|
+
var REQUEST_TIMEOUT_MS4 = 3e4;
|
|
51944
|
+
var MAX_RESPONSE_BYTES2 = 4 * 1024 * 1024;
|
|
51945
|
+
var GUID2 = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
51946
|
+
var GOID = /^[0-9a-f]{40,256}$/i;
|
|
51947
|
+
var THREAD_ID = /^19:[A-Za-z0-9_-]+@thread\.(?:v2|tacv2|skype)$/;
|
|
51948
|
+
var DATE = /^(\d{4})-(\d{2})-(\d{2})$/;
|
|
51949
|
+
var EPOCH_TICKS = 621355968000000000n;
|
|
51950
|
+
async function captureRecapTokenLazily() {
|
|
51951
|
+
const mod = await Promise.resolve().then(() => (init_recap_auth(), recap_auth_exports));
|
|
51952
|
+
return mod.captureRecapTokenViaFetchproxy();
|
|
51953
|
+
}
|
|
51954
|
+
function obj2(v) {
|
|
51955
|
+
return v !== null && typeof v === "object" && !Array.isArray(v) ? v : void 0;
|
|
51956
|
+
}
|
|
51957
|
+
function str2(v) {
|
|
51958
|
+
return typeof v === "string" && v.trim() !== "" ? v.trim() : void 0;
|
|
51959
|
+
}
|
|
51960
|
+
function isoOf2(v) {
|
|
51961
|
+
const s = str2(v);
|
|
51962
|
+
if (s === void 0) return void 0;
|
|
51963
|
+
const ms = Date.parse(s);
|
|
51964
|
+
return Number.isFinite(ms) ? new Date(ms).toISOString() : void 0;
|
|
51965
|
+
}
|
|
51966
|
+
function httpsUrl(v) {
|
|
51967
|
+
const s = str2(v);
|
|
51968
|
+
return s !== void 0 && /^https:\/\//i.test(s) ? s : void 0;
|
|
51969
|
+
}
|
|
51970
|
+
function parseMeetingInfo(thread) {
|
|
51971
|
+
const raw = thread.properties?.meeting;
|
|
51972
|
+
let m;
|
|
51973
|
+
if (typeof raw === "string") {
|
|
51974
|
+
try {
|
|
51975
|
+
m = obj2(JSON.parse(raw));
|
|
51976
|
+
} catch {
|
|
51977
|
+
return void 0;
|
|
51978
|
+
}
|
|
51979
|
+
} else {
|
|
51980
|
+
m = obj2(raw);
|
|
51981
|
+
}
|
|
51982
|
+
const iCalUid = str2(m?.iCalUid);
|
|
51983
|
+
const organizerId = str2(m?.organizerId);
|
|
51984
|
+
const tenantId = str2(m?.tenantId);
|
|
51985
|
+
if (m === void 0 || iCalUid === void 0 || organizerId === void 0 || tenantId === void 0) return void 0;
|
|
51986
|
+
if (!GOID.test(iCalUid) || !GUID2.test(organizerId) || !GUID2.test(tenantId)) return void 0;
|
|
51987
|
+
const subject = str2(m.subject);
|
|
51988
|
+
const seriesStart = isoOf2(m.startTime);
|
|
51989
|
+
const joinUrl = httpsUrl(m.meetingJoinUrl);
|
|
51990
|
+
return {
|
|
51991
|
+
...subject !== void 0 ? { subject } : {},
|
|
51992
|
+
iCalUid,
|
|
51993
|
+
organizerId,
|
|
51994
|
+
tenantId,
|
|
51995
|
+
recurring: m.meetingType === "Recurring",
|
|
51996
|
+
...seriesStart !== void 0 ? { seriesStart } : {},
|
|
51997
|
+
...joinUrl !== void 0 ? { joinUrl } : {}
|
|
51998
|
+
};
|
|
51999
|
+
}
|
|
52000
|
+
function isOccurrenceDate(date5) {
|
|
52001
|
+
const m = DATE.exec(date5);
|
|
52002
|
+
if (!m) return false;
|
|
52003
|
+
const d = new Date(Date.UTC(Number(m[1]), Number(m[2]) - 1, Number(m[3])));
|
|
52004
|
+
return d.toISOString().slice(0, 10) === date5;
|
|
52005
|
+
}
|
|
52006
|
+
function occurrenceUid(iCalUid, date5) {
|
|
52007
|
+
if (!GOID.test(iCalUid)) throw new Error(`not a meeting id: ${JSON.stringify(iCalUid)}`);
|
|
52008
|
+
if (!isOccurrenceDate(date5)) throw new Error(`not a YYYY-MM-DD date: ${JSON.stringify(date5)}`);
|
|
52009
|
+
const [y, mo, d] = date5.split("-").map(Number);
|
|
52010
|
+
const hex3 = [y >> 8, y & 255, mo, d].map((b) => b.toString(16).padStart(2, "0")).join("").toUpperCase();
|
|
52011
|
+
return iCalUid.slice(0, 32) + hex3 + iCalUid.slice(40);
|
|
52012
|
+
}
|
|
52013
|
+
function mcpsBase(env = process.env) {
|
|
52014
|
+
const region = readEnvVar("TEAMS_MCPS_REGION", { env }) ?? DEFAULT_MCPS_REGION;
|
|
52015
|
+
return `https://teams.cloud.microsoft/api/mcps/${encodeURIComponent(region)}`;
|
|
52016
|
+
}
|
|
52017
|
+
function collabObjectUrl(base, meeting, uid, threadId) {
|
|
52018
|
+
if (!GUID2.test(meeting.organizerId) || !GUID2.test(meeting.tenantId)) throw new Error("not a meeting organizer");
|
|
52019
|
+
if (!GOID.test(uid)) throw new Error(`not a meeting id: ${JSON.stringify(uid)}`);
|
|
52020
|
+
if (!THREAD_ID.test(threadId)) throw new Error(`not a meeting thread id: ${JSON.stringify(threadId)}`);
|
|
52021
|
+
return `${base}/collab/readcollabobject/V2/${meeting.organizerId}@${meeting.tenantId}/${uid}/${threadId}`;
|
|
52022
|
+
}
|
|
52023
|
+
function ticksToIso(ticks) {
|
|
52024
|
+
const s = str2(ticks);
|
|
52025
|
+
if (s === void 0 || !/^\d{15,20}$/.test(s)) return void 0;
|
|
52026
|
+
const ms = Number((BigInt(s) - EPOCH_TICKS) / 10000n);
|
|
52027
|
+
return Number.isFinite(ms) && ms > 0 ? new Date(ms).toISOString() : void 0;
|
|
52028
|
+
}
|
|
52029
|
+
function hms(totalSeconds) {
|
|
52030
|
+
const s = Math.floor(totalSeconds);
|
|
52031
|
+
return `${Math.floor(s / 3600)}:${String(Math.floor(s % 3600 / 60)).padStart(2, "0")}:${String(s % 60).padStart(2, "0")}`;
|
|
52032
|
+
}
|
|
52033
|
+
function timespan(v) {
|
|
52034
|
+
const m = /^(\d+):(\d{2}):(\d{2})/.exec(str2(v) ?? "");
|
|
52035
|
+
return m ? hms(Number(m[1]) * 3600 + Number(m[2]) * 60 + Number(m[3])) : void 0;
|
|
52036
|
+
}
|
|
52037
|
+
function parseCollabObject(body) {
|
|
52038
|
+
const list = obj2(body)?.resources;
|
|
52039
|
+
if (!Array.isArray(list)) return [];
|
|
52040
|
+
const byId = /* @__PURE__ */ new Map();
|
|
52041
|
+
for (const raw of list) {
|
|
52042
|
+
const r = obj2(raw);
|
|
52043
|
+
const id = str2(r?.id);
|
|
52044
|
+
const type = str2(r?.type);
|
|
52045
|
+
if (r === void 0 || id === void 0 || type === void 0 || byId.has(id)) continue;
|
|
52046
|
+
const location = str2(r.location);
|
|
52047
|
+
const added = isoOf2(r.additionDateTime);
|
|
52048
|
+
byId.set(id, {
|
|
52049
|
+
id,
|
|
52050
|
+
type,
|
|
52051
|
+
...location !== void 0 ? { location } : {},
|
|
52052
|
+
metadata: obj2(r.metadata) ?? {},
|
|
52053
|
+
...added !== void 0 ? { added } : {}
|
|
52054
|
+
});
|
|
52055
|
+
}
|
|
52056
|
+
return [...byId.values()];
|
|
52057
|
+
}
|
|
52058
|
+
function compact(o) {
|
|
52059
|
+
return Object.fromEntries(Object.entries(o).filter(([, v]) => v !== void 0));
|
|
52060
|
+
}
|
|
52061
|
+
function summarizeRecap(resources) {
|
|
52062
|
+
const out = {
|
|
52063
|
+
recordings: [],
|
|
52064
|
+
transcripts: [],
|
|
52065
|
+
notes: [],
|
|
52066
|
+
attendance_reports: [],
|
|
52067
|
+
files: [],
|
|
52068
|
+
other: []
|
|
52069
|
+
};
|
|
52070
|
+
for (const r of resources) {
|
|
52071
|
+
const md = r.metadata;
|
|
52072
|
+
switch (r.type) {
|
|
52073
|
+
case "Recording": {
|
|
52074
|
+
const started = ticksToIso(md.startTime);
|
|
52075
|
+
const ended = ticksToIso(md.endTime);
|
|
52076
|
+
const duration3 = started && ended ? hms((Date.parse(ended) - Date.parse(started)) / 1e3) : void 0;
|
|
52077
|
+
out.recordings.push(compact({ started, ended, duration: duration3, url: httpsUrl(r.location) }));
|
|
52078
|
+
break;
|
|
52079
|
+
}
|
|
52080
|
+
case "TranscriptV2":
|
|
52081
|
+
out.transcripts.push(compact({ started: ticksToIso(md.startTime), duration: timespan(md.duration), url: httpsUrl(md.webUrl) }));
|
|
52082
|
+
break;
|
|
52083
|
+
case "transcript":
|
|
52084
|
+
out.transcripts.push(compact({ started: isoOf2(md.startTime), state: str2(md.state) }));
|
|
52085
|
+
break;
|
|
52086
|
+
case "notes":
|
|
52087
|
+
out.notes.push(compact({ url: httpsUrl(r.location), added: r.added }));
|
|
52088
|
+
break;
|
|
52089
|
+
case "AttendanceReport":
|
|
52090
|
+
out.attendance_reports.push(compact({ started: ticksToIso(md.startTime), url: httpsUrl(md.webUrl) ?? httpsUrl(r.location) }));
|
|
52091
|
+
break;
|
|
52092
|
+
case "MeetingChat":
|
|
52093
|
+
case "MeetingStage":
|
|
52094
|
+
out.files.push(
|
|
52095
|
+
compact({
|
|
52096
|
+
name: str2(md.fileTitle),
|
|
52097
|
+
file_type: str2(md.fileType),
|
|
52098
|
+
app: str2(md.appTitle),
|
|
52099
|
+
shared_in: r.type === "MeetingChat" ? "chat" : "meeting",
|
|
52100
|
+
url: httpsUrl(md.shareUrl) ?? httpsUrl(r.location),
|
|
52101
|
+
added: r.added
|
|
52102
|
+
})
|
|
52103
|
+
);
|
|
52104
|
+
break;
|
|
52105
|
+
case "AISummary":
|
|
52106
|
+
out.ai_summary = compact({ exists: true, generated: r.added });
|
|
52107
|
+
break;
|
|
52108
|
+
default:
|
|
52109
|
+
out.other.push(compact({ type: r.type, url: httpsUrl(r.location), added: r.added }));
|
|
52110
|
+
}
|
|
52111
|
+
}
|
|
52112
|
+
return Object.fromEntries(
|
|
52113
|
+
Object.entries(out).filter(([, v]) => v !== void 0 && (!Array.isArray(v) || v.length > 0))
|
|
52114
|
+
);
|
|
52115
|
+
}
|
|
52116
|
+
var RecapClient = class {
|
|
52117
|
+
#fetchImpl;
|
|
52118
|
+
#base;
|
|
52119
|
+
#configError = null;
|
|
52120
|
+
#manager;
|
|
52121
|
+
constructor(opts = {}) {
|
|
52122
|
+
const env = opts.env ?? process.env;
|
|
52123
|
+
this.#fetchImpl = opts.fetchImpl ?? ((input2, init) => fetch(input2, init));
|
|
52124
|
+
this.#base = mcpsBase(env);
|
|
52125
|
+
this.#manager = createCapturedTokenManager({
|
|
52126
|
+
capture: opts.captureToken ?? captureRecapTokenLazily,
|
|
52127
|
+
persistence: createRecapTokenCache(env)
|
|
52128
|
+
});
|
|
52129
|
+
if (parseBoolEnv("TEAMS_DISABLE_FETCHPROXY", { env })) {
|
|
52130
|
+
this.#configError = new McpToolError("Meeting recaps are disabled (no token source).", {
|
|
52131
|
+
kind: "no_credential",
|
|
52132
|
+
hint: "Unset TEAMS_DISABLE_FETCHPROXY so a recap token can be captured from a signed-in Teams tab."
|
|
52133
|
+
});
|
|
52134
|
+
}
|
|
52135
|
+
}
|
|
52136
|
+
isConfigured() {
|
|
52137
|
+
return this.#configError === null;
|
|
52138
|
+
}
|
|
52139
|
+
async readCollabObject(meeting, uid, threadId) {
|
|
52140
|
+
if (this.#configError) throw this.#configError;
|
|
52141
|
+
const url2 = collabObjectUrl(this.#base, meeting, uid, threadId);
|
|
52142
|
+
let text = "";
|
|
52143
|
+
const res = await this.#manager.withAuth(async (token) => {
|
|
52144
|
+
let r;
|
|
52145
|
+
try {
|
|
52146
|
+
r = await fetchBounded(
|
|
52147
|
+
url2,
|
|
52148
|
+
{ method: "GET", headers: { authorization: `Bearer ${token}`, accept: "application/json" }, redirect: "error" },
|
|
52149
|
+
{ read: "text", maxBytes: MAX_RESPONSE_BYTES2, service: "Teams meeting recap", timeoutMs: REQUEST_TIMEOUT_MS4, fetchImpl: this.#fetchImpl }
|
|
52150
|
+
);
|
|
52151
|
+
} catch (e) {
|
|
52152
|
+
throw describeTransportFailure2(e, url2, "Teams meeting recap") ?? e;
|
|
52153
|
+
}
|
|
52154
|
+
text = r.body;
|
|
52155
|
+
return r.res;
|
|
52156
|
+
});
|
|
52157
|
+
checkStatus2(res.status);
|
|
52158
|
+
try {
|
|
52159
|
+
return parseCollabObject(JSON.parse(text));
|
|
52160
|
+
} catch {
|
|
52161
|
+
throw new McpToolError("The Teams meeting-recap service returned a response that is not JSON.", { status: res.status, kind: "http" });
|
|
52162
|
+
}
|
|
52163
|
+
}
|
|
52164
|
+
};
|
|
52165
|
+
function checkStatus2(status) {
|
|
52166
|
+
if (status >= 200 && status < 300) return;
|
|
52167
|
+
if (status === 401) {
|
|
52168
|
+
throw new McpToolError("The Teams meeting-recap service rejected the recap token (401) even after a fresh capture.", {
|
|
52169
|
+
status,
|
|
52170
|
+
kind: "credential_rejected",
|
|
52171
|
+
hint: "Open a meeting chat's Recap tab in a signed-in Teams tab to mint a fresh recap token, then retry."
|
|
52172
|
+
});
|
|
52173
|
+
}
|
|
52174
|
+
if (status === 403) {
|
|
52175
|
+
throw new McpToolError("You are not allowed to read this meeting's recap (403).", { status, kind: "http" });
|
|
52176
|
+
}
|
|
52177
|
+
if (status === 429) {
|
|
52178
|
+
throw new McpToolError("The Teams meeting-recap service is rate-limiting requests (429).", {
|
|
52179
|
+
status,
|
|
52180
|
+
kind: "http",
|
|
52181
|
+
hint: "Wait a minute before retrying."
|
|
52182
|
+
});
|
|
52183
|
+
}
|
|
52184
|
+
throw new McpToolError(`The Teams meeting-recap service returned HTTP ${status}.`, {
|
|
52185
|
+
status,
|
|
52186
|
+
kind: "http",
|
|
52187
|
+
...status >= 500 ? { hint: "A Teams-side failure; retry shortly." } : {}
|
|
52188
|
+
});
|
|
52189
|
+
}
|
|
52190
|
+
|
|
51811
52191
|
// src/tools/chat.ts
|
|
51812
52192
|
init_dist2();
|
|
51813
52193
|
init_zod();
|
|
@@ -54444,10 +54824,10 @@ function decodeExportCursor(cursor) {
|
|
|
54444
54824
|
}
|
|
54445
54825
|
if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed))
|
|
54446
54826
|
throw bad();
|
|
54447
|
-
const
|
|
54448
|
-
if (
|
|
54827
|
+
const obj3 = parsed;
|
|
54828
|
+
if (obj3.v !== CURSOR_VERSION)
|
|
54449
54829
|
throw bad();
|
|
54450
|
-
return
|
|
54830
|
+
return obj3;
|
|
54451
54831
|
}
|
|
54452
54832
|
function jsonlLine(value) {
|
|
54453
54833
|
const s = JSON.stringify(value);
|
|
@@ -55404,13 +55784,13 @@ init_dist2();
|
|
|
55404
55784
|
// src/tools/people.ts
|
|
55405
55785
|
init_dist2();
|
|
55406
55786
|
var MRI = /^\d+:\S+$/;
|
|
55407
|
-
var
|
|
55787
|
+
var GUID3 = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
55408
55788
|
var RECENT_MESSAGES = 200;
|
|
55409
55789
|
var MAX_CANDIDATES2 = 10;
|
|
55410
55790
|
function personMri(input2) {
|
|
55411
55791
|
const s = input2.trim();
|
|
55412
55792
|
if (MRI.test(s)) return s;
|
|
55413
|
-
if (
|
|
55793
|
+
if (GUID3.test(s)) return `8:orgid:${s.toLowerCase()}`;
|
|
55414
55794
|
return void 0;
|
|
55415
55795
|
}
|
|
55416
55796
|
function normaliseName(name) {
|
|
@@ -55443,6 +55823,7 @@ async function knownPeople(chatsvc, me, conversationId) {
|
|
|
55443
55823
|
}
|
|
55444
55824
|
} catch {
|
|
55445
55825
|
}
|
|
55826
|
+
if (conversationId === void 0) return [...byMri.values()];
|
|
55446
55827
|
try {
|
|
55447
55828
|
for (const [mri, name] of await recentSenders(chatsvc, conversationId)) add(mri, name);
|
|
55448
55829
|
} catch {
|
|
@@ -55524,7 +55905,7 @@ function pickByName(person, found) {
|
|
|
55524
55905
|
);
|
|
55525
55906
|
}
|
|
55526
55907
|
throw new McpToolError(`No one in your chats or your organisation's directory is called "${person}".`, {
|
|
55527
|
-
hint: `${PASS_ID} A name is matched among the other person of each of your 1:1 chats and
|
|
55908
|
+
hint: `${PASS_ID} A name is matched among the other person of each of your 1:1 chats and (for an existing chat) its recent senders, then searched in your organisation's directory.`
|
|
55528
55909
|
});
|
|
55529
55910
|
}
|
|
55530
55911
|
async function resolvePeople(inputs, known, directory) {
|
|
@@ -55918,6 +56299,7 @@ init_dist2();
|
|
|
55918
56299
|
var RENAME = "teams_rename_chat";
|
|
55919
56300
|
var ADD = "teams_add_chat_members";
|
|
55920
56301
|
var REMOVE = "teams_remove_chat_members";
|
|
56302
|
+
var CREATE = "teams_create_group_chat";
|
|
55921
56303
|
var MAX_PEOPLE = 20;
|
|
55922
56304
|
var KIND_LABELS = {
|
|
55923
56305
|
oneOnOne: "a 1:1 chat",
|
|
@@ -55928,10 +56310,16 @@ var KIND_LABELS = {
|
|
|
55928
56310
|
var conversationParam = external_exports.string().min(1).describe(
|
|
55929
56311
|
"The group chat: its id (from teams_list_conversations), or a case-insensitive substring of its title or an untitled chat's participant names."
|
|
55930
56312
|
);
|
|
55931
|
-
|
|
55932
|
-
`
|
|
56313
|
+
function peopleParamText(local) {
|
|
56314
|
+
return `each an MRI (8:orgid:\u2026), a bare Entra object id, an email address (looked up in your organisation's directory), or a display name ("Greg King" and "King, Greg" are the same) matched among ${local}, then \u2014 only if no one there matches \u2014 in the directory.`;
|
|
56315
|
+
}
|
|
56316
|
+
var peopleParam = external_exports.array(external_exports.string().trim().min(1)).min(1).max(MAX_PEOPLE).describe(`Who: ${peopleParamText("the other people of your 1:1 chats and recent senders in this chat")}`);
|
|
56317
|
+
function peopleSentence(local) {
|
|
56318
|
+
return `people are MRIs (8:orgid:\u2026), bare object ids, email addresses, or display names. A name is matched (ignoring case, in either "First Last" or "Last, First" order) among ${local} first; only when no one there matches is the organisation's directory searched, where the one person with exactly that name is taken (or the only suggestion, when the name is whole words of it). An email address is looked up in the directory and must be exactly one person's email or UPN. An ambiguous or unknown person refuses the whole call, listing candidates. The directory is searched with the same token as teams_search_messages: the first lookup may need the user to run any search in the Teams search box so it can be captured. `;
|
|
56319
|
+
}
|
|
56320
|
+
var PEOPLE_SENTENCE = peopleSentence(
|
|
56321
|
+
"the other person of each of the user's 1:1 chats and the chat's recent senders"
|
|
55933
56322
|
);
|
|
55934
|
-
var PEOPLE_SENTENCE = `people are MRIs (8:orgid:\u2026), bare object ids, email addresses, or display names. A name is matched (ignoring case, in either "First Last" or "Last, First" order) among the other person of each of the user's 1:1 chats and the chat's recent senders first; only when no one there matches is the organisation's directory searched, where the one person with exactly that name is taken (or the only suggestion, when the name is whole words of it). An email address is looked up in the directory and must be exactly one person's email or UPN. An ambiguous or unknown person refuses the whole call, listing candidates. The directory is searched with the same token as teams_search_messages: the first lookup may need the user to run any search in the Teams search box so it can be captured. `;
|
|
55935
56323
|
async function groupChat(chatsvc, conversation, me, doing) {
|
|
55936
56324
|
const target = await resolveTarget(chatsvc, conversation, me, `change`);
|
|
55937
56325
|
if (target.kind === "group") return target;
|
|
@@ -56228,6 +56616,102 @@ function registerGroupChatTools(server, { chatsvc, substrate }) {
|
|
|
56228
56616
|
}
|
|
56229
56617
|
}
|
|
56230
56618
|
);
|
|
56619
|
+
server.registerTool(
|
|
56620
|
+
CREATE,
|
|
56621
|
+
{
|
|
56622
|
+
title: "Create a Teams group chat",
|
|
56623
|
+
description: "Start a new group chat as the signed-in user with 2\u201320 other people, optionally named (topic). The user is always included (listing them is ignored), as are duplicates; fewer than two other people is refused \u2014 one other person is a 1:1, which this tool does not create. " + peopleSentence("the other person of each of the user's 1:1 chats") + 'Everyone added sees the chat at once in their chat list, and it cannot be deleted afterwards \u2014 only left. No message is sent: post the first one with teams_send_message, passing the new conversation id. Not idempotent: every confirmed call makes a NEW chat. The result has the new conversation (id, title, kind "group"), the members and whether reading the chat back showed them all and the topic (verified); status "unknown" means Teams did not confirm the create \u2014 a chat may exist anyway, so check teams_list_conversations and do NOT retry blindly (that would make a second chat). ' + CONFIRM_FLOW_SENTENCE + " The preview shows the topic and exactly who would be in the chat \u2014 each with their source (id, chat or directory) and, from the directory, their email \u2014 so the user can check it is the right people. " + CONFIRM_INJECTION_RULE + UNTRUSTED_DESCRIPTION_SUFFIX2,
|
|
56624
|
+
annotations: toolAnnotations({ readOnly: false, destructive: false, idempotent: false, openWorld: true }),
|
|
56625
|
+
_meta: workMeta("send", {
|
|
56626
|
+
aliases: ["create chat", "new group chat", "start a chat", "new chat", "group chat", "start group chat"]
|
|
56627
|
+
}),
|
|
56628
|
+
inputSchema: {
|
|
56629
|
+
people: external_exports.array(external_exports.string().trim().min(1)).min(2).max(MAX_PEOPLE).describe(
|
|
56630
|
+
`Who to start the chat with (2\u201320 others; you are added automatically): ` + peopleParamText("the other people of your 1:1 chats")
|
|
56631
|
+
),
|
|
56632
|
+
topic: external_exports.string().optional().describe("A name for the chat (surrounding spaces are trimmed). Omit or leave empty for an untitled chat."),
|
|
56633
|
+
confirmToken: confirmTokenParam
|
|
56634
|
+
}
|
|
56635
|
+
},
|
|
56636
|
+
async ({ people, topic: rawTopic, confirmToken }, ctx) => {
|
|
56637
|
+
try {
|
|
56638
|
+
const me = await chatsvc.meMri();
|
|
56639
|
+
const topic = rawTopic?.trim() || void 0;
|
|
56640
|
+
const others = (await resolveFor(chatsvc, substrate, me, void 0, people)).filter(
|
|
56641
|
+
(p) => p.mri.toLowerCase() !== me.toLowerCase()
|
|
56642
|
+
);
|
|
56643
|
+
if (others.length < 2) {
|
|
56644
|
+
throw new McpToolError(
|
|
56645
|
+
`A group chat needs at least two other people besides you; ${others.length === 1 ? `only ${JSON.stringify(others[0].person)} is` : "no one else is"} left once you and duplicates are dropped. One other person is a 1:1 chat, which this tool does not create.`,
|
|
56646
|
+
{
|
|
56647
|
+
hint: "Add at least one more person, or to talk to one person use your 1:1 chat with them (teams_send_message, conversation set to their name)."
|
|
56648
|
+
}
|
|
56649
|
+
);
|
|
56650
|
+
}
|
|
56651
|
+
const members2 = others.map(shown);
|
|
56652
|
+
const allMris = [me, ...others.map((p) => p.mri)];
|
|
56653
|
+
const count = `you and ${others.length} other people`;
|
|
56654
|
+
const gate = await confirmWrite(ctx, {
|
|
56655
|
+
tool: CREATE,
|
|
56656
|
+
action: "chat.create",
|
|
56657
|
+
message: "Review and confirm this new group chat before it is created \u2014 it cannot be deleted afterwards:",
|
|
56658
|
+
// The topic is the caller's own text: JSON-quoted all the same, so it reads as one value.
|
|
56659
|
+
summary: `Create ${topic !== void 0 ? `group chat ${JSON.stringify(topic)}` : "an untitled group chat"} with ${count}`,
|
|
56660
|
+
account: me,
|
|
56661
|
+
target: "new group chat",
|
|
56662
|
+
request: { method: "POST", path: "/threads", body: { members: allMris, ...topic !== void 0 ? { topic } : {} } },
|
|
56663
|
+
// The resolved names are set by other people, so they are fenced.
|
|
56664
|
+
preview: {
|
|
56665
|
+
topic: topic ?? "(untitled)",
|
|
56666
|
+
members: untrustedField(members2),
|
|
56667
|
+
note: "Creates a NEW group chat with everyone as a member (Teams makes each one an Admin). Everyone added sees it at once; it cannot be deleted afterwards, only left. No message is sent."
|
|
56668
|
+
},
|
|
56669
|
+
confirmToken
|
|
56670
|
+
});
|
|
56671
|
+
if (gate) return gate;
|
|
56672
|
+
let id;
|
|
56673
|
+
try {
|
|
56674
|
+
({ id } = await chatsvc.createGroupChat(others.map((p) => p.mri), topic));
|
|
56675
|
+
} catch (e) {
|
|
56676
|
+
if (!(e instanceof WriteOutcomeUnknownError)) throw e;
|
|
56677
|
+
return untrustedResult2({
|
|
56678
|
+
status: "unknown",
|
|
56679
|
+
...topic !== void 0 ? { topic } : {},
|
|
56680
|
+
members: members2,
|
|
56681
|
+
warning: `Teams did not confirm creating the chat (${unconfirmedWhy2(e)}), so it may or may not exist. Check teams_list_conversations for a new group chat with these people (no messages yet) before doing anything else \u2014 do NOT retry blindly: if it was created, retrying makes a second chat, and chats cannot be deleted.`
|
|
56682
|
+
});
|
|
56683
|
+
}
|
|
56684
|
+
let warning;
|
|
56685
|
+
let verified;
|
|
56686
|
+
try {
|
|
56687
|
+
const thread = await chatsvc.getThread(id);
|
|
56688
|
+
const present = memberSet(thread);
|
|
56689
|
+
const missing = allMris.filter((m) => !present.has(m.toLowerCase()));
|
|
56690
|
+
const shownTopic = thread.properties?.topic || void 0;
|
|
56691
|
+
const notes = [];
|
|
56692
|
+
if (missing.length > 0) notes.push(`did not show ${missing.join(", ")} as a member`);
|
|
56693
|
+
if (shownTopic !== topic) notes.push(`showed the topic as ${JSON.stringify(shownTopic ?? "")}`);
|
|
56694
|
+
verified = notes.length === 0;
|
|
56695
|
+
if (!verified) {
|
|
56696
|
+
warning = `Teams created the chat, but reading it back ${notes.join(" and ")} \u2014 check it in Teams (do not create it again).`;
|
|
56697
|
+
}
|
|
56698
|
+
} catch {
|
|
56699
|
+
verified = null;
|
|
56700
|
+
warning = "Teams created the chat, but reading the chat back failed \u2014 check it in teams_list_conversations (do not create it again).";
|
|
56701
|
+
}
|
|
56702
|
+
return untrustedResult2({
|
|
56703
|
+
status: "created",
|
|
56704
|
+
conversation: { id, title: topic ?? UNTITLED_GROUP_TITLE, kind: "group" },
|
|
56705
|
+
...topic !== void 0 ? { topic } : {},
|
|
56706
|
+
members: members2,
|
|
56707
|
+
verified,
|
|
56708
|
+
...warning !== void 0 ? { warning } : {}
|
|
56709
|
+
});
|
|
56710
|
+
} catch (err) {
|
|
56711
|
+
throw wrapApiError(err, "create the group chat");
|
|
56712
|
+
}
|
|
56713
|
+
}
|
|
56714
|
+
);
|
|
56231
56715
|
}
|
|
56232
56716
|
function orderAs(people, results) {
|
|
56233
56717
|
return people.map((p) => results.find((r) => r.mri === p.mri));
|
|
@@ -56268,13 +56752,13 @@ function activityOf(m) {
|
|
|
56268
56752
|
}
|
|
56269
56753
|
return value !== null && typeof value === "object" && !Array.isArray(value) ? value : void 0;
|
|
56270
56754
|
}
|
|
56271
|
-
function
|
|
56755
|
+
function str3(v) {
|
|
56272
56756
|
if (typeof v === "string") return v === "" ? void 0 : v;
|
|
56273
56757
|
if (typeof v === "number" && Number.isFinite(v)) return String(v);
|
|
56274
56758
|
return void 0;
|
|
56275
56759
|
}
|
|
56276
56760
|
function isoOrUndefined(v) {
|
|
56277
|
-
const s =
|
|
56761
|
+
const s = str3(v);
|
|
56278
56762
|
if (s === void 0) return void 0;
|
|
56279
56763
|
const ms = /^\d+$/.test(s) ? Number(s) : Date.parse(s);
|
|
56280
56764
|
return Number.isFinite(ms) ? new Date(ms).toISOString() : void 0;
|
|
@@ -56286,25 +56770,25 @@ function activityRow(m) {
|
|
|
56286
56770
|
if (m.properties?.deletetime) return void 0;
|
|
56287
56771
|
const a = activityOf(m);
|
|
56288
56772
|
if (a === void 0) return void 0;
|
|
56289
|
-
const type =
|
|
56290
|
-
const replyChain =
|
|
56773
|
+
const type = str3(a.activityType) ?? "";
|
|
56774
|
+
const replyChain = str3(a.sourceReplyChainId);
|
|
56291
56775
|
const isread = m.properties?.isread;
|
|
56292
56776
|
return {
|
|
56293
56777
|
id: m.id,
|
|
56294
56778
|
time: isoOrUndefined(a.activityTimestamp) ?? isoOrUndefined(m.originalarrivaltime),
|
|
56295
56779
|
kind: activityKind(type),
|
|
56296
56780
|
type,
|
|
56297
|
-
subtype:
|
|
56781
|
+
subtype: str3(a.activitySubtype) ?? "",
|
|
56298
56782
|
read: isread === true || isread === "true",
|
|
56299
|
-
from:
|
|
56783
|
+
from: str3(a.sourceUserImDisplayName),
|
|
56300
56784
|
where: {
|
|
56301
|
-
conversation_id:
|
|
56302
|
-
title:
|
|
56303
|
-
type:
|
|
56785
|
+
conversation_id: str3(a.sourceThreadId),
|
|
56786
|
+
title: str3(a.sourceThreadTopic),
|
|
56787
|
+
type: str3(a.sourceThreadType)
|
|
56304
56788
|
},
|
|
56305
|
-
message_id:
|
|
56789
|
+
message_id: str3(a.sourceMessageId),
|
|
56306
56790
|
...replyChain !== void 0 ? { reply_chain_id: replyChain } : {},
|
|
56307
|
-
preview: clip(htmlToText(
|
|
56791
|
+
preview: clip(htmlToText(str3(a.messagePreview) ?? ""))
|
|
56308
56792
|
};
|
|
56309
56793
|
}
|
|
56310
56794
|
async function nameRows(name, rows) {
|
|
@@ -56880,12 +57364,115 @@ function recordingObjectOf(messages, id) {
|
|
|
56880
57364
|
return m === void 0 ? void 0 : parseRecording(m)?.object_id;
|
|
56881
57365
|
}
|
|
56882
57366
|
|
|
57367
|
+
// src/tools/recap.ts
|
|
57368
|
+
init_zod();
|
|
57369
|
+
init_dist2();
|
|
57370
|
+
var MAX_SCAN2 = 1e3;
|
|
57371
|
+
var MAX_PROBE = 5;
|
|
57372
|
+
var MAX_OTHERS2 = 20;
|
|
57373
|
+
var CALL_TYPES = /* @__PURE__ */ new Set(["Event/Call", "RichText/Media_CallRecording", "RichText/Media_CallTranscript"]);
|
|
57374
|
+
function callDays(messages) {
|
|
57375
|
+
const days = /* @__PURE__ */ new Map();
|
|
57376
|
+
for (const m of messages) {
|
|
57377
|
+
if (!CALL_TYPES.has(m.messagetype ?? "")) continue;
|
|
57378
|
+
const ms = Date.parse(m.composetime ?? m.originalarrivaltime ?? "") || Number(m.id);
|
|
57379
|
+
if (!Number.isFinite(ms) || ms <= 0) continue;
|
|
57380
|
+
const day = new Date(ms).toISOString().slice(0, 10);
|
|
57381
|
+
days.set(day, Math.max(days.get(day) ?? 0, ms));
|
|
57382
|
+
}
|
|
57383
|
+
return [...days.entries()].sort((a, b) => b[1] - a[1]).map(([d]) => d);
|
|
57384
|
+
}
|
|
57385
|
+
var isEmpty = (r) => Object.keys(r).length === 0;
|
|
57386
|
+
function hintFor(recap, occurrence, recurring, searched) {
|
|
57387
|
+
const parts = [];
|
|
57388
|
+
if (isEmpty(recap)) {
|
|
57389
|
+
parts.push(
|
|
57390
|
+
recurring && occurrence === void 0 && !searched ? "No call was found in this chat to pick an occurrence from: pass date (YYYY-MM-DD) for the occurrence you want." : `Nothing was recorded or shared for ${occurrence !== void 0 ? `the ${occurrence} occurrence` : "this meeting"}: no recording, transcript, notes or files.`
|
|
57391
|
+
);
|
|
57392
|
+
}
|
|
57393
|
+
if (recap.transcripts !== void 0) parts.push("teams_get_transcript reads a recording's transcript text from this same chat.");
|
|
57394
|
+
if (recap.ai_summary !== void 0) {
|
|
57395
|
+
parts.push("Teams made AI notes (Intelligent Recap) for this meeting; they are shown only in Teams, to licensed users, and are not read here.");
|
|
57396
|
+
}
|
|
57397
|
+
return parts.length > 0 ? parts.join(" ") : void 0;
|
|
57398
|
+
}
|
|
57399
|
+
function registerRecapTools(server, { chatsvc, recap }) {
|
|
57400
|
+
server.registerTool(
|
|
57401
|
+
"teams_get_meeting_recap",
|
|
57402
|
+
{
|
|
57403
|
+
title: "Get a Teams meeting recap",
|
|
57404
|
+
description: `Get what a Teams meeting's Recap tab shows, from its meeting chat (by id or by name, as teams_list_conversations lists it): recordings (start, end, duration, play link), transcripts, the meeting notes (Loop) link, attendance reports, files shared in the meeting chat or on stage (e.g. a whiteboard), and whether Teams made AI notes (their text is not read). A recurring meeting has one recap per occurrence: pass date (YYYY-MM-DD) for one, else the newest day the chat shows a call on that has a recap is returned (up to ${MAX_PROBE} tried), with series (what belongs to the whole series) and other_occurrences (other call days, newest first). For the transcript text use teams_get_transcript. Uses its own token, captured when a Recap tab is opened in Teams. Does not mark anything read.` + UNTRUSTED_DESCRIPTION_SUFFIX2,
|
|
57405
|
+
_meta: workMeta("lookup", {
|
|
57406
|
+
aliases: ["recap", "meeting recap", "meeting notes", "attendance report", "attendance", "recording link", "intelligent recap", "ai notes"]
|
|
57407
|
+
}),
|
|
57408
|
+
annotations: toolAnnotations({ readOnly: true, openWorld: true }),
|
|
57409
|
+
inputSchema: {
|
|
57410
|
+
conversation: external_exports.string().min(1).describe("The meeting chat's id, or a case-insensitive substring of its title."),
|
|
57411
|
+
date: external_exports.string().refine(isOccurrenceDate, "date must be a real day, YYYY-MM-DD").optional().describe("For a recurring meeting: the occurrence, YYYY-MM-DD (the UTC day it met). Default: the newest with a recap.")
|
|
57412
|
+
}
|
|
57413
|
+
},
|
|
57414
|
+
async ({ conversation, date: date5 }) => {
|
|
57415
|
+
try {
|
|
57416
|
+
const [raw, me] = await Promise.all([chatsvc.listConversations(), chatsvc.meMri()]);
|
|
57417
|
+
const summary = await resolveListed(chatsvc, raw, me, conversation, "read the recap of");
|
|
57418
|
+
const meeting = parseMeetingInfo(await chatsvc.getThread(summary.id));
|
|
57419
|
+
if (meeting === void 0) {
|
|
57420
|
+
throw new McpToolError(`"${summary.title}" is not a meeting chat: it has no scheduled meeting to recap.`, {
|
|
57421
|
+
hint: `Pass a meeting's own chat (teams_list_conversations lists them with type "meeting").`
|
|
57422
|
+
});
|
|
57423
|
+
}
|
|
57424
|
+
const read = async (uid) => summarizeRecap(await recap.readCollabObject(meeting, uid, summary.id));
|
|
57425
|
+
const base = {
|
|
57426
|
+
conversation: summary.id,
|
|
57427
|
+
title: summary.title,
|
|
57428
|
+
meeting: {
|
|
57429
|
+
...meeting.subject !== void 0 ? { subject: meeting.subject } : {},
|
|
57430
|
+
recurring: meeting.recurring,
|
|
57431
|
+
...meeting.joinUrl !== void 0 ? { join_url: meeting.joinUrl } : {}
|
|
57432
|
+
}
|
|
57433
|
+
};
|
|
57434
|
+
if (!meeting.recurring) {
|
|
57435
|
+
const r2 = await read(meeting.iCalUid);
|
|
57436
|
+
const hint2 = hintFor(r2, void 0, false, true);
|
|
57437
|
+
return untrustedResult2({ ...base, recap: r2, ...hint2 !== void 0 ? { hint: hint2 } : {} });
|
|
57438
|
+
}
|
|
57439
|
+
const days = date5 !== void 0 ? [date5] : callDays(await chatsvc.getMessages(summary.id, { max: MAX_SCAN2 }));
|
|
57440
|
+
const series = await read(meeting.iCalUid);
|
|
57441
|
+
let chosen;
|
|
57442
|
+
for (const day of days.slice(0, MAX_PROBE)) {
|
|
57443
|
+
const r2 = await read(occurrenceUid(meeting.iCalUid, day));
|
|
57444
|
+
chosen ??= { day, recap: r2 };
|
|
57445
|
+
if (!isEmpty(r2)) {
|
|
57446
|
+
chosen = { day, recap: r2 };
|
|
57447
|
+
break;
|
|
57448
|
+
}
|
|
57449
|
+
}
|
|
57450
|
+
const r = chosen?.recap ?? {};
|
|
57451
|
+
const others = days.filter((d) => d !== chosen?.day).slice(0, MAX_OTHERS2);
|
|
57452
|
+
const hint = hintFor(r, chosen?.day, true, days.length > 0);
|
|
57453
|
+
return untrustedResult2({
|
|
57454
|
+
...base,
|
|
57455
|
+
...chosen !== void 0 ? { occurrence: chosen.day } : {},
|
|
57456
|
+
recap: r,
|
|
57457
|
+
...!isEmpty(series) ? { series } : {},
|
|
57458
|
+
...others.length > 0 ? { other_occurrences: others } : {},
|
|
57459
|
+
...hint !== void 0 ? { hint } : {}
|
|
57460
|
+
});
|
|
57461
|
+
} catch (err) {
|
|
57462
|
+
if (err instanceof AmbiguousConversationError) return untrustedResult2(ambiguousResult(err));
|
|
57463
|
+
throw wrapApiError(err, "get the meeting recap");
|
|
57464
|
+
}
|
|
57465
|
+
}
|
|
57466
|
+
);
|
|
57467
|
+
}
|
|
57468
|
+
|
|
56883
57469
|
// src/index.ts
|
|
56884
57470
|
loadDotenvSafely();
|
|
56885
57471
|
var deps = {
|
|
56886
57472
|
chatsvc: new ChatServiceClient(),
|
|
56887
57473
|
sharepoint: new SharePointClient(),
|
|
56888
|
-
substrate: new SubstrateClient()
|
|
57474
|
+
substrate: new SubstrateClient(),
|
|
57475
|
+
recap: new RecapClient()
|
|
56889
57476
|
};
|
|
56890
57477
|
await runMcp({
|
|
56891
57478
|
name: "microsoft-teams-mcp",
|
|
@@ -56907,6 +57494,7 @@ await runMcp({
|
|
|
56907
57494
|
registerSearchTools,
|
|
56908
57495
|
registerExportTools,
|
|
56909
57496
|
registerTranscriptTools,
|
|
57497
|
+
registerRecapTools,
|
|
56910
57498
|
registerHealthcheckTool
|
|
56911
57499
|
]
|
|
56912
57500
|
});
|