@agimon-ai/mcp-proxy 0.7.3 → 0.8.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/cli.cjs +49 -67
- package/dist/cli.mjs +34 -52
- package/dist/index.cjs +3 -3
- package/dist/index.d.cts +5 -5
- package/dist/index.d.mts +5 -5
- package/dist/index.mjs +2 -3
- package/dist/{src-Y-cyyxaw.mjs → src-Dorvm5bM.mjs} +201 -313
- package/dist/{src-Dp2m9_I_.cjs → src-dZuRf3Wt.cjs} +389 -506
- package/package.json +18 -18
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//#region
|
|
1
|
+
//#region \0rolldown/runtime.js
|
|
2
2
|
var __create = Object.create;
|
|
3
3
|
var __defProp = Object.defineProperty;
|
|
4
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -6,16 +6,12 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
|
6
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
7
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
8
|
var __copyProps = (to, from, except, desc) => {
|
|
9
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
}
|
|
9
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
10
|
+
key = keys[i];
|
|
11
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
12
|
+
get: ((k) => from[k]).bind(null, key),
|
|
13
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
14
|
+
});
|
|
19
15
|
}
|
|
20
16
|
return to;
|
|
21
17
|
};
|
|
@@ -23,11 +19,10 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
23
19
|
value: mod,
|
|
24
20
|
enumerable: true
|
|
25
21
|
}) : target, mod));
|
|
26
|
-
|
|
27
22
|
//#endregion
|
|
28
|
-
let
|
|
29
|
-
let
|
|
30
|
-
let
|
|
23
|
+
let _agimon_ai_foundation_validator = require("@agimon-ai/foundation-validator");
|
|
24
|
+
let _modelcontextprotocol_sdk_server_index_js = require("@modelcontextprotocol/sdk/server/index.js");
|
|
25
|
+
let _modelcontextprotocol_sdk_types_js = require("@modelcontextprotocol/sdk/types.js");
|
|
31
26
|
let zod = require("zod");
|
|
32
27
|
let node_fs = require("node:fs");
|
|
33
28
|
let node_fs_promises = require("node:fs/promises");
|
|
@@ -36,25 +31,23 @@ js_yaml = __toESM(js_yaml);
|
|
|
36
31
|
let node_crypto = require("node:crypto");
|
|
37
32
|
let node_os = require("node:os");
|
|
38
33
|
let node_path = require("node:path");
|
|
39
|
-
let
|
|
40
|
-
let
|
|
41
|
-
let
|
|
42
|
-
let
|
|
43
|
-
let
|
|
34
|
+
let _agimon_ai_log_sink_mcp = require("@agimon-ai/log-sink-mcp");
|
|
35
|
+
let _modelcontextprotocol_sdk_client_index_js = require("@modelcontextprotocol/sdk/client/index.js");
|
|
36
|
+
let _modelcontextprotocol_sdk_client_sse_js = require("@modelcontextprotocol/sdk/client/sse.js");
|
|
37
|
+
let _modelcontextprotocol_sdk_client_stdio_js = require("@modelcontextprotocol/sdk/client/stdio.js");
|
|
38
|
+
let _modelcontextprotocol_sdk_client_streamableHttp_js = require("@modelcontextprotocol/sdk/client/streamableHttp.js");
|
|
44
39
|
let node_child_process = require("node:child_process");
|
|
45
40
|
let liquidjs = require("liquidjs");
|
|
46
41
|
let node_events = require("node:events");
|
|
47
42
|
let node_http = require("node:http");
|
|
48
43
|
let node_util = require("node:util");
|
|
49
|
-
let
|
|
50
|
-
let
|
|
44
|
+
let _hono_node_server = require("@hono/node-server");
|
|
45
|
+
let _modelcontextprotocol_sdk_server_streamableHttp_js = require("@modelcontextprotocol/sdk/server/streamableHttp.js");
|
|
51
46
|
let hono = require("hono");
|
|
52
|
-
let
|
|
53
|
-
let
|
|
54
|
-
|
|
47
|
+
let _modelcontextprotocol_sdk_server_sse_js = require("@modelcontextprotocol/sdk/server/sse.js");
|
|
48
|
+
let _modelcontextprotocol_sdk_server_stdio_js = require("@modelcontextprotocol/sdk/server/stdio.js");
|
|
55
49
|
//#region package.json
|
|
56
|
-
var version = "0.7.
|
|
57
|
-
|
|
50
|
+
var version = "0.7.3";
|
|
58
51
|
//#endregion
|
|
59
52
|
//#region src/utils/mcpConfigSchema.ts
|
|
60
53
|
/**
|
|
@@ -449,7 +442,6 @@ function parseMcpConfig(rawConfig) {
|
|
|
449
442
|
const internalConfig = transformClaudeCodeConfig(ClaudeCodeMcpConfigSchema.parse(rawConfig));
|
|
450
443
|
return InternalMcpConfigSchema.parse(internalConfig);
|
|
451
444
|
}
|
|
452
|
-
|
|
453
445
|
//#endregion
|
|
454
446
|
//#region src/services/RemoteConfigCacheService.ts
|
|
455
447
|
/**
|
|
@@ -676,7 +668,6 @@ var RemoteConfigCacheService = class {
|
|
|
676
668
|
this.writeEnabled = enabled;
|
|
677
669
|
}
|
|
678
670
|
};
|
|
679
|
-
|
|
680
671
|
//#endregion
|
|
681
672
|
//#region src/services/ConfigFetcherService.ts
|
|
682
673
|
/**
|
|
@@ -903,7 +894,6 @@ var ConfigFetcherService = class {
|
|
|
903
894
|
return this.cachedConfig !== null && now - this.lastFetchTime < this.cacheTtlMs;
|
|
904
895
|
}
|
|
905
896
|
};
|
|
906
|
-
|
|
907
897
|
//#endregion
|
|
908
898
|
//#region src/constants/index.ts
|
|
909
899
|
/**
|
|
@@ -923,17 +913,6 @@ const LOG_PREFIX_SKILL_DETECTION = "[skill-detection]";
|
|
|
923
913
|
* Log prefix for general MCP capability discovery messages.
|
|
924
914
|
*/
|
|
925
915
|
const LOG_PREFIX_CAPABILITY_DISCOVERY = "[capability-discovery]";
|
|
926
|
-
/**
|
|
927
|
-
* Prefix for prompt-based skill locations.
|
|
928
|
-
* Format: "prompt:{serverName}:{promptName}"
|
|
929
|
-
*/
|
|
930
|
-
const PROMPT_LOCATION_PREFIX = "prompt:";
|
|
931
|
-
/**
|
|
932
|
-
* Default server ID used when no ID is provided via CLI or config.
|
|
933
|
-
* This fallback is used when auto-generation also fails.
|
|
934
|
-
*/
|
|
935
|
-
const DEFAULT_SERVER_ID = "unknown";
|
|
936
|
-
|
|
937
916
|
//#endregion
|
|
938
917
|
//#region src/utils/findConfigFile.ts
|
|
939
918
|
/**
|
|
@@ -986,7 +965,6 @@ function findConfigFile() {
|
|
|
986
965
|
}
|
|
987
966
|
return null;
|
|
988
967
|
}
|
|
989
|
-
|
|
990
968
|
//#endregion
|
|
991
969
|
//#region src/utils/parseToolName.ts
|
|
992
970
|
/**
|
|
@@ -1008,7 +986,6 @@ function parseToolName(toolName) {
|
|
|
1008
986
|
};
|
|
1009
987
|
return { actualToolName: toolName };
|
|
1010
988
|
}
|
|
1011
|
-
|
|
1012
989
|
//#endregion
|
|
1013
990
|
//#region src/utils/parseFrontMatter.ts
|
|
1014
991
|
/**
|
|
@@ -1142,7 +1119,6 @@ function extractSkillFrontMatter(content) {
|
|
|
1142
1119
|
};
|
|
1143
1120
|
return null;
|
|
1144
1121
|
}
|
|
1145
|
-
|
|
1146
1122
|
//#endregion
|
|
1147
1123
|
//#region src/utils/generateServerId.ts
|
|
1148
1124
|
/**
|
|
@@ -1207,7 +1183,6 @@ function generateServerId(length = DEFAULT_ID_LENGTH) {
|
|
|
1207
1183
|
}
|
|
1208
1184
|
return result;
|
|
1209
1185
|
}
|
|
1210
|
-
|
|
1211
1186
|
//#endregion
|
|
1212
1187
|
//#region src/services/DefinitionsCacheService.ts
|
|
1213
1188
|
/**
|
|
@@ -1506,7 +1481,6 @@ var DefinitionsCacheService = class {
|
|
|
1506
1481
|
return promptSkills;
|
|
1507
1482
|
}
|
|
1508
1483
|
};
|
|
1509
|
-
|
|
1510
1484
|
//#endregion
|
|
1511
1485
|
//#region src/services/logger.ts
|
|
1512
1486
|
function isRecord(value) {
|
|
@@ -1549,7 +1523,7 @@ function createLoggerFacade(handle) {
|
|
|
1549
1523
|
};
|
|
1550
1524
|
}
|
|
1551
1525
|
async function createProxyLogger(options = {}) {
|
|
1552
|
-
return createLoggerFacade(await (0,
|
|
1526
|
+
return createLoggerFacade(await (0, _agimon_ai_log_sink_mcp.createNodeTelemetry)({
|
|
1553
1527
|
env: options.env,
|
|
1554
1528
|
workspaceRoot: options.workspaceRoot,
|
|
1555
1529
|
serviceName: options.serviceName ?? "@agimon-ai/mcp-proxy",
|
|
@@ -1560,7 +1534,6 @@ async function createProxyLogger(options = {}) {
|
|
|
1560
1534
|
maxFileCount: options.maxFileCount
|
|
1561
1535
|
}));
|
|
1562
1536
|
}
|
|
1563
|
-
|
|
1564
1537
|
//#endregion
|
|
1565
1538
|
//#region src/services/McpClientManagerService.ts
|
|
1566
1539
|
/** Default connection timeout in milliseconds (30 seconds) */
|
|
@@ -1632,8 +1605,8 @@ var McpClient = class {
|
|
|
1632
1605
|
this.logger = logger;
|
|
1633
1606
|
this.client = client;
|
|
1634
1607
|
}
|
|
1635
|
-
setChildProcess(process
|
|
1636
|
-
this.childProcess = process
|
|
1608
|
+
setChildProcess(process) {
|
|
1609
|
+
this.childProcess = process;
|
|
1637
1610
|
}
|
|
1638
1611
|
setConnected(connected) {
|
|
1639
1612
|
this.connected = connected;
|
|
@@ -1762,7 +1735,7 @@ var McpClientManagerService = class {
|
|
|
1762
1735
|
if (childProcess && !childProcess.killed) {
|
|
1763
1736
|
this.logger.info(`Killing stdio MCP server: ${serverName} (PID: ${childProcess.pid})`);
|
|
1764
1737
|
childProcess.kill("SIGTERM");
|
|
1765
|
-
killPromises.push(new Promise((resolve
|
|
1738
|
+
killPromises.push(new Promise((resolve) => {
|
|
1766
1739
|
setTimeout(() => {
|
|
1767
1740
|
try {
|
|
1768
1741
|
if (!childProcess.killed) {
|
|
@@ -1770,7 +1743,7 @@ var McpClientManagerService = class {
|
|
|
1770
1743
|
childProcess.kill("SIGKILL");
|
|
1771
1744
|
}
|
|
1772
1745
|
} catch {}
|
|
1773
|
-
resolve
|
|
1746
|
+
resolve();
|
|
1774
1747
|
}, 1e3);
|
|
1775
1748
|
}));
|
|
1776
1749
|
}
|
|
@@ -1813,7 +1786,7 @@ var McpClientManagerService = class {
|
|
|
1813
1786
|
}
|
|
1814
1787
|
async createConnection(serverName, config) {
|
|
1815
1788
|
const timeoutMs = config.timeout ?? DEFAULT_CONNECTION_TIMEOUT_MS;
|
|
1816
|
-
const client = new
|
|
1789
|
+
const client = new _modelcontextprotocol_sdk_client_index_js.Client({
|
|
1817
1790
|
name: "@agimon-ai/mcp-proxy-client",
|
|
1818
1791
|
version: "0.1.0"
|
|
1819
1792
|
}, { capabilities: {} });
|
|
@@ -1828,7 +1801,7 @@ var McpClientManagerService = class {
|
|
|
1828
1801
|
mcpClient.setConnected(true);
|
|
1829
1802
|
if (config.transport === "http" || config.transport === "sse") mcpClient.setReconnectFn(async () => {
|
|
1830
1803
|
try {
|
|
1831
|
-
const newClient = new
|
|
1804
|
+
const newClient = new _modelcontextprotocol_sdk_client_index_js.Client({
|
|
1832
1805
|
name: "@agimon-ai/mcp-proxy-client",
|
|
1833
1806
|
version: "0.1.0"
|
|
1834
1807
|
}, { capabilities: {} });
|
|
@@ -1863,7 +1836,7 @@ var McpClientManagerService = class {
|
|
|
1863
1836
|
else throw new Error(`Unsupported transport type: ${config.transport}`);
|
|
1864
1837
|
}
|
|
1865
1838
|
async connectStdioClient(mcpClient, config) {
|
|
1866
|
-
const transport = new
|
|
1839
|
+
const transport = new _modelcontextprotocol_sdk_client_stdio_js.StdioClientTransport({
|
|
1867
1840
|
command: config.command,
|
|
1868
1841
|
args: config.args,
|
|
1869
1842
|
env: {
|
|
@@ -1876,11 +1849,11 @@ var McpClientManagerService = class {
|
|
|
1876
1849
|
if (childProcess) mcpClient.setChildProcess(childProcess);
|
|
1877
1850
|
}
|
|
1878
1851
|
async connectHttpClient(mcpClient, config) {
|
|
1879
|
-
const transport = new
|
|
1852
|
+
const transport = new _modelcontextprotocol_sdk_client_streamableHttp_js.StreamableHTTPClientTransport(new URL(config.url), { requestInit: config.headers ? { headers: config.headers } : void 0 });
|
|
1880
1853
|
await mcpClient["client"].connect(transport);
|
|
1881
1854
|
}
|
|
1882
1855
|
async connectSseClient(mcpClient, config) {
|
|
1883
|
-
const transport = new
|
|
1856
|
+
const transport = new _modelcontextprotocol_sdk_client_sse_js.SSEClientTransport(new URL(config.url));
|
|
1884
1857
|
await mcpClient["client"].connect(transport);
|
|
1885
1858
|
}
|
|
1886
1859
|
/**
|
|
@@ -1921,7 +1894,6 @@ var McpClientManagerService = class {
|
|
|
1921
1894
|
return this.clients.has(serverName);
|
|
1922
1895
|
}
|
|
1923
1896
|
};
|
|
1924
|
-
|
|
1925
1897
|
//#endregion
|
|
1926
1898
|
//#region src/services/RuntimeStateService.ts
|
|
1927
1899
|
/**
|
|
@@ -2023,24 +1995,10 @@ var RuntimeStateService = class RuntimeStateService {
|
|
|
2023
1995
|
await (0, node_fs_promises.rm)(this.getRecordPath(serverId), { force: true });
|
|
2024
1996
|
}
|
|
2025
1997
|
};
|
|
2026
|
-
|
|
2027
|
-
//#endregion
|
|
2028
|
-
//#region src/services/StopServerService/constants.ts
|
|
2029
|
-
/**
|
|
2030
|
-
* StopServerService constants.
|
|
2031
|
-
*/
|
|
2032
|
-
/** Maximum time in milliseconds to wait for a shutdown to complete. */
|
|
2033
|
-
const DEFAULT_STOP_TIMEOUT_MS = 5e3;
|
|
2034
|
-
/** Minimum timeout in milliseconds for individual health check requests. */
|
|
2035
|
-
const HEALTH_REQUEST_TIMEOUT_FLOOR_MS = 250;
|
|
2036
|
-
/** Delay in milliseconds between shutdown polling attempts. */
|
|
2037
|
-
const SHUTDOWN_POLL_INTERVAL_MS = 200;
|
|
2038
1998
|
/** Path for the runtime health check endpoint. */
|
|
2039
1999
|
const HEALTH_CHECK_PATH = "/health";
|
|
2040
2000
|
/** Path for the authenticated admin shutdown endpoint. */
|
|
2041
2001
|
const ADMIN_SHUTDOWN_PATH = "/admin/shutdown";
|
|
2042
|
-
/** HTTP GET method identifier. */
|
|
2043
|
-
const HTTP_METHOD_GET = "GET";
|
|
2044
2002
|
/** HTTP POST method identifier. */
|
|
2045
2003
|
const HTTP_METHOD_POST = "POST";
|
|
2046
2004
|
/** HTTP header name for bearer token authorization. */
|
|
@@ -2049,35 +2007,12 @@ const AUTHORIZATION_HEADER_NAME = "Authorization";
|
|
|
2049
2007
|
const BEARER_TOKEN_PREFIX = "Bearer ";
|
|
2050
2008
|
/** HTTP protocol scheme prefix for URL construction. */
|
|
2051
2009
|
const HTTP_PROTOCOL = "http://";
|
|
2052
|
-
/** Separator between host and port in URL construction. */
|
|
2053
|
-
const URL_PORT_SEPARATOR = ":";
|
|
2054
|
-
/** Loopback hostname. */
|
|
2055
|
-
const LOOPBACK_HOST_LOCALHOST = "localhost";
|
|
2056
|
-
/** IPv4 loopback address. */
|
|
2057
|
-
const LOOPBACK_HOST_IPV4 = "127.0.0.1";
|
|
2058
|
-
/** IPv6 loopback address. */
|
|
2059
|
-
const LOOPBACK_HOST_IPV6 = "::1";
|
|
2060
2010
|
/** Hosts that are safe to send admin requests to (loopback only). */
|
|
2061
2011
|
const ALLOWED_HOSTS = new Set([
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2012
|
+
"localhost",
|
|
2013
|
+
"127.0.0.1",
|
|
2014
|
+
"::1"
|
|
2065
2015
|
]);
|
|
2066
|
-
/** Expected status value in a healthy runtime response. */
|
|
2067
|
-
const HEALTH_STATUS_OK = "ok";
|
|
2068
|
-
/** Expected transport value in a healthy runtime response. */
|
|
2069
|
-
const HEALTH_TRANSPORT_HTTP = "http";
|
|
2070
|
-
/** Property key for status field in health responses. */
|
|
2071
|
-
const KEY_STATUS = "status";
|
|
2072
|
-
/** Property key for transport field in health responses. */
|
|
2073
|
-
const KEY_TRANSPORT = "transport";
|
|
2074
|
-
/** Property key for serverId field in runtime responses. */
|
|
2075
|
-
const KEY_SERVER_ID = "serverId";
|
|
2076
|
-
/** Property key for ok field in shutdown responses. */
|
|
2077
|
-
const KEY_OK = "ok";
|
|
2078
|
-
/** Property key for message field in shutdown responses. */
|
|
2079
|
-
const KEY_MESSAGE = "message";
|
|
2080
|
-
|
|
2081
2016
|
//#endregion
|
|
2082
2017
|
//#region src/services/StopServerService/types.ts
|
|
2083
2018
|
/**
|
|
@@ -2096,7 +2031,7 @@ function toRecord(value) {
|
|
|
2096
2031
|
function isHealthResponse(value) {
|
|
2097
2032
|
if (typeof value !== "object" || value === null) return false;
|
|
2098
2033
|
const record = toRecord(value);
|
|
2099
|
-
return
|
|
2034
|
+
return "status" in record && record["status"] === "ok" && "transport" in record && record["transport"] === "http" && (!("serverId" in record) || record["serverId"] === void 0 || typeof record["serverId"] === "string");
|
|
2100
2035
|
}
|
|
2101
2036
|
/**
|
|
2102
2037
|
* Type guard for shutdown responses.
|
|
@@ -2106,9 +2041,8 @@ function isHealthResponse(value) {
|
|
|
2106
2041
|
function isShutdownResponse(value) {
|
|
2107
2042
|
if (typeof value !== "object" || value === null) return false;
|
|
2108
2043
|
const record = toRecord(value);
|
|
2109
|
-
return
|
|
2044
|
+
return "ok" in record && typeof record["ok"] === "boolean" && "message" in record && typeof record["message"] === "string" && (!("serverId" in record) || record["serverId"] === void 0 || typeof record["serverId"] === "string");
|
|
2110
2045
|
}
|
|
2111
|
-
|
|
2112
2046
|
//#endregion
|
|
2113
2047
|
//#region src/services/StopServerService/StopServerService.ts
|
|
2114
2048
|
/**
|
|
@@ -2120,14 +2054,14 @@ function isShutdownResponse(value) {
|
|
|
2120
2054
|
*/
|
|
2121
2055
|
function buildRuntimeUrl(runtime, path) {
|
|
2122
2056
|
if (!ALLOWED_HOSTS.has(runtime.host)) throw new Error(`Refusing to connect to non-loopback host '${runtime.host}'. Only ${Array.from(ALLOWED_HOSTS).join(", ")} are allowed.`);
|
|
2123
|
-
return `${HTTP_PROTOCOL}${runtime.host}
|
|
2057
|
+
return `${HTTP_PROTOCOL}${runtime.host}:${runtime.port}${path}`;
|
|
2124
2058
|
}
|
|
2125
2059
|
function toErrorMessage$1(error) {
|
|
2126
2060
|
return error instanceof Error ? error.message : String(error);
|
|
2127
2061
|
}
|
|
2128
2062
|
function sleep(delayMs) {
|
|
2129
|
-
return new Promise((resolve
|
|
2130
|
-
setTimeout(resolve
|
|
2063
|
+
return new Promise((resolve) => {
|
|
2064
|
+
setTimeout(resolve, delayMs);
|
|
2131
2065
|
});
|
|
2132
2066
|
}
|
|
2133
2067
|
/**
|
|
@@ -2146,7 +2080,7 @@ var StopServerService = class {
|
|
|
2146
2080
|
* @returns Stop result payload
|
|
2147
2081
|
*/
|
|
2148
2082
|
async stop(request) {
|
|
2149
|
-
const timeoutMs = request.timeoutMs ??
|
|
2083
|
+
const timeoutMs = request.timeoutMs ?? 5e3;
|
|
2150
2084
|
const runtime = await this.resolveRuntime(request);
|
|
2151
2085
|
const health = await this.fetchHealth(runtime, timeoutMs);
|
|
2152
2086
|
if (!health.reachable) {
|
|
@@ -2192,7 +2126,7 @@ var StopServerService = class {
|
|
|
2192
2126
|
*/
|
|
2193
2127
|
async fetchHealth(runtime, timeoutMs) {
|
|
2194
2128
|
try {
|
|
2195
|
-
const response = await this.fetchWithTimeout(buildRuntimeUrl(runtime, HEALTH_CHECK_PATH), { method:
|
|
2129
|
+
const response = await this.fetchWithTimeout(buildRuntimeUrl(runtime, HEALTH_CHECK_PATH), { method: "GET" }, timeoutMs);
|
|
2196
2130
|
if (!response.ok) return { reachable: false };
|
|
2197
2131
|
const payload = await response.json();
|
|
2198
2132
|
if (!isHealthResponse(payload)) throw new Error("Received invalid health response payload.");
|
|
@@ -2231,8 +2165,8 @@ var StopServerService = class {
|
|
|
2231
2165
|
async waitForShutdown(runtime, timeoutMs) {
|
|
2232
2166
|
const deadline = Date.now() + timeoutMs;
|
|
2233
2167
|
while (Date.now() < deadline) {
|
|
2234
|
-
if (!(await this.fetchHealth(runtime, Math.max(
|
|
2235
|
-
await sleep(
|
|
2168
|
+
if (!(await this.fetchHealth(runtime, Math.max(250, deadline - Date.now()))).reachable) return;
|
|
2169
|
+
await sleep(200);
|
|
2236
2170
|
}
|
|
2237
2171
|
throw new Error(`Timed out waiting for runtime '${runtime.serverId}' to stop at http://${runtime.host}:${runtime.port}.`);
|
|
2238
2172
|
}
|
|
@@ -2260,7 +2194,6 @@ var StopServerService = class {
|
|
|
2260
2194
|
}
|
|
2261
2195
|
}
|
|
2262
2196
|
};
|
|
2263
|
-
|
|
2264
2197
|
//#endregion
|
|
2265
2198
|
//#region src/services/SkillService.ts
|
|
2266
2199
|
/**
|
|
@@ -2617,54 +2550,14 @@ var SkillService = class {
|
|
|
2617
2550
|
};
|
|
2618
2551
|
}
|
|
2619
2552
|
};
|
|
2620
|
-
|
|
2621
|
-
//#endregion
|
|
2622
|
-
//#region src/services/PrefetchService/constants.ts
|
|
2623
|
-
/**
|
|
2624
|
-
* PrefetchService Constants
|
|
2625
|
-
*
|
|
2626
|
-
* Constants for package manager commands and process configuration.
|
|
2627
|
-
*/
|
|
2628
|
-
/** Transport type for stdio-based MCP servers */
|
|
2629
|
-
const TRANSPORT_STDIO = "stdio";
|
|
2630
|
-
/** npx command name */
|
|
2631
|
-
const COMMAND_NPX = "npx";
|
|
2632
|
-
/** npm command name */
|
|
2633
|
-
const COMMAND_NPM = "npm";
|
|
2634
2553
|
/** pnpx command name (pnpm's npx equivalent) */
|
|
2635
2554
|
const COMMAND_PNPX = "pnpx";
|
|
2636
2555
|
/** pnpm command name */
|
|
2637
2556
|
const COMMAND_PNPM = "pnpm";
|
|
2638
|
-
/** uvx command name */
|
|
2639
|
-
const COMMAND_UVX = "uvx";
|
|
2640
|
-
/** uv command name */
|
|
2641
|
-
const COMMAND_UV = "uv";
|
|
2642
|
-
/** Path suffix for npx command */
|
|
2643
|
-
const COMMAND_NPX_SUFFIX = "/npx";
|
|
2644
|
-
/** Path suffix for pnpx command */
|
|
2645
|
-
const COMMAND_PNPX_SUFFIX = "/pnpx";
|
|
2646
|
-
/** Path suffix for uvx command */
|
|
2647
|
-
const COMMAND_UVX_SUFFIX = "/uvx";
|
|
2648
|
-
/** Path suffix for uv command */
|
|
2649
|
-
const COMMAND_UV_SUFFIX = "/uv";
|
|
2650
|
-
/** Run subcommand for uv */
|
|
2651
|
-
const ARG_RUN = "run";
|
|
2652
2557
|
/** Tool subcommand for uv */
|
|
2653
2558
|
const ARG_TOOL = "tool";
|
|
2654
2559
|
/** Install subcommand for uv tool and npm/pnpm */
|
|
2655
2560
|
const ARG_INSTALL = "install";
|
|
2656
|
-
/** Add subcommand for pnpm */
|
|
2657
|
-
const ARG_ADD = "add";
|
|
2658
|
-
/** Global flag for npm/pnpm install */
|
|
2659
|
-
const ARG_GLOBAL = "-g";
|
|
2660
|
-
/** Flag prefix for command arguments */
|
|
2661
|
-
const FLAG_PREFIX = "-";
|
|
2662
|
-
/** npx --package flag (long form) */
|
|
2663
|
-
const FLAG_PACKAGE_LONG = "--package";
|
|
2664
|
-
/** npx -p flag (short form) */
|
|
2665
|
-
const FLAG_PACKAGE_SHORT = "-p";
|
|
2666
|
-
/** Equals delimiter used in flag=value patterns */
|
|
2667
|
-
const EQUALS_DELIMITER = "=";
|
|
2668
2561
|
/**
|
|
2669
2562
|
* Regex pattern for valid package names (npm, pnpm, uvx, uv)
|
|
2670
2563
|
* Allows: @scope/package-name@version, package-name, package_name
|
|
@@ -2676,13 +2569,10 @@ const EQUALS_DELIMITER = "=";
|
|
|
2676
2569
|
const VALID_PACKAGE_NAME_PATTERN = /^(@[a-zA-Z0-9_-]+\/)?[a-zA-Z0-9._-]+(@[a-zA-Z0-9._-]+)?$/;
|
|
2677
2570
|
/** Windows platform identifier */
|
|
2678
2571
|
const PLATFORM_WIN32 = "win32";
|
|
2679
|
-
/** Success exit code */
|
|
2680
|
-
const EXIT_CODE_SUCCESS = 0;
|
|
2681
2572
|
/** Stdio option to ignore stream */
|
|
2682
2573
|
const STDIO_IGNORE = "ignore";
|
|
2683
2574
|
/** Stdio option to pipe stream */
|
|
2684
2575
|
const STDIO_PIPE = "pipe";
|
|
2685
|
-
|
|
2686
2576
|
//#endregion
|
|
2687
2577
|
//#region src/services/PrefetchService/PrefetchService.ts
|
|
2688
2578
|
/**
|
|
@@ -2742,7 +2632,7 @@ var PrefetchService = class {
|
|
|
2742
2632
|
const { mcpConfig, filter } = this.config;
|
|
2743
2633
|
for (const [serverName, serverConfig] of Object.entries(mcpConfig.mcpServers)) {
|
|
2744
2634
|
if (serverConfig.disabled) continue;
|
|
2745
|
-
if (serverConfig.transport !==
|
|
2635
|
+
if (serverConfig.transport !== "stdio") continue;
|
|
2746
2636
|
if (!isMcpStdioConfig(serverConfig.config)) continue;
|
|
2747
2637
|
const packageInfo = this.extractPackageInfo(serverName, serverConfig.config);
|
|
2748
2638
|
if (packageInfo) {
|
|
@@ -2831,21 +2721,21 @@ var PrefetchService = class {
|
|
|
2831
2721
|
extractPackageInfo(serverName, config) {
|
|
2832
2722
|
const command = config.command.toLowerCase();
|
|
2833
2723
|
const args = config.args || [];
|
|
2834
|
-
if (command ===
|
|
2724
|
+
if (command === "npx" || command.endsWith("/npx")) {
|
|
2835
2725
|
const packageName = this.extractNpxPackage(args);
|
|
2836
2726
|
if (packageName && this.isValidPackageName(packageName)) return {
|
|
2837
2727
|
serverName,
|
|
2838
|
-
packageManager:
|
|
2728
|
+
packageManager: "npx",
|
|
2839
2729
|
packageName,
|
|
2840
2730
|
fullCommand: [
|
|
2841
|
-
|
|
2731
|
+
"npm",
|
|
2842
2732
|
ARG_INSTALL,
|
|
2843
|
-
|
|
2733
|
+
"-g",
|
|
2844
2734
|
packageName
|
|
2845
2735
|
]
|
|
2846
2736
|
};
|
|
2847
2737
|
}
|
|
2848
|
-
if (command ===
|
|
2738
|
+
if (command === "pnpx" || command.endsWith("/pnpx")) {
|
|
2849
2739
|
const packageName = this.extractNpxPackage(args);
|
|
2850
2740
|
if (packageName && this.isValidPackageName(packageName)) return {
|
|
2851
2741
|
serverName,
|
|
@@ -2853,29 +2743,29 @@ var PrefetchService = class {
|
|
|
2853
2743
|
packageName,
|
|
2854
2744
|
fullCommand: [
|
|
2855
2745
|
COMMAND_PNPM,
|
|
2856
|
-
|
|
2857
|
-
|
|
2746
|
+
"add",
|
|
2747
|
+
"-g",
|
|
2858
2748
|
packageName
|
|
2859
2749
|
]
|
|
2860
2750
|
};
|
|
2861
2751
|
}
|
|
2862
|
-
if (command ===
|
|
2752
|
+
if (command === "uvx" || command.endsWith("/uvx")) {
|
|
2863
2753
|
const packageName = this.extractUvxPackage(args);
|
|
2864
2754
|
if (packageName && this.isValidPackageName(packageName)) return {
|
|
2865
2755
|
serverName,
|
|
2866
|
-
packageManager:
|
|
2756
|
+
packageManager: "uvx",
|
|
2867
2757
|
packageName,
|
|
2868
|
-
fullCommand: [
|
|
2758
|
+
fullCommand: ["uvx", packageName]
|
|
2869
2759
|
};
|
|
2870
2760
|
}
|
|
2871
|
-
if ((command ===
|
|
2761
|
+
if ((command === "uv" || command.endsWith("/uv")) && args.includes("run")) {
|
|
2872
2762
|
const packageName = this.extractUvRunPackage(args);
|
|
2873
2763
|
if (packageName && this.isValidPackageName(packageName)) return {
|
|
2874
2764
|
serverName,
|
|
2875
|
-
packageManager:
|
|
2765
|
+
packageManager: "uv",
|
|
2876
2766
|
packageName,
|
|
2877
2767
|
fullCommand: [
|
|
2878
|
-
|
|
2768
|
+
"uv",
|
|
2879
2769
|
ARG_TOOL,
|
|
2880
2770
|
ARG_INSTALL,
|
|
2881
2771
|
packageName
|
|
@@ -2902,18 +2792,18 @@ var PrefetchService = class {
|
|
|
2902
2792
|
extractNpxPackage(args) {
|
|
2903
2793
|
for (let i = 0; i < args.length; i++) {
|
|
2904
2794
|
const arg = args[i];
|
|
2905
|
-
if (arg.startsWith(
|
|
2906
|
-
if (arg ===
|
|
2795
|
+
if (arg.startsWith("--package=")) return arg.slice(10) || null;
|
|
2796
|
+
if (arg === "--package" && i + 1 < args.length) {
|
|
2907
2797
|
const nextArg = args[i + 1];
|
|
2908
|
-
if (!nextArg.startsWith(
|
|
2798
|
+
if (!nextArg.startsWith("-")) return nextArg;
|
|
2909
2799
|
}
|
|
2910
|
-
if (arg ===
|
|
2800
|
+
if (arg === "-p" && i + 1 < args.length) {
|
|
2911
2801
|
const nextArg = args[i + 1];
|
|
2912
|
-
if (!nextArg.startsWith(
|
|
2802
|
+
if (!nextArg.startsWith("-")) return nextArg;
|
|
2913
2803
|
}
|
|
2914
2804
|
}
|
|
2915
2805
|
for (const arg of args) {
|
|
2916
|
-
if (arg.startsWith(
|
|
2806
|
+
if (arg.startsWith("-")) continue;
|
|
2917
2807
|
return arg;
|
|
2918
2808
|
}
|
|
2919
2809
|
return null;
|
|
@@ -2930,7 +2820,7 @@ var PrefetchService = class {
|
|
|
2930
2820
|
*/
|
|
2931
2821
|
extractUvxPackage(args) {
|
|
2932
2822
|
for (const arg of args) {
|
|
2933
|
-
if (arg.startsWith(
|
|
2823
|
+
if (arg.startsWith("-")) continue;
|
|
2934
2824
|
return arg;
|
|
2935
2825
|
}
|
|
2936
2826
|
return null;
|
|
@@ -2947,11 +2837,11 @@ var PrefetchService = class {
|
|
|
2947
2837
|
* extractUvRunPackage(['install', 'pkg']) // returns null (no 'run')
|
|
2948
2838
|
*/
|
|
2949
2839
|
extractUvRunPackage(args) {
|
|
2950
|
-
const runIndex = args.indexOf(
|
|
2840
|
+
const runIndex = args.indexOf("run");
|
|
2951
2841
|
if (runIndex === -1) return null;
|
|
2952
2842
|
for (let i = runIndex + 1; i < args.length; i++) {
|
|
2953
2843
|
const arg = args[i];
|
|
2954
|
-
if (arg.startsWith(
|
|
2844
|
+
if (arg.startsWith("-")) continue;
|
|
2955
2845
|
return arg;
|
|
2956
2846
|
}
|
|
2957
2847
|
return null;
|
|
@@ -2963,7 +2853,7 @@ var PrefetchService = class {
|
|
|
2963
2853
|
* @returns Promise with success status and output
|
|
2964
2854
|
*/
|
|
2965
2855
|
runCommand(command, args) {
|
|
2966
|
-
return new Promise((resolve
|
|
2856
|
+
return new Promise((resolve) => {
|
|
2967
2857
|
const proc = (0, node_child_process.spawn)(command, args, {
|
|
2968
2858
|
stdio: [
|
|
2969
2859
|
STDIO_IGNORE,
|
|
@@ -2981,13 +2871,13 @@ var PrefetchService = class {
|
|
|
2981
2871
|
stderr += data.toString();
|
|
2982
2872
|
});
|
|
2983
2873
|
proc.on("close", (code) => {
|
|
2984
|
-
resolve
|
|
2985
|
-
success: code ===
|
|
2874
|
+
resolve({
|
|
2875
|
+
success: code === 0,
|
|
2986
2876
|
output: stdout || stderr
|
|
2987
2877
|
});
|
|
2988
2878
|
});
|
|
2989
2879
|
proc.on("error", (error) => {
|
|
2990
|
-
resolve
|
|
2880
|
+
resolve({
|
|
2991
2881
|
success: false,
|
|
2992
2882
|
output: error.message
|
|
2993
2883
|
});
|
|
@@ -2995,11 +2885,9 @@ var PrefetchService = class {
|
|
|
2995
2885
|
});
|
|
2996
2886
|
}
|
|
2997
2887
|
};
|
|
2998
|
-
|
|
2999
2888
|
//#endregion
|
|
3000
2889
|
//#region src/templates/toolkit-description.liquid?raw
|
|
3001
2890
|
var toolkit_description_default = "<toolkit id=\"{{ serverId }}\">\n<instruction>\nBefore you use any capabilities below, you MUST call this tool with a list of names to learn how to use them properly; this includes:\n- For tools: Arguments schema needed to pass to use_tool\n- For skills: Detailed instructions that will expand when invoked (Prefer to be explored first when relevant)\n\nThis tool is optimized for batch queries - you can request multiple capabilities at once for better performance.\n\nHow to invoke:\n- For MCP tools: Use use_tool with toolName and toolArgs based on the schema\n- For skills: Use this tool with the skill name to get expanded instructions\n</instruction>\n\n<available_capabilities>\n{% for server in servers -%}\n<group original-mcp-server=\"{{ server.name }}\">\n{% if server.instruction -%}\n<group_instruction>{{ server.instruction }}</group_instruction>\n{% endif -%}\n{% if server.omitToolDescription -%}\n{% for toolName in server.toolNames -%}\n<item name=\"{{ toolName }}\"></item>\n{% endfor -%}\n{% else -%}\n{% for tool in server.tools -%}\n<item name=\"{{ tool.displayName }}\"><description>{{ tool.description | default: \"No description\" }}</description></item>\n{% endfor -%}\n{% endif -%}\n</group>\n{% endfor -%}\n{% if skills.size > 0 -%}\n<group name=\"skills\">\n{% for skill in skills -%}\n<item name=\"{{ skill.displayName }}\"><description>{{ skill.description }}</description></item>\n{% endfor -%}\n</group>\n{% endif -%}\n</available_capabilities>\n</toolkit>\n";
|
|
3002
|
-
|
|
3003
2891
|
//#endregion
|
|
3004
2892
|
//#region src/tools/DescribeToolsTool.ts
|
|
3005
2893
|
/**
|
|
@@ -3054,7 +2942,7 @@ var DescribeToolsTool = class DescribeToolsTool {
|
|
|
3054
2942
|
constructor(clientManager, skillService, serverId, definitionsCacheService) {
|
|
3055
2943
|
this.clientManager = clientManager;
|
|
3056
2944
|
this.skillService = skillService;
|
|
3057
|
-
this.serverId = serverId ||
|
|
2945
|
+
this.serverId = serverId || "unknown";
|
|
3058
2946
|
this.definitionsCacheService = definitionsCacheService || new DefinitionsCacheService(clientManager, skillService);
|
|
3059
2947
|
}
|
|
3060
2948
|
/**
|
|
@@ -3170,7 +3058,7 @@ var DescribeToolsTool = class DescribeToolsTool {
|
|
|
3170
3058
|
}).join("\n") || "";
|
|
3171
3059
|
return {
|
|
3172
3060
|
name: promptSkill.skill.name,
|
|
3173
|
-
location: promptSkill.skill.folder ||
|
|
3061
|
+
location: promptSkill.skill.folder || `prompt:${promptSkill.serverName}/${promptSkill.promptName}`,
|
|
3174
3062
|
instructions: formatSkillInstructions(promptSkill.skill.name, rawInstructions)
|
|
3175
3063
|
};
|
|
3176
3064
|
} catch (error) {
|
|
@@ -3286,6 +3174,115 @@ var DescribeToolsTool = class DescribeToolsTool {
|
|
|
3286
3174
|
inputSchema: zod.z.toJSONSchema(DescribeToolsToolInputSchema, { reused: "inline" })
|
|
3287
3175
|
};
|
|
3288
3176
|
}
|
|
3177
|
+
async runLookups(toolNames, serverDefinitions) {
|
|
3178
|
+
const serverToolsMap = /* @__PURE__ */ new Map();
|
|
3179
|
+
const toolToServers = /* @__PURE__ */ new Map();
|
|
3180
|
+
for (const serverDefinition of serverDefinitions) {
|
|
3181
|
+
const typedTools = serverDefinition.tools.map((tool) => ({
|
|
3182
|
+
name: tool.name,
|
|
3183
|
+
description: tool.description,
|
|
3184
|
+
inputSchema: tool.inputSchema
|
|
3185
|
+
}));
|
|
3186
|
+
serverToolsMap.set(serverDefinition.serverName, typedTools);
|
|
3187
|
+
for (const tool of typedTools) {
|
|
3188
|
+
if (!toolToServers.has(tool.name)) toolToServers.set(tool.name, []);
|
|
3189
|
+
toolToServers.get(tool.name)?.push(serverDefinition.serverName);
|
|
3190
|
+
}
|
|
3191
|
+
}
|
|
3192
|
+
const lookupResults = await Promise.all(toolNames.map(async (requestedName) => {
|
|
3193
|
+
const result = {
|
|
3194
|
+
tools: [],
|
|
3195
|
+
skills: [],
|
|
3196
|
+
notFound: null
|
|
3197
|
+
};
|
|
3198
|
+
if (requestedName.startsWith("skill__")) {
|
|
3199
|
+
const skillName = requestedName.slice(7);
|
|
3200
|
+
if (this.skillService) {
|
|
3201
|
+
const skill = await this.skillService.getSkill(skillName);
|
|
3202
|
+
if (skill) {
|
|
3203
|
+
result.skills.push({
|
|
3204
|
+
name: skill.name,
|
|
3205
|
+
location: skill.basePath,
|
|
3206
|
+
instructions: formatSkillInstructions(skill.name, skill.content)
|
|
3207
|
+
});
|
|
3208
|
+
return result;
|
|
3209
|
+
}
|
|
3210
|
+
}
|
|
3211
|
+
const promptSkillContent = await this.getPromptSkillContent(skillName);
|
|
3212
|
+
if (promptSkillContent) {
|
|
3213
|
+
result.skills.push(promptSkillContent);
|
|
3214
|
+
return result;
|
|
3215
|
+
}
|
|
3216
|
+
result.notFound = requestedName;
|
|
3217
|
+
return result;
|
|
3218
|
+
}
|
|
3219
|
+
const { serverName, actualToolName } = parseToolName(requestedName);
|
|
3220
|
+
if (serverName) {
|
|
3221
|
+
const serverTools = serverToolsMap.get(serverName);
|
|
3222
|
+
if (!serverTools) {
|
|
3223
|
+
result.notFound = requestedName;
|
|
3224
|
+
return result;
|
|
3225
|
+
}
|
|
3226
|
+
const tool = serverTools.find((t) => t.name === actualToolName);
|
|
3227
|
+
if (tool) result.tools.push({
|
|
3228
|
+
server: serverName,
|
|
3229
|
+
tool: {
|
|
3230
|
+
name: tool.name,
|
|
3231
|
+
description: tool.description,
|
|
3232
|
+
inputSchema: tool.inputSchema
|
|
3233
|
+
}
|
|
3234
|
+
});
|
|
3235
|
+
else result.notFound = requestedName;
|
|
3236
|
+
return result;
|
|
3237
|
+
}
|
|
3238
|
+
const servers = toolToServers.get(actualToolName);
|
|
3239
|
+
if (!servers || servers.length === 0) {
|
|
3240
|
+
if (this.skillService) {
|
|
3241
|
+
const skill = await this.skillService.getSkill(actualToolName);
|
|
3242
|
+
if (skill) {
|
|
3243
|
+
result.skills.push({
|
|
3244
|
+
name: skill.name,
|
|
3245
|
+
location: skill.basePath,
|
|
3246
|
+
instructions: formatSkillInstructions(skill.name, skill.content)
|
|
3247
|
+
});
|
|
3248
|
+
return result;
|
|
3249
|
+
}
|
|
3250
|
+
}
|
|
3251
|
+
const promptSkillContent = await this.getPromptSkillContent(actualToolName);
|
|
3252
|
+
if (promptSkillContent) {
|
|
3253
|
+
result.skills.push(promptSkillContent);
|
|
3254
|
+
return result;
|
|
3255
|
+
}
|
|
3256
|
+
result.notFound = requestedName;
|
|
3257
|
+
return result;
|
|
3258
|
+
}
|
|
3259
|
+
for (const server of servers) {
|
|
3260
|
+
const tool = serverToolsMap.get(server).find((t) => t.name === actualToolName);
|
|
3261
|
+
result.tools.push({
|
|
3262
|
+
server,
|
|
3263
|
+
tool: {
|
|
3264
|
+
name: tool.name,
|
|
3265
|
+
description: tool.description,
|
|
3266
|
+
inputSchema: tool.inputSchema
|
|
3267
|
+
}
|
|
3268
|
+
});
|
|
3269
|
+
}
|
|
3270
|
+
return result;
|
|
3271
|
+
}));
|
|
3272
|
+
const foundTools = [];
|
|
3273
|
+
const foundSkills = [];
|
|
3274
|
+
const notFoundItems = [];
|
|
3275
|
+
for (const result of lookupResults) {
|
|
3276
|
+
foundTools.push(...result.tools);
|
|
3277
|
+
foundSkills.push(...result.skills);
|
|
3278
|
+
if (result.notFound) notFoundItems.push(result.notFound);
|
|
3279
|
+
}
|
|
3280
|
+
return {
|
|
3281
|
+
foundTools,
|
|
3282
|
+
foundSkills,
|
|
3283
|
+
notFoundItems
|
|
3284
|
+
};
|
|
3285
|
+
}
|
|
3289
3286
|
/**
|
|
3290
3287
|
* Executes tool description lookup for the requested tool and skill names.
|
|
3291
3288
|
*
|
|
@@ -3300,7 +3297,6 @@ var DescribeToolsTool = class DescribeToolsTool {
|
|
|
3300
3297
|
async execute(rawInput) {
|
|
3301
3298
|
try {
|
|
3302
3299
|
const { toolNames } = DescribeToolsToolInputSchema.parse(rawInput);
|
|
3303
|
-
const serverDefinitions = await this.definitionsCacheService.getServerDefinitions();
|
|
3304
3300
|
if (!toolNames || toolNames.length === 0) return {
|
|
3305
3301
|
content: [{
|
|
3306
3302
|
type: "text",
|
|
@@ -3308,119 +3304,13 @@ var DescribeToolsTool = class DescribeToolsTool {
|
|
|
3308
3304
|
}],
|
|
3309
3305
|
isError: true
|
|
3310
3306
|
};
|
|
3311
|
-
|
|
3312
|
-
|
|
3313
|
-
|
|
3314
|
-
|
|
3315
|
-
|
|
3316
|
-
description: tool.description,
|
|
3317
|
-
inputSchema: tool.inputSchema
|
|
3318
|
-
}));
|
|
3319
|
-
serverToolsMap.set(serverDefinition.serverName, typedTools);
|
|
3320
|
-
for (const tool of typedTools) {
|
|
3321
|
-
if (!toolToServers.has(tool.name)) toolToServers.set(tool.name, []);
|
|
3322
|
-
toolToServers.get(tool.name)?.push(serverDefinition.serverName);
|
|
3323
|
-
}
|
|
3324
|
-
}
|
|
3325
|
-
const lookupResults = await Promise.all(toolNames.map(async (requestedName) => {
|
|
3326
|
-
const result$1 = {
|
|
3327
|
-
tools: [],
|
|
3328
|
-
skills: [],
|
|
3329
|
-
notFound: null
|
|
3330
|
-
};
|
|
3331
|
-
if (requestedName.startsWith(SKILL_PREFIX)) {
|
|
3332
|
-
const skillName = requestedName.slice(SKILL_PREFIX.length);
|
|
3333
|
-
if (this.skillService) {
|
|
3334
|
-
const skill = await this.skillService.getSkill(skillName);
|
|
3335
|
-
if (skill) {
|
|
3336
|
-
result$1.skills.push({
|
|
3337
|
-
name: skill.name,
|
|
3338
|
-
location: skill.basePath,
|
|
3339
|
-
instructions: formatSkillInstructions(skill.name, skill.content)
|
|
3340
|
-
});
|
|
3341
|
-
return result$1;
|
|
3342
|
-
}
|
|
3343
|
-
}
|
|
3344
|
-
const promptSkillContent = await this.getPromptSkillContent(skillName);
|
|
3345
|
-
if (promptSkillContent) {
|
|
3346
|
-
result$1.skills.push(promptSkillContent);
|
|
3347
|
-
return result$1;
|
|
3348
|
-
}
|
|
3349
|
-
result$1.notFound = requestedName;
|
|
3350
|
-
return result$1;
|
|
3351
|
-
}
|
|
3352
|
-
const { serverName, actualToolName } = parseToolName(requestedName);
|
|
3353
|
-
if (serverName) {
|
|
3354
|
-
const serverTools = serverToolsMap.get(serverName);
|
|
3355
|
-
if (!serverTools) {
|
|
3356
|
-
result$1.notFound = requestedName;
|
|
3357
|
-
return result$1;
|
|
3358
|
-
}
|
|
3359
|
-
const tool = serverTools.find((t) => t.name === actualToolName);
|
|
3360
|
-
if (tool) result$1.tools.push({
|
|
3361
|
-
server: serverName,
|
|
3362
|
-
tool: {
|
|
3363
|
-
name: tool.name,
|
|
3364
|
-
description: tool.description,
|
|
3365
|
-
inputSchema: tool.inputSchema
|
|
3366
|
-
}
|
|
3367
|
-
});
|
|
3368
|
-
else result$1.notFound = requestedName;
|
|
3369
|
-
return result$1;
|
|
3370
|
-
}
|
|
3371
|
-
const servers = toolToServers.get(actualToolName);
|
|
3372
|
-
if (!servers || servers.length === 0) {
|
|
3373
|
-
if (this.skillService) {
|
|
3374
|
-
const skill = await this.skillService.getSkill(actualToolName);
|
|
3375
|
-
if (skill) {
|
|
3376
|
-
result$1.skills.push({
|
|
3377
|
-
name: skill.name,
|
|
3378
|
-
location: skill.basePath,
|
|
3379
|
-
instructions: formatSkillInstructions(skill.name, skill.content)
|
|
3380
|
-
});
|
|
3381
|
-
return result$1;
|
|
3382
|
-
}
|
|
3383
|
-
}
|
|
3384
|
-
const promptSkillContent = await this.getPromptSkillContent(actualToolName);
|
|
3385
|
-
if (promptSkillContent) {
|
|
3386
|
-
result$1.skills.push(promptSkillContent);
|
|
3387
|
-
return result$1;
|
|
3388
|
-
}
|
|
3389
|
-
result$1.notFound = requestedName;
|
|
3390
|
-
return result$1;
|
|
3391
|
-
}
|
|
3392
|
-
if (servers.length === 1) {
|
|
3393
|
-
const server = servers[0];
|
|
3394
|
-
const tool = serverToolsMap.get(server).find((t) => t.name === actualToolName);
|
|
3395
|
-
result$1.tools.push({
|
|
3396
|
-
server,
|
|
3397
|
-
tool: {
|
|
3398
|
-
name: tool.name,
|
|
3399
|
-
description: tool.description,
|
|
3400
|
-
inputSchema: tool.inputSchema
|
|
3401
|
-
}
|
|
3402
|
-
});
|
|
3403
|
-
} else for (const server of servers) {
|
|
3404
|
-
const tool = serverToolsMap.get(server).find((t) => t.name === actualToolName);
|
|
3405
|
-
result$1.tools.push({
|
|
3406
|
-
server,
|
|
3407
|
-
tool: {
|
|
3408
|
-
name: tool.name,
|
|
3409
|
-
description: tool.description,
|
|
3410
|
-
inputSchema: tool.inputSchema
|
|
3411
|
-
}
|
|
3412
|
-
});
|
|
3413
|
-
}
|
|
3414
|
-
return result$1;
|
|
3415
|
-
}));
|
|
3416
|
-
const foundTools = [];
|
|
3417
|
-
const foundSkills = [];
|
|
3418
|
-
const notFoundItems = [];
|
|
3419
|
-
for (const result$1 of lookupResults) {
|
|
3420
|
-
foundTools.push(...result$1.tools);
|
|
3421
|
-
foundSkills.push(...result$1.skills);
|
|
3422
|
-
if (result$1.notFound) notFoundItems.push(result$1.notFound);
|
|
3307
|
+
let lookup = await this.runLookups(toolNames, await this.definitionsCacheService.getServerDefinitions());
|
|
3308
|
+
if (lookup.notFoundItems.length > 0) {
|
|
3309
|
+
this.definitionsCacheService.clearLiveCache();
|
|
3310
|
+
await this.definitionsCacheService.collectForCache();
|
|
3311
|
+
lookup = await this.runLookups(toolNames, await this.definitionsCacheService.getServerDefinitions());
|
|
3423
3312
|
}
|
|
3313
|
+
const { foundTools, foundSkills, notFoundItems } = lookup;
|
|
3424
3314
|
if (foundTools.length === 0 && foundSkills.length === 0) return {
|
|
3425
3315
|
content: [{
|
|
3426
3316
|
type: "text",
|
|
@@ -3458,7 +3348,6 @@ var DescribeToolsTool = class DescribeToolsTool {
|
|
|
3458
3348
|
}
|
|
3459
3349
|
}
|
|
3460
3350
|
};
|
|
3461
|
-
|
|
3462
3351
|
//#endregion
|
|
3463
3352
|
//#region src/utils/toolCapabilities.ts
|
|
3464
3353
|
const TOOL_CAPABILITIES_META_KEY = "agiflowai/capabilities";
|
|
@@ -3470,7 +3359,6 @@ function getToolCapabilities(tool) {
|
|
|
3470
3359
|
function getUniqueSortedCapabilities(tools) {
|
|
3471
3360
|
return Array.from(new Set(tools.flatMap((tool) => getToolCapabilities(tool)))).sort();
|
|
3472
3361
|
}
|
|
3473
|
-
|
|
3474
3362
|
//#endregion
|
|
3475
3363
|
//#region src/tools/SearchListToolsTool.ts
|
|
3476
3364
|
const SearchListToolsToolInputSchema = zod.z.object({
|
|
@@ -3532,17 +3420,15 @@ var SearchListToolsTool = class SearchListToolsTool {
|
|
|
3532
3420
|
capabilities: getToolCapabilities(tool)
|
|
3533
3421
|
}))
|
|
3534
3422
|
})).filter((server) => server.tools.length > 0);
|
|
3535
|
-
const result = { servers: filteredServers };
|
|
3536
3423
|
return {
|
|
3537
3424
|
content: [{
|
|
3538
3425
|
type: "text",
|
|
3539
|
-
text: JSON.stringify(
|
|
3426
|
+
text: JSON.stringify({ servers: filteredServers }, null, 2)
|
|
3540
3427
|
}],
|
|
3541
3428
|
isError: filteredServers.length === 0 ? true : void 0
|
|
3542
3429
|
};
|
|
3543
3430
|
}
|
|
3544
3431
|
};
|
|
3545
|
-
|
|
3546
3432
|
//#endregion
|
|
3547
3433
|
//#region src/tools/UseToolTool.ts
|
|
3548
3434
|
/**
|
|
@@ -3608,7 +3494,7 @@ var UseToolTool = class UseToolTool {
|
|
|
3608
3494
|
this.clientManager = clientManager;
|
|
3609
3495
|
this.skillService = skillService;
|
|
3610
3496
|
this.definitionsCacheService = definitionsCacheService || new DefinitionsCacheService(clientManager, skillService);
|
|
3611
|
-
this.serverId = serverId ||
|
|
3497
|
+
this.serverId = serverId || "unknown";
|
|
3612
3498
|
}
|
|
3613
3499
|
/**
|
|
3614
3500
|
* Returns the MCP tool definition with name, description, and input schema.
|
|
@@ -3651,7 +3537,7 @@ IMPORTANT: Only use tools discovered from describe_tools with id="${this.serverI
|
|
|
3651
3537
|
async coerceToolArgs(serverName, toolName, toolArgs) {
|
|
3652
3538
|
const jsonSchema = await this.definitionsCacheService.getToolSchema(serverName, toolName);
|
|
3653
3539
|
if (!jsonSchema) return toolArgs;
|
|
3654
|
-
return (0,
|
|
3540
|
+
return (0, _agimon_ai_foundation_validator.coerceArgs)(toolArgs, (0, _agimon_ai_foundation_validator.jsonSchemaToZod)(jsonSchema));
|
|
3655
3541
|
}
|
|
3656
3542
|
executeSkill(skill) {
|
|
3657
3543
|
return { content: [{
|
|
@@ -3701,8 +3587,8 @@ IMPORTANT: Only use tools discovered from describe_tools with id="${this.serverI
|
|
|
3701
3587
|
async execute(rawInput) {
|
|
3702
3588
|
try {
|
|
3703
3589
|
const { toolName: inputToolName, toolArgs = {} } = UseToolToolInputSchema.parse(rawInput);
|
|
3704
|
-
if (inputToolName.startsWith(
|
|
3705
|
-
const skillName = inputToolName.slice(
|
|
3590
|
+
if (inputToolName.startsWith("skill__")) {
|
|
3591
|
+
const skillName = inputToolName.slice(7);
|
|
3706
3592
|
if (this.skillService) {
|
|
3707
3593
|
const skill = await this.skillService.getSkill(skillName);
|
|
3708
3594
|
if (skill) return this.executeSkill(skill);
|
|
@@ -3740,7 +3626,12 @@ IMPORTANT: Only use tools discovered from describe_tools with id="${this.serverI
|
|
|
3740
3626
|
isError: true
|
|
3741
3627
|
};
|
|
3742
3628
|
}
|
|
3743
|
-
|
|
3629
|
+
let matchingServers = await this.definitionsCacheService.getServersForTool(actualToolName);
|
|
3630
|
+
if (matchingServers.length === 0) {
|
|
3631
|
+
this.definitionsCacheService.clearLiveCache();
|
|
3632
|
+
await this.definitionsCacheService.collectForCache();
|
|
3633
|
+
matchingServers = await this.definitionsCacheService.getServersForTool(actualToolName);
|
|
3634
|
+
}
|
|
3744
3635
|
if (matchingServers.length === 0) {
|
|
3745
3636
|
if (this.skillService) {
|
|
3746
3637
|
const skill = await this.skillService.getSkill(actualToolName);
|
|
@@ -3789,7 +3680,6 @@ IMPORTANT: Only use tools discovered from describe_tools with id="${this.serverI
|
|
|
3789
3680
|
}
|
|
3790
3681
|
}
|
|
3791
3682
|
};
|
|
3792
|
-
|
|
3793
3683
|
//#endregion
|
|
3794
3684
|
//#region src/transports/http.ts
|
|
3795
3685
|
/**
|
|
@@ -3931,13 +3821,13 @@ var AdminRateLimiter = class {
|
|
|
3931
3821
|
* Parse JSON body from IncomingMessage
|
|
3932
3822
|
*/
|
|
3933
3823
|
async function parseJsonBody$1(req) {
|
|
3934
|
-
return new Promise((resolve
|
|
3824
|
+
return new Promise((resolve, reject) => {
|
|
3935
3825
|
const chunks = [];
|
|
3936
3826
|
req.on("data", (chunk) => chunks.push(chunk));
|
|
3937
3827
|
req.on("end", () => {
|
|
3938
3828
|
try {
|
|
3939
3829
|
const body = Buffer.concat(chunks).toString("utf-8");
|
|
3940
|
-
resolve
|
|
3830
|
+
resolve(body ? JSON.parse(body) : void 0);
|
|
3941
3831
|
} catch (error) {
|
|
3942
3832
|
reject(/* @__PURE__ */ new Error(`Failed to parse JSON body: ${toErrorMessage(error)}`));
|
|
3943
3833
|
}
|
|
@@ -4025,24 +3915,24 @@ var HttpTransportHandler = class {
|
|
|
4025
3915
|
}
|
|
4026
3916
|
async handleAdminShutdownRequest(c) {
|
|
4027
3917
|
if (!this.adminOptions?.onShutdownRequested) {
|
|
4028
|
-
const payload
|
|
3918
|
+
const payload = {
|
|
4029
3919
|
ok: false,
|
|
4030
3920
|
message: "Shutdown endpoint is not enabled for this server instance.",
|
|
4031
3921
|
serverId: this.adminOptions?.serverId
|
|
4032
3922
|
};
|
|
4033
|
-
return c.json(payload
|
|
3923
|
+
return c.json(payload, 404);
|
|
4034
3924
|
}
|
|
4035
3925
|
const headers = {
|
|
4036
3926
|
authorization: c.req.header("authorization"),
|
|
4037
3927
|
"x-mcp-proxy-shutdown-token": c.req.header("x-mcp-proxy-shutdown-token")
|
|
4038
3928
|
};
|
|
4039
3929
|
if (!this.isAuthorizedShutdownRequest(headers)) {
|
|
4040
|
-
const payload
|
|
3930
|
+
const payload = {
|
|
4041
3931
|
ok: false,
|
|
4042
3932
|
message: "Unauthorized shutdown request: invalid or missing shutdown token.",
|
|
4043
3933
|
serverId: this.adminOptions?.serverId
|
|
4044
3934
|
};
|
|
4045
|
-
return c.json(payload
|
|
3935
|
+
return c.json(payload, 401);
|
|
4046
3936
|
}
|
|
4047
3937
|
const payload = {
|
|
4048
3938
|
ok: true,
|
|
@@ -4084,9 +3974,9 @@ var HttpTransportHandler = class {
|
|
|
4084
3974
|
const body = await parseJsonBody$1(req);
|
|
4085
3975
|
let transport;
|
|
4086
3976
|
if (sessionId && this.sessionManager.hasSession(sessionId)) transport = this.sessionManager.getSession(sessionId).transport;
|
|
4087
|
-
else if (!sessionId && (0,
|
|
3977
|
+
else if (!sessionId && (0, _modelcontextprotocol_sdk_types_js.isInitializeRequest)(body)) {
|
|
4088
3978
|
const mcpServer = await this.serverFactory();
|
|
4089
|
-
transport = new
|
|
3979
|
+
transport = new _modelcontextprotocol_sdk_server_streamableHttp_js.StreamableHTTPServerTransport({
|
|
4090
3980
|
sessionIdGenerator: () => (0, node_crypto.randomUUID)(),
|
|
4091
3981
|
enableJsonResponse: true,
|
|
4092
3982
|
onsessioninitialized: (initializedSessionId) => {
|
|
@@ -4153,7 +4043,7 @@ var HttpTransportHandler = class {
|
|
|
4153
4043
|
}
|
|
4154
4044
|
async start() {
|
|
4155
4045
|
try {
|
|
4156
|
-
const honoHandler = (0,
|
|
4046
|
+
const honoHandler = (0, _hono_node_server.getRequestListener)(this.honoApp.fetch);
|
|
4157
4047
|
const server = (0, node_http.createServer)(async (req, res) => {
|
|
4158
4048
|
if (new URL(req.url ?? "/", `http://${req.headers.host ?? this.config.host}`).pathname === "/mcp") await this.handleMcpRequest(req, res);
|
|
4159
4049
|
else honoHandler(req, res);
|
|
@@ -4198,7 +4088,6 @@ var HttpTransportHandler = class {
|
|
|
4198
4088
|
return this.config.host;
|
|
4199
4089
|
}
|
|
4200
4090
|
};
|
|
4201
|
-
|
|
4202
4091
|
//#endregion
|
|
4203
4092
|
//#region src/transports/sse.ts
|
|
4204
4093
|
/**
|
|
@@ -4268,13 +4157,13 @@ var SseSessionManager = class {
|
|
|
4268
4157
|
* Parse JSON body from IncomingMessage
|
|
4269
4158
|
*/
|
|
4270
4159
|
async function parseJsonBody(req) {
|
|
4271
|
-
return new Promise((resolve
|
|
4160
|
+
return new Promise((resolve, reject) => {
|
|
4272
4161
|
const chunks = [];
|
|
4273
4162
|
req.on("data", (chunk) => chunks.push(chunk));
|
|
4274
4163
|
req.on("end", () => {
|
|
4275
4164
|
try {
|
|
4276
4165
|
const body = Buffer.concat(chunks).toString("utf-8");
|
|
4277
|
-
resolve
|
|
4166
|
+
resolve(body ? JSON.parse(body) : void 0);
|
|
4278
4167
|
} catch (error) {
|
|
4279
4168
|
reject(/* @__PURE__ */ new Error(`Failed to parse JSON body: ${error instanceof Error ? error.message : String(error)}`));
|
|
4280
4169
|
}
|
|
@@ -4317,7 +4206,7 @@ var SseTransportHandler = class {
|
|
|
4317
4206
|
async handleSseConnection(res) {
|
|
4318
4207
|
try {
|
|
4319
4208
|
const mcpServer = this.serverFactory();
|
|
4320
|
-
const transport = new
|
|
4209
|
+
const transport = new _modelcontextprotocol_sdk_server_sse_js.SSEServerTransport("/messages", res);
|
|
4321
4210
|
this.sessionManager.setSession(transport.sessionId, transport, mcpServer);
|
|
4322
4211
|
res.on("close", () => {
|
|
4323
4212
|
const sessionId = transport.sessionId;
|
|
@@ -4358,9 +4247,9 @@ var SseTransportHandler = class {
|
|
|
4358
4247
|
}
|
|
4359
4248
|
}
|
|
4360
4249
|
async start() {
|
|
4361
|
-
return new Promise((resolve
|
|
4250
|
+
return new Promise((resolve, reject) => {
|
|
4362
4251
|
try {
|
|
4363
|
-
const honoHandler = (0,
|
|
4252
|
+
const honoHandler = (0, _hono_node_server.getRequestListener)(this.honoApp.fetch);
|
|
4364
4253
|
const server = (0, node_http.createServer)(async (req, res) => {
|
|
4365
4254
|
const url = new URL(req.url ?? "/", `http://${req.headers.host ?? this.config.host}`);
|
|
4366
4255
|
const method = req.method?.toUpperCase();
|
|
@@ -4373,7 +4262,7 @@ var SseTransportHandler = class {
|
|
|
4373
4262
|
this.logger.info(`SSE endpoint: http://${this.config.host}:${this.config.port}/sse`);
|
|
4374
4263
|
this.logger.info(`Messages endpoint: http://${this.config.host}:${this.config.port}/messages`);
|
|
4375
4264
|
this.logger.info(`Health check: http://${this.config.host}:${this.config.port}/health`);
|
|
4376
|
-
resolve
|
|
4265
|
+
resolve();
|
|
4377
4266
|
});
|
|
4378
4267
|
server.on("error", (error) => {
|
|
4379
4268
|
reject(error);
|
|
@@ -4385,7 +4274,7 @@ var SseTransportHandler = class {
|
|
|
4385
4274
|
});
|
|
4386
4275
|
}
|
|
4387
4276
|
async stop() {
|
|
4388
|
-
return new Promise((resolve
|
|
4277
|
+
return new Promise((resolve, reject) => {
|
|
4389
4278
|
if (this.server) {
|
|
4390
4279
|
const server = this.server;
|
|
4391
4280
|
(async () => {
|
|
@@ -4395,14 +4284,14 @@ var SseTransportHandler = class {
|
|
|
4395
4284
|
if (err) reject(err);
|
|
4396
4285
|
else {
|
|
4397
4286
|
this.server = null;
|
|
4398
|
-
resolve
|
|
4287
|
+
resolve();
|
|
4399
4288
|
}
|
|
4400
4289
|
});
|
|
4401
4290
|
} catch (error) {
|
|
4402
4291
|
reject(error);
|
|
4403
4292
|
}
|
|
4404
4293
|
})();
|
|
4405
|
-
} else resolve
|
|
4294
|
+
} else resolve();
|
|
4406
4295
|
});
|
|
4407
4296
|
}
|
|
4408
4297
|
getPort() {
|
|
@@ -4412,7 +4301,6 @@ var SseTransportHandler = class {
|
|
|
4412
4301
|
return this.config.host;
|
|
4413
4302
|
}
|
|
4414
4303
|
};
|
|
4415
|
-
|
|
4416
4304
|
//#endregion
|
|
4417
4305
|
//#region src/transports/stdio.ts
|
|
4418
4306
|
/**
|
|
@@ -4428,7 +4316,7 @@ var StdioTransportHandler = class {
|
|
|
4428
4316
|
this.logger = logger;
|
|
4429
4317
|
}
|
|
4430
4318
|
async start() {
|
|
4431
|
-
this.transport = new
|
|
4319
|
+
this.transport = new _modelcontextprotocol_sdk_server_stdio_js.StdioServerTransport();
|
|
4432
4320
|
await this.server.connect(this.transport);
|
|
4433
4321
|
this.logger.info("@agimon-ai/mcp-proxy MCP server started on stdio");
|
|
4434
4322
|
}
|
|
@@ -4439,7 +4327,6 @@ var StdioTransportHandler = class {
|
|
|
4439
4327
|
}
|
|
4440
4328
|
}
|
|
4441
4329
|
};
|
|
4442
|
-
|
|
4443
4330
|
//#endregion
|
|
4444
4331
|
//#region src/transports/stdio-http.ts
|
|
4445
4332
|
/**
|
|
@@ -4501,7 +4388,7 @@ var StdioHttpTransportHandler = class {
|
|
|
4501
4388
|
this.httpClient = client;
|
|
4502
4389
|
this.stdioProxyServer = this.createProxyServer();
|
|
4503
4390
|
this.registerElicitationHandler(client);
|
|
4504
|
-
this.stdioTransport = new
|
|
4391
|
+
this.stdioTransport = new _modelcontextprotocol_sdk_server_stdio_js.StdioServerTransport();
|
|
4505
4392
|
await this.stdioProxyServer.connect(this.stdioTransport);
|
|
4506
4393
|
this.logger.info(`@agimon-ai/mcp-proxy MCP stdio proxy connected to ${this.endpoint.toString()}`);
|
|
4507
4394
|
} catch (error) {
|
|
@@ -4543,8 +4430,8 @@ var StdioHttpTransportHandler = class {
|
|
|
4543
4430
|
if (cleanupErrors.length > 0) throw new Error(`Failed to stop stdio-http proxy transport: ${cleanupErrors.join("; ")}`);
|
|
4544
4431
|
}
|
|
4545
4432
|
async createAndConnectClient() {
|
|
4546
|
-
const httpClientTransport = new
|
|
4547
|
-
const client = new
|
|
4433
|
+
const httpClientTransport = new _modelcontextprotocol_sdk_client_streamableHttp_js.StreamableHTTPClientTransport(this.endpoint);
|
|
4434
|
+
const client = new _modelcontextprotocol_sdk_client_index_js.Client({
|
|
4548
4435
|
name: "@agimon-ai/mcp-proxy-stdio-http-proxy",
|
|
4549
4436
|
version: "0.1.0"
|
|
4550
4437
|
}, { capabilities: { elicitation: {} } });
|
|
@@ -4554,14 +4441,14 @@ var StdioHttpTransportHandler = class {
|
|
|
4554
4441
|
registerElicitationHandler(client) {
|
|
4555
4442
|
const proxyServer = this.stdioProxyServer;
|
|
4556
4443
|
if (!proxyServer) return;
|
|
4557
|
-
client.setRequestHandler(
|
|
4444
|
+
client.setRequestHandler(_modelcontextprotocol_sdk_types_js.ElicitRequestSchema, async (request) => {
|
|
4558
4445
|
return await proxyServer.elicitInput(request.params);
|
|
4559
4446
|
});
|
|
4560
4447
|
}
|
|
4561
4448
|
async reconnectWithBackoff() {
|
|
4562
4449
|
for (let attempt = 0; attempt < this.MAX_RECONNECT_ATTEMPTS; attempt++) {
|
|
4563
4450
|
const delay = Math.min(this.RECONNECT_BASE_MS * 2 ** attempt, this.RECONNECT_MAX_MS);
|
|
4564
|
-
await new Promise((resolve
|
|
4451
|
+
await new Promise((resolve) => setTimeout(resolve, delay));
|
|
4565
4452
|
try {
|
|
4566
4453
|
await this.httpClient?.close().catch(() => void 0);
|
|
4567
4454
|
const client = await this.createAndConnectClient();
|
|
@@ -4588,7 +4475,7 @@ var StdioHttpTransportHandler = class {
|
|
|
4588
4475
|
}
|
|
4589
4476
|
}
|
|
4590
4477
|
createProxyServer() {
|
|
4591
|
-
const proxyServer = new
|
|
4478
|
+
const proxyServer = new _modelcontextprotocol_sdk_server_index_js.Server({
|
|
4592
4479
|
name: "@agimon-ai/mcp-proxy-stdio-http-proxy",
|
|
4593
4480
|
version: "0.1.0"
|
|
4594
4481
|
}, { capabilities: {
|
|
@@ -4596,14 +4483,14 @@ var StdioHttpTransportHandler = class {
|
|
|
4596
4483
|
resources: {},
|
|
4597
4484
|
prompts: {}
|
|
4598
4485
|
} });
|
|
4599
|
-
proxyServer.setRequestHandler(
|
|
4486
|
+
proxyServer.setRequestHandler(_modelcontextprotocol_sdk_types_js.ListToolsRequestSchema, async () => {
|
|
4600
4487
|
try {
|
|
4601
4488
|
return await this.withReconnect(() => this.httpClient.listTools());
|
|
4602
4489
|
} catch (error) {
|
|
4603
4490
|
throw new Error(`Failed forwarding tools/list to HTTP backend: ${error instanceof Error ? error.message : String(error)}`);
|
|
4604
4491
|
}
|
|
4605
4492
|
});
|
|
4606
|
-
proxyServer.setRequestHandler(
|
|
4493
|
+
proxyServer.setRequestHandler(_modelcontextprotocol_sdk_types_js.CallToolRequestSchema, async (request) => {
|
|
4607
4494
|
try {
|
|
4608
4495
|
return await this.withReconnect(() => this.httpClient.callTool({
|
|
4609
4496
|
name: request.params.name,
|
|
@@ -4613,28 +4500,28 @@ var StdioHttpTransportHandler = class {
|
|
|
4613
4500
|
throw new Error(`Failed forwarding tools/call (${request.params.name}) to HTTP backend: ${error instanceof Error ? error.message : String(error)}`);
|
|
4614
4501
|
}
|
|
4615
4502
|
});
|
|
4616
|
-
proxyServer.setRequestHandler(
|
|
4503
|
+
proxyServer.setRequestHandler(_modelcontextprotocol_sdk_types_js.ListResourcesRequestSchema, async () => {
|
|
4617
4504
|
try {
|
|
4618
4505
|
return await this.withReconnect(() => this.httpClient.listResources());
|
|
4619
4506
|
} catch (error) {
|
|
4620
4507
|
throw new Error(`Failed forwarding resources/list to HTTP backend: ${error instanceof Error ? error.message : String(error)}`);
|
|
4621
4508
|
}
|
|
4622
4509
|
});
|
|
4623
|
-
proxyServer.setRequestHandler(
|
|
4510
|
+
proxyServer.setRequestHandler(_modelcontextprotocol_sdk_types_js.ReadResourceRequestSchema, async (request) => {
|
|
4624
4511
|
try {
|
|
4625
4512
|
return await this.withReconnect(() => this.httpClient.readResource({ uri: request.params.uri }));
|
|
4626
4513
|
} catch (error) {
|
|
4627
4514
|
throw new Error(`Failed forwarding resources/read (${request.params.uri}) to HTTP backend: ${error instanceof Error ? error.message : String(error)}`);
|
|
4628
4515
|
}
|
|
4629
4516
|
});
|
|
4630
|
-
proxyServer.setRequestHandler(
|
|
4517
|
+
proxyServer.setRequestHandler(_modelcontextprotocol_sdk_types_js.ListPromptsRequestSchema, async () => {
|
|
4631
4518
|
try {
|
|
4632
4519
|
return await this.withReconnect(() => this.httpClient.listPrompts());
|
|
4633
4520
|
} catch (error) {
|
|
4634
4521
|
throw new Error(`Failed forwarding prompts/list to HTTP backend: ${error instanceof Error ? error.message : String(error)}`);
|
|
4635
4522
|
}
|
|
4636
4523
|
});
|
|
4637
|
-
proxyServer.setRequestHandler(
|
|
4524
|
+
proxyServer.setRequestHandler(_modelcontextprotocol_sdk_types_js.GetPromptRequestSchema, async (request) => {
|
|
4638
4525
|
try {
|
|
4639
4526
|
return await this.withReconnect(() => this.httpClient.getPrompt({
|
|
4640
4527
|
name: request.params.name,
|
|
@@ -4647,7 +4534,6 @@ var StdioHttpTransportHandler = class {
|
|
|
4647
4534
|
return proxyServer;
|
|
4648
4535
|
}
|
|
4649
4536
|
};
|
|
4650
|
-
|
|
4651
4537
|
//#endregion
|
|
4652
4538
|
//#region src/container/index.ts
|
|
4653
4539
|
/**
|
|
@@ -4679,13 +4565,13 @@ function createProxyIoCContainer(logger = console) {
|
|
|
4679
4565
|
createDescribeToolsTool: (clientManager, skillService, serverId, definitionsCacheService) => new DescribeToolsTool(clientManager, skillService, serverId, definitionsCacheService),
|
|
4680
4566
|
createUseToolTool: (clientManager, skillService, serverId, definitionsCacheService) => new UseToolTool(clientManager, skillService, serverId, definitionsCacheService),
|
|
4681
4567
|
createSearchListToolsTool: (clientManager, definitionsCacheService) => new SearchListToolsTool(clientManager, definitionsCacheService),
|
|
4682
|
-
createStdioTransportHandler: async (createServer
|
|
4683
|
-
return new StdioTransportHandler(await createServer
|
|
4568
|
+
createStdioTransportHandler: async (createServer) => {
|
|
4569
|
+
return new StdioTransportHandler(await createServer(), logger);
|
|
4684
4570
|
},
|
|
4685
|
-
createSseTransportHandler: async (createServer
|
|
4686
|
-
return new SseTransportHandler(await createServer
|
|
4571
|
+
createSseTransportHandler: async (createServer, config) => {
|
|
4572
|
+
return new SseTransportHandler(await createServer(), config, logger);
|
|
4687
4573
|
},
|
|
4688
|
-
createHttpTransportHandler: (createServer
|
|
4574
|
+
createHttpTransportHandler: (createServer, config, adminOptions) => new HttpTransportHandler(createServer, config, adminOptions, logger),
|
|
4689
4575
|
createStdioHttpTransportHandler: (endpoint) => new StdioHttpTransportHandler({ endpoint }, logger)
|
|
4690
4576
|
};
|
|
4691
4577
|
}
|
|
@@ -4822,22 +4708,22 @@ async function createProxyContainer(options) {
|
|
|
4822
4708
|
/**
|
|
4823
4709
|
* Create a sessionless stdio transport handler from the shared server factory.
|
|
4824
4710
|
*/
|
|
4825
|
-
async function createStdioTransportHandler(createServer
|
|
4826
|
-
const server = await createServer
|
|
4711
|
+
async function createStdioTransportHandler(createServer) {
|
|
4712
|
+
const server = await createServer();
|
|
4827
4713
|
return createProxyIoCContainer().createStdioTransportHandler(() => Promise.resolve(server));
|
|
4828
4714
|
}
|
|
4829
4715
|
/**
|
|
4830
4716
|
* Create an SSE transport handler from the shared server factory.
|
|
4831
4717
|
*/
|
|
4832
|
-
async function createSseTransportHandler(createServer
|
|
4833
|
-
const server = await createServer
|
|
4718
|
+
async function createSseTransportHandler(createServer, config) {
|
|
4719
|
+
const server = await createServer();
|
|
4834
4720
|
return createProxyIoCContainer().createSseTransportHandler(() => Promise.resolve(server), config);
|
|
4835
4721
|
}
|
|
4836
4722
|
/**
|
|
4837
4723
|
* Create an HTTP transport handler from shared services.
|
|
4838
4724
|
*/
|
|
4839
|
-
function createHttpTransportHandler(createServer
|
|
4840
|
-
return createProxyIoCContainer().createHttpTransportHandler(createServer
|
|
4725
|
+
function createHttpTransportHandler(createServer, config, adminOptions) {
|
|
4726
|
+
return createProxyIoCContainer().createHttpTransportHandler(createServer, config, adminOptions);
|
|
4841
4727
|
}
|
|
4842
4728
|
/**
|
|
4843
4729
|
* Create a stdio-http transport handler from an endpoint URL.
|
|
@@ -4851,7 +4737,6 @@ function createStdioHttpTransportHandler(endpoint) {
|
|
|
4851
4737
|
async function initializeSharedServices(options) {
|
|
4852
4738
|
return createProxyContainer(options);
|
|
4853
4739
|
}
|
|
4854
|
-
|
|
4855
4740
|
//#endregion
|
|
4856
4741
|
//#region src/server/index.ts
|
|
4857
4742
|
/**
|
|
@@ -4978,7 +4863,7 @@ function buildProxyInstructions(serverDefinitions, mode, includeSkillsTool) {
|
|
|
4978
4863
|
*/
|
|
4979
4864
|
async function createSessionServer(shared) {
|
|
4980
4865
|
const { clientManager, definitionsCacheService, skillService, describeTools, useTool: useToolWithCache, searchListTools, serverId, proxyMode } = shared;
|
|
4981
|
-
const server = new
|
|
4866
|
+
const server = new _modelcontextprotocol_sdk_server_index_js.Server({
|
|
4982
4867
|
name: "@agimon-ai/mcp-proxy",
|
|
4983
4868
|
version: "0.1.0"
|
|
4984
4869
|
}, {
|
|
@@ -4989,7 +4874,7 @@ async function createSessionServer(shared) {
|
|
|
4989
4874
|
},
|
|
4990
4875
|
instructions: buildProxyInstructions(await definitionsCacheService.getServerDefinitions(), proxyMode, await hasAnySkills(definitionsCacheService, skillService))
|
|
4991
4876
|
});
|
|
4992
|
-
server.setRequestHandler(
|
|
4877
|
+
server.setRequestHandler(_modelcontextprotocol_sdk_types_js.ListToolsRequestSchema, async () => ({ tools: proxyMode === "flat" ? await (async () => {
|
|
4993
4878
|
const currentServerDefinitions = await definitionsCacheService.getServerDefinitions();
|
|
4994
4879
|
const shouldIncludeSkillsTool = await hasAnySkills(definitionsCacheService, skillService);
|
|
4995
4880
|
return [...buildFlatToolDefinitions(currentServerDefinitions), ...shouldIncludeSkillsTool ? [buildSkillsDescribeDefinition(currentServerDefinitions, serverId)] : []];
|
|
@@ -5000,17 +4885,17 @@ async function createSessionServer(shared) {
|
|
|
5000
4885
|
useToolWithCache.getDefinition()
|
|
5001
4886
|
];
|
|
5002
4887
|
})() : [await describeTools.getDefinition(), useToolWithCache.getDefinition()] }));
|
|
5003
|
-
server.setRequestHandler(
|
|
4888
|
+
server.setRequestHandler(_modelcontextprotocol_sdk_types_js.CallToolRequestSchema, async (request) => {
|
|
5004
4889
|
const { name, arguments: args } = request.params;
|
|
5005
4890
|
const executeWithCoercion = async (tool, toolName) => {
|
|
5006
|
-
const coerced = (0,
|
|
4891
|
+
const coerced = (0, _agimon_ai_foundation_validator.coerceArgs)(args ?? {}, tool.getInputSchema());
|
|
5007
4892
|
try {
|
|
5008
4893
|
return await tool.execute(coerced);
|
|
5009
4894
|
} catch (error) {
|
|
5010
4895
|
if (error instanceof zod.z.ZodError) return {
|
|
5011
4896
|
content: [{
|
|
5012
4897
|
type: "text",
|
|
5013
|
-
text: (0,
|
|
4898
|
+
text: (0, _agimon_ai_foundation_validator.formatZodError)(error, {
|
|
5014
4899
|
schemaName: toolName,
|
|
5015
4900
|
schema: tool.getInputSchema()
|
|
5016
4901
|
})
|
|
@@ -5029,7 +4914,7 @@ async function createSessionServer(shared) {
|
|
|
5029
4914
|
});
|
|
5030
4915
|
throw new Error(`Unknown tool: ${name}`);
|
|
5031
4916
|
});
|
|
5032
|
-
server.setRequestHandler(
|
|
4917
|
+
server.setRequestHandler(_modelcontextprotocol_sdk_types_js.ListResourcesRequestSchema, async () => {
|
|
5033
4918
|
const currentServerDefinitions = await definitionsCacheService.getServerDefinitions();
|
|
5034
4919
|
const resourceToServers = /* @__PURE__ */ new Map();
|
|
5035
4920
|
for (const serverDefinition of currentServerDefinitions) for (const resource of serverDefinition.resources) {
|
|
@@ -5046,7 +4931,7 @@ async function createSessionServer(shared) {
|
|
|
5046
4931
|
}
|
|
5047
4932
|
return { resources };
|
|
5048
4933
|
});
|
|
5049
|
-
server.setRequestHandler(
|
|
4934
|
+
server.setRequestHandler(_modelcontextprotocol_sdk_types_js.ReadResourceRequestSchema, async (request) => {
|
|
5050
4935
|
const { uri } = request.params;
|
|
5051
4936
|
const { serverName, actualToolName: actualUri } = parseToolName(uri);
|
|
5052
4937
|
if (serverName) return await (await clientManager.ensureConnected(serverName)).readResource(actualUri);
|
|
@@ -5055,7 +4940,7 @@ async function createSessionServer(shared) {
|
|
|
5055
4940
|
if (matchingServers.length > 1) throw new Error(`Resource "${actualUri}" exists on multiple servers: ${matchingServers.join(", ")}. Use the prefixed format (e.g., "${matchingServers[0]}__${actualUri}") to specify which server to use.`);
|
|
5056
4941
|
return await (await clientManager.ensureConnected(matchingServers[0])).readResource(actualUri);
|
|
5057
4942
|
});
|
|
5058
|
-
server.setRequestHandler(
|
|
4943
|
+
server.setRequestHandler(_modelcontextprotocol_sdk_types_js.ListPromptsRequestSchema, async () => {
|
|
5059
4944
|
const currentServerDefinitions = await definitionsCacheService.getServerDefinitions();
|
|
5060
4945
|
const promptToServers = /* @__PURE__ */ new Map();
|
|
5061
4946
|
const serverPromptsMap = /* @__PURE__ */ new Map();
|
|
@@ -5080,7 +4965,7 @@ async function createSessionServer(shared) {
|
|
|
5080
4965
|
}
|
|
5081
4966
|
return { prompts: aggregatedPrompts };
|
|
5082
4967
|
});
|
|
5083
|
-
server.setRequestHandler(
|
|
4968
|
+
server.setRequestHandler(_modelcontextprotocol_sdk_types_js.GetPromptRequestSchema, async (request) => {
|
|
5084
4969
|
const { name, arguments: args } = request.params;
|
|
5085
4970
|
const currentServerDefinitions = await definitionsCacheService.getServerDefinitions();
|
|
5086
4971
|
const { serverName, actualToolName: actualPromptName } = parseToolName(name);
|
|
@@ -5102,7 +4987,6 @@ async function createSessionServer(shared) {
|
|
|
5102
4987
|
async function createServer(options) {
|
|
5103
4988
|
return createSessionServer(await createProxyContainer(options));
|
|
5104
4989
|
}
|
|
5105
|
-
|
|
5106
4990
|
//#endregion
|
|
5107
4991
|
//#region src/types/index.ts
|
|
5108
4992
|
/**
|
|
@@ -5113,173 +4997,172 @@ const TRANSPORT_MODE = {
|
|
|
5113
4997
|
HTTP: "http",
|
|
5114
4998
|
SSE: "sse"
|
|
5115
4999
|
};
|
|
5116
|
-
|
|
5117
5000
|
//#endregion
|
|
5118
|
-
Object.defineProperty(exports,
|
|
5119
|
-
|
|
5120
|
-
|
|
5121
|
-
|
|
5122
|
-
|
|
5001
|
+
Object.defineProperty(exports, "ConfigFetcherService", {
|
|
5002
|
+
enumerable: true,
|
|
5003
|
+
get: function() {
|
|
5004
|
+
return ConfigFetcherService;
|
|
5005
|
+
}
|
|
5123
5006
|
});
|
|
5124
|
-
Object.defineProperty(exports,
|
|
5125
|
-
|
|
5126
|
-
|
|
5127
|
-
|
|
5128
|
-
|
|
5007
|
+
Object.defineProperty(exports, "DefinitionsCacheService", {
|
|
5008
|
+
enumerable: true,
|
|
5009
|
+
get: function() {
|
|
5010
|
+
return DefinitionsCacheService;
|
|
5011
|
+
}
|
|
5129
5012
|
});
|
|
5130
|
-
Object.defineProperty(exports,
|
|
5131
|
-
|
|
5132
|
-
|
|
5133
|
-
|
|
5134
|
-
|
|
5013
|
+
Object.defineProperty(exports, "DescribeToolsTool", {
|
|
5014
|
+
enumerable: true,
|
|
5015
|
+
get: function() {
|
|
5016
|
+
return DescribeToolsTool;
|
|
5017
|
+
}
|
|
5135
5018
|
});
|
|
5136
|
-
Object.defineProperty(exports,
|
|
5137
|
-
|
|
5138
|
-
|
|
5139
|
-
|
|
5140
|
-
|
|
5019
|
+
Object.defineProperty(exports, "HttpTransportHandler", {
|
|
5020
|
+
enumerable: true,
|
|
5021
|
+
get: function() {
|
|
5022
|
+
return HttpTransportHandler;
|
|
5023
|
+
}
|
|
5141
5024
|
});
|
|
5142
|
-
Object.defineProperty(exports,
|
|
5143
|
-
|
|
5144
|
-
|
|
5145
|
-
|
|
5146
|
-
|
|
5025
|
+
Object.defineProperty(exports, "McpClientManagerService", {
|
|
5026
|
+
enumerable: true,
|
|
5027
|
+
get: function() {
|
|
5028
|
+
return McpClientManagerService;
|
|
5029
|
+
}
|
|
5147
5030
|
});
|
|
5148
|
-
Object.defineProperty(exports,
|
|
5149
|
-
|
|
5150
|
-
|
|
5151
|
-
|
|
5152
|
-
|
|
5031
|
+
Object.defineProperty(exports, "RuntimeStateService", {
|
|
5032
|
+
enumerable: true,
|
|
5033
|
+
get: function() {
|
|
5034
|
+
return RuntimeStateService;
|
|
5035
|
+
}
|
|
5153
5036
|
});
|
|
5154
|
-
Object.defineProperty(exports,
|
|
5155
|
-
|
|
5156
|
-
|
|
5157
|
-
|
|
5158
|
-
|
|
5037
|
+
Object.defineProperty(exports, "SearchListToolsTool", {
|
|
5038
|
+
enumerable: true,
|
|
5039
|
+
get: function() {
|
|
5040
|
+
return SearchListToolsTool;
|
|
5041
|
+
}
|
|
5159
5042
|
});
|
|
5160
|
-
Object.defineProperty(exports,
|
|
5161
|
-
|
|
5162
|
-
|
|
5163
|
-
|
|
5164
|
-
|
|
5043
|
+
Object.defineProperty(exports, "SkillService", {
|
|
5044
|
+
enumerable: true,
|
|
5045
|
+
get: function() {
|
|
5046
|
+
return SkillService;
|
|
5047
|
+
}
|
|
5165
5048
|
});
|
|
5166
|
-
Object.defineProperty(exports,
|
|
5167
|
-
|
|
5168
|
-
|
|
5169
|
-
|
|
5170
|
-
|
|
5049
|
+
Object.defineProperty(exports, "SseTransportHandler", {
|
|
5050
|
+
enumerable: true,
|
|
5051
|
+
get: function() {
|
|
5052
|
+
return SseTransportHandler;
|
|
5053
|
+
}
|
|
5171
5054
|
});
|
|
5172
|
-
Object.defineProperty(exports,
|
|
5173
|
-
|
|
5174
|
-
|
|
5175
|
-
|
|
5176
|
-
|
|
5055
|
+
Object.defineProperty(exports, "StdioHttpTransportHandler", {
|
|
5056
|
+
enumerable: true,
|
|
5057
|
+
get: function() {
|
|
5058
|
+
return StdioHttpTransportHandler;
|
|
5059
|
+
}
|
|
5177
5060
|
});
|
|
5178
|
-
Object.defineProperty(exports,
|
|
5179
|
-
|
|
5180
|
-
|
|
5181
|
-
|
|
5182
|
-
|
|
5061
|
+
Object.defineProperty(exports, "StdioTransportHandler", {
|
|
5062
|
+
enumerable: true,
|
|
5063
|
+
get: function() {
|
|
5064
|
+
return StdioTransportHandler;
|
|
5065
|
+
}
|
|
5183
5066
|
});
|
|
5184
|
-
Object.defineProperty(exports,
|
|
5185
|
-
|
|
5186
|
-
|
|
5187
|
-
|
|
5188
|
-
|
|
5067
|
+
Object.defineProperty(exports, "StopServerService", {
|
|
5068
|
+
enumerable: true,
|
|
5069
|
+
get: function() {
|
|
5070
|
+
return StopServerService;
|
|
5071
|
+
}
|
|
5189
5072
|
});
|
|
5190
|
-
Object.defineProperty(exports,
|
|
5191
|
-
|
|
5192
|
-
|
|
5193
|
-
|
|
5194
|
-
|
|
5073
|
+
Object.defineProperty(exports, "TRANSPORT_MODE", {
|
|
5074
|
+
enumerable: true,
|
|
5075
|
+
get: function() {
|
|
5076
|
+
return TRANSPORT_MODE;
|
|
5077
|
+
}
|
|
5195
5078
|
});
|
|
5196
|
-
Object.defineProperty(exports,
|
|
5197
|
-
|
|
5198
|
-
|
|
5199
|
-
|
|
5200
|
-
|
|
5079
|
+
Object.defineProperty(exports, "UseToolTool", {
|
|
5080
|
+
enumerable: true,
|
|
5081
|
+
get: function() {
|
|
5082
|
+
return UseToolTool;
|
|
5083
|
+
}
|
|
5084
|
+
});
|
|
5085
|
+
Object.defineProperty(exports, "__toESM", {
|
|
5086
|
+
enumerable: true,
|
|
5087
|
+
get: function() {
|
|
5088
|
+
return __toESM;
|
|
5089
|
+
}
|
|
5201
5090
|
});
|
|
5202
|
-
Object.defineProperty(exports,
|
|
5203
|
-
|
|
5204
|
-
|
|
5205
|
-
|
|
5206
|
-
|
|
5091
|
+
Object.defineProperty(exports, "createHttpTransportHandler", {
|
|
5092
|
+
enumerable: true,
|
|
5093
|
+
get: function() {
|
|
5094
|
+
return createHttpTransportHandler;
|
|
5095
|
+
}
|
|
5207
5096
|
});
|
|
5208
|
-
Object.defineProperty(exports,
|
|
5209
|
-
|
|
5210
|
-
|
|
5211
|
-
|
|
5212
|
-
|
|
5097
|
+
Object.defineProperty(exports, "createProxyContainer", {
|
|
5098
|
+
enumerable: true,
|
|
5099
|
+
get: function() {
|
|
5100
|
+
return createProxyContainer;
|
|
5101
|
+
}
|
|
5213
5102
|
});
|
|
5214
|
-
Object.defineProperty(exports,
|
|
5215
|
-
|
|
5216
|
-
|
|
5217
|
-
|
|
5218
|
-
|
|
5103
|
+
Object.defineProperty(exports, "createProxyIoCContainer", {
|
|
5104
|
+
enumerable: true,
|
|
5105
|
+
get: function() {
|
|
5106
|
+
return createProxyIoCContainer;
|
|
5107
|
+
}
|
|
5219
5108
|
});
|
|
5220
|
-
Object.defineProperty(exports,
|
|
5221
|
-
|
|
5222
|
-
|
|
5223
|
-
|
|
5224
|
-
|
|
5109
|
+
Object.defineProperty(exports, "createProxyLogger", {
|
|
5110
|
+
enumerable: true,
|
|
5111
|
+
get: function() {
|
|
5112
|
+
return createProxyLogger;
|
|
5113
|
+
}
|
|
5225
5114
|
});
|
|
5226
|
-
Object.defineProperty(exports,
|
|
5227
|
-
|
|
5228
|
-
|
|
5229
|
-
|
|
5230
|
-
|
|
5115
|
+
Object.defineProperty(exports, "createServer", {
|
|
5116
|
+
enumerable: true,
|
|
5117
|
+
get: function() {
|
|
5118
|
+
return createServer;
|
|
5119
|
+
}
|
|
5231
5120
|
});
|
|
5232
|
-
Object.defineProperty(exports,
|
|
5233
|
-
|
|
5234
|
-
|
|
5235
|
-
|
|
5236
|
-
|
|
5121
|
+
Object.defineProperty(exports, "createSessionServer", {
|
|
5122
|
+
enumerable: true,
|
|
5123
|
+
get: function() {
|
|
5124
|
+
return createSessionServer;
|
|
5125
|
+
}
|
|
5237
5126
|
});
|
|
5238
|
-
Object.defineProperty(exports,
|
|
5239
|
-
|
|
5240
|
-
|
|
5241
|
-
|
|
5242
|
-
|
|
5127
|
+
Object.defineProperty(exports, "createSseTransportHandler", {
|
|
5128
|
+
enumerable: true,
|
|
5129
|
+
get: function() {
|
|
5130
|
+
return createSseTransportHandler;
|
|
5131
|
+
}
|
|
5243
5132
|
});
|
|
5244
|
-
Object.defineProperty(exports,
|
|
5245
|
-
|
|
5246
|
-
|
|
5247
|
-
|
|
5248
|
-
|
|
5133
|
+
Object.defineProperty(exports, "createStdioHttpTransportHandler", {
|
|
5134
|
+
enumerable: true,
|
|
5135
|
+
get: function() {
|
|
5136
|
+
return createStdioHttpTransportHandler;
|
|
5137
|
+
}
|
|
5249
5138
|
});
|
|
5250
|
-
Object.defineProperty(exports,
|
|
5251
|
-
|
|
5252
|
-
|
|
5253
|
-
|
|
5254
|
-
|
|
5139
|
+
Object.defineProperty(exports, "createStdioTransportHandler", {
|
|
5140
|
+
enumerable: true,
|
|
5141
|
+
get: function() {
|
|
5142
|
+
return createStdioTransportHandler;
|
|
5143
|
+
}
|
|
5255
5144
|
});
|
|
5256
|
-
Object.defineProperty(exports,
|
|
5257
|
-
|
|
5258
|
-
|
|
5259
|
-
|
|
5260
|
-
|
|
5145
|
+
Object.defineProperty(exports, "findConfigFile", {
|
|
5146
|
+
enumerable: true,
|
|
5147
|
+
get: function() {
|
|
5148
|
+
return findConfigFile;
|
|
5149
|
+
}
|
|
5261
5150
|
});
|
|
5262
|
-
Object.defineProperty(exports,
|
|
5263
|
-
|
|
5264
|
-
|
|
5265
|
-
|
|
5266
|
-
|
|
5151
|
+
Object.defineProperty(exports, "generateServerId", {
|
|
5152
|
+
enumerable: true,
|
|
5153
|
+
get: function() {
|
|
5154
|
+
return generateServerId;
|
|
5155
|
+
}
|
|
5267
5156
|
});
|
|
5268
|
-
Object.defineProperty(exports,
|
|
5269
|
-
|
|
5270
|
-
|
|
5271
|
-
|
|
5272
|
-
|
|
5157
|
+
Object.defineProperty(exports, "initializeSharedServices", {
|
|
5158
|
+
enumerable: true,
|
|
5159
|
+
get: function() {
|
|
5160
|
+
return initializeSharedServices;
|
|
5161
|
+
}
|
|
5273
5162
|
});
|
|
5274
|
-
Object.defineProperty(exports,
|
|
5275
|
-
|
|
5276
|
-
|
|
5277
|
-
|
|
5278
|
-
|
|
5163
|
+
Object.defineProperty(exports, "version", {
|
|
5164
|
+
enumerable: true,
|
|
5165
|
+
get: function() {
|
|
5166
|
+
return version;
|
|
5167
|
+
}
|
|
5279
5168
|
});
|
|
5280
|
-
Object.defineProperty(exports, 'version', {
|
|
5281
|
-
enumerable: true,
|
|
5282
|
-
get: function () {
|
|
5283
|
-
return version;
|
|
5284
|
-
}
|
|
5285
|
-
});
|