@agiflowai/one-mcp 0.3.14 → 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/index.d.mts CHANGED
@@ -406,160 +406,6 @@ interface Skill {
406
406
  basePath: string;
407
407
  }
408
408
  //#endregion
409
- //#region src/server/index.d.ts
410
- /**
411
- * Configuration options for creating an MCP server instance
412
- * @property configFilePath - Path to the MCP configuration file
413
- * @property noCache - Skip cache when fetching remote configuration
414
- * @property skills - Skills configuration with paths array (optional, skills disabled if not provided)
415
- * @property serverId - CLI-provided server ID (takes precedence over config file id)
416
- */
417
- interface ServerOptions {
418
- configFilePath?: string;
419
- noCache?: boolean;
420
- skills?: {
421
- paths: string[];
422
- };
423
- serverId?: string;
424
- definitionsCachePath?: string;
425
- clearDefinitionsCache?: boolean;
426
- proxyMode?: 'meta' | 'flat' | 'search';
427
- onServerIdResolved?: (serverId: string) => Promise<void> | void;
428
- }
429
- declare function createServer(options?: ServerOptions): Promise<Server>;
430
- //#endregion
431
- //#region src/transports/http.d.ts
432
- /**
433
- * HTTP transport handler using Streamable HTTP (protocol version 2025-03-26)
434
- * Provides stateful session management with resumability support
435
- */
436
- declare class HttpTransportHandler implements HttpTransportHandler$1 {
437
- private serverFactory;
438
- private app;
439
- private server;
440
- private sessionManager;
441
- private config;
442
- private adminOptions?;
443
- private adminRateLimiter;
444
- constructor(serverFactory: Server | (() => Server), config: TransportConfig, adminOptions?: HttpTransportAdminOptions);
445
- private setupMiddleware;
446
- private setupRoutes;
447
- private isAuthorizedShutdownRequest;
448
- private handleAdminShutdownRequest;
449
- private handlePostRequest;
450
- private handleGetRequest;
451
- private handleDeleteRequest;
452
- start(): Promise<void>;
453
- stop(): Promise<void>;
454
- getPort(): number;
455
- getHost(): string;
456
- }
457
- //#endregion
458
- //#region src/transports/sse.d.ts
459
- /**
460
- * SSE (Server-Sent Events) transport handler
461
- * Legacy transport for backwards compatibility (protocol version 2024-11-05)
462
- * Uses separate endpoints: /sse for SSE stream (GET) and /messages for client messages (POST)
463
- */
464
- declare class SseTransportHandler implements HttpTransportHandler$1 {
465
- private serverFactory;
466
- private app;
467
- private server;
468
- private sessionManager;
469
- private config;
470
- constructor(serverFactory: Server | (() => Server), config: TransportConfig);
471
- private setupMiddleware;
472
- private setupRoutes;
473
- private handleSseConnection;
474
- private handlePostMessage;
475
- start(): Promise<void>;
476
- stop(): Promise<void>;
477
- getPort(): number;
478
- getHost(): string;
479
- }
480
- //#endregion
481
- //#region src/transports/stdio.d.ts
482
- /**
483
- * Stdio transport handler for MCP server
484
- * Used for command-line and direct integrations
485
- */
486
- declare class StdioTransportHandler implements TransportHandler {
487
- private server;
488
- private transport;
489
- constructor(server: Server);
490
- start(): Promise<void>;
491
- stop(): Promise<void>;
492
- }
493
- //#endregion
494
- //#region src/transports/stdio-http.d.ts
495
- interface StdioHttpProxyTransportConfig {
496
- endpoint: URL;
497
- }
498
- /**
499
- * Transport that serves MCP over stdio and forwards MCP requests to an HTTP endpoint.
500
- */
501
- declare class StdioHttpTransportHandler implements TransportHandler {
502
- private readonly endpoint;
503
- private stdioProxyServer;
504
- private stdioTransport;
505
- private httpClient;
506
- constructor(config: StdioHttpProxyTransportConfig);
507
- start(): Promise<void>;
508
- stop(): Promise<void>;
509
- private createProxyServer;
510
- }
511
- //#endregion
512
- //#region src/services/McpClientManagerService.d.ts
513
- /**
514
- * Service for managing MCP client connections to remote servers
515
- */
516
- declare class McpClientManagerService {
517
- private clients;
518
- private serverConfigs;
519
- private connectionPromises;
520
- constructor();
521
- /**
522
- * Cleanup all resources on exit (child processes)
523
- */
524
- private cleanupOnExit;
525
- /**
526
- * Connect to an MCP server based on its configuration with timeout
527
- * Uses the timeout from server config, falling back to default (30s)
528
- */
529
- connectToServer(serverName: string, config: McpServerConfig): Promise<void>;
530
- registerServerConfigs(configs: Record<string, McpServerConfig>): void;
531
- getKnownServerNames(): string[];
532
- ensureConnected(serverName: string): Promise<McpClientConnection>;
533
- private createConnection;
534
- /**
535
- * Perform the actual connection to MCP server
536
- */
537
- private performConnection;
538
- private connectStdioClient;
539
- private connectHttpClient;
540
- private connectSseClient;
541
- /**
542
- * Get a connected client by server name
543
- */
544
- getClient(serverName: string): McpClientConnection | undefined;
545
- /**
546
- * Get all connected clients
547
- */
548
- getAllClients(): McpClientConnection[];
549
- /**
550
- * Disconnect from a specific server
551
- */
552
- disconnectServer(serverName: string): Promise<void>;
553
- /**
554
- * Disconnect from all servers
555
- */
556
- disconnectAll(): Promise<void>;
557
- /**
558
- * Check if a server is connected
559
- */
560
- isConnected(serverName: string): boolean;
561
- }
562
- //#endregion
563
409
  //#region src/services/SkillService.d.ts
564
410
  /**
565
411
  * Service for loading and managing skills from configured skill directories.
@@ -687,6 +533,57 @@ declare class SkillService {
687
533
  private loadSkillFile;
688
534
  }
689
535
  //#endregion
536
+ //#region src/services/McpClientManagerService.d.ts
537
+ /**
538
+ * Service for managing MCP client connections to remote servers
539
+ */
540
+ declare class McpClientManagerService {
541
+ private clients;
542
+ private serverConfigs;
543
+ private connectionPromises;
544
+ /**
545
+ * Synchronously kill all stdio MCP server child processes.
546
+ * Must be called by the owner (e.g. transport/command layer) during shutdown.
547
+ */
548
+ cleanupChildProcesses(): void;
549
+ /**
550
+ * Connect to an MCP server based on its configuration with timeout
551
+ * Uses the timeout from server config, falling back to default (30s)
552
+ */
553
+ connectToServer(serverName: string, config: McpServerConfig): Promise<void>;
554
+ registerServerConfigs(configs: Record<string, McpServerConfig>): void;
555
+ getKnownServerNames(): string[];
556
+ ensureConnected(serverName: string): Promise<McpClientConnection>;
557
+ private createConnection;
558
+ /**
559
+ * Perform the actual connection to MCP server
560
+ */
561
+ private performConnection;
562
+ private connectStdioClient;
563
+ private connectHttpClient;
564
+ private connectSseClient;
565
+ /**
566
+ * Get a connected client by server name
567
+ */
568
+ getClient(serverName: string): McpClientConnection | undefined;
569
+ /**
570
+ * Get all connected clients
571
+ */
572
+ getAllClients(): McpClientConnection[];
573
+ /**
574
+ * Disconnect from a specific server
575
+ */
576
+ disconnectServer(serverName: string): Promise<void>;
577
+ /**
578
+ * Disconnect from all servers
579
+ */
580
+ disconnectAll(): Promise<void>;
581
+ /**
582
+ * Check if a server is connected
583
+ */
584
+ isConnected(serverName: string): boolean;
585
+ }
586
+ //#endregion
690
587
  //#region src/services/DefinitionsCacheService.d.ts
691
588
  interface DefinitionsCacheServiceOptions {
692
589
  cacheData?: DefinitionsCacheFile;
@@ -970,6 +867,147 @@ declare class UseToolTool implements Tool<UseToolToolInput> {
970
867
  execute(input: UseToolToolInput): Promise<CallToolResult>;
971
868
  }
972
869
  //#endregion
870
+ //#region src/server/index.d.ts
871
+ /**
872
+ * Configuration options for creating an MCP server instance
873
+ * @property configFilePath - Path to the MCP configuration file
874
+ * @property noCache - Skip cache when fetching remote configuration
875
+ * @property skills - Skills configuration with paths array (optional, skills disabled if not provided)
876
+ * @property serverId - CLI-provided server ID (takes precedence over config file id)
877
+ */
878
+ interface ServerOptions {
879
+ configFilePath?: string;
880
+ noCache?: boolean;
881
+ skills?: {
882
+ paths: string[];
883
+ };
884
+ serverId?: string;
885
+ definitionsCachePath?: string;
886
+ clearDefinitionsCache?: boolean;
887
+ proxyMode?: 'meta' | 'flat' | 'search';
888
+ onServerIdResolved?: (serverId: string) => Promise<void> | void;
889
+ }
890
+ /**
891
+ * Shared services and tools for multi-session HTTP transport.
892
+ * Created once via initializeSharedServices(), then passed to createSessionServer()
893
+ * for each new client session. This avoids duplicating downstream connections,
894
+ * file watchers, and caches across concurrent sessions.
895
+ */
896
+ interface SharedServices {
897
+ clientManager: McpClientManagerService;
898
+ definitionsCacheService: DefinitionsCacheService;
899
+ skillService?: SkillService;
900
+ describeTools: DescribeToolsTool;
901
+ useTool: UseToolTool;
902
+ searchListTools: SearchListToolsTool;
903
+ serverId: string;
904
+ proxyMode: 'meta' | 'flat' | 'search';
905
+ /**
906
+ * Disposes all shared resources: disconnects downstream servers,
907
+ * stops file watchers. Must be called by the owner on shutdown.
908
+ */
909
+ dispose: () => Promise<void>;
910
+ }
911
+ /**
912
+ * Initialize shared services and tools once for use across multiple sessions.
913
+ * Use with createSessionServer() for HTTP transport where multiple agents
914
+ * connect concurrently. This avoids duplicating downstream connections,
915
+ * file watchers, caches, and tool instances per session.
916
+ */
917
+ declare function initializeSharedServices(options?: ServerOptions): Promise<SharedServices>;
918
+ /**
919
+ * Create a lightweight per-session MCP Server instance that delegates
920
+ * to shared services and tools. Use with initializeSharedServices()
921
+ * for multi-session HTTP transport.
922
+ */
923
+ declare function createSessionServer(shared: SharedServices): Promise<Server>;
924
+ /**
925
+ * Create a single MCP server instance (backward-compatible wrapper).
926
+ * For multi-session HTTP transport, use initializeSharedServices() + createSessionServer() instead.
927
+ */
928
+ declare function createServer(options?: ServerOptions): Promise<Server>;
929
+ //#endregion
930
+ //#region src/transports/http.d.ts
931
+ /**
932
+ * HTTP transport handler using Streamable HTTP (protocol version 2025-03-26)
933
+ * Provides stateful session management with resumability support
934
+ */
935
+ declare class HttpTransportHandler implements HttpTransportHandler$1 {
936
+ private serverFactory;
937
+ private app;
938
+ private server;
939
+ private sessionManager;
940
+ private config;
941
+ private adminOptions?;
942
+ private adminRateLimiter;
943
+ constructor(serverFactory: (() => Server | Promise<Server>), config: TransportConfig, adminOptions?: HttpTransportAdminOptions);
944
+ private setupMiddleware;
945
+ private setupRoutes;
946
+ private isAuthorizedShutdownRequest;
947
+ private handleAdminShutdownRequest;
948
+ private handlePostRequest;
949
+ private handleGetRequest;
950
+ private handleDeleteRequest;
951
+ start(): Promise<void>;
952
+ stop(): Promise<void>;
953
+ getPort(): number;
954
+ getHost(): string;
955
+ }
956
+ //#endregion
957
+ //#region src/transports/sse.d.ts
958
+ /**
959
+ * SSE (Server-Sent Events) transport handler
960
+ * Legacy transport for backwards compatibility (protocol version 2024-11-05)
961
+ * Uses separate endpoints: /sse for SSE stream (GET) and /messages for client messages (POST)
962
+ */
963
+ declare class SseTransportHandler implements HttpTransportHandler$1 {
964
+ private serverFactory;
965
+ private app;
966
+ private server;
967
+ private sessionManager;
968
+ private config;
969
+ constructor(serverFactory: Server | (() => Server), config: TransportConfig);
970
+ private setupMiddleware;
971
+ private setupRoutes;
972
+ private handleSseConnection;
973
+ private handlePostMessage;
974
+ start(): Promise<void>;
975
+ stop(): Promise<void>;
976
+ getPort(): number;
977
+ getHost(): string;
978
+ }
979
+ //#endregion
980
+ //#region src/transports/stdio.d.ts
981
+ /**
982
+ * Stdio transport handler for MCP server
983
+ * Used for command-line and direct integrations
984
+ */
985
+ declare class StdioTransportHandler implements TransportHandler {
986
+ private server;
987
+ private transport;
988
+ constructor(server: Server);
989
+ start(): Promise<void>;
990
+ stop(): Promise<void>;
991
+ }
992
+ //#endregion
993
+ //#region src/transports/stdio-http.d.ts
994
+ interface StdioHttpProxyTransportConfig {
995
+ endpoint: URL;
996
+ }
997
+ /**
998
+ * Transport that serves MCP over stdio and forwards MCP requests to an HTTP endpoint.
999
+ */
1000
+ declare class StdioHttpTransportHandler implements TransportHandler {
1001
+ private readonly endpoint;
1002
+ private stdioProxyServer;
1003
+ private stdioTransport;
1004
+ private httpClient;
1005
+ constructor(config: StdioHttpProxyTransportConfig);
1006
+ start(): Promise<void>;
1007
+ stop(): Promise<void>;
1008
+ private createProxyServer;
1009
+ }
1010
+ //#endregion
973
1011
  //#region src/services/ConfigFetcherService.d.ts
974
1012
  interface ConfigFetcherOptions {
975
1013
  configFilePath?: string;
@@ -1084,7 +1122,7 @@ declare class RuntimeStateService implements RuntimeStateManager {
1084
1122
  remove(serverId: string): Promise<void>;
1085
1123
  }
1086
1124
  //#endregion
1087
- //#region src/services/StopServerService.d.ts
1125
+ //#region src/services/StopServerService/types.d.ts
1088
1126
  /**
1089
1127
  * Stop request options.
1090
1128
  * @property serverId - Explicit one-mcp server identifier to stop
@@ -1117,6 +1155,8 @@ interface StopServerResult {
1117
1155
  port: number;
1118
1156
  message: string;
1119
1157
  }
1158
+ //#endregion
1159
+ //#region src/services/StopServerService/StopServerService.d.ts
1120
1160
  /**
1121
1161
  * Service for resolving runtime targets and stopping them safely.
1122
1162
  */
@@ -1236,4 +1276,4 @@ declare function findConfigFile(): string | null;
1236
1276
  */
1237
1277
  declare function generateServerId(length?: number): string;
1238
1278
  //#endregion
1239
- 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 };
1279
+ 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 };
package/dist/index.mjs CHANGED
@@ -1,3 +1,3 @@
1
- import { _ as findConfigFile, a as SseTransportHandler, c as createServer, d as SearchListToolsTool, f as DescribeToolsTool, g as generateServerId, h as DefinitionsCacheService, i as StdioTransportHandler, m as McpClientManagerService, n as RuntimeStateService, o as HttpTransportHandler, p as SkillService, r as StdioHttpTransportHandler, s as TRANSPORT_MODE, t as StopServerService, u as UseToolTool, v as ConfigFetcherService } from "./src-D7Yq1bTx.mjs";
1
+ import { _ as DefinitionsCacheService, a as SseTransportHandler, b as ConfigFetcherService, c as createServer, f as UseToolTool, g as McpClientManagerService, h as SkillService, i as StdioTransportHandler, l as createSessionServer, m as DescribeToolsTool, 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";
2
2
 
3
- export { ConfigFetcherService, DefinitionsCacheService, DescribeToolsTool, HttpTransportHandler, McpClientManagerService, RuntimeStateService, SearchListToolsTool, SkillService, SseTransportHandler, StdioHttpTransportHandler, StdioTransportHandler, StopServerService, TRANSPORT_MODE, UseToolTool, createServer, findConfigFile, generateServerId };
3
+ export { ConfigFetcherService, DefinitionsCacheService, DescribeToolsTool, HttpTransportHandler, McpClientManagerService, RuntimeStateService, SearchListToolsTool, SkillService, SseTransportHandler, StdioHttpTransportHandler, StdioTransportHandler, StopServerService, TRANSPORT_MODE, UseToolTool, createServer, createSessionServer, findConfigFile, generateServerId, initializeSharedServices };