@aiquants/html-to-markdown 0.5.2 → 0.6.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/dist/{core-DhxxOcPm.js → core-txi0EJ9v.js} +19 -12
- package/dist/index.cjs +1 -1
- package/dist/index.js +3 -3
- package/dist/main.js +1 -1
- package/dist/{mcp-server-DOe8W9IZ.js → mcp-server-B8T7ljWL.js} +2 -2
- package/dist/{mcp-server-Dn3EHzcf.cjs → mcp-server-jjdOcY1v.cjs} +1 -1
- package/dist/{mcp-server-streamable-pcpU_lDl.js → mcp-server-streamable-Bv5fFO_D.js} +498 -330
- package/dist/mcp-server-streamable-DU6yq8ZG.cjs +1 -0
- package/dist/mcp-streamable.cjs +1 -1
- package/dist/mcp-streamable.js +1 -1
- package/dist/mcp.cjs +1 -1
- package/dist/mcp.js +1 -1
- package/dist/src/mcp-server.d.ts +18 -0
- package/dist/{version-BNwQMbri.js → version-DrEUqsN7.js} +99 -70
- package/dist/version-Jbxn3hLf.cjs +1 -0
- package/package.json +17 -13
- package/dist/mcp-server-streamable-DUB_ixZe.cjs +0 -1
- package/dist/version-BsWiDlbg.cjs +0 -1
package/dist/mcp-streamable.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
"use strict";require("./mcp-server-streamable-
|
|
2
|
+
"use strict";require("./mcp-server-streamable-DU6yq8ZG.cjs").runStreamableMcpServer().catch(e=>{process.exit(1)});
|
package/dist/mcp-streamable.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { r as runStreamableMcpServer } from "./mcp-server-streamable-
|
|
2
|
+
import { r as runStreamableMcpServer } from "./mcp-server-streamable-Bv5fFO_D.js";
|
|
3
3
|
runStreamableMcpServer().catch((error) => {
|
|
4
4
|
console.error("Failed to start streamable MCP server:", error);
|
|
5
5
|
process.exit(1);
|
package/dist/mcp.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
const e=new(require("happy-dom").Window);Object.assign(global,{document:e.document,window:e,self:e});require("./mcp-server-
|
|
2
|
+
const e=new(require("happy-dom").Window);Object.assign(global,{document:e.document,window:e,self:e});require("./mcp-server-jjdOcY1v.cjs").runMcpServer().catch(e=>{process.exit(1)});
|
package/dist/mcp.js
CHANGED
|
@@ -6,7 +6,7 @@ Object.assign(global, {
|
|
|
6
6
|
window,
|
|
7
7
|
self: window
|
|
8
8
|
});
|
|
9
|
-
import { r as runMcpServer } from "./mcp-server-
|
|
9
|
+
import { r as runMcpServer } from "./mcp-server-B8T7ljWL.js";
|
|
10
10
|
runMcpServer().catch((error) => {
|
|
11
11
|
console.error("Failed to start MCP server:", error);
|
|
12
12
|
process.exit(1);
|
package/dist/src/mcp-server.d.ts
CHANGED
|
@@ -54,6 +54,12 @@ export declare class HtmlToMarkdownMcpServer {
|
|
|
54
54
|
} | undefined;
|
|
55
55
|
mimeType?: string | undefined;
|
|
56
56
|
description?: string | undefined;
|
|
57
|
+
icons?: {
|
|
58
|
+
[x: string]: unknown;
|
|
59
|
+
src: string;
|
|
60
|
+
mimeType?: string | undefined;
|
|
61
|
+
sizes?: string[] | undefined;
|
|
62
|
+
}[] | undefined;
|
|
57
63
|
} | {
|
|
58
64
|
[x: string]: unknown;
|
|
59
65
|
type: "resource";
|
|
@@ -126,6 +132,12 @@ export declare class HtmlToMarkdownMcpServer {
|
|
|
126
132
|
} | undefined;
|
|
127
133
|
mimeType?: string | undefined;
|
|
128
134
|
description?: string | undefined;
|
|
135
|
+
icons?: {
|
|
136
|
+
[x: string]: unknown;
|
|
137
|
+
src: string;
|
|
138
|
+
mimeType?: string | undefined;
|
|
139
|
+
sizes?: string[] | undefined;
|
|
140
|
+
}[] | undefined;
|
|
129
141
|
} | {
|
|
130
142
|
[x: string]: unknown;
|
|
131
143
|
type: "resource";
|
|
@@ -198,6 +210,12 @@ export declare class HtmlToMarkdownMcpServer {
|
|
|
198
210
|
} | undefined;
|
|
199
211
|
mimeType?: string | undefined;
|
|
200
212
|
description?: string | undefined;
|
|
213
|
+
icons?: {
|
|
214
|
+
[x: string]: unknown;
|
|
215
|
+
src: string;
|
|
216
|
+
mimeType?: string | undefined;
|
|
217
|
+
sizes?: string[] | undefined;
|
|
218
|
+
}[] | undefined;
|
|
201
219
|
} | {
|
|
202
220
|
[x: string]: unknown;
|
|
203
221
|
type: "resource";
|
|
@@ -5,7 +5,7 @@ Object.assign(global, {
|
|
|
5
5
|
window,
|
|
6
6
|
self: window
|
|
7
7
|
});
|
|
8
|
-
import { b as getDefaultExportFromCjs } from "./core-
|
|
8
|
+
import { b as getDefaultExportFromCjs } from "./core-txi0EJ9v.js";
|
|
9
9
|
import { promises } from "fs";
|
|
10
10
|
import { resolve, dirname } from "path";
|
|
11
11
|
import { readFileSync } from "node:fs";
|
|
@@ -3749,12 +3749,7 @@ const optionalType = ZodOptional.create;
|
|
|
3749
3749
|
ZodNullable.create;
|
|
3750
3750
|
const LATEST_PROTOCOL_VERSION = "2025-06-18";
|
|
3751
3751
|
const DEFAULT_NEGOTIATED_PROTOCOL_VERSION = "2025-03-26";
|
|
3752
|
-
const SUPPORTED_PROTOCOL_VERSIONS = [
|
|
3753
|
-
LATEST_PROTOCOL_VERSION,
|
|
3754
|
-
"2025-03-26",
|
|
3755
|
-
"2024-11-05",
|
|
3756
|
-
"2024-10-07"
|
|
3757
|
-
];
|
|
3752
|
+
const SUPPORTED_PROTOCOL_VERSIONS = [LATEST_PROTOCOL_VERSION, "2025-03-26", "2024-11-05", "2024-10-07"];
|
|
3758
3753
|
const JSONRPC_VERSION = "2.0";
|
|
3759
3754
|
const ProgressTokenSchema = unionType([stringType(), numberType().int()]);
|
|
3760
3755
|
const CursorSchema = stringType();
|
|
@@ -3834,12 +3829,7 @@ const JSONRPCErrorSchema = objectType({
|
|
|
3834
3829
|
})
|
|
3835
3830
|
}).strict();
|
|
3836
3831
|
const isJSONRPCError = (value) => JSONRPCErrorSchema.safeParse(value).success;
|
|
3837
|
-
const JSONRPCMessageSchema = unionType([
|
|
3838
|
-
JSONRPCRequestSchema,
|
|
3839
|
-
JSONRPCNotificationSchema,
|
|
3840
|
-
JSONRPCResponseSchema,
|
|
3841
|
-
JSONRPCErrorSchema
|
|
3842
|
-
]);
|
|
3832
|
+
const JSONRPCMessageSchema = unionType([JSONRPCRequestSchema, JSONRPCNotificationSchema, JSONRPCResponseSchema, JSONRPCErrorSchema]);
|
|
3843
3833
|
const EmptyResultSchema = ResultSchema.strict();
|
|
3844
3834
|
const CancelledNotificationSchema = NotificationSchema.extend({
|
|
3845
3835
|
method: literalType("notifications/cancelled"),
|
|
@@ -3856,22 +3846,57 @@ const CancelledNotificationSchema = NotificationSchema.extend({
|
|
|
3856
3846
|
reason: stringType().optional()
|
|
3857
3847
|
})
|
|
3858
3848
|
});
|
|
3849
|
+
const IconSchema = objectType({
|
|
3850
|
+
/**
|
|
3851
|
+
* URL or data URI for the icon.
|
|
3852
|
+
*/
|
|
3853
|
+
src: stringType(),
|
|
3854
|
+
/**
|
|
3855
|
+
* Optional MIME type for the icon.
|
|
3856
|
+
*/
|
|
3857
|
+
mimeType: optionalType(stringType()),
|
|
3858
|
+
/**
|
|
3859
|
+
* Optional array of strings that specify sizes at which the icon can be used.
|
|
3860
|
+
* Each string should be in WxH format (e.g., `"48x48"`, `"96x96"`) or `"any"` for scalable formats like SVG.
|
|
3861
|
+
*
|
|
3862
|
+
* If not provided, the client should assume that the icon can be used at any size.
|
|
3863
|
+
*/
|
|
3864
|
+
sizes: optionalType(arrayType(stringType()))
|
|
3865
|
+
}).passthrough();
|
|
3866
|
+
const IconsSchema = objectType({
|
|
3867
|
+
/**
|
|
3868
|
+
* Optional set of sized icons that the client can display in a user interface.
|
|
3869
|
+
*
|
|
3870
|
+
* Clients that support rendering icons MUST support at least the following MIME types:
|
|
3871
|
+
* - `image/png` - PNG images (safe, universal compatibility)
|
|
3872
|
+
* - `image/jpeg` (and `image/jpg`) - JPEG images (safe, universal compatibility)
|
|
3873
|
+
*
|
|
3874
|
+
* Clients that support rendering icons SHOULD also support:
|
|
3875
|
+
* - `image/svg+xml` - SVG images (scalable but requires security precautions)
|
|
3876
|
+
* - `image/webp` - WebP images (modern, efficient format)
|
|
3877
|
+
*/
|
|
3878
|
+
icons: arrayType(IconSchema).optional()
|
|
3879
|
+
}).passthrough();
|
|
3859
3880
|
const BaseMetadataSchema = objectType({
|
|
3860
3881
|
/** Intended for programmatic or logical use, but used as a display name in past specs or fallback */
|
|
3861
3882
|
name: stringType(),
|
|
3862
3883
|
/**
|
|
3863
|
-
|
|
3864
|
-
|
|
3865
|
-
|
|
3866
|
-
|
|
3867
|
-
|
|
3868
|
-
|
|
3869
|
-
|
|
3884
|
+
* Intended for UI and end-user contexts — optimized to be human-readable and easily understood,
|
|
3885
|
+
* even by those unfamiliar with domain-specific terminology.
|
|
3886
|
+
*
|
|
3887
|
+
* If not provided, the name should be used for display (except for Tool,
|
|
3888
|
+
* where `annotations.title` should be given precedence over using `name`,
|
|
3889
|
+
* if present).
|
|
3890
|
+
*/
|
|
3870
3891
|
title: optionalType(stringType())
|
|
3871
3892
|
}).passthrough();
|
|
3872
3893
|
const ImplementationSchema = BaseMetadataSchema.extend({
|
|
3873
|
-
version: stringType()
|
|
3874
|
-
|
|
3894
|
+
version: stringType(),
|
|
3895
|
+
/**
|
|
3896
|
+
* An optional URL of the website for this implementation.
|
|
3897
|
+
*/
|
|
3898
|
+
websiteUrl: optionalType(stringType())
|
|
3899
|
+
}).merge(IconsSchema);
|
|
3875
3900
|
const ClientCapabilitiesSchema = objectType({
|
|
3876
3901
|
/**
|
|
3877
3902
|
* Experimental, non-standard capabilities that the client supports.
|
|
@@ -4066,7 +4091,7 @@ const ResourceSchema = BaseMetadataSchema.extend({
|
|
|
4066
4091
|
* for notes on _meta usage.
|
|
4067
4092
|
*/
|
|
4068
4093
|
_meta: optionalType(objectType({}).passthrough())
|
|
4069
|
-
});
|
|
4094
|
+
}).merge(IconsSchema);
|
|
4070
4095
|
const ResourceTemplateSchema = BaseMetadataSchema.extend({
|
|
4071
4096
|
/**
|
|
4072
4097
|
* A URI template (according to RFC 6570) that can be used to construct resource URIs.
|
|
@@ -4087,7 +4112,7 @@ const ResourceTemplateSchema = BaseMetadataSchema.extend({
|
|
|
4087
4112
|
* for notes on _meta usage.
|
|
4088
4113
|
*/
|
|
4089
4114
|
_meta: optionalType(objectType({}).passthrough())
|
|
4090
|
-
});
|
|
4115
|
+
}).merge(IconsSchema);
|
|
4091
4116
|
const ListResourcesRequestSchema = PaginatedRequestSchema.extend({
|
|
4092
4117
|
method: literalType("resources/list")
|
|
4093
4118
|
});
|
|
@@ -4170,7 +4195,7 @@ const PromptSchema = BaseMetadataSchema.extend({
|
|
|
4170
4195
|
* for notes on _meta usage.
|
|
4171
4196
|
*/
|
|
4172
4197
|
_meta: optionalType(objectType({}).passthrough())
|
|
4173
|
-
});
|
|
4198
|
+
}).merge(IconsSchema);
|
|
4174
4199
|
const ListPromptsRequestSchema = PaginatedRequestSchema.extend({
|
|
4175
4200
|
method: literalType("prompts/list")
|
|
4176
4201
|
});
|
|
@@ -4337,7 +4362,7 @@ const ToolSchema = BaseMetadataSchema.extend({
|
|
|
4337
4362
|
* for notes on _meta usage.
|
|
4338
4363
|
*/
|
|
4339
4364
|
_meta: optionalType(objectType({}).passthrough())
|
|
4340
|
-
});
|
|
4365
|
+
}).merge(IconsSchema);
|
|
4341
4366
|
const ListToolsRequestSchema = PaginatedRequestSchema.extend({
|
|
4342
4367
|
method: literalType("tools/list")
|
|
4343
4368
|
});
|
|
@@ -4387,16 +4412,7 @@ const CallToolRequestSchema = RequestSchema.extend({
|
|
|
4387
4412
|
const ToolListChangedNotificationSchema = NotificationSchema.extend({
|
|
4388
4413
|
method: literalType("notifications/tools/list_changed")
|
|
4389
4414
|
});
|
|
4390
|
-
const LoggingLevelSchema = enumType([
|
|
4391
|
-
"debug",
|
|
4392
|
-
"info",
|
|
4393
|
-
"notice",
|
|
4394
|
-
"warning",
|
|
4395
|
-
"error",
|
|
4396
|
-
"critical",
|
|
4397
|
-
"alert",
|
|
4398
|
-
"emergency"
|
|
4399
|
-
]);
|
|
4415
|
+
const LoggingLevelSchema = enumType(["debug", "info", "notice", "warning", "error", "critical", "alert", "emergency"]);
|
|
4400
4416
|
const SetLevelRequestSchema = RequestSchema.extend({
|
|
4401
4417
|
method: literalType("logging/setLevel"),
|
|
4402
4418
|
params: BaseRequestParamsSchema.extend({
|
|
@@ -4489,11 +4505,7 @@ const CreateMessageResultSchema = ResultSchema.extend({
|
|
|
4489
4505
|
*/
|
|
4490
4506
|
stopReason: optionalType(enumType(["endTurn", "stopSequence", "maxTokens"]).or(stringType())),
|
|
4491
4507
|
role: enumType(["user", "assistant"]),
|
|
4492
|
-
content: discriminatedUnionType("type", [
|
|
4493
|
-
TextContentSchema,
|
|
4494
|
-
ImageContentSchema,
|
|
4495
|
-
AudioContentSchema
|
|
4496
|
-
])
|
|
4508
|
+
content: discriminatedUnionType("type", [TextContentSchema, ImageContentSchema, AudioContentSchema])
|
|
4497
4509
|
});
|
|
4498
4510
|
const BooleanSchemaSchema = objectType({
|
|
4499
4511
|
type: literalType("boolean"),
|
|
@@ -4523,12 +4535,7 @@ const EnumSchemaSchema = objectType({
|
|
|
4523
4535
|
enum: arrayType(stringType()),
|
|
4524
4536
|
enumNames: optionalType(arrayType(stringType()))
|
|
4525
4537
|
}).passthrough();
|
|
4526
|
-
const PrimitiveSchemaDefinitionSchema = unionType([
|
|
4527
|
-
BooleanSchemaSchema,
|
|
4528
|
-
StringSchemaSchema,
|
|
4529
|
-
NumberSchemaSchema,
|
|
4530
|
-
EnumSchemaSchema
|
|
4531
|
-
]);
|
|
4538
|
+
const PrimitiveSchemaDefinitionSchema = unionType([BooleanSchemaSchema, StringSchemaSchema, NumberSchemaSchema, EnumSchemaSchema]);
|
|
4532
4539
|
const ElicitRequestSchema = RequestSchema.extend({
|
|
4533
4540
|
method: literalType("elicitation/create"),
|
|
4534
4541
|
params: BaseRequestParamsSchema.extend({
|
|
@@ -4656,18 +4663,8 @@ unionType([
|
|
|
4656
4663
|
InitializedNotificationSchema,
|
|
4657
4664
|
RootsListChangedNotificationSchema
|
|
4658
4665
|
]);
|
|
4659
|
-
unionType([
|
|
4660
|
-
|
|
4661
|
-
CreateMessageResultSchema,
|
|
4662
|
-
ElicitResultSchema,
|
|
4663
|
-
ListRootsResultSchema
|
|
4664
|
-
]);
|
|
4665
|
-
unionType([
|
|
4666
|
-
PingRequestSchema,
|
|
4667
|
-
CreateMessageRequestSchema,
|
|
4668
|
-
ElicitRequestSchema,
|
|
4669
|
-
ListRootsRequestSchema
|
|
4670
|
-
]);
|
|
4666
|
+
unionType([EmptyResultSchema, CreateMessageResultSchema, ElicitResultSchema, ListRootsResultSchema]);
|
|
4667
|
+
unionType([PingRequestSchema, CreateMessageRequestSchema, ElicitRequestSchema, ListRootsRequestSchema]);
|
|
4671
4668
|
unionType([
|
|
4672
4669
|
CancelledNotificationSchema,
|
|
4673
4670
|
ProgressNotificationSchema,
|
|
@@ -4739,7 +4736,10 @@ class Protocol {
|
|
|
4739
4736
|
const totalElapsed = Date.now() - info.startTime;
|
|
4740
4737
|
if (info.maxTotalTimeout && totalElapsed >= info.maxTotalTimeout) {
|
|
4741
4738
|
this._timeoutInfo.delete(messageId);
|
|
4742
|
-
throw new McpError(ErrorCode.RequestTimeout, "Maximum total timeout exceeded", {
|
|
4739
|
+
throw new McpError(ErrorCode.RequestTimeout, "Maximum total timeout exceeded", {
|
|
4740
|
+
maxTotalTimeout: info.maxTotalTimeout,
|
|
4741
|
+
totalElapsed
|
|
4742
|
+
});
|
|
4743
4743
|
}
|
|
4744
4744
|
clearTimeout(info.timeoutId);
|
|
4745
4745
|
info.timeoutId = setTimeout(info.onTimeout, info.timeout);
|
|
@@ -5083,7 +5083,7 @@ function requireUri_all() {
|
|
|
5083
5083
|
(function(module, exports) {
|
|
5084
5084
|
(function(global2, factory) {
|
|
5085
5085
|
factory(exports);
|
|
5086
|
-
})(uri_all, function(exports2) {
|
|
5086
|
+
})(uri_all, (function(exports2) {
|
|
5087
5087
|
function merge() {
|
|
5088
5088
|
for (var _len = arguments.length, sets = Array(_len), _key = 0; _key < _len; _key++) {
|
|
5089
5089
|
sets[_key] = arguments[_key];
|
|
@@ -5150,7 +5150,7 @@ function requireUri_all() {
|
|
|
5150
5150
|
}
|
|
5151
5151
|
var URI_PROTOCOL = buildExps(false);
|
|
5152
5152
|
var IRI_PROTOCOL = buildExps(true);
|
|
5153
|
-
var slicedToArray = /* @__PURE__ */ function() {
|
|
5153
|
+
var slicedToArray = /* @__PURE__ */ (function() {
|
|
5154
5154
|
function sliceIterator(arr, i) {
|
|
5155
5155
|
var _arr = [];
|
|
5156
5156
|
var _n = true;
|
|
@@ -5182,7 +5182,7 @@ function requireUri_all() {
|
|
|
5182
5182
|
throw new TypeError("Invalid attempt to destructure non-iterable instance");
|
|
5183
5183
|
}
|
|
5184
5184
|
};
|
|
5185
|
-
}();
|
|
5185
|
+
})();
|
|
5186
5186
|
var toConsumableArray = function(arr) {
|
|
5187
5187
|
if (Array.isArray(arr)) {
|
|
5188
5188
|
for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i];
|
|
@@ -6097,7 +6097,7 @@ function requireUri_all() {
|
|
|
6097
6097
|
exports2.escapeComponent = escapeComponent;
|
|
6098
6098
|
exports2.unescapeComponent = unescapeComponent;
|
|
6099
6099
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
6100
|
-
});
|
|
6100
|
+
}));
|
|
6101
6101
|
})(uri_all$1, uri_all$1.exports);
|
|
6102
6102
|
return uri_all$1.exports;
|
|
6103
6103
|
}
|
|
@@ -6691,7 +6691,7 @@ function requireFastJsonStableStringify() {
|
|
|
6691
6691
|
if (!opts) opts = {};
|
|
6692
6692
|
if (typeof opts === "function") opts = { cmp: opts };
|
|
6693
6693
|
var cycles = typeof opts.cycles === "boolean" ? opts.cycles : false;
|
|
6694
|
-
var cmp = opts.cmp && /* @__PURE__ */ function(f) {
|
|
6694
|
+
var cmp = opts.cmp && /* @__PURE__ */ (function(f) {
|
|
6695
6695
|
return function(node) {
|
|
6696
6696
|
return function(a, b) {
|
|
6697
6697
|
var aobj = { key: a, value: node[a] };
|
|
@@ -6699,9 +6699,9 @@ function requireFastJsonStableStringify() {
|
|
|
6699
6699
|
return f(aobj, bobj);
|
|
6700
6700
|
};
|
|
6701
6701
|
};
|
|
6702
|
-
}(opts.cmp);
|
|
6702
|
+
})(opts.cmp);
|
|
6703
6703
|
var seen = [];
|
|
6704
|
-
return function stringify(node) {
|
|
6704
|
+
return (function stringify(node) {
|
|
6705
6705
|
if (node && node.toJSON && typeof node.toJSON === "function") {
|
|
6706
6706
|
node = node.toJSON();
|
|
6707
6707
|
}
|
|
@@ -6734,7 +6734,7 @@ function requireFastJsonStableStringify() {
|
|
|
6734
6734
|
}
|
|
6735
6735
|
seen.splice(seenIndex, 1);
|
|
6736
6736
|
return "{" + out + "}";
|
|
6737
|
-
}(data2);
|
|
6737
|
+
})(data2);
|
|
6738
6738
|
};
|
|
6739
6739
|
return fastJsonStableStringify;
|
|
6740
6740
|
}
|
|
@@ -11119,6 +11119,12 @@ class Server extends Protocol {
|
|
|
11119
11119
|
var _a;
|
|
11120
11120
|
super(options);
|
|
11121
11121
|
this._serverInfo = _serverInfo;
|
|
11122
|
+
this._loggingLevels = /* @__PURE__ */ new Map();
|
|
11123
|
+
this.LOG_LEVEL_SEVERITY = new Map(LoggingLevelSchema.options.map((level, index) => [level, index]));
|
|
11124
|
+
this.isMessageIgnored = (level, sessionId) => {
|
|
11125
|
+
const currentLevel = this._loggingLevels.get(sessionId);
|
|
11126
|
+
return currentLevel ? this.LOG_LEVEL_SEVERITY.get(level) < this.LOG_LEVEL_SEVERITY.get(currentLevel) : false;
|
|
11127
|
+
};
|
|
11122
11128
|
this._capabilities = (_a = options === null || options === void 0 ? void 0 : options.capabilities) !== null && _a !== void 0 ? _a : {};
|
|
11123
11129
|
this._instructions = options === null || options === void 0 ? void 0 : options.instructions;
|
|
11124
11130
|
this.setRequestHandler(InitializeRequestSchema, (request) => this._oninitialize(request));
|
|
@@ -11126,6 +11132,18 @@ class Server extends Protocol {
|
|
|
11126
11132
|
var _a2;
|
|
11127
11133
|
return (_a2 = this.oninitialized) === null || _a2 === void 0 ? void 0 : _a2.call(this);
|
|
11128
11134
|
});
|
|
11135
|
+
if (this._capabilities.logging) {
|
|
11136
|
+
this.setRequestHandler(SetLevelRequestSchema, async (request, extra) => {
|
|
11137
|
+
var _a2;
|
|
11138
|
+
const transportSessionId = extra.sessionId || ((_a2 = extra.requestInfo) === null || _a2 === void 0 ? void 0 : _a2.headers["mcp-session-id"]) || void 0;
|
|
11139
|
+
const { level } = request.params;
|
|
11140
|
+
const parseResult = LoggingLevelSchema.safeParse(level);
|
|
11141
|
+
if (parseResult.success) {
|
|
11142
|
+
this._loggingLevels.set(transportSessionId, parseResult.data);
|
|
11143
|
+
}
|
|
11144
|
+
return {};
|
|
11145
|
+
});
|
|
11146
|
+
}
|
|
11129
11147
|
}
|
|
11130
11148
|
/**
|
|
11131
11149
|
* Registers new capabilities. This can only be called before connecting to a transport.
|
|
@@ -11271,8 +11289,19 @@ class Server extends Protocol {
|
|
|
11271
11289
|
async listRoots(params, options) {
|
|
11272
11290
|
return this.request({ method: "roots/list", params }, ListRootsResultSchema, options);
|
|
11273
11291
|
}
|
|
11274
|
-
|
|
11275
|
-
|
|
11292
|
+
/**
|
|
11293
|
+
* Sends a logging message to the client, if connected.
|
|
11294
|
+
* Note: You only need to send the parameters object, not the entire JSON RPC message
|
|
11295
|
+
* @see LoggingMessageNotification
|
|
11296
|
+
* @param params
|
|
11297
|
+
* @param sessionId optional for stateless and backward compatibility
|
|
11298
|
+
*/
|
|
11299
|
+
async sendLoggingMessage(params, sessionId) {
|
|
11300
|
+
if (this._capabilities.logging) {
|
|
11301
|
+
if (!this.isMessageIgnored(params.level, sessionId)) {
|
|
11302
|
+
return this.notification({ method: "notifications/message", params });
|
|
11303
|
+
}
|
|
11304
|
+
}
|
|
11276
11305
|
}
|
|
11277
11306
|
async sendResourceUpdated(params) {
|
|
11278
11307
|
return this.notification({
|