mcp-use 1.9.1-canary.1 → 1.10.0-canary.11

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 (145) hide show
  1. package/README.md +9 -6
  2. package/dist/.tsbuildinfo +1 -1
  3. package/dist/{chunk-QREDNTLS.js → chunk-5S5DWSKI.js} +1 -1
  4. package/dist/{chunk-MUZ5WYE3.js → chunk-5UB2K5L6.js} +72 -14
  5. package/dist/{chunk-33U4IA4N.js → chunk-B5N3LQQU.js} +99 -5
  6. package/dist/{chunk-3R5PDYIN.js → chunk-J75I2C26.js} +39 -11
  7. package/dist/{chunk-U5BX3ISQ.js → chunk-KMTBWOVS.js} +22 -408
  8. package/dist/{chunk-D22NUQTL.js → chunk-LXYUQEEE.js} +235 -12
  9. package/dist/{chunk-ZQUCGISK.js → chunk-NNQUSDFU.js} +21 -5
  10. package/dist/chunk-PESKSVLQ.js +1129 -0
  11. package/dist/index.cjs +1190 -200
  12. package/dist/index.d.ts +6 -4
  13. package/dist/index.d.ts.map +1 -1
  14. package/dist/index.js +63 -23
  15. package/dist/src/adapters/langchain_adapter.d.ts +1 -1
  16. package/dist/src/adapters/langchain_adapter.d.ts.map +1 -1
  17. package/dist/src/agents/index.cjs +2263 -1626
  18. package/dist/src/agents/index.js +4 -4
  19. package/dist/src/agents/mcp_agent.d.ts +5 -0
  20. package/dist/src/agents/mcp_agent.d.ts.map +1 -1
  21. package/dist/src/auth/browser-provider.d.ts +2 -2
  22. package/dist/src/auth/browser-provider.d.ts.map +1 -1
  23. package/dist/src/auth/callback.d.ts.map +1 -1
  24. package/dist/src/auth/index.cjs +39 -11
  25. package/dist/src/auth/index.js +1 -1
  26. package/dist/src/auth/types.d.ts +1 -1
  27. package/dist/src/auth/types.d.ts.map +1 -1
  28. package/dist/src/browser.cjs +2672 -1754
  29. package/dist/src/browser.d.ts +5 -1
  30. package/dist/src/browser.d.ts.map +1 -1
  31. package/dist/src/browser.js +18 -5
  32. package/dist/src/client/base.d.ts.map +1 -1
  33. package/dist/src/client/browser.d.ts +6 -0
  34. package/dist/src/client/browser.d.ts.map +1 -1
  35. package/dist/src/client/connectors/codeMode.d.ts +1 -1
  36. package/dist/src/client/connectors/codeMode.d.ts.map +1 -1
  37. package/dist/src/client/executors/base.d.ts +1 -1
  38. package/dist/src/client/executors/base.d.ts.map +1 -1
  39. package/dist/src/client/prompts.cjs +4 -1
  40. package/dist/src/client/prompts.js +3 -2
  41. package/dist/src/client.d.ts +7 -1
  42. package/dist/src/client.d.ts.map +1 -1
  43. package/dist/src/connectors/base.d.ts +56 -6
  44. package/dist/src/connectors/base.d.ts.map +1 -1
  45. package/dist/src/connectors/http.d.ts.map +1 -1
  46. package/dist/src/connectors/stdio.d.ts.map +1 -1
  47. package/dist/src/connectors/websocket.d.ts +1 -1
  48. package/dist/src/connectors/websocket.d.ts.map +1 -1
  49. package/dist/src/oauth-helper.d.ts.map +1 -1
  50. package/dist/src/react/WidgetControls.d.ts.map +1 -1
  51. package/dist/src/react/index.cjs +1357 -43
  52. package/dist/src/react/index.d.ts +4 -1
  53. package/dist/src/react/index.d.ts.map +1 -1
  54. package/dist/src/react/index.js +14 -5
  55. package/dist/src/react/types.d.ts +1 -1
  56. package/dist/src/react/types.d.ts.map +1 -1
  57. package/dist/src/react/useMcp.d.ts.map +1 -1
  58. package/dist/src/server/endpoints/mount-mcp.d.ts +4 -1
  59. package/dist/src/server/endpoints/mount-mcp.d.ts.map +1 -1
  60. package/dist/src/server/index.cjs +1923 -287
  61. package/dist/src/server/index.d.ts +3 -2
  62. package/dist/src/server/index.d.ts.map +1 -1
  63. package/dist/src/server/index.js +488 -245
  64. package/dist/src/server/mcp-server.d.ts +77 -27
  65. package/dist/src/server/mcp-server.d.ts.map +1 -1
  66. package/dist/src/server/oauth/middleware.d.ts.map +1 -1
  67. package/dist/src/server/oauth/providers/auth0.d.ts +1 -1
  68. package/dist/src/server/oauth/providers/auth0.d.ts.map +1 -1
  69. package/dist/src/server/oauth/providers/custom.d.ts +4 -2
  70. package/dist/src/server/oauth/providers/custom.d.ts.map +1 -1
  71. package/dist/src/server/oauth/providers/keycloak.d.ts +1 -1
  72. package/dist/src/server/oauth/providers/keycloak.d.ts.map +1 -1
  73. package/dist/src/server/oauth/providers/supabase.d.ts +1 -1
  74. package/dist/src/server/oauth/providers/supabase.d.ts.map +1 -1
  75. package/dist/src/server/oauth/providers/types.d.ts +9 -5
  76. package/dist/src/server/oauth/providers/types.d.ts.map +1 -1
  77. package/dist/src/server/oauth/providers.d.ts +27 -9
  78. package/dist/src/server/oauth/providers.d.ts.map +1 -1
  79. package/dist/src/server/oauth/setup.d.ts +5 -4
  80. package/dist/src/server/oauth/setup.d.ts.map +1 -1
  81. package/dist/src/server/oauth/utils.d.ts +3 -2
  82. package/dist/src/server/oauth/utils.d.ts.map +1 -1
  83. package/dist/src/server/prompts/conversion.d.ts +1 -1
  84. package/dist/src/server/prompts/conversion.d.ts.map +1 -1
  85. package/dist/src/server/prompts/index.d.ts +6 -5
  86. package/dist/src/server/prompts/index.d.ts.map +1 -1
  87. package/dist/src/server/resources/conversion.d.ts +1 -1
  88. package/dist/src/server/resources/conversion.d.ts.map +1 -1
  89. package/dist/src/server/resources/index.d.ts +44 -25
  90. package/dist/src/server/resources/index.d.ts.map +1 -1
  91. package/dist/src/server/resources/subscriptions.d.ts +1 -1
  92. package/dist/src/server/resources/subscriptions.d.ts.map +1 -1
  93. package/dist/src/server/sessions/session-manager.d.ts +11 -5
  94. package/dist/src/server/sessions/session-manager.d.ts.map +1 -1
  95. package/dist/src/server/tools/tool-execution-helpers.d.ts +31 -8
  96. package/dist/src/server/tools/tool-execution-helpers.d.ts.map +1 -1
  97. package/dist/src/server/tools/tool-registration.d.ts +21 -7
  98. package/dist/src/server/tools/tool-registration.d.ts.map +1 -1
  99. package/dist/src/server/types/common.d.ts +25 -9
  100. package/dist/src/server/types/common.d.ts.map +1 -1
  101. package/dist/src/server/types/index.d.ts +3 -3
  102. package/dist/src/server/types/index.d.ts.map +1 -1
  103. package/dist/src/server/types/prompt.d.ts +3 -2
  104. package/dist/src/server/types/prompt.d.ts.map +1 -1
  105. package/dist/src/server/types/resource.d.ts +60 -10
  106. package/dist/src/server/types/resource.d.ts.map +1 -1
  107. package/dist/src/server/types/tool-context.d.ts +116 -1
  108. package/dist/src/server/types/tool-context.d.ts.map +1 -1
  109. package/dist/src/server/types/tool.d.ts +43 -2
  110. package/dist/src/server/types/tool.d.ts.map +1 -1
  111. package/dist/src/server/types/widget.d.ts +11 -1
  112. package/dist/src/server/types/widget.d.ts.map +1 -1
  113. package/dist/src/server/utils/response-helpers.d.ts +17 -29
  114. package/dist/src/server/utils/response-helpers.d.ts.map +1 -1
  115. package/dist/src/server/widgets/index.d.ts +3 -3
  116. package/dist/src/server/widgets/index.d.ts.map +1 -1
  117. package/dist/src/server/widgets/mount-widgets-dev.d.ts.map +1 -1
  118. package/dist/src/server/widgets/ui-resource-registration.d.ts +13 -25
  119. package/dist/src/server/widgets/ui-resource-registration.d.ts.map +1 -1
  120. package/dist/src/server/widgets/widget-helpers.d.ts +11 -6
  121. package/dist/src/server/widgets/widget-helpers.d.ts.map +1 -1
  122. package/dist/src/server/widgets/widget-types.d.ts +3 -3
  123. package/dist/src/server/widgets/widget-types.d.ts.map +1 -1
  124. package/dist/src/session.d.ts +372 -2
  125. package/dist/src/session.d.ts.map +1 -1
  126. package/dist/src/task_managers/sse.d.ts +2 -2
  127. package/dist/src/task_managers/sse.d.ts.map +1 -1
  128. package/dist/src/task_managers/stdio.d.ts +2 -2
  129. package/dist/src/task_managers/stdio.d.ts.map +1 -1
  130. package/dist/src/task_managers/streamable_http.d.ts +2 -2
  131. package/dist/src/task_managers/streamable_http.d.ts.map +1 -1
  132. package/dist/src/telemetry/events.d.ts +247 -0
  133. package/dist/src/telemetry/events.d.ts.map +1 -1
  134. package/dist/src/telemetry/index.d.ts +4 -4
  135. package/dist/src/telemetry/index.d.ts.map +1 -1
  136. package/dist/src/telemetry/telemetry.d.ts +122 -4
  137. package/dist/src/telemetry/telemetry.d.ts.map +1 -1
  138. package/dist/src/telemetry/utils.d.ts +1 -1
  139. package/dist/src/telemetry/utils.d.ts.map +1 -1
  140. package/dist/src/version.d.ts +8 -0
  141. package/dist/src/version.d.ts.map +1 -0
  142. package/dist/{tool-execution-helpers-BQJTPWPN.js → tool-execution-helpers-OOVLOJYH.js} +3 -2
  143. package/dist/tsup.config.d.ts.map +1 -1
  144. package/package.json +7 -5
  145. package/dist/chunk-MTHLLDCX.js +0 -97
@@ -1,12 +1,14 @@
1
1
  import {
2
2
  BaseConnector
3
- } from "./chunk-ZQUCGISK.js";
3
+ } from "./chunk-NNQUSDFU.js";
4
+ import {
5
+ Tel,
6
+ generateUUID,
7
+ getPackageVersion
8
+ } from "./chunk-PESKSVLQ.js";
4
9
  import {
5
10
  logger
6
11
  } from "./chunk-34R6SIER.js";
7
- import {
8
- generateUUID
9
- } from "./chunk-MTHLLDCX.js";
10
12
  import {
11
13
  __name
12
14
  } from "./chunk-3GQAWCBQ.js";
@@ -82,17 +84,201 @@ var MCPSession = class {
82
84
  getRoots() {
83
85
  return this.connector.getRoots();
84
86
  }
87
+ /**
88
+ * Get the cached list of tools from the server.
89
+ *
90
+ * @returns Array of available tools
91
+ *
92
+ * @example
93
+ * ```typescript
94
+ * const tools = session.tools;
95
+ * console.log(`Available tools: ${tools.map(t => t.name).join(", ")}`);
96
+ * ```
97
+ */
98
+ get tools() {
99
+ return this.connector.tools;
100
+ }
101
+ /**
102
+ * Get the server capabilities advertised during initialization.
103
+ *
104
+ * @returns Server capabilities object
105
+ */
106
+ get serverCapabilities() {
107
+ return this.connector.serverCapabilities;
108
+ }
109
+ /**
110
+ * Get the server information (name and version).
111
+ *
112
+ * @returns Server info object or null if not available
113
+ */
114
+ get serverInfo() {
115
+ return this.connector.serverInfo;
116
+ }
117
+ /**
118
+ * Call a tool on the server.
119
+ *
120
+ * @param name - Name of the tool to call
121
+ * @param args - Arguments to pass to the tool
122
+ * @param options - Optional request options (timeout, progress handlers, etc.)
123
+ * @returns Result from the tool execution
124
+ *
125
+ * @example
126
+ * ```typescript
127
+ * const result = await session.callTool("add", { a: 5, b: 3 });
128
+ * console.log(`Result: ${result.content[0].text}`);
129
+ * ```
130
+ */
131
+ async callTool(name, args, options) {
132
+ return this.connector.callTool(name, args, options);
133
+ }
134
+ /**
135
+ * List resources from the server with optional pagination.
136
+ *
137
+ * @param cursor - Optional cursor for pagination
138
+ * @param options - Request options
139
+ * @returns Resource list with optional nextCursor for pagination
140
+ *
141
+ * @example
142
+ * ```typescript
143
+ * const result = await session.listResources();
144
+ * console.log(`Found ${result.resources.length} resources`);
145
+ * ```
146
+ */
147
+ async listResources(cursor, options) {
148
+ return this.connector.listResources(cursor, options);
149
+ }
150
+ /**
151
+ * List all resources from the server, automatically handling pagination.
152
+ *
153
+ * @param options - Request options
154
+ * @returns Complete list of all resources
155
+ *
156
+ * @example
157
+ * ```typescript
158
+ * const result = await session.listAllResources();
159
+ * console.log(`Total resources: ${result.resources.length}`);
160
+ * ```
161
+ */
162
+ async listAllResources(options) {
163
+ return this.connector.listAllResources(options);
164
+ }
165
+ /**
166
+ * List resource templates from the server.
167
+ *
168
+ * @param options - Request options
169
+ * @returns List of available resource templates
170
+ *
171
+ * @example
172
+ * ```typescript
173
+ * const result = await session.listResourceTemplates();
174
+ * console.log(`Available templates: ${result.resourceTemplates.length}`);
175
+ * ```
176
+ */
177
+ async listResourceTemplates(options) {
178
+ return this.connector.listResourceTemplates(options);
179
+ }
180
+ /**
181
+ * Read a resource by URI.
182
+ *
183
+ * @param uri - URI of the resource to read
184
+ * @param options - Request options
185
+ * @returns Resource content
186
+ *
187
+ * @example
188
+ * ```typescript
189
+ * const resource = await session.readResource("file:///path/to/file.txt");
190
+ * console.log(resource.contents);
191
+ * ```
192
+ */
193
+ async readResource(uri, options) {
194
+ return this.connector.readResource(uri, options);
195
+ }
196
+ /**
197
+ * Subscribe to resource updates.
198
+ *
199
+ * @param uri - URI of the resource to subscribe to
200
+ * @param options - Request options
201
+ *
202
+ * @example
203
+ * ```typescript
204
+ * await session.subscribeToResource("file:///path/to/file.txt");
205
+ * // Now you'll receive notifications when this resource changes
206
+ * ```
207
+ */
208
+ async subscribeToResource(uri, options) {
209
+ return this.connector.subscribeToResource(uri, options);
210
+ }
211
+ /**
212
+ * Unsubscribe from resource updates.
213
+ *
214
+ * @param uri - URI of the resource to unsubscribe from
215
+ * @param options - Request options
216
+ *
217
+ * @example
218
+ * ```typescript
219
+ * await session.unsubscribeFromResource("file:///path/to/file.txt");
220
+ * ```
221
+ */
222
+ async unsubscribeFromResource(uri, options) {
223
+ return this.connector.unsubscribeFromResource(uri, options);
224
+ }
225
+ /**
226
+ * List available prompts from the server.
227
+ *
228
+ * @returns List of available prompts
229
+ *
230
+ * @example
231
+ * ```typescript
232
+ * const result = await session.listPrompts();
233
+ * console.log(`Available prompts: ${result.prompts.length}`);
234
+ * ```
235
+ */
236
+ async listPrompts() {
237
+ return this.connector.listPrompts();
238
+ }
239
+ /**
240
+ * Get a specific prompt with arguments.
241
+ *
242
+ * @param name - Name of the prompt to get
243
+ * @param args - Arguments for the prompt
244
+ * @returns Prompt result
245
+ *
246
+ * @example
247
+ * ```typescript
248
+ * const prompt = await session.getPrompt("greeting", { name: "Alice" });
249
+ * console.log(prompt.messages);
250
+ * ```
251
+ */
252
+ async getPrompt(name, args) {
253
+ return this.connector.getPrompt(name, args);
254
+ }
255
+ /**
256
+ * Send a raw request through the client.
257
+ *
258
+ * @param method - MCP method name
259
+ * @param params - Request parameters
260
+ * @param options - Request options
261
+ * @returns Response from the server
262
+ *
263
+ * @example
264
+ * ```typescript
265
+ * const result = await session.request("custom/method", { key: "value" });
266
+ * ```
267
+ */
268
+ async request(method, params = null, options) {
269
+ return this.connector.request(method, params, options);
270
+ }
85
271
  };
86
272
 
87
273
  // src/connectors/http.ts
88
- import { Client } from "@modelcontextprotocol/sdk/client/index.js";
274
+ import { Client } from "@mcp-use/modelcontextprotocol-sdk/client/index.js";
89
275
  import {
90
276
  StreamableHTTPClientTransport,
91
277
  StreamableHTTPError
92
- } from "@modelcontextprotocol/sdk/client/streamableHttp.js";
278
+ } from "@mcp-use/modelcontextprotocol-sdk/client/streamableHttp.js";
93
279
 
94
280
  // src/task_managers/sse.ts
95
- import { SSEClientTransport } from "@modelcontextprotocol/sdk/client/sse.js";
281
+ import { SSEClientTransport } from "@mcp-use/modelcontextprotocol-sdk/client/sse.js";
96
282
 
97
283
  // src/task_managers/base.ts
98
284
  var ConnectionManager = class {
@@ -303,15 +489,16 @@ var HttpConnector = class extends BaseConnector {
303
489
  let fallbackReason = "Unknown error";
304
490
  let is401Error = false;
305
491
  if (err instanceof StreamableHTTPError) {
306
- is401Error = err.code === 401;
307
- if (err.code === 400 && err.message.includes("Missing session ID")) {
492
+ const streamableErr = err;
493
+ is401Error = streamableErr.code === 401;
494
+ if (streamableErr.code === 400 && streamableErr.message.includes("Missing session ID")) {
308
495
  fallbackReason = "Server requires session ID (FastMCP compatibility) - using SSE transport";
309
496
  logger.warn(`\u26A0\uFE0F ${fallbackReason}`);
310
- } else if (err.code === 404 || err.code === 405) {
311
- fallbackReason = `Server returned ${err.code} - server likely doesn't support streamable HTTP`;
497
+ } else if (streamableErr.code === 404 || streamableErr.code === 405) {
498
+ fallbackReason = `Server returned ${streamableErr.code} - server likely doesn't support streamable HTTP`;
312
499
  logger.debug(fallbackReason);
313
500
  } else {
314
- fallbackReason = `Server returned ${err.code}: ${err.message}`;
501
+ fallbackReason = `Server returned ${streamableErr.code}: ${streamableErr.message}`;
315
502
  logger.debug(fallbackReason);
316
503
  }
317
504
  } else if (err instanceof Error) {
@@ -451,6 +638,10 @@ var HttpConnector = class extends BaseConnector {
451
638
  logger.debug(
452
639
  `Successfully connected to MCP implementation via streamable HTTP: ${baseUrl}`
453
640
  );
641
+ this.trackConnectorInit({
642
+ serverUrl: this.baseUrl,
643
+ publicIdentifier: `${this.baseUrl} (streamable-http)`
644
+ });
454
645
  } catch (err) {
455
646
  await this.cleanupResources();
456
647
  throw err;
@@ -498,6 +689,10 @@ var HttpConnector = class extends BaseConnector {
498
689
  logger.debug(
499
690
  `Successfully connected to MCP implementation via HTTP/SSE: ${baseUrl}`
500
691
  );
692
+ this.trackConnectorInit({
693
+ serverUrl: this.baseUrl,
694
+ publicIdentifier: `${this.baseUrl} (sse)`
695
+ });
501
696
  } catch (err) {
502
697
  await this.cleanupResources();
503
698
  throw err;
@@ -810,11 +1005,13 @@ var BaseMCPClient = class {
810
1005
  addServer(name, serverConfig) {
811
1006
  this.config.mcpServers = this.config.mcpServers || {};
812
1007
  this.config.mcpServers[name] = serverConfig;
1008
+ Tel.getInstance().trackClientAddServer(name, serverConfig);
813
1009
  }
814
1010
  removeServer(name) {
815
1011
  if (this.config.mcpServers?.[name]) {
816
1012
  delete this.config.mcpServers[name];
817
1013
  this.activeSessions = this.activeSessions.filter((n) => n !== name);
1014
+ Tel.getInstance().trackClientRemoveServer(name);
818
1015
  }
819
1016
  }
820
1017
  getServerNames() {
@@ -913,8 +1110,34 @@ var BrowserMCPClient = class _BrowserMCPClient extends BaseMCPClient {
913
1110
  static {
914
1111
  __name(this, "BrowserMCPClient");
915
1112
  }
1113
+ /**
1114
+ * Get the mcp-use package version.
1115
+ * Works in all environments (Node.js, browser, Cloudflare Workers, Deno, etc.)
1116
+ */
1117
+ static getPackageVersion() {
1118
+ return getPackageVersion();
1119
+ }
916
1120
  constructor(config) {
917
1121
  super(config);
1122
+ this._trackClientInit();
1123
+ }
1124
+ _trackClientInit() {
1125
+ const servers = Object.keys(this.config.mcpServers ?? {});
1126
+ Tel.getInstance().trackMCPClientInit({
1127
+ codeMode: false,
1128
+ // Browser client doesn't support code mode
1129
+ sandbox: false,
1130
+ // Sandbox not supported in browser
1131
+ allCallbacks: false,
1132
+ // Will be set per-server
1133
+ verify: false,
1134
+ servers,
1135
+ numServers: servers.length,
1136
+ isBrowser: true
1137
+ // Browser MCPClient
1138
+ }).catch(
1139
+ (e) => logger.debug(`Failed to track BrowserMCPClient init: ${e}`)
1140
+ );
918
1141
  }
919
1142
  static fromDict(cfg) {
920
1143
  return new _BrowserMCPClient(cfg);
@@ -1,3 +1,6 @@
1
+ import {
2
+ Telemetry
3
+ } from "./chunk-PESKSVLQ.js";
1
4
  import {
2
5
  logger
3
6
  } from "./chunk-34R6SIER.js";
@@ -10,7 +13,7 @@ import {
10
13
  ListRootsRequestSchema,
11
14
  CreateMessageRequestSchema,
12
15
  ElicitRequestSchema
13
- } from "@modelcontextprotocol/sdk/types.js";
16
+ } from "@mcp-use/modelcontextprotocol-sdk/types.js";
14
17
  var BaseConnector = class {
15
18
  static {
16
19
  __name(this, "BaseConnector");
@@ -30,6 +33,17 @@ var BaseConnector = class {
30
33
  this.rootsCache = [...opts.roots];
31
34
  }
32
35
  }
36
+ /**
37
+ * Track connector initialization event
38
+ * Should be called by subclasses after successful connection
39
+ */
40
+ trackConnectorInit(data) {
41
+ const connectorType = this.constructor.name;
42
+ Telemetry.getInstance().trackConnectorInit({
43
+ connectorType,
44
+ ...data
45
+ }).catch((e) => logger.debug(`Failed to track connector init: ${e}`));
46
+ }
33
47
  /**
34
48
  * Register a handler for server notifications
35
49
  *
@@ -238,7 +252,7 @@ var BaseConnector = class {
238
252
  }
239
253
  logger.debug("Caching server capabilities & tools");
240
254
  const capabilities = this.client.getServerCapabilities();
241
- this.capabilitiesCache = capabilities;
255
+ this.capabilitiesCache = capabilities || null;
242
256
  const serverInfo = this.client.getServerVersion();
243
257
  this.serverInfoCache = serverInfo || null;
244
258
  const listToolsRes = await this.client.listTools(
@@ -260,7 +274,7 @@ var BaseConnector = class {
260
274
  }
261
275
  /** Expose cached server capabilities. */
262
276
  get serverCapabilities() {
263
- return this.capabilitiesCache;
277
+ return this.capabilitiesCache || {};
264
278
  }
265
279
  /** Expose cached server info. */
266
280
  get serverInfo() {
@@ -327,7 +341,8 @@ var BaseConnector = class {
327
341
  } while (cursor);
328
342
  return { resources: allResources };
329
343
  } catch (err) {
330
- if (err.code === -32601) {
344
+ const error = err;
345
+ if (error.code === -32601) {
331
346
  logger.debug("Server advertised resources but method not found");
332
347
  return { resources: [] };
333
348
  }
@@ -394,7 +409,8 @@ var BaseConnector = class {
394
409
  logger.debug("Listing prompts");
395
410
  return await this.client.listPrompts();
396
411
  } catch (err) {
397
- if (err.code === -32601) {
412
+ const error = err;
413
+ if (error.code === -32601) {
398
414
  logger.debug("Server advertised prompts but method not found");
399
415
  return { prompts: [] };
400
416
  }