@mcp-rating/gateway 0.2.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/LICENSE +21 -0
- package/README.md +130 -0
- package/dist/ads/ad-tracker.d.ts +63 -0
- package/dist/ads/ad-tracker.js +144 -0
- package/dist/ads/ad-tracker.js.map +1 -0
- package/dist/analytics/usage-tracker.d.ts +67 -0
- package/dist/analytics/usage-tracker.js +148 -0
- package/dist/analytics/usage-tracker.js.map +1 -0
- package/dist/audit/audit-log.d.ts +71 -0
- package/dist/audit/audit-log.js +72 -0
- package/dist/audit/audit-log.js.map +1 -0
- package/dist/config/gateway-config.d.ts +6 -0
- package/dist/config/gateway-config.js +135 -0
- package/dist/config/gateway-config.js.map +1 -0
- package/dist/config/groups.d.ts +29 -0
- package/dist/config/groups.js +102 -0
- package/dist/config/groups.js.map +1 -0
- package/dist/config/profiles.d.ts +42 -0
- package/dist/config/profiles.js +167 -0
- package/dist/config/profiles.js.map +1 -0
- package/dist/config/types.d.ts +76 -0
- package/dist/config/types.js +2 -0
- package/dist/config/types.js.map +1 -0
- package/dist/connection/auto-installer.d.ts +13 -0
- package/dist/connection/auto-installer.js +61 -0
- package/dist/connection/auto-installer.js.map +1 -0
- package/dist/connection/connection-manager.d.ts +106 -0
- package/dist/connection/connection-manager.js +845 -0
- package/dist/connection/connection-manager.js.map +1 -0
- package/dist/connection/downstream-client.d.ts +50 -0
- package/dist/connection/downstream-client.js +170 -0
- package/dist/connection/downstream-client.js.map +1 -0
- package/dist/connection/http-client.d.ts +12 -0
- package/dist/connection/http-client.js +26 -0
- package/dist/connection/http-client.js.map +1 -0
- package/dist/connection/sse-client.d.ts +12 -0
- package/dist/connection/sse-client.js +26 -0
- package/dist/connection/sse-client.js.map +1 -0
- package/dist/connection/transport-factory.d.ts +31 -0
- package/dist/connection/transport-factory.js +67 -0
- package/dist/connection/transport-factory.js.map +1 -0
- package/dist/connection/types.d.ts +134 -0
- package/dist/connection/types.js +5 -0
- package/dist/connection/types.js.map +1 -0
- package/dist/connection/ws-client.d.ts +12 -0
- package/dist/connection/ws-client.js +26 -0
- package/dist/connection/ws-client.js.map +1 -0
- package/dist/discovery/auto-recommender.d.ts +51 -0
- package/dist/discovery/auto-recommender.js +176 -0
- package/dist/discovery/auto-recommender.js.map +1 -0
- package/dist/gateway-server.d.ts +42 -0
- package/dist/gateway-server.js +135 -0
- package/dist/gateway-server.js.map +1 -0
- package/dist/http-daemon.d.ts +26 -0
- package/dist/http-daemon.js +302 -0
- package/dist/http-daemon.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +83 -0
- package/dist/index.js.map +1 -0
- package/dist/meta-tools/ad-status.d.ts +8 -0
- package/dist/meta-tools/ad-status.js +41 -0
- package/dist/meta-tools/ad-status.js.map +1 -0
- package/dist/meta-tools/audit.d.ts +12 -0
- package/dist/meta-tools/audit.js +98 -0
- package/dist/meta-tools/audit.js.map +1 -0
- package/dist/meta-tools/call-tool.d.ts +11 -0
- package/dist/meta-tools/call-tool.js +65 -0
- package/dist/meta-tools/call-tool.js.map +1 -0
- package/dist/meta-tools/connect.d.ts +3 -0
- package/dist/meta-tools/connect.js +105 -0
- package/dist/meta-tools/connect.js.map +1 -0
- package/dist/meta-tools/disconnect.d.ts +3 -0
- package/dist/meta-tools/disconnect.js +30 -0
- package/dist/meta-tools/disconnect.js.map +1 -0
- package/dist/meta-tools/discover.d.ts +3 -0
- package/dist/meta-tools/discover.js +97 -0
- package/dist/meta-tools/discover.js.map +1 -0
- package/dist/meta-tools/groups.d.ts +7 -0
- package/dist/meta-tools/groups.js +237 -0
- package/dist/meta-tools/groups.js.map +1 -0
- package/dist/meta-tools/health.d.ts +4 -0
- package/dist/meta-tools/health.js +76 -0
- package/dist/meta-tools/health.js.map +1 -0
- package/dist/meta-tools/index.d.ts +28 -0
- package/dist/meta-tools/index.js +56 -0
- package/dist/meta-tools/index.js.map +1 -0
- package/dist/meta-tools/list-active.d.ts +3 -0
- package/dist/meta-tools/list-active.js +50 -0
- package/dist/meta-tools/list-active.js.map +1 -0
- package/dist/meta-tools/profiles.d.ts +6 -0
- package/dist/meta-tools/profiles.js +197 -0
- package/dist/meta-tools/profiles.js.map +1 -0
- package/dist/meta-tools/recommend.d.ts +14 -0
- package/dist/meta-tools/recommend.js +74 -0
- package/dist/meta-tools/recommend.js.map +1 -0
- package/dist/meta-tools/sandbox.d.ts +12 -0
- package/dist/meta-tools/sandbox.js +125 -0
- package/dist/meta-tools/sandbox.js.map +1 -0
- package/dist/meta-tools/server-info.d.ts +4 -0
- package/dist/meta-tools/server-info.js +156 -0
- package/dist/meta-tools/server-info.js.map +1 -0
- package/dist/meta-tools/usage.d.ts +6 -0
- package/dist/meta-tools/usage.js +149 -0
- package/dist/meta-tools/usage.js.map +1 -0
- package/dist/permissions/permission-manager.d.ts +26 -0
- package/dist/permissions/permission-manager.js +73 -0
- package/dist/permissions/permission-manager.js.map +1 -0
- package/dist/permissions/trust-tiers.d.ts +18 -0
- package/dist/permissions/trust-tiers.js +42 -0
- package/dist/permissions/trust-tiers.js.map +1 -0
- package/dist/plugins/builtin/logging-plugin.d.ts +6 -0
- package/dist/plugins/builtin/logging-plugin.js +41 -0
- package/dist/plugins/builtin/logging-plugin.js.map +1 -0
- package/dist/plugins/plugin-manager.d.ts +65 -0
- package/dist/plugins/plugin-manager.js +137 -0
- package/dist/plugins/plugin-manager.js.map +1 -0
- package/dist/proxy/prime-handlers.d.ts +27 -0
- package/dist/proxy/prime-handlers.js +47 -0
- package/dist/proxy/prime-handlers.js.map +1 -0
- package/dist/proxy/progress-forwarder.d.ts +44 -0
- package/dist/proxy/progress-forwarder.js +40 -0
- package/dist/proxy/progress-forwarder.js.map +1 -0
- package/dist/proxy/prompt-router.d.ts +25 -0
- package/dist/proxy/prompt-router.js +110 -0
- package/dist/proxy/prompt-router.js.map +1 -0
- package/dist/proxy/resource-router.d.ts +25 -0
- package/dist/proxy/resource-router.js +91 -0
- package/dist/proxy/resource-router.js.map +1 -0
- package/dist/proxy/schema-adapter.d.ts +11 -0
- package/dist/proxy/schema-adapter.js +36 -0
- package/dist/proxy/schema-adapter.js.map +1 -0
- package/dist/proxy/task-proxy.d.ts +28 -0
- package/dist/proxy/task-proxy.js +186 -0
- package/dist/proxy/task-proxy.js.map +1 -0
- package/dist/proxy/tool-router.d.ts +38 -0
- package/dist/proxy/tool-router.js +229 -0
- package/dist/proxy/tool-router.js.map +1 -0
- package/dist/proxy/ui-detect.d.ts +22 -0
- package/dist/proxy/ui-detect.js +30 -0
- package/dist/proxy/ui-detect.js.map +1 -0
- package/dist/registry/registry-client.d.ts +55 -0
- package/dist/registry/registry-client.js +211 -0
- package/dist/registry/registry-client.js.map +1 -0
- package/dist/registry/types.d.ts +69 -0
- package/dist/registry/types.js +2 -0
- package/dist/registry/types.js.map +1 -0
- package/dist/sandbox/container-runtime.d.ts +91 -0
- package/dist/sandbox/container-runtime.js +178 -0
- package/dist/sandbox/container-runtime.js.map +1 -0
- package/dist/sandbox/egress-proxy.d.ts +51 -0
- package/dist/sandbox/egress-proxy.js +146 -0
- package/dist/sandbox/egress-proxy.js.map +1 -0
- package/dist/sandbox/env-scoper.d.ts +29 -0
- package/dist/sandbox/env-scoper.js +60 -0
- package/dist/sandbox/env-scoper.js.map +1 -0
- package/dist/sandbox/manifest-resolver.d.ts +40 -0
- package/dist/sandbox/manifest-resolver.js +185 -0
- package/dist/sandbox/manifest-resolver.js.map +1 -0
- package/dist/sandbox/types.d.ts +88 -0
- package/dist/sandbox/types.js +21 -0
- package/dist/sandbox/types.js.map +1 -0
- package/dist/utils/errors.d.ts +39 -0
- package/dist/utils/errors.js +67 -0
- package/dist/utils/errors.js.map +1 -0
- package/dist/utils/logger.d.ts +16 -0
- package/dist/utils/logger.js +51 -0
- package/dist/utils/logger.js.map +1 -0
- package/package.json +72 -0
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { parseNamespacedTool } from "../proxy/tool-router.js";
|
|
3
|
+
import { buildProgressForwarder } from "../proxy/progress-forwarder.js";
|
|
4
|
+
import { toolError } from "../utils/errors.js";
|
|
5
|
+
import { log } from "../utils/logger.js";
|
|
6
|
+
/**
|
|
7
|
+
* Register the `mcp_call_tool` meta-tool.
|
|
8
|
+
*
|
|
9
|
+
* This is a fallback for MCP clients that don't refresh their tool list
|
|
10
|
+
* when `notifications/tools/list_changed` fires. The AI can call any
|
|
11
|
+
* tool on any connected downstream server by passing the namespaced
|
|
12
|
+
* tool name (e.g. "server-slug__echo") and a JSON arguments object.
|
|
13
|
+
*/
|
|
14
|
+
export function registerCallTool(server, connectionManager) {
|
|
15
|
+
server.tool("mcp_call_tool", "Call a tool on a connected MCP server. Use this when dynamically connected tools aren't directly available. Pass the namespaced tool name (slug__toolName) and arguments.", {
|
|
16
|
+
name: z
|
|
17
|
+
.string()
|
|
18
|
+
.describe('Namespaced tool name: "server-slug__tool-name" (as shown by mcp_connect or mcp_list_active)'),
|
|
19
|
+
arguments: z
|
|
20
|
+
.record(z.string(), z.unknown())
|
|
21
|
+
.optional()
|
|
22
|
+
.default({})
|
|
23
|
+
.describe("Tool arguments as a JSON object"),
|
|
24
|
+
}, async ({ name, arguments: args },
|
|
25
|
+
// Loose-typed extra: see tool-router.ts for the same pattern. We only
|
|
26
|
+
// touch `_meta.progressToken` and `sendNotification` via the helper.
|
|
27
|
+
extra) => {
|
|
28
|
+
try {
|
|
29
|
+
// Parse the namespaced name
|
|
30
|
+
const parsed = parseNamespacedTool(name);
|
|
31
|
+
if (!parsed) {
|
|
32
|
+
return toolError(`Invalid tool name "${name}". Expected format: "server-slug__tool-name".`);
|
|
33
|
+
}
|
|
34
|
+
const { slug, toolName } = parsed;
|
|
35
|
+
// Look up the connection
|
|
36
|
+
const connection = connectionManager.getConnection(slug);
|
|
37
|
+
if (!connection) {
|
|
38
|
+
return toolError(`Server "${slug}" is not connected. Use mcp_connect first.`);
|
|
39
|
+
}
|
|
40
|
+
if (connection.state !== "ready") {
|
|
41
|
+
return toolError(`Server "${slug}" is in state "${connection.state}", not ready.`);
|
|
42
|
+
}
|
|
43
|
+
// Verify the tool exists on the downstream server
|
|
44
|
+
if (!connection.tools.has(toolName)) {
|
|
45
|
+
const available = [...connection.tools.keys()].join(", ");
|
|
46
|
+
return toolError(`Tool "${toolName}" not found on "${slug}". Available: ${available}`);
|
|
47
|
+
}
|
|
48
|
+
log.debug("mcp_call_tool proxying", { slug, toolName });
|
|
49
|
+
// Forward progress notifications back to the upstream client
|
|
50
|
+
// using the upstream-supplied progress token (Bug A fix).
|
|
51
|
+
const onprogress = buildProgressForwarder(extra, { slug, toolName });
|
|
52
|
+
const result = await connection.client.callTool({ name: toolName, arguments: args }, undefined, {
|
|
53
|
+
signal: AbortSignal.timeout(30_000),
|
|
54
|
+
...(onprogress ? { onprogress } : {}),
|
|
55
|
+
});
|
|
56
|
+
return result;
|
|
57
|
+
}
|
|
58
|
+
catch (err) {
|
|
59
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
60
|
+
log.error("mcp_call_tool failed", { name, error: msg });
|
|
61
|
+
return toolError(msg);
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=call-tool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"call-tool.js","sourceRoot":"","sources":["../../src/meta-tools/call-tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AACxE,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,GAAG,EAAE,MAAM,oBAAoB,CAAC;AAEzC;;;;;;;GAOG;AACH,MAAM,UAAU,gBAAgB,CAC9B,MAAiB,EACjB,iBAAoC;IAEpC,MAAM,CA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CACd,SAAS,QAAQ,mBAAmB,IAAI,iBAAiB,SAAS,EAAE,CACrE,CAAC;YACJ,CAAC;YAED,GAAG,CAAC,KAAK,CAAC,wBAAwB,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC;YAExD,6DAA6D;YAC7D,0DAA0D;YAC1D,MAAM,UAAU,GAAG,sBAAsB,CACvC,KAAqD,EACrD,EAAE,IAAI,EAAE,QAAQ,EAAE,CACnB,CAAC;YAEF,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,MAAM,CAAC,QAAQ,CAC7C,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,IAAI,EAAE,EACnC,SAAS,EACT;gBACE,MAAM,EAAE,WAAW,CAAC,OAAO,CAAC,MAAM,CAAC;gBACnC,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;aACtC,CACF,CAAC;YAEF,OAAO,MAAwB,CAAC;QAClC,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,MAAM,GAAG,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;YAC7D,GAAG,CAAC,KAAK,CAAC,sBAAsB,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,CAAC;YACxD,OAAO,SAAS,CAAC,GAAG,CAAC,CAAC;QACxB,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { isConfirmationRequired } from "../connection/types.js";
|
|
3
|
+
import { namespaceTool } from "../proxy/tool-router.js";
|
|
4
|
+
import { TRUST_LABELS } from "../permissions/trust-tiers.js";
|
|
5
|
+
import { ManifestResolver } from "../sandbox/manifest-resolver.js";
|
|
6
|
+
import { toolError } from "../utils/errors.js";
|
|
7
|
+
export function registerConnect(server, connectionManager) {
|
|
8
|
+
server.tool("mcp_connect", "Connect to an MCP server and make its tools available. Provide either a server slug (from mcp_discover) to look up in the registry, OR an explicit command + args to spawn directly, OR a url for remote servers.", {
|
|
9
|
+
slug: z
|
|
10
|
+
.string()
|
|
11
|
+
.optional()
|
|
12
|
+
.describe("Server slug from MCP-Rating registry (e.g., '@modelcontextprotocol/inspector')"),
|
|
13
|
+
command: z
|
|
14
|
+
.string()
|
|
15
|
+
.optional()
|
|
16
|
+
.describe("Explicit command to spawn (e.g., 'npx'). Use when server is not in registry."),
|
|
17
|
+
args: z
|
|
18
|
+
.array(z.string())
|
|
19
|
+
.optional()
|
|
20
|
+
.describe("Command arguments (e.g., ['-y', '@modelcontextprotocol/server-everything'])"),
|
|
21
|
+
url: z
|
|
22
|
+
.string()
|
|
23
|
+
.optional()
|
|
24
|
+
.describe("URL for remote transports (SSE, WebSocket, Streamable HTTP). Use instead of command for remote servers."),
|
|
25
|
+
transportType: z
|
|
26
|
+
.enum(["stdio", "sse", "websocket", "streamable-http"])
|
|
27
|
+
.optional()
|
|
28
|
+
.describe("Transport type. Defaults to 'stdio' for command-based, auto-detected from URL scheme if url is provided."),
|
|
29
|
+
env: z
|
|
30
|
+
.record(z.string(), z.string())
|
|
31
|
+
.optional()
|
|
32
|
+
.describe("Additional environment variables for the server process"),
|
|
33
|
+
confirmed: z
|
|
34
|
+
.boolean()
|
|
35
|
+
.optional()
|
|
36
|
+
.describe("Set to true to confirm connection to community/unknown trust tier servers. Required when the initial connect returns a confirmation warning."),
|
|
37
|
+
saveProfile: z
|
|
38
|
+
.boolean()
|
|
39
|
+
.optional()
|
|
40
|
+
.describe("Set to true to save this connection as an auto-connect profile. The server will auto-reconnect on gateway restart."),
|
|
41
|
+
}, async ({ slug, command, args, url, transportType, env, confirmed, saveProfile }) => {
|
|
42
|
+
try {
|
|
43
|
+
const result = await connectionManager.connect({
|
|
44
|
+
slug,
|
|
45
|
+
command,
|
|
46
|
+
args,
|
|
47
|
+
url,
|
|
48
|
+
transportType,
|
|
49
|
+
env,
|
|
50
|
+
confirmed,
|
|
51
|
+
saveProfile,
|
|
52
|
+
});
|
|
53
|
+
// If confirmation is required, return the warning for the AI to relay
|
|
54
|
+
if (isConfirmationRequired(result)) {
|
|
55
|
+
return {
|
|
56
|
+
content: [
|
|
57
|
+
{ type: "text", text: result.warning },
|
|
58
|
+
],
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
const summary = result;
|
|
62
|
+
const tierLabel = TRUST_LABELS[summary.trustTier];
|
|
63
|
+
const conn = connectionManager.getConnection(summary.slug);
|
|
64
|
+
const toolNames = [...(conn?.tools.keys() || [])];
|
|
65
|
+
const namespacedTools = toolNames.map((t) => namespaceTool(summary.slug, t));
|
|
66
|
+
const lines = [
|
|
67
|
+
`## ✅ Connected: ${summary.displayName}`,
|
|
68
|
+
`**Trust:** [${tierLabel}] · **Transport:** ${summary.transportType} · **Tools:** ${summary.toolCount}`,
|
|
69
|
+
summary.serverInfo
|
|
70
|
+
? `**Server:** ${summary.serverInfo.name} v${summary.serverInfo.version}`
|
|
71
|
+
: "",
|
|
72
|
+
"",
|
|
73
|
+
"### Available Tools",
|
|
74
|
+
...namespacedTools.map((t) => `- \`${t}\``),
|
|
75
|
+
];
|
|
76
|
+
if (summary.resourceCount > 0) {
|
|
77
|
+
lines.push("", `### Resources (${summary.resourceCount})`);
|
|
78
|
+
for (const uri of conn?.resources.keys() || []) {
|
|
79
|
+
lines.push(`- \`${summary.slug}://${uri}\``);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
if (summary.promptCount > 0) {
|
|
83
|
+
lines.push("", `### Prompts (${summary.promptCount})`);
|
|
84
|
+
for (const name of conn?.prompts.keys() || []) {
|
|
85
|
+
lines.push(`- \`${summary.slug}__${name}\``);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
// Sandbox: show what the server was granted access to (L1)
|
|
89
|
+
if (conn?.manifest) {
|
|
90
|
+
const summ = ManifestResolver.summarize(conn.manifest);
|
|
91
|
+
lines.push("", `### 🛡️ Sandbox (${summ.enforcement})`, ...summ.lines.map((l) => `- ${l}`));
|
|
92
|
+
}
|
|
93
|
+
lines.push("", `**Active connections:** ${connectionManager.connectionCount}`, "", `To disconnect: \`mcp_disconnect({slug: "${summary.slug}"})\``);
|
|
94
|
+
return {
|
|
95
|
+
content: [
|
|
96
|
+
{ type: "text", text: lines.filter(Boolean).join("\n") },
|
|
97
|
+
],
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
catch (err) {
|
|
101
|
+
return toolError(err instanceof Error ? err.message : String(err));
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
//# sourceMappingURL=connect.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connect.js","sourceRoot":"","sources":["../../src/meta-tools/connect.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE/C,MAAM,UAAU,eAAe,CAC7B,MAAiB,EACjB,iBAAoC;IAEpC,MAAM,CAAC,IAAI,CACT,aAAa,EACb,mNAAmN,EACnN;QACE,IAAI,EAAE,CAAC;aACJ,MAAM,EAAE;aACR,QAAQ,EAAE;aACV,QAAQ,CACP,gFAAgF,CACjF;QACH,OAAO,EAAE,CAAC;aACP,MAAM,EAAE;aACR,QAAQ,EAAE;aACV,QAAQ,CACP,8EAA8E,CAC/E;QACH,IAAI,EAAE,CAAC;aACJ,KAAK,CAAC,CAAC,CA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connect(server, connectionManager) {
|
|
4
|
+
server.tool("mcp_disconnect", "Disconnect from a connected MCP server and remove its tools. Use mcp_list_active to see connected servers.", {
|
|
5
|
+
slug: z
|
|
6
|
+
.string()
|
|
7
|
+
.describe("Server slug of the connected server to disconnect"),
|
|
8
|
+
}, async ({ slug }) => {
|
|
9
|
+
try {
|
|
10
|
+
await connectionManager.disconnect(slug);
|
|
11
|
+
return {
|
|
12
|
+
content: [
|
|
13
|
+
{
|
|
14
|
+
type: "text",
|
|
15
|
+
text: [
|
|
16
|
+
`## ✅ Disconnected: ${slug}`,
|
|
17
|
+
"",
|
|
18
|
+
`All tools from this server have been removed.`,
|
|
19
|
+
`**Active connections:** ${connectionManager.connectionCount}`,
|
|
20
|
+
].join("\n"),
|
|
21
|
+
},
|
|
22
|
+
],
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
catch (err) {
|
|
26
|
+
return toolError(err instanceof Error ? err.message : String(err));
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=disconnect.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"disconnect.js","sourceRoot":"","sources":["../../src/meta-tools/disconnect.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE/C,MAAM,UAAU,kBAAkB,CAChC,MAAiB,EACjB,iBAAoC;IAEpC,MAAM,CAAC,IAAI,CACT,gBAAgB,EAChB,4GAA4G,EAC5G;QACE,IAAI,EAAE,CAAC;aACJ,MAAM,EAAE;aACR,QAAQ,CAAC,mDAAmD,CAAC;KACjE,EACD,KAAK,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE;QACjB,IAAI,CAAC;YACH,MAAM,iBAAiB,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;YAEzC,OAAO;gBACL,OAAO,EAAE;oBACP;wBACE,IAAI,EAAE,MAAe;wBACrB,IAAI,EAAE;4BACJ,sBAAsB,IAAI,EAAE;4BAC5B,EAAE;4BACF,+CAA+C;4BAC/C,2BAA2B,iBAAiB,CAAC,eAAe,EAAE;yBAC/D,CAAC,IAAI,CAAC,IAAI,CAAC;qBACb;iBACF;aACF,CAAC;QACJ,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,OAAO,SAAS,CACd,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CACjD,CAAC;QACJ,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { TRUST_LABELS } from "../permissions/trust-tiers.js";
|
|
3
|
+
import { toolError } from "../utils/errors.js";
|
|
4
|
+
export function registerDiscover(server, registryClient) {
|
|
5
|
+
server.tool("mcp_discover", "Search the MCP-Rating registry for MCP servers. Returns servers with quality scores, trust tiers, and install information. Use this to find servers before connecting them with mcp_connect.", {
|
|
6
|
+
query: z.string().describe("Search query (server name, description, or capability)"),
|
|
7
|
+
category: z.string().optional().describe("Filter by category slug (e.g., 'developer-tools', 'data-databases')"),
|
|
8
|
+
limit: z.number().min(1).max(20).optional().describe("Max results (default 10)"),
|
|
9
|
+
}, async ({ query, category, limit }) => {
|
|
10
|
+
try {
|
|
11
|
+
const result = await registryClient.search(query, {
|
|
12
|
+
category,
|
|
13
|
+
limit: limit ?? 10,
|
|
14
|
+
});
|
|
15
|
+
if (result.data.length === 0) {
|
|
16
|
+
return {
|
|
17
|
+
content: [
|
|
18
|
+
{
|
|
19
|
+
type: "text",
|
|
20
|
+
text: `No MCP servers found for "${query}". Try a broader search term.`,
|
|
21
|
+
},
|
|
22
|
+
],
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
const lines = [
|
|
26
|
+
`## MCP Server Search: "${query}"`,
|
|
27
|
+
`Found ${result.total} servers (showing ${result.data.length})\n`,
|
|
28
|
+
];
|
|
29
|
+
for (const server of result.data) {
|
|
30
|
+
const tier = (await import("../registry/registry-client.js")).RegistryClient.determineTrustTier(server);
|
|
31
|
+
const tierLabel = TRUST_LABELS[tier];
|
|
32
|
+
const score = server.qualityScore ?? 0;
|
|
33
|
+
const stars = server.stars ? `${server.stars.toLocaleString()} ★` : "";
|
|
34
|
+
const downloads = server.weeklyDownloads
|
|
35
|
+
? `${server.weeklyDownloads.toLocaleString()}/wk`
|
|
36
|
+
: "";
|
|
37
|
+
const cat = server.category?.name || "";
|
|
38
|
+
const tools = server.tools?.length
|
|
39
|
+
? `${server.tools.length} tools`
|
|
40
|
+
: "";
|
|
41
|
+
const discovery = server.supportsDiscovery ? "✓ Discovery" : "";
|
|
42
|
+
const requiresAuth = server.requiresAuth || server.metadata?.requiresAuth;
|
|
43
|
+
const authLabel = requiresAuth ? "🔑 Auth Required" : "";
|
|
44
|
+
// How you run it — the single most useful thing to know at discovery time.
|
|
45
|
+
const amLabels = {
|
|
46
|
+
npm: "npx",
|
|
47
|
+
pypi: "uvx",
|
|
48
|
+
docker: "Docker",
|
|
49
|
+
remote: "Remote (URL)",
|
|
50
|
+
"github-manual": "manual build",
|
|
51
|
+
};
|
|
52
|
+
const access = server.accessMethod
|
|
53
|
+
? amLabels[server.accessMethod] || server.accessMethod
|
|
54
|
+
: "";
|
|
55
|
+
// Surface the safety screen here, not just on connect — "judge before
|
|
56
|
+
// you run" only works if the warning arrives while choosing.
|
|
57
|
+
const safety = typeof server.safetyScore === "number" && server.safetyScore < 50
|
|
58
|
+
? `⚠️ Safety ${server.safetyScore}`
|
|
59
|
+
: "";
|
|
60
|
+
const stats = [access, stars, downloads, cat, tools, discovery, authLabel, safety]
|
|
61
|
+
.filter(Boolean)
|
|
62
|
+
.join(" · ");
|
|
63
|
+
lines.push(`### ${server.name}`, `**Slug:** \`${server.slug}\` · **Score:** ${score}/100 · **Trust:** [${tierLabel}]`, server.description || "_No description_", stats ? `📊 ${stats}` : "");
|
|
64
|
+
// Show auth env vars if present
|
|
65
|
+
const authEnvVars = server.authDetails?.envVars || server.metadata?.authEnvVars || [];
|
|
66
|
+
if (authEnvVars.length > 0) {
|
|
67
|
+
lines.push(`🔑 Requires: ${authEnvVars.map(ev => `\`${ev.name}\``).join(", ")}`);
|
|
68
|
+
}
|
|
69
|
+
// Remote servers have no install command by design — you connect by URL.
|
|
70
|
+
// Warning on those read as "broken server" when nothing was wrong.
|
|
71
|
+
lines.push(server.installCommand
|
|
72
|
+
? `🔧 Install: \`${server.installCommand}\``
|
|
73
|
+
: server.accessMethod === "remote"
|
|
74
|
+
? "🌐 Hosted server — no install needed"
|
|
75
|
+
: "⚠️ No install command recorded (try connecting by slug)");
|
|
76
|
+
// Build connect suggestion with env template if auth is required
|
|
77
|
+
if (authEnvVars.length > 0) {
|
|
78
|
+
const envTemplate = authEnvVars
|
|
79
|
+
.map((ev) => `"${ev.name}": "<your-${ev.name.toLowerCase()}>"`)
|
|
80
|
+
.join(", ");
|
|
81
|
+
lines.push(`→ Connect: \`mcp_connect({slug: "${server.slug}", env: {${envTemplate}}})\``);
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
lines.push(`→ Connect: \`mcp_connect({slug: "${server.slug}"})\``);
|
|
85
|
+
}
|
|
86
|
+
lines.push("");
|
|
87
|
+
}
|
|
88
|
+
return {
|
|
89
|
+
content: [{ type: "text", text: lines.join("\n") }],
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
catch (err) {
|
|
93
|
+
return toolError(`Registry search failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
//# sourceMappingURL=discover.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"discover.js","sourceRoot":"","sources":["../../src/meta-tools/discover.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE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,cAAc,IAAI;oBAC5C,CAAC,CAAC,MAAM,CAAC,YAAY,KAAK,QAAQ;wBAChC,CAAC,CAAC,sCAAsC;wBACxC,CAAC,CAAC,yDAAyD,CAChE,CAAC;gBAEF,iEAAiE;gBACjE,IAAI,WAAW,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;oBAC3B,MAAM,WAAW,GAAG,WAAW;yBAC5B,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,IAAI,EAAE,CAAC,IAAI,aAAa,EAAE,CAAC,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC;yBAC9D,IAAI,CAAC,IAAI,CAAC,CAAC;oBACd,KAAK,CAAC,IAAI,CACR,oCAAoC,MAAM,CAAC,IAAI,YAAY,WAAW,OAAO,CAC9E,CAAC;gBACJ,CAAC;qBAAM,CAAC;oBACN,KAAK,CAAC,IAAI,CACR,oCAAoC,MAAM,CAAC,IAAI,OAAO,CACvD,CAAC;gBACJ,CAAC;gBAED,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;YACjB,CAAC;YAED,OAAO;gBACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;aAC7D,CAAC;QACJ,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,OAAO,SAAS,CACd,2BAA2B,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAC9E,CAAC;QACJ,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
|
+
import type { ConnectionManager } from "../connection/connection-manager.js";
|
|
3
|
+
/**
|
|
4
|
+
* Register the `mcp_groups` meta-tool for managing server groups.
|
|
5
|
+
* Groups allow atomic connect/disconnect of sets of servers.
|
|
6
|
+
*/
|
|
7
|
+
export declare function registerGroups(server: McpServer, connectionManager: ConnectionManager, groupsPath: string): void;
|
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { createGroup, deleteGroup, listGroups, getGroup, addToGroup, removeFromGroup, groupToConnectParams, } from "../config/groups.js";
|
|
3
|
+
import { toolError } from "../utils/errors.js";
|
|
4
|
+
// Default groups path — lives alongside profiles
|
|
5
|
+
const DEFAULT_GROUPS_PATH_SUFFIX = "mcp-gateway-groups.json";
|
|
6
|
+
/**
|
|
7
|
+
* Register the `mcp_groups` meta-tool for managing server groups.
|
|
8
|
+
* Groups allow atomic connect/disconnect of sets of servers.
|
|
9
|
+
*/
|
|
10
|
+
export function registerGroups(server, connectionManager, groupsPath) {
|
|
11
|
+
server.tool("mcp_groups", "Manage server groups for atomic connect/disconnect of sets of servers.", {
|
|
12
|
+
action: z
|
|
13
|
+
.enum(["list", "create", "delete", "add_server", "remove_server", "connect", "disconnect", "show"])
|
|
14
|
+
.describe("Action: list, create, delete, add_server, remove_server, connect (all in group), disconnect (all in group), show (details)"),
|
|
15
|
+
name: z
|
|
16
|
+
.string()
|
|
17
|
+
.optional()
|
|
18
|
+
.describe("Group name (required for all actions except list)"),
|
|
19
|
+
description: z
|
|
20
|
+
.string()
|
|
21
|
+
.optional()
|
|
22
|
+
.describe("Group description (optional, for create)"),
|
|
23
|
+
slug: z
|
|
24
|
+
.string()
|
|
25
|
+
.optional()
|
|
26
|
+
.describe("Server slug to add/remove from a group"),
|
|
27
|
+
command: z
|
|
28
|
+
.string()
|
|
29
|
+
.optional()
|
|
30
|
+
.describe("Explicit command for the server (for add_server with stdio)"),
|
|
31
|
+
args: z
|
|
32
|
+
.array(z.string())
|
|
33
|
+
.optional()
|
|
34
|
+
.describe("Command arguments (for add_server with stdio)"),
|
|
35
|
+
url: z
|
|
36
|
+
.string()
|
|
37
|
+
.optional()
|
|
38
|
+
.describe("Server URL (for add_server with SSE/WS/HTTP)"),
|
|
39
|
+
transportType: z
|
|
40
|
+
.enum(["stdio", "sse", "websocket", "streamable-http"])
|
|
41
|
+
.optional()
|
|
42
|
+
.describe("Transport type (for add_server)"),
|
|
43
|
+
}, async ({ action, name, description, slug, command, args, url, transportType }) => {
|
|
44
|
+
try {
|
|
45
|
+
switch (action) {
|
|
46
|
+
case "list": {
|
|
47
|
+
const groups = listGroups(groupsPath);
|
|
48
|
+
if (groups.length === 0) {
|
|
49
|
+
return {
|
|
50
|
+
content: [
|
|
51
|
+
{
|
|
52
|
+
type: "text",
|
|
53
|
+
text: "No server groups exist yet.\n\nUse `mcp_groups({action: \"create\", name: \"my-group\"})` to create one.",
|
|
54
|
+
},
|
|
55
|
+
],
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
const lines = [
|
|
59
|
+
`## Server Groups (${groups.length})`,
|
|
60
|
+
"",
|
|
61
|
+
];
|
|
62
|
+
for (const g of groups) {
|
|
63
|
+
lines.push(`### ${g.name}`, g.description ? `_${g.description}_` : "", `**Servers:** ${g.servers.length}`, "");
|
|
64
|
+
}
|
|
65
|
+
return {
|
|
66
|
+
content: [{ type: "text", text: lines.filter(Boolean).join("\n") }],
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
case "create": {
|
|
70
|
+
if (!name)
|
|
71
|
+
return toolError("Group name is required for 'create'.");
|
|
72
|
+
createGroup(groupsPath, name, description);
|
|
73
|
+
return {
|
|
74
|
+
content: [
|
|
75
|
+
{
|
|
76
|
+
type: "text",
|
|
77
|
+
text: `✅ Group **"${name}"** created.${description ? ` (${description})` : ""}\n\nAdd servers with \`mcp_groups({action: "add_server", name: "${name}", slug: "..."})\``,
|
|
78
|
+
},
|
|
79
|
+
],
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
case "delete": {
|
|
83
|
+
if (!name)
|
|
84
|
+
return toolError("Group name is required for 'delete'.");
|
|
85
|
+
const deleted = deleteGroup(groupsPath, name);
|
|
86
|
+
if (!deleted)
|
|
87
|
+
return toolError(`Group "${name}" not found.`);
|
|
88
|
+
return {
|
|
89
|
+
content: [
|
|
90
|
+
{ type: "text", text: `✅ Group **"${name}"** deleted.` },
|
|
91
|
+
],
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
case "add_server": {
|
|
95
|
+
if (!name)
|
|
96
|
+
return toolError("Group name is required for 'add_server'.");
|
|
97
|
+
if (!slug && !command && !url) {
|
|
98
|
+
return toolError("Either 'slug', 'command', or 'url' is required to add a server.");
|
|
99
|
+
}
|
|
100
|
+
addToGroup(groupsPath, name, {
|
|
101
|
+
slug,
|
|
102
|
+
command,
|
|
103
|
+
args,
|
|
104
|
+
url,
|
|
105
|
+
transportType: transportType,
|
|
106
|
+
});
|
|
107
|
+
const identifier = slug || command || url;
|
|
108
|
+
return {
|
|
109
|
+
content: [
|
|
110
|
+
{
|
|
111
|
+
type: "text",
|
|
112
|
+
text: `✅ Server **${identifier}** added to group **"${name}"**.`,
|
|
113
|
+
},
|
|
114
|
+
],
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
case "remove_server": {
|
|
118
|
+
if (!name)
|
|
119
|
+
return toolError("Group name is required for 'remove_server'.");
|
|
120
|
+
if (!slug)
|
|
121
|
+
return toolError("Server slug is required to remove a server.");
|
|
122
|
+
removeFromGroup(groupsPath, name, slug);
|
|
123
|
+
return {
|
|
124
|
+
content: [
|
|
125
|
+
{
|
|
126
|
+
type: "text",
|
|
127
|
+
text: `✅ Server **${slug}** removed from group **"${name}"**.`,
|
|
128
|
+
},
|
|
129
|
+
],
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
case "connect": {
|
|
133
|
+
if (!name)
|
|
134
|
+
return toolError("Group name is required for 'connect'.");
|
|
135
|
+
const group = getGroup(groupsPath, name);
|
|
136
|
+
if (!group)
|
|
137
|
+
return toolError(`Group "${name}" not found.`);
|
|
138
|
+
if (group.servers.length === 0) {
|
|
139
|
+
return toolError(`Group "${name}" has no servers.`);
|
|
140
|
+
}
|
|
141
|
+
const params = groupToConnectParams(group);
|
|
142
|
+
const results = [];
|
|
143
|
+
let successCount = 0;
|
|
144
|
+
// Connect all servers in parallel
|
|
145
|
+
const outcomes = await Promise.allSettled(params.map((p) => connectionManager.connect(p)));
|
|
146
|
+
for (let i = 0; i < outcomes.length; i++) {
|
|
147
|
+
const outcome = outcomes[i];
|
|
148
|
+
const identifier = params[i].slug || params[i].command || params[i].url || "unknown";
|
|
149
|
+
if (outcome.status === "fulfilled") {
|
|
150
|
+
successCount++;
|
|
151
|
+
results.push(`✅ ${identifier}`);
|
|
152
|
+
}
|
|
153
|
+
else {
|
|
154
|
+
const reason = outcome.reason instanceof Error
|
|
155
|
+
? outcome.reason.message
|
|
156
|
+
: String(outcome.reason);
|
|
157
|
+
results.push(`❌ ${identifier}: ${reason}`);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
const lines = [
|
|
161
|
+
`## Group "${name}" — Connect Results`,
|
|
162
|
+
"",
|
|
163
|
+
`**Success:** ${successCount}/${params.length}`,
|
|
164
|
+
"",
|
|
165
|
+
...results,
|
|
166
|
+
"",
|
|
167
|
+
`**Active connections:** ${connectionManager.connectionCount}`,
|
|
168
|
+
];
|
|
169
|
+
return {
|
|
170
|
+
content: [{ type: "text", text: lines.join("\n") }],
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
case "disconnect": {
|
|
174
|
+
if (!name)
|
|
175
|
+
return toolError("Group name is required for 'disconnect'.");
|
|
176
|
+
const group = getGroup(groupsPath, name);
|
|
177
|
+
if (!group)
|
|
178
|
+
return toolError(`Group "${name}" not found.`);
|
|
179
|
+
const results = [];
|
|
180
|
+
let successCount = 0;
|
|
181
|
+
for (const entry of group.servers) {
|
|
182
|
+
const identifier = entry.slug || entry.command || entry.url || "unknown";
|
|
183
|
+
try {
|
|
184
|
+
await connectionManager.disconnect(identifier, { removeProfile: false });
|
|
185
|
+
successCount++;
|
|
186
|
+
results.push(`✅ ${identifier}`);
|
|
187
|
+
}
|
|
188
|
+
catch (err) {
|
|
189
|
+
results.push(`❌ ${identifier}: ${err instanceof Error ? err.message : String(err)}`);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
const lines = [
|
|
193
|
+
`## Group "${name}" — Disconnect Results`,
|
|
194
|
+
"",
|
|
195
|
+
`**Disconnected:** ${successCount}/${group.servers.length}`,
|
|
196
|
+
"",
|
|
197
|
+
...results,
|
|
198
|
+
];
|
|
199
|
+
return {
|
|
200
|
+
content: [{ type: "text", text: lines.join("\n") }],
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
case "show": {
|
|
204
|
+
if (!name)
|
|
205
|
+
return toolError("Group name is required for 'show'.");
|
|
206
|
+
const group = getGroup(groupsPath, name);
|
|
207
|
+
if (!group)
|
|
208
|
+
return toolError(`Group "${name}" not found.`);
|
|
209
|
+
const lines = [
|
|
210
|
+
`## Group: ${group.name}`,
|
|
211
|
+
group.description ? `_${group.description}_` : "",
|
|
212
|
+
"",
|
|
213
|
+
`**Servers:** ${group.servers.length}`,
|
|
214
|
+
"",
|
|
215
|
+
];
|
|
216
|
+
for (const s of group.servers) {
|
|
217
|
+
const transport = s.transportType || "stdio";
|
|
218
|
+
const target = s.slug || s.command || s.url || "unknown";
|
|
219
|
+
lines.push(`- \`${target}\` (${transport})`);
|
|
220
|
+
}
|
|
221
|
+
if (group.servers.length === 0) {
|
|
222
|
+
lines.push("_No servers in this group yet._");
|
|
223
|
+
}
|
|
224
|
+
return {
|
|
225
|
+
content: [{ type: "text", text: lines.filter(Boolean).join("\n") }],
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
default:
|
|
229
|
+
return toolError(`Unknown action: ${action}`);
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
catch (err) {
|
|
233
|
+
return toolError(err instanceof Error ? err.message : String(err));
|
|
234
|
+
}
|
|
235
|
+
});
|
|
236
|
+
}
|
|
237
|
+
//# s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AAC;YACb,OAAO,SAAS,CAAC,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;QACrE,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
|
+
import type { ConnectionManager } from "../connection/connection-manager.js";
|
|
3
|
+
import type { RegistryClient } from "../registry/registry-client.js";
|
|
4
|
+
export declare function registerHealth(server: McpServer, connectionManager: ConnectionManager, registryClient: RegistryClient): void;
|