@codebolt/codeboltjs 1.1.94 → 1.1.96

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.
@@ -9,9 +9,15 @@ import { StrictEventEmitter } from "strict-event-emitter-types";
9
9
  import { EventEmitter } from "events";
10
10
  import { Transport } from "@modelcontextprotocol/sdk/shared/transport.js";
11
11
  import http from "http";
12
+ /**
13
+ * Type definition for SSE Server that can be closed.
14
+ */
12
15
  export type SSEServer = {
13
16
  close: () => Promise<void>;
14
17
  };
18
+ /**
19
+ * Event types for the FastMCP event emitter.
20
+ */
15
21
  type FastMCPEvents<T extends FastMCPSessionAuth> = {
16
22
  connect: (event: {
17
23
  session: FastMCPSession<T>;
@@ -20,6 +26,9 @@ type FastMCPEvents<T extends FastMCPSessionAuth> = {
20
26
  session: FastMCPSession<T>;
21
27
  }) => void;
22
28
  };
29
+ /**
30
+ * Event types for FastMCPSession event emitter.
31
+ */
23
32
  type FastMCPSessionEvents = {
24
33
  rootsChanged: (event: {
25
34
  roots: Root[];
@@ -30,6 +39,9 @@ type FastMCPSessionEvents = {
30
39
  };
31
40
  /**
32
41
  * Generates an image content object from a URL, file path, or buffer.
42
+ *
43
+ * @param input - The input source for the image (URL, file path, or buffer)
44
+ * @returns Promise with the image content object
33
45
  */
34
46
  export declare const imageContent: (input: {
35
47
  url: string;
@@ -38,25 +50,56 @@ export declare const imageContent: (input: {
38
50
  } | {
39
51
  buffer: Buffer;
40
52
  }) => Promise<ImageContent>;
53
+ /**
54
+ * Base class for FastMCP errors.
55
+ */
41
56
  declare abstract class FastMCPError extends Error {
42
57
  constructor(message?: string);
43
58
  }
59
+ /**
60
+ * Type for extra data in errors.
61
+ */
44
62
  type Extra = unknown;
63
+ /**
64
+ * Type for a record of extra data.
65
+ */
45
66
  type Extras = Record<string, Extra>;
67
+ /**
68
+ * Error class for unexpected state conditions.
69
+ */
46
70
  export declare class UnexpectedStateError extends FastMCPError {
71
+ /** Additional context for the error */
47
72
  extras?: Extras;
73
+ /**
74
+ * Creates a new UnexpectedStateError.
75
+ *
76
+ * @param message - Error message
77
+ * @param extras - Additional context for the error
78
+ */
48
79
  constructor(message: string, extras?: Extras);
49
80
  }
50
81
  /**
51
- * An error that is meant to be surfaced to the user.
82
+ * Error that is meant to be surfaced to the user.
52
83
  */
53
84
  export declare class UserError extends UnexpectedStateError {
54
85
  }
86
+ /**
87
+ * Type for tool parameters schema.
88
+ */
55
89
  type ToolParameters = z.ZodTypeAny;
90
+ /**
91
+ * Type for literal values.
92
+ */
56
93
  type Literal = boolean | null | number | string | undefined;
94
+ /**
95
+ * Type for serializable values that can be passed around.
96
+ */
57
97
  type SerializableValue = Literal | SerializableValue[] | {
58
98
  [key: string]: SerializableValue;
59
99
  };
100
+ /**
101
+ * Type for reporting progress of operations.
102
+ */
60
103
  type Progress = {
61
104
  /**
62
105
  * The progress thus far. This should increase every time progress is made, even if the total is unknown.
@@ -67,9 +110,15 @@ type Progress = {
67
110
  */
68
111
  total?: number;
69
112
  };
113
+ /**
114
+ * Context object passed to tool execution functions.
115
+ */
70
116
  type Context<T extends FastMCPSessionAuth> = {
117
+ /** The session authentication context */
71
118
  session: T | undefined;
119
+ /** Function to report progress of operations */
72
120
  reportProgress: (progress: Progress) => Promise<void>;
121
+ /** Logging functions */
73
122
  log: {
74
123
  debug: (message: string, data?: SerializableValue) => void;
75
124
  error: (message: string, data?: SerializableValue) => void;
@@ -77,75 +126,151 @@ type Context<T extends FastMCPSessionAuth> = {
77
126
  warn: (message: string, data?: SerializableValue) => void;
78
127
  };
79
128
  };
129
+ /**
130
+ * Type for text content in messages.
131
+ */
80
132
  type TextContent = {
133
+ /** Always "text" for text content */
81
134
  type: "text";
135
+ /** The text content */
82
136
  text: string;
83
137
  };
138
+ /**
139
+ * Type for image content in messages.
140
+ */
84
141
  type ImageContent = {
142
+ /** Always "image" for image content */
85
143
  type: "image";
144
+ /** Base64-encoded image data */
86
145
  data: string;
146
+ /** The MIME type of the image */
87
147
  mimeType: string;
88
148
  };
149
+ /**
150
+ * Union type for content in messages.
151
+ */
89
152
  type Content = TextContent | ImageContent;
153
+ /**
154
+ * Type for content results from tool executions.
155
+ */
90
156
  type ContentResult = {
157
+ /** Array of content blocks */
91
158
  content: Content[];
159
+ /** Whether this result represents an error */
92
160
  isError?: boolean;
93
161
  };
162
+ /**
163
+ * Type for completion results.
164
+ */
94
165
  type Completion = {
166
+ /** Array of completion values */
95
167
  values: string[];
168
+ /** The total number of completions available */
96
169
  total?: number;
170
+ /** Whether there are more completions available */
97
171
  hasMore?: boolean;
98
172
  };
173
+ /**
174
+ * Type for a tool that can be executed.
175
+ */
99
176
  type Tool<T extends FastMCPSessionAuth, Params extends ToolParameters = ToolParameters> = {
177
+ /** Name of the tool */
100
178
  name: string;
179
+ /** Optional description of the tool's functionality */
101
180
  description?: string;
181
+ /** Optional parameters schema for the tool */
102
182
  parameters?: Params;
183
+ /** Function to execute the tool */
103
184
  execute: (args: z.infer<Params>, context: Context<T>) => Promise<string | ContentResult | TextContent | ImageContent>;
104
185
  };
186
+ /**
187
+ * Type for resource results.
188
+ */
105
189
  type ResourceResult = {
106
190
  text: string;
107
191
  } | {
108
192
  blob: string;
109
193
  };
194
+ /**
195
+ * Type for input resource template arguments.
196
+ */
110
197
  type InputResourceTemplateArgument = Readonly<{
111
198
  name: string;
112
199
  description?: string;
113
200
  complete?: ArgumentValueCompleter;
114
201
  }>;
202
+ /**
203
+ * Type for resource template arguments.
204
+ */
115
205
  type ResourceTemplateArgument = Readonly<{
116
206
  name: string;
117
207
  description?: string;
118
208
  complete?: ArgumentValueCompleter;
119
209
  }>;
210
+ /**
211
+ * Type transformation from argument array to object.
212
+ */
120
213
  type ResourceTemplateArgumentsToObject<T extends {
121
214
  name: string;
122
215
  }[]> = {
123
216
  [K in T[number]["name"]]: string;
124
217
  };
218
+ /**
219
+ * Type for input resource templates.
220
+ */
125
221
  type InputResourceTemplate<Arguments extends ResourceTemplateArgument[] = ResourceTemplateArgument[]> = {
222
+ /** URI template for the resource */
126
223
  uriTemplate: string;
224
+ /** Name of the template */
127
225
  name: string;
226
+ /** Optional description */
128
227
  description?: string;
228
+ /** Optional MIME type */
129
229
  mimeType?: string;
230
+ /** Arguments for the template */
130
231
  arguments: Arguments;
232
+ /** Function to load the resource */
131
233
  load: (args: ResourceTemplateArgumentsToObject<Arguments>) => Promise<ResourceResult>;
132
234
  };
235
+ /**
236
+ * Type for a resource.
237
+ */
133
238
  type Resource = {
239
+ /** URI of the resource */
134
240
  uri: string;
241
+ /** Name of the resource */
135
242
  name: string;
243
+ /** Optional description */
136
244
  description?: string;
245
+ /** Optional MIME type */
137
246
  mimeType?: string;
247
+ /** Function to load the resource */
138
248
  load: () => Promise<ResourceResult | ResourceResult[]>;
249
+ /** Optional completion function */
139
250
  complete?: (name: string, value: string) => Promise<Completion>;
140
251
  };
252
+ /**
253
+ * Type for argument value completion.
254
+ */
141
255
  type ArgumentValueCompleter = (value: string) => Promise<Completion>;
256
+ /**
257
+ * Type for input prompt arguments.
258
+ */
142
259
  type InputPromptArgument = Readonly<{
260
+ /** Name of the argument */
143
261
  name: string;
262
+ /** Optional description */
144
263
  description?: string;
264
+ /** Whether the argument is required */
145
265
  required?: boolean;
266
+ /** Optional completion function */
146
267
  complete?: ArgumentValueCompleter;
268
+ /** Optional enum of possible values */
147
269
  enum?: string[];
148
270
  }>;
271
+ /**
272
+ * Type transformation from prompt arguments to object.
273
+ */
149
274
  type PromptArgumentsToObject<T extends {
150
275
  name: string;
151
276
  required?: boolean;
@@ -154,46 +279,97 @@ type PromptArgumentsToObject<T extends {
154
279
  name: K;
155
280
  }>["required"] extends true ? string : string | undefined;
156
281
  };
282
+ /**
283
+ * Type for input prompts.
284
+ */
157
285
  type InputPrompt<Arguments extends InputPromptArgument[] = InputPromptArgument[], Args = PromptArgumentsToObject<Arguments>> = {
286
+ /** Name of the prompt */
158
287
  name: string;
288
+ /** Optional description */
159
289
  description?: string;
290
+ /** Optional arguments */
160
291
  arguments?: InputPromptArgument[];
292
+ /** Function to load the prompt */
161
293
  load: (args: Args) => Promise<string>;
162
294
  };
295
+ /**
296
+ * Type for prompt arguments.
297
+ */
163
298
  type PromptArgument = Readonly<{
299
+ /** Name of the argument */
164
300
  name: string;
301
+ /** Optional description */
165
302
  description?: string;
303
+ /** Whether the argument is required */
166
304
  required?: boolean;
305
+ /** Optional completion function */
167
306
  complete?: ArgumentValueCompleter;
307
+ /** Optional enum of possible values */
168
308
  enum?: string[];
169
309
  }>;
310
+ /**
311
+ * Type for prompts.
312
+ */
170
313
  type Prompt<Arguments extends PromptArgument[] = PromptArgument[], Args = PromptArgumentsToObject<Arguments>> = {
314
+ /** Optional arguments */
171
315
  arguments?: PromptArgument[];
316
+ /** Optional completion function */
172
317
  complete?: (name: string, value: string) => Promise<Completion>;
318
+ /** Optional description */
173
319
  description?: string;
320
+ /** Function to load the prompt */
174
321
  load: (args: Args) => Promise<string>;
322
+ /** Name of the prompt */
175
323
  name: string;
176
324
  };
325
+ /**
326
+ * Type for server options.
327
+ */
177
328
  type ServerOptions<T extends FastMCPSessionAuth> = {
329
+ /** Name of the server */
178
330
  name: string;
331
+ /** Version of the server */
179
332
  version: `${number}.${number}.${number}`;
333
+ /** Optional authentication function */
180
334
  authenticate?: Authenticate<T>;
181
335
  };
336
+ /**
337
+ * Type for logging levels.
338
+ */
182
339
  type LoggingLevel = "debug" | "info" | "notice" | "warning" | "error" | "critical" | "alert" | "emergency";
183
340
  declare const FastMCPSessionEventEmitterBase: {
184
341
  new (): StrictEventEmitter<EventEmitter, FastMCPSessionEvents>;
185
342
  };
186
343
  declare class FastMCPSessionEventEmitter extends FastMCPSessionEventEmitterBase {
187
344
  }
345
+ /**
346
+ * Type for sampling responses.
347
+ */
188
348
  type SamplingResponse = {
349
+ /** The model used */
189
350
  model: string;
351
+ /** Optional reason for stopping */
190
352
  stopReason?: "endTurn" | "stopSequence" | "maxTokens" | string;
353
+ /** Role of the message */
191
354
  role: "user" | "assistant";
355
+ /** Content of the message */
192
356
  content: TextContent | ImageContent;
193
357
  };
358
+ /**
359
+ * Type for session authentication.
360
+ */
194
361
  type FastMCPSessionAuth = Record<string, unknown> | undefined;
362
+ /**
363
+ * Class representing a FastMCP session.
364
+ * Manages communication between the client and server.
365
+ */
195
366
  export declare class FastMCPSession<T extends FastMCPSessionAuth = FastMCPSessionAuth> extends FastMCPSessionEventEmitter {
196
367
  #private;
368
+ /**
369
+ * Creates a new FastMCPSession.
370
+ *
371
+ * @param options - Configuration options for the session
372
+ */
197
373
  constructor({ auth, name, version, tools, resources, resourcesTemplates, prompts, }: {
198
374
  auth?: T;
199
375
  name: string;
@@ -228,29 +404,51 @@ declare const FastMCPEventEmitterBase: {
228
404
  declare class FastMCPEventEmitter extends FastMCPEventEmitterBase {
229
405
  }
230
406
  type Authenticate<T> = (request: http.IncomingMessage) => Promise<T>;
407
+ /**
408
+ * Class representing a toolbox for FastMCP.
409
+ * Manages tools, resources, and prompts for a Model Context Protocol server.
410
+ */
231
411
  export declare class ToolBox<T extends Record<string, unknown> | undefined = undefined> extends FastMCPEventEmitter {
232
412
  #private;
233
413
  options: ServerOptions<T>;
414
+ /**
415
+ * Creates a new ToolBox instance.
416
+ *
417
+ * @param options - Configuration options for the toolbox
418
+ */
234
419
  constructor(options: ServerOptions<T>);
420
+ /**
421
+ * Gets all active sessions.
422
+ */
235
423
  get sessions(): FastMCPSession<T>[];
236
424
  /**
237
425
  * Adds a tool to the server.
426
+ *
427
+ * @param tool - The tool to add
238
428
  */
239
429
  addTool<Params extends ToolParameters>(tool: Tool<T, Params>): void;
240
430
  /**
241
431
  * Adds a resource to the server.
432
+ *
433
+ * @param resource - The resource to add
242
434
  */
243
435
  addResource(resource: Resource): void;
244
436
  /**
245
437
  * Adds a resource template to the server.
438
+ *
439
+ * @param resource - The resource template to add
246
440
  */
247
441
  addResourceTemplate<const Args extends InputResourceTemplateArgument[]>(resource: InputResourceTemplate<Args>): void;
248
442
  /**
249
443
  * Adds a prompt to the server.
444
+ *
445
+ * @param prompt - The prompt to add
250
446
  */
251
447
  addPrompt<const Args extends InputPromptArgument[]>(prompt: InputPrompt<Args>): void;
252
448
  /**
253
449
  * Starts the server.
450
+ *
451
+ * @param options - Options for the server transport
254
452
  */
255
453
  start(options?: {
256
454
  transportType: "stdio";
@@ -266,7 +464,9 @@ export declare class ToolBox<T extends Record<string, unknown> | undefined = und
266
464
  */
267
465
  stop(): Promise<void>;
268
466
  /**
269
- * Starts the server.
467
+ * Activates the server.
468
+ *
469
+ * @param options - Options for the server transport
270
470
  */
271
471
  activate(options?: {
272
472
  transportType: "stdio";
@@ -30,6 +30,9 @@ const undici_1 = require("undici");
30
30
  const load_esm_1 = require("load-esm");
31
31
  /**
32
32
  * Generates an image content object from a URL, file path, or buffer.
33
+ *
34
+ * @param input - The input source for the image (URL, file path, or buffer)
35
+ * @returns Promise with the image content object
33
36
  */
34
37
  const imageContent = async (input) => {
35
38
  var _a;
@@ -52,7 +55,6 @@ const imageContent = async (input) => {
52
55
  }
53
56
  const { fileTypeFromBuffer } = await (0, load_esm_1.loadEsm)('file-type');
54
57
  const mimeType = await fileTypeFromBuffer(rawData);
55
- console.log(mimeType);
56
58
  const base64Data = rawData.toString("base64");
57
59
  return {
58
60
  type: "image",
@@ -61,13 +63,25 @@ const imageContent = async (input) => {
61
63
  };
62
64
  };
63
65
  exports.imageContent = imageContent;
66
+ /**
67
+ * Base class for FastMCP errors.
68
+ */
64
69
  class FastMCPError extends Error {
65
70
  constructor(message) {
66
71
  super(message);
67
72
  this.name = new.target.name;
68
73
  }
69
74
  }
75
+ /**
76
+ * Error class for unexpected state conditions.
77
+ */
70
78
  class UnexpectedStateError extends FastMCPError {
79
+ /**
80
+ * Creates a new UnexpectedStateError.
81
+ *
82
+ * @param message - Error message
83
+ * @param extras - Additional context for the error
84
+ */
71
85
  constructor(message, extras) {
72
86
  super(message);
73
87
  this.name = new.target.name;
@@ -76,7 +90,7 @@ class UnexpectedStateError extends FastMCPError {
76
90
  }
77
91
  exports.UnexpectedStateError = UnexpectedStateError;
78
92
  /**
79
- * An error that is meant to be surfaced to the user.
93
+ * Error that is meant to be surfaced to the user.
80
94
  */
81
95
  class UserError extends UnexpectedStateError {
82
96
  }
@@ -114,6 +128,7 @@ const ContentResultZodSchema = zod_1.z
114
128
  })
115
129
  .strict();
116
130
  /**
131
+ * Schema for completion results.
117
132
  * https://github.com/modelcontextprotocol/typescript-sdk/blob/3164da64d085ec4e022ae881329eee7b72f208d4/src/types.ts#L983-L1003
118
133
  */
119
134
  const CompletionZodSchema = zod_1.z.object({
@@ -133,7 +148,16 @@ const CompletionZodSchema = zod_1.z.object({
133
148
  const FastMCPSessionEventEmitterBase = events_1.EventEmitter;
134
149
  class FastMCPSessionEventEmitter extends FastMCPSessionEventEmitterBase {
135
150
  }
151
+ /**
152
+ * Class representing a FastMCP session.
153
+ * Manages communication between the client and server.
154
+ */
136
155
  class FastMCPSession extends FastMCPSessionEventEmitter {
156
+ /**
157
+ * Creates a new FastMCPSession.
158
+ *
159
+ * @param options - Configuration options for the session
160
+ */
137
161
  constructor({ auth, name, version, tools, resources, resourcesTemplates, prompts, }) {
138
162
  super();
139
163
  _FastMCPSession_capabilities.set(this, {});
@@ -262,7 +286,6 @@ class FastMCPSession extends FastMCPSessionEventEmitter {
262
286
  let attempt = 0;
263
287
  while (attempt++ < 10) {
264
288
  const capabilities = await __classPrivateFieldGet(this, _FastMCPSession_server, "f").getClientCapabilities();
265
- console.log("capabilities", capabilities);
266
289
  if (capabilities) {
267
290
  __classPrivateFieldSet(this, _FastMCPSession_clientCapabilities, capabilities, "f");
268
291
  break;
@@ -270,7 +293,7 @@ class FastMCPSession extends FastMCPSessionEventEmitter {
270
293
  await (0, promises_1.setTimeout)(100);
271
294
  }
272
295
  if (!__classPrivateFieldGet(this, _FastMCPSession_clientCapabilities, "f")) {
273
- console.warn('[warning] toolBox could not infer client capabilities');
296
+ // console.warn('[warning] toolBox could not infer client capabilities')
274
297
  }
275
298
  if ((_a = __classPrivateFieldGet(this, _FastMCPSession_clientCapabilities, "f")) === null || _a === void 0 ? void 0 : _a.roots) {
276
299
  const roots = await __classPrivateFieldGet(this, _FastMCPSession_server, "f").listRoots();
@@ -619,7 +642,16 @@ _FastMCPSession_capabilities = new WeakMap(), _FastMCPSession_clientCapabilities
619
642
  const FastMCPEventEmitterBase = events_1.EventEmitter;
620
643
  class FastMCPEventEmitter extends FastMCPEventEmitterBase {
621
644
  }
645
+ /**
646
+ * Class representing a toolbox for FastMCP.
647
+ * Manages tools, resources, and prompts for a Model Context Protocol server.
648
+ */
622
649
  class ToolBox extends FastMCPEventEmitter {
650
+ /**
651
+ * Creates a new ToolBox instance.
652
+ *
653
+ * @param options - Configuration options for the toolbox
654
+ */
623
655
  constructor(options) {
624
656
  super();
625
657
  this.options = options;
@@ -634,35 +666,48 @@ class ToolBox extends FastMCPEventEmitter {
634
666
  __classPrivateFieldSet(this, _ToolBox_options, options, "f");
635
667
  __classPrivateFieldSet(this, _ToolBox_authenticate, options.authenticate, "f");
636
668
  }
669
+ /**
670
+ * Gets all active sessions.
671
+ */
637
672
  get sessions() {
638
673
  return __classPrivateFieldGet(this, _ToolBox_sessions, "f");
639
674
  }
640
675
  /**
641
676
  * Adds a tool to the server.
677
+ *
678
+ * @param tool - The tool to add
642
679
  */
643
680
  addTool(tool) {
644
681
  __classPrivateFieldGet(this, _ToolBox_tools, "f").push(tool);
645
682
  }
646
683
  /**
647
684
  * Adds a resource to the server.
685
+ *
686
+ * @param resource - The resource to add
648
687
  */
649
688
  addResource(resource) {
650
689
  __classPrivateFieldGet(this, _ToolBox_resources, "f").push(resource);
651
690
  }
652
691
  /**
653
692
  * Adds a resource template to the server.
693
+ *
694
+ * @param resource - The resource template to add
654
695
  */
655
696
  addResourceTemplate(resource) {
656
697
  __classPrivateFieldGet(this, _ToolBox_resourcesTemplates, "f").push(resource);
657
698
  }
658
699
  /**
659
700
  * Adds a prompt to the server.
701
+ *
702
+ * @param prompt - The prompt to add
660
703
  */
661
704
  addPrompt(prompt) {
662
705
  __classPrivateFieldGet(this, _ToolBox_prompts, "f").push(prompt);
663
706
  }
664
707
  /**
665
708
  * Starts the server.
709
+ *
710
+ * @param options - Options for the server transport
666
711
  */
667
712
  async start(options = {
668
713
  transportType: "stdio",
@@ -698,14 +743,15 @@ class ToolBox extends FastMCPEventEmitter {
698
743
  }
699
744
  }
700
745
  /**
701
- * Starts the server.
746
+ * Activates the server.
747
+ *
748
+ * @param options - Options for the server transport
702
749
  */
703
750
  async activate(options = {
704
751
  transportType: "stdio",
705
752
  }) {
706
753
  if (options.transportType === "stdio") {
707
754
  const transport = new stdio_js_1.StdioServerTransport();
708
- // console.log("tools", this.#tools);
709
755
  const session = new FastMCPSession({
710
756
  name: __classPrivateFieldGet(this, _ToolBox_options, "f").name,
711
757
  version: __classPrivateFieldGet(this, _ToolBox_options, "f").version,
@@ -714,7 +760,6 @@ class ToolBox extends FastMCPEventEmitter {
714
760
  resourcesTemplates: __classPrivateFieldGet(this, _ToolBox_resourcesTemplates, "f"),
715
761
  prompts: __classPrivateFieldGet(this, _ToolBox_prompts, "f"),
716
762
  });
717
- // console.log("session", session);
718
763
  await session.connect(transport);
719
764
  __classPrivateFieldGet(this, _ToolBox_sessions, "f").push(session);
720
765
  this.emit("connect", {
@@ -723,34 +768,7 @@ class ToolBox extends FastMCPEventEmitter {
723
768
  console.info(`server is running on stdio`);
724
769
  }
725
770
  else if (options.transportType === "sse") {
726
- // this.#sseServer = await startSSEServer<FastMCPSession>({
727
- // endpoint: options.sse.endpoint as `/${string}`,
728
- // port: options.sse.port,
729
- // createServer: async () => {
730
- // return new FastMCPSession({
731
- // name: this.#options.name,
732
- // version: this.#options.version,
733
- // tools: this.#tools,
734
- // resources: this.#resources,
735
- // resourcesTemplates: this.#resourcesTemplates,
736
- // prompts: this.#prompts,
737
- // });
738
- // },
739
- // onClose: (session) => {
740
- // this.emit("disconnect", {
741
- // session,
742
- // });
743
- // },
744
- // onConnect: async (session) => {
745
- // this.#sessions.push(session);
746
- // this.emit("connect", {
747
- // session,
748
- // });
749
- // },
750
- // });
751
- // console.error(
752
- // `server is running on SSE at http://localhost:${options.sse.port}${options.sse.endpoint}`,
753
- // );
771
+ // Implementation for SSE transport
754
772
  }
755
773
  else {
756
774
  throw new Error("Invalid transport type");