@mcp-ts/sdk 1.5.3 → 1.6.1

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.
Files changed (60) hide show
  1. package/dist/adapters/agui-adapter.d.mts +2 -2
  2. package/dist/adapters/agui-adapter.d.ts +2 -2
  3. package/dist/adapters/agui-adapter.js +69 -18
  4. package/dist/adapters/agui-adapter.js.map +1 -1
  5. package/dist/adapters/agui-adapter.mjs +69 -18
  6. package/dist/adapters/agui-adapter.mjs.map +1 -1
  7. package/dist/adapters/agui-middleware.d.mts +2 -2
  8. package/dist/adapters/agui-middleware.d.ts +2 -2
  9. package/dist/adapters/ai-adapter.d.mts +2 -2
  10. package/dist/adapters/ai-adapter.d.ts +2 -2
  11. package/dist/adapters/ai-adapter.js +69 -18
  12. package/dist/adapters/ai-adapter.js.map +1 -1
  13. package/dist/adapters/ai-adapter.mjs +69 -18
  14. package/dist/adapters/ai-adapter.mjs.map +1 -1
  15. package/dist/adapters/langchain-adapter.d.mts +2 -2
  16. package/dist/adapters/langchain-adapter.d.ts +2 -2
  17. package/dist/adapters/langchain-adapter.js +69 -18
  18. package/dist/adapters/langchain-adapter.js.map +1 -1
  19. package/dist/adapters/langchain-adapter.mjs +69 -18
  20. package/dist/adapters/langchain-adapter.mjs.map +1 -1
  21. package/dist/client/index.d.mts +2 -2
  22. package/dist/client/index.d.ts +2 -2
  23. package/dist/client/react.d.mts +4 -4
  24. package/dist/client/react.d.ts +4 -4
  25. package/dist/client/react.js.map +1 -1
  26. package/dist/client/react.mjs.map +1 -1
  27. package/dist/client/vue.d.mts +4 -4
  28. package/dist/client/vue.d.ts +4 -4
  29. package/dist/{index-GfC_eNEv.d.ts → index-DhA-OEAe.d.ts} +1 -1
  30. package/dist/{index-DcYfpY3H.d.mts → index-bFL4ZF2N.d.mts} +1 -1
  31. package/dist/index.d.mts +4 -4
  32. package/dist/index.d.ts +4 -4
  33. package/dist/index.js +212 -44
  34. package/dist/index.js.map +1 -1
  35. package/dist/index.mjs +212 -45
  36. package/dist/index.mjs.map +1 -1
  37. package/dist/server/index.d.mts +2 -2
  38. package/dist/server/index.d.ts +2 -2
  39. package/dist/server/index.js +13 -5
  40. package/dist/server/index.js.map +1 -1
  41. package/dist/server/index.mjs +13 -5
  42. package/dist/server/index.mjs.map +1 -1
  43. package/dist/shared/index.d.mts +17 -10
  44. package/dist/shared/index.d.ts +17 -10
  45. package/dist/shared/index.js +199 -39
  46. package/dist/shared/index.js.map +1 -1
  47. package/dist/shared/index.mjs +199 -40
  48. package/dist/shared/index.mjs.map +1 -1
  49. package/dist/{tool-router-DsKhRmJm.d.ts → tool-router-BVaV1udm.d.mts} +57 -8
  50. package/dist/{tool-router-DK0RJblO.d.mts → tool-router-Dh2804tM.d.ts} +57 -8
  51. package/dist/{types-CfCoIsWI.d.mts → types-rIuN1CQi.d.mts} +1 -0
  52. package/dist/{types-CfCoIsWI.d.ts → types-rIuN1CQi.d.ts} +1 -0
  53. package/package.json +3 -1
  54. package/src/server/handlers/sse-handler.ts +12 -0
  55. package/src/server/mcp/oauth-client.ts +10 -6
  56. package/src/shared/index.ts +4 -0
  57. package/src/shared/meta-tools.ts +163 -37
  58. package/src/shared/tool-index.ts +123 -7
  59. package/src/shared/tool-router.ts +40 -7
  60. package/src/shared/types.ts +1 -0
@@ -1,9 +1,9 @@
1
- import { c as SSEClient } from '../index-DcYfpY3H.mjs';
2
- export { A as APP_HOST_DEFAULTS, a as AppHost, D as DEFAULT_MCP_APP_CSP, S as SANDBOX_PROXY_READY_METHOD, b as SANDBOX_RESOURCE_READY_METHOD, d as SSEClientOptions } from '../index-DcYfpY3H.mjs';
1
+ import { c as SSEClient } from '../index-bFL4ZF2N.mjs';
2
+ export { A as APP_HOST_DEFAULTS, a as AppHost, D as DEFAULT_MCP_APP_CSP, S as SANDBOX_PROXY_READY_METHOD, b as SANDBOX_RESOURCE_READY_METHOD, d as SSEClientOptions } from '../index-bFL4ZF2N.mjs';
3
3
  import { c as McpConnectionState, M as McpConnectionEvent } from '../events-CK3N--3g.mjs';
4
4
  export { D as Disposable, a as DisposableStore, E as Emitter, b as Event, d as McpObservabilityEvent } from '../events-CK3N--3g.mjs';
5
- import { v as ToolInfo, k as FinishAuthResult, n as ListToolsRpcResult, L as ListPromptsResult, l as ListResourcesResult } from '../types-CfCoIsWI.mjs';
6
- export { p as McpRpcRequest, q as McpRpcResponse } from '../types-CfCoIsWI.mjs';
5
+ import { v as ToolInfo, k as FinishAuthResult, n as ListToolsRpcResult, L as ListPromptsResult, l as ListResourcesResult } from '../types-rIuN1CQi.mjs';
6
+ export { p as McpRpcRequest, q as McpRpcResponse } from '../types-rIuN1CQi.mjs';
7
7
  import '@modelcontextprotocol/ext-apps/app-bridge';
8
8
  import '@modelcontextprotocol/sdk/types.js';
9
9
 
@@ -1,9 +1,9 @@
1
- import { c as SSEClient } from '../index-GfC_eNEv.js';
2
- export { A as APP_HOST_DEFAULTS, a as AppHost, D as DEFAULT_MCP_APP_CSP, S as SANDBOX_PROXY_READY_METHOD, b as SANDBOX_RESOURCE_READY_METHOD, d as SSEClientOptions } from '../index-GfC_eNEv.js';
1
+ import { c as SSEClient } from '../index-DhA-OEAe.js';
2
+ export { A as APP_HOST_DEFAULTS, a as AppHost, D as DEFAULT_MCP_APP_CSP, S as SANDBOX_PROXY_READY_METHOD, b as SANDBOX_RESOURCE_READY_METHOD, d as SSEClientOptions } from '../index-DhA-OEAe.js';
3
3
  import { c as McpConnectionState, M as McpConnectionEvent } from '../events-CK3N--3g.js';
4
4
  export { D as Disposable, a as DisposableStore, E as Emitter, b as Event, d as McpObservabilityEvent } from '../events-CK3N--3g.js';
5
- import { v as ToolInfo, k as FinishAuthResult, n as ListToolsRpcResult, L as ListPromptsResult, l as ListResourcesResult } from '../types-CfCoIsWI.js';
6
- export { p as McpRpcRequest, q as McpRpcResponse } from '../types-CfCoIsWI.js';
5
+ import { v as ToolInfo, k as FinishAuthResult, n as ListToolsRpcResult, L as ListPromptsResult, l as ListResourcesResult } from '../types-rIuN1CQi.js';
6
+ export { p as McpRpcRequest, q as McpRpcResponse } from '../types-rIuN1CQi.js';
7
7
  import '@modelcontextprotocol/ext-apps/app-bridge';
8
8
  import '@modelcontextprotocol/sdk/types.js';
9
9
 
@@ -1,5 +1,5 @@
1
1
  import { M as McpConnectionEvent, d as McpObservabilityEvent, e as McpAppsUIEvent } from './events-CK3N--3g.js';
2
- import { s as SessionListResult, e as ConnectParams, h as ConnectResult, j as DisconnectResult, n as ListToolsRpcResult, r as RestoreSessionResult, k as FinishAuthResult, L as ListPromptsResult, l as ListResourcesResult } from './types-CfCoIsWI.js';
2
+ import { s as SessionListResult, e as ConnectParams, h as ConnectResult, j as DisconnectResult, n as ListToolsRpcResult, r as RestoreSessionResult, k as FinishAuthResult, L as ListPromptsResult, l as ListResourcesResult } from './types-rIuN1CQi.js';
3
3
  import { AppBridge } from '@modelcontextprotocol/ext-apps/app-bridge';
4
4
  import { LoggingMessageNotification } from '@modelcontextprotocol/sdk/types.js';
5
5
 
@@ -1,5 +1,5 @@
1
1
  import { M as McpConnectionEvent, d as McpObservabilityEvent, e as McpAppsUIEvent } from './events-CK3N--3g.mjs';
2
- import { s as SessionListResult, e as ConnectParams, h as ConnectResult, j as DisconnectResult, n as ListToolsRpcResult, r as RestoreSessionResult, k as FinishAuthResult, L as ListPromptsResult, l as ListResourcesResult } from './types-CfCoIsWI.mjs';
2
+ import { s as SessionListResult, e as ConnectParams, h as ConnectResult, j as DisconnectResult, n as ListToolsRpcResult, r as RestoreSessionResult, k as FinishAuthResult, L as ListPromptsResult, l as ListResourcesResult } from './types-rIuN1CQi.mjs';
3
3
  import { AppBridge } from '@modelcontextprotocol/ext-apps/app-bridge';
4
4
  import { LoggingMessageNotification } from '@modelcontextprotocol/sdk/types.js';
5
5
 
package/dist/index.d.mts CHANGED
@@ -2,11 +2,11 @@ export { M as MCPClient, a as MultiSessionClient, S as StorageOAuthClientProvide
2
2
  export { A as AuthenticationError, C as ConfigurationError, a as ConnectionError, I as InvalidStateError, M as McpError, N as NotConnectedError, R as RpcErrorCode, b as RpcErrorCodes, S as SessionNotFoundError, c as SessionValidationError, T as ToolExecutionError, U as UnauthorizedError, s as sanitizeServerLabel } from './utils-0qmYrqoa.mjs';
3
3
  export { ClientMetadata, NextMcpHandlerOptions, SSEConnectionManager, SSEHandlerOptions, StorageBackend, createNextMcpHandler, createSSEHandler, storage } from './server/index.mjs';
4
4
  export { D as Disposable, a as DisposableStore, E as Emitter, b as Event, M as McpConnectionEvent, c as McpConnectionState, d as McpObservabilityEvent } from './events-CK3N--3g.mjs';
5
- export { C as CallToolParams, a as CallToolRequest, b as CallToolResponse, c as ConnectAuthRequiredResponse, d as ConnectErrorResponse, e as ConnectParams, f as ConnectRequest, g as ConnectResponse, h as ConnectResult, i as ConnectSuccessResponse, D as DisconnectParams, j as DisconnectResult, F as FinishAuthParams, k as FinishAuthResult, G as GetPromptParams, L as ListPromptsResult, l as ListResourcesResult, m as ListToolsResponse, n as ListToolsRpcResult, M as McpRpcMethod, o as McpRpcParams, p as McpRpcRequest, q as McpRpcResponse, R as ReadResourceParams, r as RestoreSessionResult, S as SessionInfo, s as SessionListResult, t as SessionParams, T as ToolClient, u as ToolClientProvider, v as ToolInfo, w as TransportType, x as isCallToolSuccess, y as isConnectAuthRequired, z as isConnectError, A as isConnectSuccess, B as isListToolsSuccess } from './types-CfCoIsWI.mjs';
5
+ export { C as CallToolParams, a as CallToolRequest, b as CallToolResponse, c as ConnectAuthRequiredResponse, d as ConnectErrorResponse, e as ConnectParams, f as ConnectRequest, g as ConnectResponse, h as ConnectResult, i as ConnectSuccessResponse, D as DisconnectParams, j as DisconnectResult, F as FinishAuthParams, k as FinishAuthResult, G as GetPromptParams, L as ListPromptsResult, l as ListResourcesResult, m as ListToolsResponse, n as ListToolsRpcResult, M as McpRpcMethod, o as McpRpcParams, p as McpRpcRequest, q as McpRpcResponse, R as ReadResourceParams, r as RestoreSessionResult, S as SessionInfo, s as SessionListResult, t as SessionParams, T as ToolClient, u as ToolClientProvider, v as ToolInfo, w as TransportType, x as isCallToolSuccess, y as isConnectAuthRequired, z as isConnectError, A as isConnectSuccess, B as isListToolsSuccess } from './types-rIuN1CQi.mjs';
6
6
  export { OAuthClientInformation, OAuthClientInformationFull, OAuthClientMetadata, OAuthTokens } from '@modelcontextprotocol/sdk/shared/auth.js';
7
7
  export { CallToolResult, ListToolsResult, Tool } from '@modelcontextprotocol/sdk/types.js';
8
- export { A as APP_HOST_DEFAULTS, a as AppHost, D as DEFAULT_MCP_APP_CSP, S as SANDBOX_PROXY_READY_METHOD, b as SANDBOX_RESOURCE_READY_METHOD, c as SSEClient, d as SSEClientOptions } from './index-DcYfpY3H.mjs';
9
- export { CallToolFn, DEFAULT_CLIENT_NAME, DEFAULT_CLIENT_URI, DEFAULT_HEARTBEAT_INTERVAL_MS, DEFAULT_LOGO_URI, DEFAULT_POLICY_URI, MCP_CLIENT_NAME, MCP_CLIENT_VERSION, REDIS_KEY_PREFIX, SESSION_TTL_SECONDS, SOFTWARE_ID, SOFTWARE_VERSION, STATE_EXPIRATION_MS, TOKEN_EXPIRY_BUFFER_MS, ToolUiConfig, createExecuteToolDefinition, createGetSchemaToolDefinition, createRegexSearchToolDefinition, createSearchToolDefinition, executeMetaTool, findToolByName, getToolUiResourceUri, isMetaTool, resolveMetaToolProxy } from './shared/index.mjs';
10
- export { C as CompactTool, a as CompressionStats, E as EmbedFn, I as IndexedTool, S as SchemaCompressor, T as ToolGroupInfo, b as ToolIndex, c as ToolIndexOptions, d as ToolRouter, e as ToolRouterClientInput, f as ToolRouterOptions, g as ToolRouterStrategy, h as ToolSummary } from './tool-router-DK0RJblO.mjs';
8
+ export { A as APP_HOST_DEFAULTS, a as AppHost, D as DEFAULT_MCP_APP_CSP, S as SANDBOX_PROXY_READY_METHOD, b as SANDBOX_RESOURCE_READY_METHOD, c as SSEClient, d as SSEClientOptions } from './index-bFL4ZF2N.mjs';
9
+ export { CallToolFn, DEFAULT_CLIENT_NAME, DEFAULT_CLIENT_URI, DEFAULT_HEARTBEAT_INTERVAL_MS, DEFAULT_LOGO_URI, DEFAULT_POLICY_URI, MCP_CLIENT_NAME, MCP_CLIENT_VERSION, REDIS_KEY_PREFIX, SESSION_TTL_SECONDS, SOFTWARE_ID, SOFTWARE_VERSION, STATE_EXPIRATION_MS, TOKEN_EXPIRY_BUFFER_MS, ToolUiConfig, createExecuteToolDefinition, createGetSchemaToolDefinition, createListServersToolDefinition, createRegexSearchToolDefinition, createSearchToolDefinition, executeMetaTool, findToolByName, getToolUiResourceUri, isMetaTool, resolveMetaToolProxy } from './shared/index.mjs';
10
+ export { C as CompactTool, a as CompressionStats, E as EmbedFn, I as IndexedTool, S as SchemaCompressor, T as ToolGroupInfo, b as ToolIndex, c as ToolIndexOptions, d as ToolListResult, e as ToolRouter, f as ToolRouterClientInput, g as ToolRouterOptions, h as ToolRouterStrategy, i as ToolSearchOptions, j as ToolServerSummary, k as ToolSummary } from './tool-router-BVaV1udm.mjs';
11
11
  import '@modelcontextprotocol/sdk/client/auth.js';
12
12
  import '@modelcontextprotocol/ext-apps/app-bridge';
package/dist/index.d.ts CHANGED
@@ -2,11 +2,11 @@ export { M as MCPClient, a as MultiSessionClient, S as StorageOAuthClientProvide
2
2
  export { A as AuthenticationError, C as ConfigurationError, a as ConnectionError, I as InvalidStateError, M as McpError, N as NotConnectedError, R as RpcErrorCode, b as RpcErrorCodes, S as SessionNotFoundError, c as SessionValidationError, T as ToolExecutionError, U as UnauthorizedError, s as sanitizeServerLabel } from './utils-0qmYrqoa.js';
3
3
  export { ClientMetadata, NextMcpHandlerOptions, SSEConnectionManager, SSEHandlerOptions, StorageBackend, createNextMcpHandler, createSSEHandler, storage } from './server/index.js';
4
4
  export { D as Disposable, a as DisposableStore, E as Emitter, b as Event, M as McpConnectionEvent, c as McpConnectionState, d as McpObservabilityEvent } from './events-CK3N--3g.js';
5
- export { C as CallToolParams, a as CallToolRequest, b as CallToolResponse, c as ConnectAuthRequiredResponse, d as ConnectErrorResponse, e as ConnectParams, f as ConnectRequest, g as ConnectResponse, h as ConnectResult, i as ConnectSuccessResponse, D as DisconnectParams, j as DisconnectResult, F as FinishAuthParams, k as FinishAuthResult, G as GetPromptParams, L as ListPromptsResult, l as ListResourcesResult, m as ListToolsResponse, n as ListToolsRpcResult, M as McpRpcMethod, o as McpRpcParams, p as McpRpcRequest, q as McpRpcResponse, R as ReadResourceParams, r as RestoreSessionResult, S as SessionInfo, s as SessionListResult, t as SessionParams, T as ToolClient, u as ToolClientProvider, v as ToolInfo, w as TransportType, x as isCallToolSuccess, y as isConnectAuthRequired, z as isConnectError, A as isConnectSuccess, B as isListToolsSuccess } from './types-CfCoIsWI.js';
5
+ export { C as CallToolParams, a as CallToolRequest, b as CallToolResponse, c as ConnectAuthRequiredResponse, d as ConnectErrorResponse, e as ConnectParams, f as ConnectRequest, g as ConnectResponse, h as ConnectResult, i as ConnectSuccessResponse, D as DisconnectParams, j as DisconnectResult, F as FinishAuthParams, k as FinishAuthResult, G as GetPromptParams, L as ListPromptsResult, l as ListResourcesResult, m as ListToolsResponse, n as ListToolsRpcResult, M as McpRpcMethod, o as McpRpcParams, p as McpRpcRequest, q as McpRpcResponse, R as ReadResourceParams, r as RestoreSessionResult, S as SessionInfo, s as SessionListResult, t as SessionParams, T as ToolClient, u as ToolClientProvider, v as ToolInfo, w as TransportType, x as isCallToolSuccess, y as isConnectAuthRequired, z as isConnectError, A as isConnectSuccess, B as isListToolsSuccess } from './types-rIuN1CQi.js';
6
6
  export { OAuthClientInformation, OAuthClientInformationFull, OAuthClientMetadata, OAuthTokens } from '@modelcontextprotocol/sdk/shared/auth.js';
7
7
  export { CallToolResult, ListToolsResult, Tool } from '@modelcontextprotocol/sdk/types.js';
8
- export { A as APP_HOST_DEFAULTS, a as AppHost, D as DEFAULT_MCP_APP_CSP, S as SANDBOX_PROXY_READY_METHOD, b as SANDBOX_RESOURCE_READY_METHOD, c as SSEClient, d as SSEClientOptions } from './index-GfC_eNEv.js';
9
- export { CallToolFn, DEFAULT_CLIENT_NAME, DEFAULT_CLIENT_URI, DEFAULT_HEARTBEAT_INTERVAL_MS, DEFAULT_LOGO_URI, DEFAULT_POLICY_URI, MCP_CLIENT_NAME, MCP_CLIENT_VERSION, REDIS_KEY_PREFIX, SESSION_TTL_SECONDS, SOFTWARE_ID, SOFTWARE_VERSION, STATE_EXPIRATION_MS, TOKEN_EXPIRY_BUFFER_MS, ToolUiConfig, createExecuteToolDefinition, createGetSchemaToolDefinition, createRegexSearchToolDefinition, createSearchToolDefinition, executeMetaTool, findToolByName, getToolUiResourceUri, isMetaTool, resolveMetaToolProxy } from './shared/index.js';
10
- export { C as CompactTool, a as CompressionStats, E as EmbedFn, I as IndexedTool, S as SchemaCompressor, T as ToolGroupInfo, b as ToolIndex, c as ToolIndexOptions, d as ToolRouter, e as ToolRouterClientInput, f as ToolRouterOptions, g as ToolRouterStrategy, h as ToolSummary } from './tool-router-DsKhRmJm.js';
8
+ export { A as APP_HOST_DEFAULTS, a as AppHost, D as DEFAULT_MCP_APP_CSP, S as SANDBOX_PROXY_READY_METHOD, b as SANDBOX_RESOURCE_READY_METHOD, c as SSEClient, d as SSEClientOptions } from './index-DhA-OEAe.js';
9
+ export { CallToolFn, DEFAULT_CLIENT_NAME, DEFAULT_CLIENT_URI, DEFAULT_HEARTBEAT_INTERVAL_MS, DEFAULT_LOGO_URI, DEFAULT_POLICY_URI, MCP_CLIENT_NAME, MCP_CLIENT_VERSION, REDIS_KEY_PREFIX, SESSION_TTL_SECONDS, SOFTWARE_ID, SOFTWARE_VERSION, STATE_EXPIRATION_MS, TOKEN_EXPIRY_BUFFER_MS, ToolUiConfig, createExecuteToolDefinition, createGetSchemaToolDefinition, createListServersToolDefinition, createRegexSearchToolDefinition, createSearchToolDefinition, executeMetaTool, findToolByName, getToolUiResourceUri, isMetaTool, resolveMetaToolProxy } from './shared/index.js';
10
+ export { C as CompactTool, a as CompressionStats, E as EmbedFn, I as IndexedTool, S as SchemaCompressor, T as ToolGroupInfo, b as ToolIndex, c as ToolIndexOptions, d as ToolListResult, e as ToolRouter, f as ToolRouterClientInput, g as ToolRouterOptions, h as ToolRouterStrategy, i as ToolSearchOptions, j as ToolServerSummary, k as ToolSummary } from './tool-router-Dh2804tM.js';
11
11
  import '@modelcontextprotocol/sdk/client/auth.js';
12
12
  import '@modelcontextprotocol/ext-apps/app-bridge';
package/dist/index.js CHANGED
@@ -1584,9 +1584,10 @@ var MCPClient = class _MCPClient {
1584
1584
  throw new Error("Server URL is required to create transport");
1585
1585
  }
1586
1586
  const baseUrl = new URL(this.serverUrl);
1587
+ const hasAuthorizationHeader = Object.keys(this.headers || {}).some((key) => key.toLowerCase() === "authorization");
1587
1588
  const transportOptions = {
1588
- authProvider: this.oauthProvider,
1589
- ...this.headers && { headers: this.headers },
1589
+ ...!hasAuthorizationHeader && { authProvider: this.oauthProvider },
1590
+ ...this.headers && { requestInit: { headers: this.headers } },
1590
1591
  /**
1591
1592
  * Custom fetch implementation to handle connection timeouts.
1592
1593
  * Observation: SDK 1.24.0+ connections may hang indefinitely in some environments.
@@ -1687,6 +1688,7 @@ var MCPClient = class _MCPClient {
1687
1688
  serverUrl: this.serverUrl,
1688
1689
  callbackUrl: this.callbackUrl,
1689
1690
  transportType: this.transportType || "streamable_http",
1691
+ headers: this.headers,
1690
1692
  createdAt: this.createdAt,
1691
1693
  active: false
1692
1694
  }, Math.floor(STATE_EXPIRATION_MS / 1e3));
@@ -1711,6 +1713,7 @@ var MCPClient = class _MCPClient {
1711
1713
  serverUrl: this.serverUrl,
1712
1714
  callbackUrl: this.callbackUrl,
1713
1715
  transportType: this.transportType || "streamable_http",
1716
+ headers: this.headers,
1714
1717
  createdAt: this.createdAt || Date.now(),
1715
1718
  active
1716
1719
  };
@@ -2270,9 +2273,7 @@ var MCPClient = class _MCPClient {
2270
2273
  * @returns Server name or undefined
2271
2274
  */
2272
2275
  getServerName() {
2273
- const info = this.client?.getServerVersion();
2274
- console.log("server info ->", info);
2275
- return info?.title ?? info?.name ?? this.serverName;
2276
+ return this.serverName;
2276
2277
  }
2277
2278
  /**
2278
2279
  * Gets the server ID
@@ -2551,6 +2552,11 @@ function isConnectionEvent(event) {
2551
2552
 
2552
2553
  // src/server/handlers/sse-handler.ts
2553
2554
  var DEFAULT_HEARTBEAT_INTERVAL = 3e4;
2555
+ function normalizeHeaders(headers) {
2556
+ if (!headers || typeof headers !== "object") return void 0;
2557
+ const entries = Object.entries(headers).map(([key, value]) => [key.trim(), String(value).trim()]).filter(([key, value]) => key.length > 0 && value.length > 0);
2558
+ return entries.length > 0 ? Object.fromEntries(entries) : void 0;
2559
+ }
2554
2560
  var SSEConnectionManager = class {
2555
2561
  constructor(options, sendEvent) {
2556
2562
  this.options = options;
@@ -2675,6 +2681,7 @@ var SSEConnectionManager = class {
2675
2681
  */
2676
2682
  async connect(params) {
2677
2683
  const { serverName, serverUrl, callbackUrl, transportType } = params;
2684
+ const headers = normalizeHeaders(params.headers);
2678
2685
  const serverId = params.serverId && params.serverId.length <= 12 ? params.serverId : await storage.generateSessionId();
2679
2686
  const existingSessions = await storage.getIdentitySessionsData(this.identity);
2680
2687
  const duplicate = existingSessions.find(
@@ -2701,6 +2708,7 @@ var SSEConnectionManager = class {
2701
2708
  serverUrl,
2702
2709
  callbackUrl,
2703
2710
  transportType,
2711
+ headers,
2704
2712
  ...clientMetadata
2705
2713
  // Spread client metadata (clientName, clientUri, logoUri, policyUri)
2706
2714
  });
@@ -4042,17 +4050,17 @@ var ToolIndex = class _ToolIndex {
4042
4050
  *
4043
4051
  * `score = keywordWeight × keyword_score + (1 - keywordWeight) × cosine_score`
4044
4052
  */
4045
- async search(query, topK = 5) {
4053
+ async search(query, topK = 5, options = {}) {
4046
4054
  if (this.tools.size === 0) return [];
4047
4055
  const queryLower = query.toLowerCase().trim();
4048
4056
  const exactMatches = [...this.toolSummaries.values()].filter(
4049
- (summary) => summary.name.toLowerCase() === queryLower
4057
+ (summary) => summary.name.toLowerCase() === queryLower && this.matchesServer(summary, options)
4050
4058
  );
4051
4059
  if (exactMatches.length > 0) {
4052
4060
  return exactMatches.slice(0, topK);
4053
4061
  }
4054
4062
  if (queryLower.startsWith("mcp__") && queryLower.length > 5) {
4055
- const prefixMatches = [...this.toolSummaries.values()].filter((t) => t.name.toLowerCase().startsWith(queryLower)).slice(0, topK);
4063
+ const prefixMatches = [...this.toolSummaries.values()].filter((t) => t.name.toLowerCase().startsWith(queryLower) && this.matchesServer(t, options)).slice(0, topK);
4056
4064
  if (prefixMatches.length > 0) return prefixMatches;
4057
4065
  }
4058
4066
  const queryTermsRaw = queryLower.split(/\s+/).filter((t) => t.length > 0);
@@ -4070,9 +4078,10 @@ var ToolIndex = class _ToolIndex {
4070
4078
  const queryTokens = this.tokenize(allScoringTerms.join(" "));
4071
4079
  const candidateKeys = /* @__PURE__ */ new Set();
4072
4080
  for (const docKey of this.toolSummaries.keys()) {
4081
+ const summary = this.toolSummaries.get(docKey);
4082
+ if (!this.matchesServer(summary, options)) continue;
4073
4083
  if (requiredTerms.length > 0) {
4074
4084
  const text = this.searchTexts.get(docKey) || "";
4075
- const summary = this.toolSummaries.get(docKey);
4076
4085
  const nameLower = summary.name.toLowerCase();
4077
4086
  const matchesAll = requiredTerms.every(
4078
4087
  (term) => text.includes(term) || nameLower.includes(term)
@@ -4183,17 +4192,66 @@ var ToolIndex = class _ToolIndex {
4183
4192
  // -----------------------------------------------------------------------
4184
4193
  /**
4185
4194
  * Get tool definition(s) by name.
4186
- * If namespace is provided, it tries to match sessionId or serverName.
4195
+ * If namespace is provided, exact sessionId/serverId matches take precedence.
4196
+ * Falls back to serverName fragment matching only when explicitly allowed.
4187
4197
  */
4188
- getTool(name, namespace) {
4198
+ getTool(name, namespace, options = {}) {
4189
4199
  const list = this.tools.get(name) ?? [];
4190
4200
  if (!namespace) return list;
4191
- return list.filter((t) => t.sessionId === namespace || t.serverId === namespace);
4201
+ const exactMatches = list.filter(
4202
+ (t) => t.sessionId === namespace || t.serverId === namespace
4203
+ );
4204
+ if (exactMatches.length > 0) return exactMatches;
4205
+ if (!options.allowServerNameFragment) return [];
4206
+ const namespaceLower = namespace.toLowerCase();
4207
+ return list.filter((t) => t.serverName.toLowerCase().includes(namespaceLower));
4192
4208
  }
4193
4209
  /** All indexed tool names. */
4194
4210
  getToolNames() {
4195
4211
  return [...this.tools.keys()];
4196
4212
  }
4213
+ /** List indexed servers with tool counts. */
4214
+ listServers(options = {}) {
4215
+ const servers = /* @__PURE__ */ new Map();
4216
+ for (const summary of this.toolSummaries.values()) {
4217
+ if (!this.matchesServer(summary, options)) continue;
4218
+ const key = `${summary.sessionId}::${summary.serverId}`;
4219
+ const existing = servers.get(key);
4220
+ if (existing) {
4221
+ existing.toolCount += 1;
4222
+ } else {
4223
+ servers.set(key, {
4224
+ serverName: summary.serverName,
4225
+ serverId: summary.serverId,
4226
+ sessionId: summary.sessionId,
4227
+ toolCount: 1
4228
+ });
4229
+ }
4230
+ }
4231
+ return [...servers.values()].sort((a, b) => {
4232
+ const byName = a.serverName.localeCompare(b.serverName);
4233
+ return byName !== 0 ? byName : a.serverId.localeCompare(b.serverId);
4234
+ });
4235
+ }
4236
+ /** List tools deterministically, optionally scoped to a server. */
4237
+ listTools(options = {}) {
4238
+ const offset = Math.max(Number(options.cursor) || 0, 0);
4239
+ const limit = Math.max(Number(options.limit) || 20, 1);
4240
+ const tools = [...this.toolSummaries.values()].filter((summary) => this.matchesServer(summary, options)).sort((a, b) => {
4241
+ const byServer = a.serverName.localeCompare(b.serverName);
4242
+ if (byServer !== 0) return byServer;
4243
+ return a.name.localeCompare(b.name);
4244
+ });
4245
+ const page = tools.slice(offset, offset + limit);
4246
+ const nextOffset = offset + page.length;
4247
+ return {
4248
+ tools: page,
4249
+ totalCount: tools.length,
4250
+ returnedCount: page.length,
4251
+ nextCursor: nextOffset < tools.length ? String(nextOffset) : void 0,
4252
+ servers: this.listServers(options)
4253
+ };
4254
+ }
4197
4255
  /** Number of indexed tools (including duplicates). */
4198
4256
  get size() {
4199
4257
  let count = 0;
@@ -4250,6 +4308,20 @@ var ToolIndex = class _ToolIndex {
4250
4308
  getDocumentKey(tool) {
4251
4309
  return `${tool.sessionId}::${tool.serverId}::${tool.name}`;
4252
4310
  }
4311
+ matchesServer(summary, options) {
4312
+ if (options.serverId && summary.serverId !== options.serverId) {
4313
+ return false;
4314
+ }
4315
+ if (options.serverName) {
4316
+ const serverNameQuery = options.serverName.toLowerCase();
4317
+ const serverName = summary.serverName.toLowerCase();
4318
+ const serverId = summary.serverId.toLowerCase();
4319
+ if (!serverName.includes(serverNameQuery) && !serverId.includes(serverNameQuery)) {
4320
+ return false;
4321
+ }
4322
+ }
4323
+ return true;
4324
+ }
4253
4325
  /** Simple whitespace + camelCase + snake_case tokenizer. */
4254
4326
  tokenize(text) {
4255
4327
  return text.replace(/([a-z])([A-Z])/g, "$1 $2").replace(/[_-]/g, " ").replace(/[^a-z0-9\s]/g, "").split(/\s+/).filter((t) => t.length > 1);
@@ -4335,7 +4407,7 @@ var SchemaCompressor = class _SchemaCompressor {
4335
4407
  init_cjs_shims();
4336
4408
  function createSearchToolDefinition() {
4337
4409
  return {
4338
- name: "mcp_search_tool_bm25",
4410
+ name: "mcp_search_tools",
4339
4411
  description: 'Search the catalog of available tools. Returns tool names, descriptions, and server info. Use this FIRST to find relevant tools before calling them.\n\nQuery forms:\n- "select:Read,Edit,Grep" \u2014 fetch these exact tools by name\n- "notebook jupyter" \u2014 keyword search, up to limit best matches\n- "+slack send" \u2014 require "slack" in the name, rank by remaining terms',
4340
4412
  inputSchema: {
4341
4413
  type: "object",
@@ -4344,15 +4416,47 @@ function createSearchToolDefinition() {
4344
4416
  type: "string",
4345
4417
  description: 'Query to find tools. Use "select:<tool_name>" for direct selection, or keywords to search. Prefix keywords with + to require them.'
4346
4418
  },
4419
+ operation: {
4420
+ type: "string",
4421
+ enum: ["search", "list"],
4422
+ description: 'Operation to perform. Use "search" to find relevant tools by capability. Use "list" with serverId or serverName when the user asks for every tool from a connected MCP server.'
4423
+ },
4424
+ serverId: {
4425
+ type: "string",
4426
+ description: "Optional server ID to restrict search/list results to one MCP server."
4427
+ },
4428
+ serverName: {
4429
+ type: "string",
4430
+ description: 'Optional server name fragment to restrict search/list results to matching MCP servers, e.g. "supabase".'
4431
+ },
4347
4432
  limit: {
4348
4433
  type: "number",
4349
- description: "Maximum number of results to return (default: 5, max: 20)."
4434
+ description: "Maximum number of results to return (default: 5 for search, 20 for list; max: 20 for search, 100 for list)."
4435
+ },
4436
+ cursor: {
4437
+ type: "string",
4438
+ description: 'Optional pagination cursor returned by operation "list".'
4350
4439
  }
4351
4440
  },
4352
4441
  required: ["query"]
4353
4442
  }
4354
4443
  };
4355
4444
  }
4445
+ function createListServersToolDefinition() {
4446
+ return {
4447
+ name: "mcp_list_servers",
4448
+ description: "List connected MCP servers and their tool counts. Use this when mcp_search_tools returns no matches, then retry mcp_search_tools with serverId or serverName.",
4449
+ inputSchema: {
4450
+ type: "object",
4451
+ properties: {
4452
+ query: {
4453
+ type: "string",
4454
+ description: 'Optional server filter text. Matches server name or serverId, e.g. "web" or "supabase".'
4455
+ }
4456
+ }
4457
+ }
4458
+ };
4459
+ }
4356
4460
  function createRegexSearchToolDefinition() {
4357
4461
  return {
4358
4462
  name: "mcp_search_tool_regex",
@@ -4376,17 +4480,17 @@ function createRegexSearchToolDefinition() {
4376
4480
  function createGetSchemaToolDefinition() {
4377
4481
  return {
4378
4482
  name: "mcp_get_tool_schema",
4379
- description: "Get the full input schema (parameters) for a specific tool. Call this after mcp_search_tool_bm25 to get the parameter details needed to call a tool correctly. Do NOT call the discovered tool directly; after reading the schema, call mcp_execute_tool.",
4483
+ description: "Get the full input schema (parameters) for a specific tool. Call this after mcp_search_tools to get the parameter details needed to call a tool correctly. Do NOT call the discovered tool directly; after reading the schema, call mcp_execute_tool.",
4380
4484
  inputSchema: {
4381
4485
  type: "object",
4382
4486
  properties: {
4383
4487
  toolName: {
4384
4488
  type: "string",
4385
- description: "The exact tool name returned by mcp_search_tool_bm25."
4489
+ description: "The exact tool name returned by mcp_search_tools."
4386
4490
  },
4387
4491
  serverId: {
4388
4492
  type: "string",
4389
- description: "Optional: The server ID provided in mcp_search_tool_bm25. Required if multiple tools have the same name."
4493
+ description: "Optional: The server ID provided in mcp_search_tools. Required if multiple tools have the same name."
4390
4494
  }
4391
4495
  },
4392
4496
  required: ["toolName"]
@@ -4396,17 +4500,17 @@ function createGetSchemaToolDefinition() {
4396
4500
  function createExecuteToolDefinition() {
4397
4501
  return {
4398
4502
  name: "mcp_execute_tool",
4399
- description: "Execute a tool that was discovered via mcp_search_tool_bm25. You MUST call mcp_get_tool_schema first to know the correct parameters. Pass the exact tool name and its arguments.",
4503
+ description: "Execute a tool that was discovered via mcp_search_tools. You MUST call mcp_get_tool_schema first to know the correct parameters. Pass the exact tool name and its arguments.",
4400
4504
  inputSchema: {
4401
4505
  type: "object",
4402
4506
  properties: {
4403
4507
  toolName: {
4404
4508
  type: "string",
4405
- description: "The exact tool name from mcp_search_tool_bm25 results."
4509
+ description: "The exact tool name from mcp_search_tools results."
4406
4510
  },
4407
4511
  serverId: {
4408
4512
  type: "string",
4409
- description: "Optional: The server ID provided in mcp_search_tool_bm25. Required if multiple tools have the same name."
4513
+ description: "Optional: The server ID provided in mcp_search_tools. Required if multiple tools have the same name."
4410
4514
  },
4411
4515
  args: {
4412
4516
  type: "object",
@@ -4419,9 +4523,9 @@ function createExecuteToolDefinition() {
4419
4523
  };
4420
4524
  }
4421
4525
  async function executeMetaTool(toolName, args, router, callToolFn) {
4422
- const resolveToolSchema = (name, namespace) => {
4526
+ const resolveToolSchema = (name, namespace, options) => {
4423
4527
  try {
4424
- return { tool: router.getToolSchema(name, namespace) };
4528
+ return { tool: router.getToolSchema(name, namespace, options) };
4425
4529
  } catch (err) {
4426
4530
  const errorMessage = err instanceof Error ? err.message : String(err);
4427
4531
  return {
@@ -4433,23 +4537,61 @@ async function executeMetaTool(toolName, args, router, callToolFn) {
4433
4537
  }
4434
4538
  };
4435
4539
  switch (toolName) {
4436
- case "mcp_search_tool_bm25": {
4540
+ case "mcp_search_tools": {
4437
4541
  const query = String(args.query ?? "");
4542
+ const operation = String(args.operation ?? "search");
4543
+ const serverId = String(args.serverId ?? "") || void 0;
4544
+ const serverName = String(args.serverName ?? "") || void 0;
4545
+ if (operation === "list") {
4546
+ const limit2 = Math.min(Number(args.limit) || 20, 100);
4547
+ const cursor = String(args.cursor ?? "") || void 0;
4548
+ const result = await router.listTools({
4549
+ serverId,
4550
+ serverName: serverName ?? (!serverId && query ? query : void 0),
4551
+ limit: limit2,
4552
+ cursor
4553
+ });
4554
+ const serverText = result.servers.length > 0 ? result.servers.map((server) => `${server.serverName} (serverId: ${server.serverId}, tools: ${server.toolCount})`).join(", ") : "none";
4555
+ const lines = [
4556
+ "operation: list",
4557
+ `servers: ${serverText}`,
4558
+ `totalCount: ${result.totalCount}`,
4559
+ `returnedCount: ${result.returnedCount}`,
4560
+ `nextCursor: ${result.nextCursor ?? "null"}`,
4561
+ ""
4562
+ ];
4563
+ if (result.tools.length > 0) {
4564
+ lines.push(...formatToolSummaries(result.tools));
4565
+ } else {
4566
+ lines.push(
4567
+ serverId || serverName ? "No tools found for the requested server scope." : 'No tools found. Try operation "search" or provide serverId/serverName.'
4568
+ );
4569
+ }
4570
+ return {
4571
+ content: [{ type: "text", text: lines.join("\n") }],
4572
+ isError: false
4573
+ };
4574
+ }
4438
4575
  const limit = Math.min(Number(args.limit) || 5, 20);
4576
+ const searchOptions = { serverId, serverName };
4439
4577
  const selectMatch = query.match(/^select:(.+)$/i);
4440
4578
  if (selectMatch) {
4579
+ await router.listTools({ serverId, serverName, limit: 1 });
4441
4580
  const requested = selectMatch[1].split(",").map((s) => s.trim()).filter(Boolean);
4442
4581
  const found = [];
4443
4582
  const errors = [];
4583
+ const namespace = serverId ?? serverName;
4444
4584
  for (const requestedToolName of requested) {
4445
- const { tool, error } = resolveToolSchema(requestedToolName);
4585
+ const { tool, error } = resolveToolSchema(requestedToolName, namespace, {
4586
+ allowServerNameFragment: Boolean(serverName && !serverId)
4587
+ });
4446
4588
  if (error) {
4447
4589
  const errorMsg = error.content[0]?.type === "text" ? error.content[0].text : "Unknown error";
4448
4590
  errors.push(`- **${requestedToolName}**: ${errorMsg}`);
4449
4591
  } else if (tool) {
4450
4592
  found.push(tool);
4451
4593
  } else {
4452
- errors.push(`- **${requestedToolName}**: Tool not found. Try searching with mcp_search_tool_bm25.`);
4594
+ errors.push(`- **${requestedToolName}**: Tool not found. Try searching with mcp_search_tools.`);
4453
4595
  }
4454
4596
  }
4455
4597
  const lines = [];
@@ -4470,11 +4612,21 @@ async function executeMetaTool(toolName, args, router, callToolFn) {
4470
4612
  isError: found.length === 0
4471
4613
  };
4472
4614
  }
4473
- const results = await router.searchTools(query, limit);
4474
- const text = results.length === 0 ? "No tools found matching your query. Try different keywords." : results.map(
4475
- (t, i) => `${i + 1}. **${t.name}** (server: ${t.serverName}, serverId: ${t.serverId})
4476
- ${t.description}
4477
- Estimated tokens: ${t.estimatedTokens}`
4615
+ const results = await router.searchTools(query, limit, searchOptions);
4616
+ const text = results.length === 0 ? "No tools found matching your query. Call mcp_list_servers to inspect connected servers, then retry mcp_search_tools with serverId or serverName." : formatToolSummaries(results).join("\n");
4617
+ return {
4618
+ content: [{ type: "text", text }],
4619
+ isError: false
4620
+ };
4621
+ }
4622
+ case "mcp_list_servers": {
4623
+ const query = String(args.query ?? "").trim();
4624
+ const servers = await router.listServers({
4625
+ serverName: query || void 0
4626
+ });
4627
+ const text = servers.length === 0 ? "No connected servers found." : servers.map(
4628
+ (server, i) => `${i + 1}. **${server.serverName}** (serverId: ${server.serverId}, sessionId: ${server.sessionId})
4629
+ Tool count: ${server.toolCount}`
4478
4630
  ).join("\n");
4479
4631
  return {
4480
4632
  content: [{ type: "text", text }],
@@ -4485,11 +4637,7 @@ async function executeMetaTool(toolName, args, router, callToolFn) {
4485
4637
  const pattern = String(args.query ?? "");
4486
4638
  const limit = Math.min(Number(args.limit) || 5, 20);
4487
4639
  const results = await router.searchToolsRegex(pattern, limit);
4488
- const text = results.length === 0 ? "No tools matched your regex pattern. Try a broader pattern." : results.map(
4489
- (t, i) => `${i + 1}. **${t.name}** (server: ${t.serverName}, serverId: ${t.serverId})
4490
- ${t.description}
4491
- Estimated tokens: ${t.estimatedTokens}`
4492
- ).join("\n");
4640
+ const text = results.length === 0 ? "No tools matched your regex pattern. Try a broader pattern." : formatToolSummaries(results).join("\n");
4493
4641
  return {
4494
4642
  content: [{ type: "text", text }],
4495
4643
  isError: false
@@ -4507,7 +4655,7 @@ async function executeMetaTool(toolName, args, router, callToolFn) {
4507
4655
  content: [
4508
4656
  {
4509
4657
  type: "text",
4510
- text: `Tool "${name}" not found. Use mcp_search_tool_bm25 to find available tools first.`
4658
+ text: `Tool "${name}" not found. Use mcp_search_tools to find available tools first.`
4511
4659
  }
4512
4660
  ],
4513
4661
  isError: true
@@ -4548,7 +4696,7 @@ async function executeMetaTool(toolName, args, router, callToolFn) {
4548
4696
  content: [
4549
4697
  {
4550
4698
  type: "text",
4551
- text: `Tool "${targetToolName}" not found. Use mcp_search_tool_bm25 to discover available tools first.`
4699
+ text: `Tool "${targetToolName}" not found. Use mcp_search_tools to discover available tools first.`
4552
4700
  }
4553
4701
  ],
4554
4702
  isError: true
@@ -4582,8 +4730,15 @@ async function executeMetaTool(toolName, args, router, callToolFn) {
4582
4730
  return null;
4583
4731
  }
4584
4732
  }
4733
+ function formatToolSummaries(tools) {
4734
+ return tools.map(
4735
+ (t, i) => `${i + 1}. **${t.name}** (server: ${t.serverName}, serverId: ${t.serverId})
4736
+ ${t.description}
4737
+ Estimated tokens: ${t.estimatedTokens}`
4738
+ );
4739
+ }
4585
4740
  function isMetaTool(toolName) {
4586
- return toolName === "mcp_search_tool_bm25" || toolName === "mcp_search_tool_regex" || toolName === "mcp_get_tool_schema" || toolName === "mcp_execute_tool";
4741
+ return toolName === "mcp_search_tools" || toolName === "mcp_list_servers" || toolName === "mcp_search_tool_regex" || toolName === "mcp_get_tool_schema" || toolName === "mcp_execute_tool";
4587
4742
  }
4588
4743
  function resolveMetaToolProxy(toolName, args) {
4589
4744
  if (toolName === "mcp_execute_tool") {
@@ -4631,7 +4786,7 @@ var ToolRouter = class {
4631
4786
  * This is the main method adapters should call.
4632
4787
  *
4633
4788
  * - `all` → returns all tools (unchanged behavior)
4634
- * - `search` → returns only meta-tools (mcp_search_tool_bm25, mcp_get_tool_schema, mcp_execute_tool)
4789
+ * - `search` → returns only meta-tools (mcp_search_tools, mcp_get_tool_schema, mcp_execute_tool)
4635
4790
  * - `groups` → returns tools from active groups only
4636
4791
  */
4637
4792
  async getFilteredTools() {
@@ -4660,9 +4815,10 @@ var ToolRouter = class {
4660
4815
  * Search tools by natural-language query.
4661
4816
  * Works regardless of strategy.
4662
4817
  */
4663
- async searchTools(query, topK) {
4818
+ async searchTools(query, topK, options = {}) {
4664
4819
  await this.ensureInitialized();
4665
- return this.index.search(query, topK ?? this.maxTools);
4820
+ const limit = topK ?? this.maxTools;
4821
+ return this.index.search(query, limit, options);
4666
4822
  }
4667
4823
  /**
4668
4824
  * Search tools by regex pattern.
@@ -4672,12 +4828,22 @@ var ToolRouter = class {
4672
4828
  await this.ensureInitialized();
4673
4829
  return this.index.searchRegex(pattern, topK ?? this.maxTools);
4674
4830
  }
4831
+ /** List connected MCP servers with indexed tool counts. */
4832
+ async listServers(options = {}) {
4833
+ await this.ensureInitialized();
4834
+ return this.index.listServers(options);
4835
+ }
4836
+ /** List tools deterministically, optionally scoped to a server. */
4837
+ async listTools(options = {}) {
4838
+ await this.ensureInitialized();
4839
+ return this.index.listTools(options);
4840
+ }
4675
4841
  /**
4676
4842
  * Get the full tool definition by name.
4677
4843
  * If tool name is ambiguous, use namespace to specify the server.
4678
4844
  */
4679
- getToolSchema(toolName, namespace) {
4680
- const matches = this.index.getTool(toolName, namespace);
4845
+ getToolSchema(toolName, namespace, options = {}) {
4846
+ const matches = this.index.getTool(toolName, namespace, options);
4681
4847
  if (matches.length === 0) return void 0;
4682
4848
  if (matches.length > 1) {
4683
4849
  const servers = matches.map((m) => m.serverId).join(", ");
@@ -4756,7 +4922,7 @@ var ToolRouter = class {
4756
4922
  const indexedTool = this.getToolSchema(toolName, namespace);
4757
4923
  if (!indexedTool) {
4758
4924
  throw new Error(
4759
- `Tool "${toolName}" not found${namespace ? ` on server "${namespace}"` : ""}. Use mcp_search_tool_bm25 or mcp_search_tool_regex to discover available tools.`
4925
+ `Tool "${toolName}" not found${namespace ? ` on server "${namespace}"` : ""}. Use mcp_search_tools or mcp_search_tool_regex to discover available tools.`
4760
4926
  );
4761
4927
  }
4762
4928
  const clients = this.getClients();
@@ -4868,6 +5034,7 @@ var ToolRouter = class {
4868
5034
  getMetaToolDefinitions() {
4869
5035
  return [
4870
5036
  createSearchToolDefinition(),
5037
+ createListServersToolDefinition(),
4871
5038
  createRegexSearchToolDefinition(),
4872
5039
  createGetSchemaToolDefinition(),
4873
5040
  createExecuteToolDefinition()
@@ -4916,6 +5083,7 @@ exports.ToolRouter = ToolRouter;
4916
5083
  exports.UnauthorizedError = UnauthorizedError;
4917
5084
  exports.createExecuteToolDefinition = createExecuteToolDefinition;
4918
5085
  exports.createGetSchemaToolDefinition = createGetSchemaToolDefinition;
5086
+ exports.createListServersToolDefinition = createListServersToolDefinition;
4919
5087
  exports.createNextMcpHandler = createNextMcpHandler;
4920
5088
  exports.createRegexSearchToolDefinition = createRegexSearchToolDefinition;
4921
5089
  exports.createSSEHandler = createSSEHandler;