@agiflowai/one-mcp 0.3.15 → 0.3.16

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/cli.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- const require_src = require('./src-CWShQS8u.cjs');
2
+ const require_src = require('./src-BRqEdbha.cjs');
3
3
  let node_fs_promises = require("node:fs/promises");
4
4
  let node_fs = require("node:fs");
5
5
  let node_crypto = require("node:crypto");
@@ -653,9 +653,9 @@ async function removeRuntimeRecordDuringStop(runtimeStateService, serverId) {
653
653
  throw new Error(`Failed to remove runtime state during HTTP stop callback for '${serverId}': ${toErrorMessage$6(error)}`);
654
654
  }
655
655
  }
656
- function createStdioHttpInternalTransport(serverOptions, config, adminOptions) {
656
+ function createStdioHttpInternalTransport(sharedServices, config, adminOptions) {
657
657
  try {
658
- return new require_src.HttpTransportHandler(() => require_src.createServer(serverOptions), config, adminOptions);
658
+ return new require_src.HttpTransportHandler(() => require_src.createSessionServer(sharedServices), config, adminOptions);
659
659
  } catch (error) {
660
660
  throw new Error(`Failed to create internal HTTP transport for stdio-http proxy: ${toErrorMessage$6(error)}`);
661
661
  }
@@ -686,6 +686,7 @@ async function startServer(handler, onStopped) {
686
686
  process.on("SIGTERM", async () => await shutdown("SIGTERM"));
687
687
  }
688
688
  async function createAndStartHttpRuntime(serverOptions, config, resolvedConfigPath) {
689
+ const sharedServices = await require_src.initializeSharedServices(serverOptions);
689
690
  const runtimeStateService = new require_src.RuntimeStateService();
690
691
  const shutdownToken = (0, node_crypto.randomUUID)();
691
692
  const runtimeRecord = createRuntimeRecord(serverOptions.serverId ?? require_src.generateServerId(), config, shutdownToken, resolvedConfigPath);
@@ -696,22 +697,26 @@ async function createAndStartHttpRuntime(serverOptions, config, resolvedConfigPa
696
697
  isStopping = true;
697
698
  try {
698
699
  await stopOwnedHttpTransport(handler, runtimeStateService, runtimeRecord.serverId);
700
+ await sharedServices.dispose();
699
701
  process.exit(0);
700
702
  } catch (error) {
701
703
  throw new Error(`Failed to stop HTTP runtime '${runtimeRecord.serverId}' from admin shutdown: ${toErrorMessage$6(error)}`);
702
704
  }
703
705
  };
704
706
  try {
705
- handler = new require_src.HttpTransportHandler(() => require_src.createServer(serverOptions), config, createHttpAdminOptions(runtimeRecord.serverId, shutdownToken, stopHandler));
707
+ handler = new require_src.HttpTransportHandler(() => require_src.createSessionServer(sharedServices), config, createHttpAdminOptions(runtimeRecord.serverId, shutdownToken, stopHandler));
706
708
  } catch (error) {
709
+ await sharedServices.dispose();
707
710
  throw new Error(`Failed to create HTTP runtime server: ${toErrorMessage$6(error)}`);
708
711
  }
709
712
  try {
710
713
  await startServer(handler, async () => {
714
+ await sharedServices.dispose();
711
715
  await removeRuntimeRecordDuringStop(runtimeStateService, runtimeRecord.serverId);
712
716
  });
713
717
  await writeRuntimeRecord(runtimeStateService, runtimeRecord);
714
718
  } catch (error) {
719
+ await sharedServices.dispose();
715
720
  await cleanupFailedRuntimeStartup(handler, runtimeStateService, runtimeRecord.serverId);
716
721
  throw new Error(`Failed to start HTTP runtime '${runtimeRecord.serverId}': ${toErrorMessage$6(error)}`);
717
722
  }
@@ -745,6 +750,7 @@ async function startSseTransport(serverOptions, config) {
745
750
  }
746
751
  }
747
752
  async function startStdioHttpTransport(serverOptions, config, resolvedConfigPath) {
753
+ const shared = { services: null };
748
754
  try {
749
755
  const stdioHttpHandler = new require_src.StdioHttpTransportHandler({ endpoint: new URL(`http://${config.host}:${config.port}${MCP_ENDPOINT_PATH}`) });
750
756
  const runtimeStateService = new require_src.RuntimeStateService();
@@ -758,6 +764,7 @@ async function startStdioHttpTransport(serverOptions, config, resolvedConfigPath
758
764
  isStopping = true;
759
765
  try {
760
766
  await Promise.all([stopInternalHttpTransport(stdioHttpHandler, httpHandler, ownsInternalHttpTransport), removeRuntimeRecord(runtimeStateService, serverId)]);
767
+ if (shared.services) await shared.services.dispose();
761
768
  ownsInternalHttpTransport = false;
762
769
  process.exit(0);
763
770
  } catch (error) {
@@ -775,8 +782,9 @@ async function startStdioHttpTransport(serverOptions, config, resolvedConfigPath
775
782
  } catch (error) {
776
783
  initialProxyConnectError = error;
777
784
  }
785
+ if (!shared.services) shared.services = await require_src.initializeSharedServices(serverOptions);
778
786
  try {
779
- httpHandler = createStdioHttpInternalTransport(serverOptions, config, adminOptions);
787
+ httpHandler = createStdioHttpInternalTransport(shared.services, config, adminOptions);
780
788
  await httpHandler.start();
781
789
  ownsInternalHttpTransport = true;
782
790
  } catch (error) {
@@ -809,6 +817,7 @@ async function startStdioHttpTransport(serverOptions, config, resolvedConfigPath
809
817
  try {
810
818
  await Promise.all([stopInternalHttpTransport(stdioHttpHandler, httpHandler, ownsInternalHttpTransport), removeRuntimeRecord(runtimeStateService, serverId)]);
811
819
  ownsInternalHttpTransport = false;
820
+ if (shared.services) await shared.services.dispose();
812
821
  } catch (error) {
813
822
  ownsInternalHttpTransport = false;
814
823
  throw new Error(`Failed during stdio-http shutdown for '${serverId}': ${toErrorMessage$6(error)}`);
@@ -816,6 +825,7 @@ async function startStdioHttpTransport(serverOptions, config, resolvedConfigPath
816
825
  }
817
826
  });
818
827
  } catch (error) {
828
+ if (shared.services) await shared.services.dispose();
819
829
  throw new Error(`Failed to start stdio-http transport: ${toErrorMessage$6(error)}`);
820
830
  }
821
831
  }
package/dist/cli.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { _ as findConfigFile, a as SseTransportHandler, c as createServer, d as SearchListToolsTool, g as generateServerId, h as DefinitionsCacheService, i as StdioTransportHandler, l as version, m as McpClientManagerService, n as RuntimeStateService, o as HttpTransportHandler, p as SkillService, r as StdioHttpTransportHandler, s as TRANSPORT_MODE, t as StopServerService, v as ConfigFetcherService } from "./src-CH93aUm2.mjs";
2
+ import { _ as DefinitionsCacheService, a as SseTransportHandler, b as ConfigFetcherService, c as createServer, d as version, g as McpClientManagerService, h as SkillService, i as StdioTransportHandler, l as createSessionServer, n as RuntimeStateService, o as HttpTransportHandler, p as SearchListToolsTool, r as StdioHttpTransportHandler, s as TRANSPORT_MODE, t as StopServerService, u as initializeSharedServices, v as generateServerId, y as findConfigFile } from "./src-Dn6vMZIk.mjs";
3
3
  import { access, writeFile } from "node:fs/promises";
4
4
  import { constants } from "node:fs";
5
5
  import { randomUUID } from "node:crypto";
@@ -653,9 +653,9 @@ async function removeRuntimeRecordDuringStop(runtimeStateService, serverId) {
653
653
  throw new Error(`Failed to remove runtime state during HTTP stop callback for '${serverId}': ${toErrorMessage$6(error)}`);
654
654
  }
655
655
  }
656
- function createStdioHttpInternalTransport(serverOptions, config, adminOptions) {
656
+ function createStdioHttpInternalTransport(sharedServices, config, adminOptions) {
657
657
  try {
658
- return new HttpTransportHandler(() => createServer(serverOptions), config, adminOptions);
658
+ return new HttpTransportHandler(() => createSessionServer(sharedServices), config, adminOptions);
659
659
  } catch (error) {
660
660
  throw new Error(`Failed to create internal HTTP transport for stdio-http proxy: ${toErrorMessage$6(error)}`);
661
661
  }
@@ -686,6 +686,7 @@ async function startServer(handler, onStopped) {
686
686
  process.on("SIGTERM", async () => await shutdown("SIGTERM"));
687
687
  }
688
688
  async function createAndStartHttpRuntime(serverOptions, config, resolvedConfigPath) {
689
+ const sharedServices = await initializeSharedServices(serverOptions);
689
690
  const runtimeStateService = new RuntimeStateService();
690
691
  const shutdownToken = randomUUID();
691
692
  const runtimeRecord = createRuntimeRecord(serverOptions.serverId ?? generateServerId(), config, shutdownToken, resolvedConfigPath);
@@ -696,22 +697,26 @@ async function createAndStartHttpRuntime(serverOptions, config, resolvedConfigPa
696
697
  isStopping = true;
697
698
  try {
698
699
  await stopOwnedHttpTransport(handler, runtimeStateService, runtimeRecord.serverId);
700
+ await sharedServices.dispose();
699
701
  process.exit(0);
700
702
  } catch (error) {
701
703
  throw new Error(`Failed to stop HTTP runtime '${runtimeRecord.serverId}' from admin shutdown: ${toErrorMessage$6(error)}`);
702
704
  }
703
705
  };
704
706
  try {
705
- handler = new HttpTransportHandler(() => createServer(serverOptions), config, createHttpAdminOptions(runtimeRecord.serverId, shutdownToken, stopHandler));
707
+ handler = new HttpTransportHandler(() => createSessionServer(sharedServices), config, createHttpAdminOptions(runtimeRecord.serverId, shutdownToken, stopHandler));
706
708
  } catch (error) {
709
+ await sharedServices.dispose();
707
710
  throw new Error(`Failed to create HTTP runtime server: ${toErrorMessage$6(error)}`);
708
711
  }
709
712
  try {
710
713
  await startServer(handler, async () => {
714
+ await sharedServices.dispose();
711
715
  await removeRuntimeRecordDuringStop(runtimeStateService, runtimeRecord.serverId);
712
716
  });
713
717
  await writeRuntimeRecord(runtimeStateService, runtimeRecord);
714
718
  } catch (error) {
719
+ await sharedServices.dispose();
715
720
  await cleanupFailedRuntimeStartup(handler, runtimeStateService, runtimeRecord.serverId);
716
721
  throw new Error(`Failed to start HTTP runtime '${runtimeRecord.serverId}': ${toErrorMessage$6(error)}`);
717
722
  }
@@ -745,6 +750,7 @@ async function startSseTransport(serverOptions, config) {
745
750
  }
746
751
  }
747
752
  async function startStdioHttpTransport(serverOptions, config, resolvedConfigPath) {
753
+ const shared = { services: null };
748
754
  try {
749
755
  const stdioHttpHandler = new StdioHttpTransportHandler({ endpoint: new URL(`http://${config.host}:${config.port}${MCP_ENDPOINT_PATH}`) });
750
756
  const runtimeStateService = new RuntimeStateService();
@@ -758,6 +764,7 @@ async function startStdioHttpTransport(serverOptions, config, resolvedConfigPath
758
764
  isStopping = true;
759
765
  try {
760
766
  await Promise.all([stopInternalHttpTransport(stdioHttpHandler, httpHandler, ownsInternalHttpTransport), removeRuntimeRecord(runtimeStateService, serverId)]);
767
+ if (shared.services) await shared.services.dispose();
761
768
  ownsInternalHttpTransport = false;
762
769
  process.exit(0);
763
770
  } catch (error) {
@@ -775,8 +782,9 @@ async function startStdioHttpTransport(serverOptions, config, resolvedConfigPath
775
782
  } catch (error) {
776
783
  initialProxyConnectError = error;
777
784
  }
785
+ if (!shared.services) shared.services = await initializeSharedServices(serverOptions);
778
786
  try {
779
- httpHandler = createStdioHttpInternalTransport(serverOptions, config, adminOptions);
787
+ httpHandler = createStdioHttpInternalTransport(shared.services, config, adminOptions);
780
788
  await httpHandler.start();
781
789
  ownsInternalHttpTransport = true;
782
790
  } catch (error) {
@@ -809,6 +817,7 @@ async function startStdioHttpTransport(serverOptions, config, resolvedConfigPath
809
817
  try {
810
818
  await Promise.all([stopInternalHttpTransport(stdioHttpHandler, httpHandler, ownsInternalHttpTransport), removeRuntimeRecord(runtimeStateService, serverId)]);
811
819
  ownsInternalHttpTransport = false;
820
+ if (shared.services) await shared.services.dispose();
812
821
  } catch (error) {
813
822
  ownsInternalHttpTransport = false;
814
823
  throw new Error(`Failed during stdio-http shutdown for '${serverId}': ${toErrorMessage$6(error)}`);
@@ -816,6 +825,7 @@ async function startStdioHttpTransport(serverOptions, config, resolvedConfigPath
816
825
  }
817
826
  });
818
827
  } catch (error) {
828
+ if (shared.services) await shared.services.dispose();
819
829
  throw new Error(`Failed to start stdio-http transport: ${toErrorMessage$6(error)}`);
820
830
  }
821
831
  }
package/dist/index.cjs CHANGED
@@ -1,4 +1,4 @@
1
- const require_src = require('./src-CWShQS8u.cjs');
1
+ const require_src = require('./src-BRqEdbha.cjs');
2
2
 
3
3
  exports.ConfigFetcherService = require_src.ConfigFetcherService;
4
4
  exports.DefinitionsCacheService = require_src.DefinitionsCacheService;
@@ -15,5 +15,7 @@ exports.StopServerService = require_src.StopServerService;
15
15
  exports.TRANSPORT_MODE = require_src.TRANSPORT_MODE;
16
16
  exports.UseToolTool = require_src.UseToolTool;
17
17
  exports.createServer = require_src.createServer;
18
+ exports.createSessionServer = require_src.createSessionServer;
18
19
  exports.findConfigFile = require_src.findConfigFile;
19
- exports.generateServerId = require_src.generateServerId;
20
+ exports.generateServerId = require_src.generateServerId;
21
+ exports.initializeSharedServices = require_src.initializeSharedServices;
package/dist/index.d.cts CHANGED
@@ -405,160 +405,6 @@ interface Skill {
405
405
  basePath: string;
406
406
  }
407
407
  //#endregion
408
- //#region src/server/index.d.ts
409
- /**
410
- * Configuration options for creating an MCP server instance
411
- * @property configFilePath - Path to the MCP configuration file
412
- * @property noCache - Skip cache when fetching remote configuration
413
- * @property skills - Skills configuration with paths array (optional, skills disabled if not provided)
414
- * @property serverId - CLI-provided server ID (takes precedence over config file id)
415
- */
416
- interface ServerOptions {
417
- configFilePath?: string;
418
- noCache?: boolean;
419
- skills?: {
420
- paths: string[];
421
- };
422
- serverId?: string;
423
- definitionsCachePath?: string;
424
- clearDefinitionsCache?: boolean;
425
- proxyMode?: 'meta' | 'flat' | 'search';
426
- onServerIdResolved?: (serverId: string) => Promise<void> | void;
427
- }
428
- declare function createServer(options?: ServerOptions): Promise<Server>;
429
- //#endregion
430
- //#region src/transports/http.d.ts
431
- /**
432
- * HTTP transport handler using Streamable HTTP (protocol version 2025-03-26)
433
- * Provides stateful session management with resumability support
434
- */
435
- declare class HttpTransportHandler implements HttpTransportHandler$1 {
436
- private serverFactory;
437
- private app;
438
- private server;
439
- private sessionManager;
440
- private config;
441
- private adminOptions?;
442
- private adminRateLimiter;
443
- constructor(serverFactory: (() => Server | Promise<Server>), config: TransportConfig, adminOptions?: HttpTransportAdminOptions);
444
- private setupMiddleware;
445
- private setupRoutes;
446
- private isAuthorizedShutdownRequest;
447
- private handleAdminShutdownRequest;
448
- private handlePostRequest;
449
- private handleGetRequest;
450
- private handleDeleteRequest;
451
- start(): Promise<void>;
452
- stop(): Promise<void>;
453
- getPort(): number;
454
- getHost(): string;
455
- }
456
- //#endregion
457
- //#region src/transports/sse.d.ts
458
- /**
459
- * SSE (Server-Sent Events) transport handler
460
- * Legacy transport for backwards compatibility (protocol version 2024-11-05)
461
- * Uses separate endpoints: /sse for SSE stream (GET) and /messages for client messages (POST)
462
- */
463
- declare class SseTransportHandler implements HttpTransportHandler$1 {
464
- private serverFactory;
465
- private app;
466
- private server;
467
- private sessionManager;
468
- private config;
469
- constructor(serverFactory: Server | (() => Server), config: TransportConfig);
470
- private setupMiddleware;
471
- private setupRoutes;
472
- private handleSseConnection;
473
- private handlePostMessage;
474
- start(): Promise<void>;
475
- stop(): Promise<void>;
476
- getPort(): number;
477
- getHost(): string;
478
- }
479
- //#endregion
480
- //#region src/transports/stdio.d.ts
481
- /**
482
- * Stdio transport handler for MCP server
483
- * Used for command-line and direct integrations
484
- */
485
- declare class StdioTransportHandler implements TransportHandler {
486
- private server;
487
- private transport;
488
- constructor(server: Server);
489
- start(): Promise<void>;
490
- stop(): Promise<void>;
491
- }
492
- //#endregion
493
- //#region src/transports/stdio-http.d.ts
494
- interface StdioHttpProxyTransportConfig {
495
- endpoint: URL;
496
- }
497
- /**
498
- * Transport that serves MCP over stdio and forwards MCP requests to an HTTP endpoint.
499
- */
500
- declare class StdioHttpTransportHandler implements TransportHandler {
501
- private readonly endpoint;
502
- private stdioProxyServer;
503
- private stdioTransport;
504
- private httpClient;
505
- constructor(config: StdioHttpProxyTransportConfig);
506
- start(): Promise<void>;
507
- stop(): Promise<void>;
508
- private createProxyServer;
509
- }
510
- //#endregion
511
- //#region src/services/McpClientManagerService.d.ts
512
- /**
513
- * Service for managing MCP client connections to remote servers
514
- */
515
- declare class McpClientManagerService {
516
- private clients;
517
- private serverConfigs;
518
- private connectionPromises;
519
- constructor();
520
- /**
521
- * Cleanup all resources on exit (child processes)
522
- */
523
- private cleanupOnExit;
524
- /**
525
- * Connect to an MCP server based on its configuration with timeout
526
- * Uses the timeout from server config, falling back to default (30s)
527
- */
528
- connectToServer(serverName: string, config: McpServerConfig): Promise<void>;
529
- registerServerConfigs(configs: Record<string, McpServerConfig>): void;
530
- getKnownServerNames(): string[];
531
- ensureConnected(serverName: string): Promise<McpClientConnection>;
532
- private createConnection;
533
- /**
534
- * Perform the actual connection to MCP server
535
- */
536
- private performConnection;
537
- private connectStdioClient;
538
- private connectHttpClient;
539
- private connectSseClient;
540
- /**
541
- * Get a connected client by server name
542
- */
543
- getClient(serverName: string): McpClientConnection | undefined;
544
- /**
545
- * Get all connected clients
546
- */
547
- getAllClients(): McpClientConnection[];
548
- /**
549
- * Disconnect from a specific server
550
- */
551
- disconnectServer(serverName: string): Promise<void>;
552
- /**
553
- * Disconnect from all servers
554
- */
555
- disconnectAll(): Promise<void>;
556
- /**
557
- * Check if a server is connected
558
- */
559
- isConnected(serverName: string): boolean;
560
- }
561
- //#endregion
562
408
  //#region src/services/SkillService.d.ts
563
409
  /**
564
410
  * Service for loading and managing skills from configured skill directories.
@@ -686,6 +532,57 @@ declare class SkillService {
686
532
  private loadSkillFile;
687
533
  }
688
534
  //#endregion
535
+ //#region src/services/McpClientManagerService.d.ts
536
+ /**
537
+ * Service for managing MCP client connections to remote servers
538
+ */
539
+ declare class McpClientManagerService {
540
+ private clients;
541
+ private serverConfigs;
542
+ private connectionPromises;
543
+ /**
544
+ * Synchronously kill all stdio MCP server child processes.
545
+ * Must be called by the owner (e.g. transport/command layer) during shutdown.
546
+ */
547
+ cleanupChildProcesses(): void;
548
+ /**
549
+ * Connect to an MCP server based on its configuration with timeout
550
+ * Uses the timeout from server config, falling back to default (30s)
551
+ */
552
+ connectToServer(serverName: string, config: McpServerConfig): Promise<void>;
553
+ registerServerConfigs(configs: Record<string, McpServerConfig>): void;
554
+ getKnownServerNames(): string[];
555
+ ensureConnected(serverName: string): Promise<McpClientConnection>;
556
+ private createConnection;
557
+ /**
558
+ * Perform the actual connection to MCP server
559
+ */
560
+ private performConnection;
561
+ private connectStdioClient;
562
+ private connectHttpClient;
563
+ private connectSseClient;
564
+ /**
565
+ * Get a connected client by server name
566
+ */
567
+ getClient(serverName: string): McpClientConnection | undefined;
568
+ /**
569
+ * Get all connected clients
570
+ */
571
+ getAllClients(): McpClientConnection[];
572
+ /**
573
+ * Disconnect from a specific server
574
+ */
575
+ disconnectServer(serverName: string): Promise<void>;
576
+ /**
577
+ * Disconnect from all servers
578
+ */
579
+ disconnectAll(): Promise<void>;
580
+ /**
581
+ * Check if a server is connected
582
+ */
583
+ isConnected(serverName: string): boolean;
584
+ }
585
+ //#endregion
689
586
  //#region src/services/DefinitionsCacheService.d.ts
690
587
  interface DefinitionsCacheServiceOptions {
691
588
  cacheData?: DefinitionsCacheFile;
@@ -969,6 +866,147 @@ declare class UseToolTool implements Tool<UseToolToolInput> {
969
866
  execute(input: UseToolToolInput): Promise<CallToolResult>;
970
867
  }
971
868
  //#endregion
869
+ //#region src/server/index.d.ts
870
+ /**
871
+ * Configuration options for creating an MCP server instance
872
+ * @property configFilePath - Path to the MCP configuration file
873
+ * @property noCache - Skip cache when fetching remote configuration
874
+ * @property skills - Skills configuration with paths array (optional, skills disabled if not provided)
875
+ * @property serverId - CLI-provided server ID (takes precedence over config file id)
876
+ */
877
+ interface ServerOptions {
878
+ configFilePath?: string;
879
+ noCache?: boolean;
880
+ skills?: {
881
+ paths: string[];
882
+ };
883
+ serverId?: string;
884
+ definitionsCachePath?: string;
885
+ clearDefinitionsCache?: boolean;
886
+ proxyMode?: 'meta' | 'flat' | 'search';
887
+ onServerIdResolved?: (serverId: string) => Promise<void> | void;
888
+ }
889
+ /**
890
+ * Shared services and tools for multi-session HTTP transport.
891
+ * Created once via initializeSharedServices(), then passed to createSessionServer()
892
+ * for each new client session. This avoids duplicating downstream connections,
893
+ * file watchers, and caches across concurrent sessions.
894
+ */
895
+ interface SharedServices {
896
+ clientManager: McpClientManagerService;
897
+ definitionsCacheService: DefinitionsCacheService;
898
+ skillService?: SkillService;
899
+ describeTools: DescribeToolsTool;
900
+ useTool: UseToolTool;
901
+ searchListTools: SearchListToolsTool;
902
+ serverId: string;
903
+ proxyMode: 'meta' | 'flat' | 'search';
904
+ /**
905
+ * Disposes all shared resources: disconnects downstream servers,
906
+ * stops file watchers. Must be called by the owner on shutdown.
907
+ */
908
+ dispose: () => Promise<void>;
909
+ }
910
+ /**
911
+ * Initialize shared services and tools once for use across multiple sessions.
912
+ * Use with createSessionServer() for HTTP transport where multiple agents
913
+ * connect concurrently. This avoids duplicating downstream connections,
914
+ * file watchers, caches, and tool instances per session.
915
+ */
916
+ declare function initializeSharedServices(options?: ServerOptions): Promise<SharedServices>;
917
+ /**
918
+ * Create a lightweight per-session MCP Server instance that delegates
919
+ * to shared services and tools. Use with initializeSharedServices()
920
+ * for multi-session HTTP transport.
921
+ */
922
+ declare function createSessionServer(shared: SharedServices): Promise<Server>;
923
+ /**
924
+ * Create a single MCP server instance (backward-compatible wrapper).
925
+ * For multi-session HTTP transport, use initializeSharedServices() + createSessionServer() instead.
926
+ */
927
+ declare function createServer(options?: ServerOptions): Promise<Server>;
928
+ //#endregion
929
+ //#region src/transports/http.d.ts
930
+ /**
931
+ * HTTP transport handler using Streamable HTTP (protocol version 2025-03-26)
932
+ * Provides stateful session management with resumability support
933
+ */
934
+ declare class HttpTransportHandler implements HttpTransportHandler$1 {
935
+ private serverFactory;
936
+ private app;
937
+ private server;
938
+ private sessionManager;
939
+ private config;
940
+ private adminOptions?;
941
+ private adminRateLimiter;
942
+ constructor(serverFactory: (() => Server | Promise<Server>), config: TransportConfig, adminOptions?: HttpTransportAdminOptions);
943
+ private setupMiddleware;
944
+ private setupRoutes;
945
+ private isAuthorizedShutdownRequest;
946
+ private handleAdminShutdownRequest;
947
+ private handlePostRequest;
948
+ private handleGetRequest;
949
+ private handleDeleteRequest;
950
+ start(): Promise<void>;
951
+ stop(): Promise<void>;
952
+ getPort(): number;
953
+ getHost(): string;
954
+ }
955
+ //#endregion
956
+ //#region src/transports/sse.d.ts
957
+ /**
958
+ * SSE (Server-Sent Events) transport handler
959
+ * Legacy transport for backwards compatibility (protocol version 2024-11-05)
960
+ * Uses separate endpoints: /sse for SSE stream (GET) and /messages for client messages (POST)
961
+ */
962
+ declare class SseTransportHandler implements HttpTransportHandler$1 {
963
+ private serverFactory;
964
+ private app;
965
+ private server;
966
+ private sessionManager;
967
+ private config;
968
+ constructor(serverFactory: Server | (() => Server), config: TransportConfig);
969
+ private setupMiddleware;
970
+ private setupRoutes;
971
+ private handleSseConnection;
972
+ private handlePostMessage;
973
+ start(): Promise<void>;
974
+ stop(): Promise<void>;
975
+ getPort(): number;
976
+ getHost(): string;
977
+ }
978
+ //#endregion
979
+ //#region src/transports/stdio.d.ts
980
+ /**
981
+ * Stdio transport handler for MCP server
982
+ * Used for command-line and direct integrations
983
+ */
984
+ declare class StdioTransportHandler implements TransportHandler {
985
+ private server;
986
+ private transport;
987
+ constructor(server: Server);
988
+ start(): Promise<void>;
989
+ stop(): Promise<void>;
990
+ }
991
+ //#endregion
992
+ //#region src/transports/stdio-http.d.ts
993
+ interface StdioHttpProxyTransportConfig {
994
+ endpoint: URL;
995
+ }
996
+ /**
997
+ * Transport that serves MCP over stdio and forwards MCP requests to an HTTP endpoint.
998
+ */
999
+ declare class StdioHttpTransportHandler implements TransportHandler {
1000
+ private readonly endpoint;
1001
+ private stdioProxyServer;
1002
+ private stdioTransport;
1003
+ private httpClient;
1004
+ constructor(config: StdioHttpProxyTransportConfig);
1005
+ start(): Promise<void>;
1006
+ stop(): Promise<void>;
1007
+ private createProxyServer;
1008
+ }
1009
+ //#endregion
972
1010
  //#region src/services/ConfigFetcherService.d.ts
973
1011
  interface ConfigFetcherOptions {
974
1012
  configFilePath?: string;
@@ -1237,4 +1275,4 @@ declare function findConfigFile(): string | null;
1237
1275
  */
1238
1276
  declare function generateServerId(length?: number): string;
1239
1277
  //#endregion
1240
- export { CachedFileSkillInfo, CachedPromptSkillInfo, CachedServerDefinition, ConfigFetcherService, DefinitionsCacheFile, DefinitionsCacheService, DescribeToolsTool, HttpTransportAdminOptions, HttpTransportHandler, HttpTransportHealthResponse, HttpTransportShutdownResponse, McpClientConnection, McpClientManagerService, McpHttpConfig, McpPromptInfo, McpResourceInfo, McpServerConfig, McpServerTransportConfig, McpServerTransportType, McpSseConfig, McpStdioConfig, McpToolInfo, PromptConfig, PromptSkillConfig, RemoteMcpConfiguration, RuntimeLookupOptions, RuntimeStateManager, RuntimeStateRecord, RuntimeStateService, SearchListToolsTool, type ServerOptions, Skill, SkillMetadata, SkillService, SkillsConfig, SseTransportHandler, StdioHttpTransportHandler, StdioTransportHandler, type StopServerRequest, type StopServerResult, StopServerService, TRANSPORT_MODE, Tool, ToolDefinition, TransportConfig, TransportHandler, TransportMode, UseToolTool, createServer, findConfigFile, generateServerId };
1278
+ export { CachedFileSkillInfo, CachedPromptSkillInfo, CachedServerDefinition, ConfigFetcherService, DefinitionsCacheFile, DefinitionsCacheService, DescribeToolsTool, HttpTransportAdminOptions, HttpTransportHandler, HttpTransportHealthResponse, HttpTransportShutdownResponse, McpClientConnection, McpClientManagerService, McpHttpConfig, McpPromptInfo, McpResourceInfo, McpServerConfig, McpServerTransportConfig, McpServerTransportType, McpSseConfig, McpStdioConfig, McpToolInfo, PromptConfig, PromptSkillConfig, RemoteMcpConfiguration, RuntimeLookupOptions, RuntimeStateManager, RuntimeStateRecord, RuntimeStateService, SearchListToolsTool, type ServerOptions, type SharedServices, Skill, SkillMetadata, SkillService, SkillsConfig, SseTransportHandler, StdioHttpTransportHandler, StdioTransportHandler, type StopServerRequest, type StopServerResult, StopServerService, TRANSPORT_MODE, Tool, ToolDefinition, TransportConfig, TransportHandler, TransportMode, UseToolTool, createServer, createSessionServer, findConfigFile, generateServerId, initializeSharedServices };