@agimon-ai/mcp-proxy 0.5.0 → 0.5.2
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 +225 -109
- package/dist/cli.mjs +225 -110
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +76 -62
- package/dist/index.d.mts +76 -62
- package/dist/index.mjs +1 -1
- package/dist/{src-B2m53VQ1.cjs → src-DUR0uWiY.cjs} +2967 -2804
- package/dist/{src-DCIv5S_2.mjs → src-kgJ-iu3i.mjs} +2970 -2806
- package/package.json +9 -6
package/dist/index.d.cts
CHANGED
|
@@ -50,7 +50,7 @@ type TransportMode = (typeof TRANSPORT_MODE)[keyof typeof TRANSPORT_MODE];
|
|
|
50
50
|
*/
|
|
51
51
|
interface TransportConfig {
|
|
52
52
|
mode: TransportMode;
|
|
53
|
-
port
|
|
53
|
+
port: number;
|
|
54
54
|
host?: string;
|
|
55
55
|
}
|
|
56
56
|
/**
|
|
@@ -260,6 +260,11 @@ interface PromptConfig {
|
|
|
260
260
|
*/
|
|
261
261
|
interface RemoteMcpConfiguration {
|
|
262
262
|
id?: string;
|
|
263
|
+
proxy?: {
|
|
264
|
+
type?: string;
|
|
265
|
+
port?: number;
|
|
266
|
+
host?: string;
|
|
267
|
+
};
|
|
263
268
|
mcpServers: Record<string, McpServerConfig>;
|
|
264
269
|
skills?: SkillsConfig;
|
|
265
270
|
}
|
|
@@ -515,6 +520,62 @@ declare class ConfigFetcherService {
|
|
|
515
520
|
isCacheValid(): boolean;
|
|
516
521
|
}
|
|
517
522
|
//#endregion
|
|
523
|
+
//#region src/services/McpClientManagerService.d.ts
|
|
524
|
+
/**
|
|
525
|
+
* Service for managing MCP client connections to remote servers
|
|
526
|
+
*/
|
|
527
|
+
declare class McpClientManagerService {
|
|
528
|
+
private clients;
|
|
529
|
+
private serverConfigs;
|
|
530
|
+
private connectionPromises;
|
|
531
|
+
private logger;
|
|
532
|
+
constructor(logger?: LoggerLike);
|
|
533
|
+
/**
|
|
534
|
+
* Kill all stdio MCP server child processes.
|
|
535
|
+
* Sends SIGTERM first, then SIGKILL after 1s if the process hasn't exited.
|
|
536
|
+
* Must be called by the owner (e.g. transport/command layer) during shutdown.
|
|
537
|
+
* Awaiting the returned promise ensures force-kill timers complete before process.exit().
|
|
538
|
+
*/
|
|
539
|
+
cleanupChildProcesses(): Promise<void>;
|
|
540
|
+
/**
|
|
541
|
+
* Connect to an MCP server based on its configuration with timeout
|
|
542
|
+
* Uses the timeout from server config, falling back to default (30s)
|
|
543
|
+
*/
|
|
544
|
+
connectToServer(serverName: string, config: McpServerConfig): Promise<void>;
|
|
545
|
+
registerServerConfigs(configs: Record<string, McpServerConfig>): void;
|
|
546
|
+
getKnownServerNames(): string[];
|
|
547
|
+
getServerRequestTimeout(serverName: string): number | undefined;
|
|
548
|
+
ensureConnected(serverName: string): Promise<McpClientConnection>;
|
|
549
|
+
private createConnection;
|
|
550
|
+
/**
|
|
551
|
+
* Perform the actual connection to MCP server
|
|
552
|
+
*/
|
|
553
|
+
private performConnection;
|
|
554
|
+
private connectStdioClient;
|
|
555
|
+
private connectHttpClient;
|
|
556
|
+
private connectSseClient;
|
|
557
|
+
/**
|
|
558
|
+
* Get a connected client by server name
|
|
559
|
+
*/
|
|
560
|
+
getClient(serverName: string): McpClientConnection | undefined;
|
|
561
|
+
/**
|
|
562
|
+
* Get all connected clients
|
|
563
|
+
*/
|
|
564
|
+
getAllClients(): McpClientConnection[];
|
|
565
|
+
/**
|
|
566
|
+
* Disconnect from a specific server
|
|
567
|
+
*/
|
|
568
|
+
disconnectServer(serverName: string): Promise<void>;
|
|
569
|
+
/**
|
|
570
|
+
* Disconnect from all servers
|
|
571
|
+
*/
|
|
572
|
+
disconnectAll(): Promise<void>;
|
|
573
|
+
/**
|
|
574
|
+
* Check if a server is connected
|
|
575
|
+
*/
|
|
576
|
+
isConnected(serverName: string): boolean;
|
|
577
|
+
}
|
|
578
|
+
//#endregion
|
|
518
579
|
//#region src/services/SkillService.d.ts
|
|
519
580
|
/**
|
|
520
581
|
* Service for loading and managing skills from configured skill directories.
|
|
@@ -643,60 +704,6 @@ declare class SkillService {
|
|
|
643
704
|
private loadSkillFile;
|
|
644
705
|
}
|
|
645
706
|
//#endregion
|
|
646
|
-
//#region src/services/McpClientManagerService.d.ts
|
|
647
|
-
/**
|
|
648
|
-
* Service for managing MCP client connections to remote servers
|
|
649
|
-
*/
|
|
650
|
-
declare class McpClientManagerService {
|
|
651
|
-
private clients;
|
|
652
|
-
private serverConfigs;
|
|
653
|
-
private connectionPromises;
|
|
654
|
-
private logger;
|
|
655
|
-
constructor(logger?: LoggerLike);
|
|
656
|
-
/**
|
|
657
|
-
* Synchronously kill all stdio MCP server child processes.
|
|
658
|
-
* Must be called by the owner (e.g. transport/command layer) during shutdown.
|
|
659
|
-
*/
|
|
660
|
-
cleanupChildProcesses(): void;
|
|
661
|
-
/**
|
|
662
|
-
* Connect to an MCP server based on its configuration with timeout
|
|
663
|
-
* Uses the timeout from server config, falling back to default (30s)
|
|
664
|
-
*/
|
|
665
|
-
connectToServer(serverName: string, config: McpServerConfig): Promise<void>;
|
|
666
|
-
registerServerConfigs(configs: Record<string, McpServerConfig>): void;
|
|
667
|
-
getKnownServerNames(): string[];
|
|
668
|
-
getServerRequestTimeout(serverName: string): number | undefined;
|
|
669
|
-
ensureConnected(serverName: string): Promise<McpClientConnection>;
|
|
670
|
-
private createConnection;
|
|
671
|
-
/**
|
|
672
|
-
* Perform the actual connection to MCP server
|
|
673
|
-
*/
|
|
674
|
-
private performConnection;
|
|
675
|
-
private connectStdioClient;
|
|
676
|
-
private connectHttpClient;
|
|
677
|
-
private connectSseClient;
|
|
678
|
-
/**
|
|
679
|
-
* Get a connected client by server name
|
|
680
|
-
*/
|
|
681
|
-
getClient(serverName: string): McpClientConnection | undefined;
|
|
682
|
-
/**
|
|
683
|
-
* Get all connected clients
|
|
684
|
-
*/
|
|
685
|
-
getAllClients(): McpClientConnection[];
|
|
686
|
-
/**
|
|
687
|
-
* Disconnect from a specific server
|
|
688
|
-
*/
|
|
689
|
-
disconnectServer(serverName: string): Promise<void>;
|
|
690
|
-
/**
|
|
691
|
-
* Disconnect from all servers
|
|
692
|
-
*/
|
|
693
|
-
disconnectAll(): Promise<void>;
|
|
694
|
-
/**
|
|
695
|
-
* Check if a server is connected
|
|
696
|
-
*/
|
|
697
|
-
isConnected(serverName: string): boolean;
|
|
698
|
-
}
|
|
699
|
-
//#endregion
|
|
700
707
|
//#region src/services/DefinitionsCacheService.d.ts
|
|
701
708
|
interface DefinitionsCacheServiceOptions {
|
|
702
709
|
cacheData?: DefinitionsCacheFile;
|
|
@@ -1115,21 +1122,29 @@ declare class UseToolTool implements Tool<UseToolToolInput> {
|
|
|
1115
1122
|
/**
|
|
1116
1123
|
* HTTP transport handler using Streamable HTTP (protocol version 2025-03-26)
|
|
1117
1124
|
* Provides stateful session management with resumability support
|
|
1125
|
+
*
|
|
1126
|
+
* Uses a hybrid server architecture:
|
|
1127
|
+
* - Raw Node.js createServer for /mcp routes (MCP SDK needs native req/res)
|
|
1128
|
+
* - Hono for REST routes (/health, /admin/shutdown)
|
|
1118
1129
|
*/
|
|
1119
1130
|
declare class HttpTransportHandler implements HttpTransportHandler$1 {
|
|
1120
1131
|
private serverFactory;
|
|
1121
|
-
private
|
|
1132
|
+
private honoApp;
|
|
1122
1133
|
private server;
|
|
1123
1134
|
private sessionManager;
|
|
1124
1135
|
private config;
|
|
1125
1136
|
private adminOptions?;
|
|
1126
1137
|
private adminRateLimiter;
|
|
1127
1138
|
private logger;
|
|
1128
|
-
constructor(serverFactory: (
|
|
1129
|
-
private
|
|
1130
|
-
private setupRoutes;
|
|
1139
|
+
constructor(serverFactory: () => Server | Promise<Server>, config: TransportConfig, adminOptions?: HttpTransportAdminOptions, logger?: LoggerLike);
|
|
1140
|
+
private setupHonoRoutes;
|
|
1131
1141
|
private isAuthorizedShutdownRequest;
|
|
1132
1142
|
private handleAdminShutdownRequest;
|
|
1143
|
+
/**
|
|
1144
|
+
* Handle MCP protocol requests (POST/GET/DELETE /mcp)
|
|
1145
|
+
* Uses raw Node.js req/res as required by MCP SDK
|
|
1146
|
+
*/
|
|
1147
|
+
private handleMcpRequest;
|
|
1133
1148
|
private handlePostRequest;
|
|
1134
1149
|
private handleGetRequest;
|
|
1135
1150
|
private handleDeleteRequest;
|
|
@@ -1147,14 +1162,13 @@ declare class HttpTransportHandler implements HttpTransportHandler$1 {
|
|
|
1147
1162
|
*/
|
|
1148
1163
|
declare class SseTransportHandler implements HttpTransportHandler$1 {
|
|
1149
1164
|
private serverFactory;
|
|
1150
|
-
private
|
|
1165
|
+
private honoApp;
|
|
1151
1166
|
private server;
|
|
1152
1167
|
private sessionManager;
|
|
1153
1168
|
private config;
|
|
1154
1169
|
private logger;
|
|
1155
1170
|
constructor(serverFactory: Server | (() => Server), config: TransportConfig, logger?: LoggerLike);
|
|
1156
|
-
private
|
|
1157
|
-
private setupRoutes;
|
|
1171
|
+
private setupHonoRoutes;
|
|
1158
1172
|
private handleSseConnection;
|
|
1159
1173
|
private handlePostMessage;
|
|
1160
1174
|
start(): Promise<void>;
|
package/dist/index.d.mts
CHANGED
|
@@ -51,7 +51,7 @@ type TransportMode = (typeof TRANSPORT_MODE)[keyof typeof TRANSPORT_MODE];
|
|
|
51
51
|
*/
|
|
52
52
|
interface TransportConfig {
|
|
53
53
|
mode: TransportMode;
|
|
54
|
-
port
|
|
54
|
+
port: number;
|
|
55
55
|
host?: string;
|
|
56
56
|
}
|
|
57
57
|
/**
|
|
@@ -261,6 +261,11 @@ interface PromptConfig {
|
|
|
261
261
|
*/
|
|
262
262
|
interface RemoteMcpConfiguration {
|
|
263
263
|
id?: string;
|
|
264
|
+
proxy?: {
|
|
265
|
+
type?: string;
|
|
266
|
+
port?: number;
|
|
267
|
+
host?: string;
|
|
268
|
+
};
|
|
264
269
|
mcpServers: Record<string, McpServerConfig>;
|
|
265
270
|
skills?: SkillsConfig;
|
|
266
271
|
}
|
|
@@ -516,6 +521,62 @@ declare class ConfigFetcherService {
|
|
|
516
521
|
isCacheValid(): boolean;
|
|
517
522
|
}
|
|
518
523
|
//#endregion
|
|
524
|
+
//#region src/services/McpClientManagerService.d.ts
|
|
525
|
+
/**
|
|
526
|
+
* Service for managing MCP client connections to remote servers
|
|
527
|
+
*/
|
|
528
|
+
declare class McpClientManagerService {
|
|
529
|
+
private clients;
|
|
530
|
+
private serverConfigs;
|
|
531
|
+
private connectionPromises;
|
|
532
|
+
private logger;
|
|
533
|
+
constructor(logger?: LoggerLike);
|
|
534
|
+
/**
|
|
535
|
+
* Kill all stdio MCP server child processes.
|
|
536
|
+
* Sends SIGTERM first, then SIGKILL after 1s if the process hasn't exited.
|
|
537
|
+
* Must be called by the owner (e.g. transport/command layer) during shutdown.
|
|
538
|
+
* Awaiting the returned promise ensures force-kill timers complete before process.exit().
|
|
539
|
+
*/
|
|
540
|
+
cleanupChildProcesses(): Promise<void>;
|
|
541
|
+
/**
|
|
542
|
+
* Connect to an MCP server based on its configuration with timeout
|
|
543
|
+
* Uses the timeout from server config, falling back to default (30s)
|
|
544
|
+
*/
|
|
545
|
+
connectToServer(serverName: string, config: McpServerConfig): Promise<void>;
|
|
546
|
+
registerServerConfigs(configs: Record<string, McpServerConfig>): void;
|
|
547
|
+
getKnownServerNames(): string[];
|
|
548
|
+
getServerRequestTimeout(serverName: string): number | undefined;
|
|
549
|
+
ensureConnected(serverName: string): Promise<McpClientConnection>;
|
|
550
|
+
private createConnection;
|
|
551
|
+
/**
|
|
552
|
+
* Perform the actual connection to MCP server
|
|
553
|
+
*/
|
|
554
|
+
private performConnection;
|
|
555
|
+
private connectStdioClient;
|
|
556
|
+
private connectHttpClient;
|
|
557
|
+
private connectSseClient;
|
|
558
|
+
/**
|
|
559
|
+
* Get a connected client by server name
|
|
560
|
+
*/
|
|
561
|
+
getClient(serverName: string): McpClientConnection | undefined;
|
|
562
|
+
/**
|
|
563
|
+
* Get all connected clients
|
|
564
|
+
*/
|
|
565
|
+
getAllClients(): McpClientConnection[];
|
|
566
|
+
/**
|
|
567
|
+
* Disconnect from a specific server
|
|
568
|
+
*/
|
|
569
|
+
disconnectServer(serverName: string): Promise<void>;
|
|
570
|
+
/**
|
|
571
|
+
* Disconnect from all servers
|
|
572
|
+
*/
|
|
573
|
+
disconnectAll(): Promise<void>;
|
|
574
|
+
/**
|
|
575
|
+
* Check if a server is connected
|
|
576
|
+
*/
|
|
577
|
+
isConnected(serverName: string): boolean;
|
|
578
|
+
}
|
|
579
|
+
//#endregion
|
|
519
580
|
//#region src/services/SkillService.d.ts
|
|
520
581
|
/**
|
|
521
582
|
* Service for loading and managing skills from configured skill directories.
|
|
@@ -644,60 +705,6 @@ declare class SkillService {
|
|
|
644
705
|
private loadSkillFile;
|
|
645
706
|
}
|
|
646
707
|
//#endregion
|
|
647
|
-
//#region src/services/McpClientManagerService.d.ts
|
|
648
|
-
/**
|
|
649
|
-
* Service for managing MCP client connections to remote servers
|
|
650
|
-
*/
|
|
651
|
-
declare class McpClientManagerService {
|
|
652
|
-
private clients;
|
|
653
|
-
private serverConfigs;
|
|
654
|
-
private connectionPromises;
|
|
655
|
-
private logger;
|
|
656
|
-
constructor(logger?: LoggerLike);
|
|
657
|
-
/**
|
|
658
|
-
* Synchronously kill all stdio MCP server child processes.
|
|
659
|
-
* Must be called by the owner (e.g. transport/command layer) during shutdown.
|
|
660
|
-
*/
|
|
661
|
-
cleanupChildProcesses(): void;
|
|
662
|
-
/**
|
|
663
|
-
* Connect to an MCP server based on its configuration with timeout
|
|
664
|
-
* Uses the timeout from server config, falling back to default (30s)
|
|
665
|
-
*/
|
|
666
|
-
connectToServer(serverName: string, config: McpServerConfig): Promise<void>;
|
|
667
|
-
registerServerConfigs(configs: Record<string, McpServerConfig>): void;
|
|
668
|
-
getKnownServerNames(): string[];
|
|
669
|
-
getServerRequestTimeout(serverName: string): number | undefined;
|
|
670
|
-
ensureConnected(serverName: string): Promise<McpClientConnection>;
|
|
671
|
-
private createConnection;
|
|
672
|
-
/**
|
|
673
|
-
* Perform the actual connection to MCP server
|
|
674
|
-
*/
|
|
675
|
-
private performConnection;
|
|
676
|
-
private connectStdioClient;
|
|
677
|
-
private connectHttpClient;
|
|
678
|
-
private connectSseClient;
|
|
679
|
-
/**
|
|
680
|
-
* Get a connected client by server name
|
|
681
|
-
*/
|
|
682
|
-
getClient(serverName: string): McpClientConnection | undefined;
|
|
683
|
-
/**
|
|
684
|
-
* Get all connected clients
|
|
685
|
-
*/
|
|
686
|
-
getAllClients(): McpClientConnection[];
|
|
687
|
-
/**
|
|
688
|
-
* Disconnect from a specific server
|
|
689
|
-
*/
|
|
690
|
-
disconnectServer(serverName: string): Promise<void>;
|
|
691
|
-
/**
|
|
692
|
-
* Disconnect from all servers
|
|
693
|
-
*/
|
|
694
|
-
disconnectAll(): Promise<void>;
|
|
695
|
-
/**
|
|
696
|
-
* Check if a server is connected
|
|
697
|
-
*/
|
|
698
|
-
isConnected(serverName: string): boolean;
|
|
699
|
-
}
|
|
700
|
-
//#endregion
|
|
701
708
|
//#region src/services/DefinitionsCacheService.d.ts
|
|
702
709
|
interface DefinitionsCacheServiceOptions {
|
|
703
710
|
cacheData?: DefinitionsCacheFile;
|
|
@@ -1116,21 +1123,29 @@ declare class UseToolTool implements Tool<UseToolToolInput> {
|
|
|
1116
1123
|
/**
|
|
1117
1124
|
* HTTP transport handler using Streamable HTTP (protocol version 2025-03-26)
|
|
1118
1125
|
* Provides stateful session management with resumability support
|
|
1126
|
+
*
|
|
1127
|
+
* Uses a hybrid server architecture:
|
|
1128
|
+
* - Raw Node.js createServer for /mcp routes (MCP SDK needs native req/res)
|
|
1129
|
+
* - Hono for REST routes (/health, /admin/shutdown)
|
|
1119
1130
|
*/
|
|
1120
1131
|
declare class HttpTransportHandler implements HttpTransportHandler$1 {
|
|
1121
1132
|
private serverFactory;
|
|
1122
|
-
private
|
|
1133
|
+
private honoApp;
|
|
1123
1134
|
private server;
|
|
1124
1135
|
private sessionManager;
|
|
1125
1136
|
private config;
|
|
1126
1137
|
private adminOptions?;
|
|
1127
1138
|
private adminRateLimiter;
|
|
1128
1139
|
private logger;
|
|
1129
|
-
constructor(serverFactory: (
|
|
1130
|
-
private
|
|
1131
|
-
private setupRoutes;
|
|
1140
|
+
constructor(serverFactory: () => Server | Promise<Server>, config: TransportConfig, adminOptions?: HttpTransportAdminOptions, logger?: LoggerLike);
|
|
1141
|
+
private setupHonoRoutes;
|
|
1132
1142
|
private isAuthorizedShutdownRequest;
|
|
1133
1143
|
private handleAdminShutdownRequest;
|
|
1144
|
+
/**
|
|
1145
|
+
* Handle MCP protocol requests (POST/GET/DELETE /mcp)
|
|
1146
|
+
* Uses raw Node.js req/res as required by MCP SDK
|
|
1147
|
+
*/
|
|
1148
|
+
private handleMcpRequest;
|
|
1134
1149
|
private handlePostRequest;
|
|
1135
1150
|
private handleGetRequest;
|
|
1136
1151
|
private handleDeleteRequest;
|
|
@@ -1148,14 +1163,13 @@ declare class HttpTransportHandler implements HttpTransportHandler$1 {
|
|
|
1148
1163
|
*/
|
|
1149
1164
|
declare class SseTransportHandler implements HttpTransportHandler$1 {
|
|
1150
1165
|
private serverFactory;
|
|
1151
|
-
private
|
|
1166
|
+
private honoApp;
|
|
1152
1167
|
private server;
|
|
1153
1168
|
private sessionManager;
|
|
1154
1169
|
private config;
|
|
1155
1170
|
private logger;
|
|
1156
1171
|
constructor(serverFactory: Server | (() => Server), config: TransportConfig, logger?: LoggerLike);
|
|
1157
|
-
private
|
|
1158
|
-
private setupRoutes;
|
|
1172
|
+
private setupHonoRoutes;
|
|
1159
1173
|
private handleSseConnection;
|
|
1160
1174
|
private handlePostMessage;
|
|
1161
1175
|
start(): Promise<void>;
|
package/dist/index.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { C as
|
|
1
|
+
import { C as DefinitionsCacheService, E as ConfigFetcherService, S as createProxyLogger, T as findConfigFile, _ as DescribeToolsTool, a as createProxyContainer, b as RuntimeStateService, c as createStdioHttpTransportHandler, d as StdioHttpTransportHandler, f as StdioTransportHandler, g as SearchListToolsTool, h as UseToolTool, i as createHttpTransportHandler, l as createStdioTransportHandler, m as HttpTransportHandler, n as createServer, p as SseTransportHandler, r as createSessionServer, s as createSseTransportHandler, t as TRANSPORT_MODE, u as initializeSharedServices, v as SkillService, w as generateServerId, x as McpClientManagerService, y as StopServerService } from "./src-kgJ-iu3i.mjs";
|
|
2
2
|
|
|
3
3
|
export { ConfigFetcherService, DefinitionsCacheService, DescribeToolsTool, HttpTransportHandler, McpClientManagerService, RuntimeStateService, SearchListToolsTool, SkillService, SseTransportHandler, StdioHttpTransportHandler, StdioTransportHandler, StopServerService, TRANSPORT_MODE, UseToolTool, createHttpTransportHandler, createProxyContainer, createProxyLogger, createServer, createSessionServer, createSseTransportHandler, createStdioHttpTransportHandler, createStdioTransportHandler, findConfigFile, generateServerId, initializeSharedServices };
|