mcp-use 1.9.1-canary.1 → 1.10.0-canary.3
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/README.md +9 -6
- package/dist/.tsbuildinfo +1 -1
- package/dist/{chunk-QREDNTLS.js → chunk-F5MMLHUR.js} +1 -1
- package/dist/{chunk-33U4IA4N.js → chunk-L6P6GBCW.js} +84 -3
- package/dist/{chunk-ZQUCGISK.js → chunk-LTA4LQTH.js} +6 -4
- package/dist/{chunk-D22NUQTL.js → chunk-QBTQXCAI.js} +185 -1
- package/dist/{chunk-MUZ5WYE3.js → chunk-VPHP7ERH.js} +18 -9
- package/dist/{chunk-U5BX3ISQ.js → chunk-YMJL66MY.js} +10 -6
- package/dist/index.cjs +220 -20
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +13 -12
- package/dist/src/agents/index.cjs +10 -6
- package/dist/src/agents/index.js +3 -3
- package/dist/src/agents/mcp_agent.d.ts.map +1 -1
- package/dist/src/browser.cjs +200 -10
- package/dist/src/browser.js +7 -7
- package/dist/src/client/prompts.js +2 -2
- package/dist/src/connectors/base.d.ts +2 -2
- package/dist/src/connectors/base.d.ts.map +1 -1
- package/dist/src/oauth-helper.d.ts.map +1 -1
- package/dist/src/react/WidgetControls.d.ts.map +1 -1
- package/dist/src/react/index.cjs +207 -12
- package/dist/src/react/index.js +4 -4
- package/dist/src/react/useMcp.d.ts.map +1 -1
- package/dist/src/server/endpoints/mount-mcp.d.ts +4 -1
- package/dist/src/server/endpoints/mount-mcp.d.ts.map +1 -1
- package/dist/src/server/index.cjs +268 -125
- package/dist/src/server/index.d.ts +2 -2
- package/dist/src/server/index.d.ts.map +1 -1
- package/dist/src/server/index.js +188 -126
- package/dist/src/server/mcp-server.d.ts +21 -10
- package/dist/src/server/mcp-server.d.ts.map +1 -1
- package/dist/src/server/oauth/middleware.d.ts.map +1 -1
- package/dist/src/server/oauth/providers/auth0.d.ts +1 -1
- package/dist/src/server/oauth/providers/auth0.d.ts.map +1 -1
- package/dist/src/server/oauth/providers/custom.d.ts +4 -2
- package/dist/src/server/oauth/providers/custom.d.ts.map +1 -1
- package/dist/src/server/oauth/providers/keycloak.d.ts +1 -1
- package/dist/src/server/oauth/providers/keycloak.d.ts.map +1 -1
- package/dist/src/server/oauth/providers/supabase.d.ts +1 -1
- package/dist/src/server/oauth/providers/supabase.d.ts.map +1 -1
- package/dist/src/server/oauth/providers/types.d.ts +9 -5
- package/dist/src/server/oauth/providers/types.d.ts.map +1 -1
- package/dist/src/server/oauth/providers.d.ts +27 -9
- package/dist/src/server/oauth/providers.d.ts.map +1 -1
- package/dist/src/server/oauth/setup.d.ts +5 -4
- package/dist/src/server/oauth/setup.d.ts.map +1 -1
- package/dist/src/server/oauth/utils.d.ts +3 -2
- package/dist/src/server/oauth/utils.d.ts.map +1 -1
- package/dist/src/server/prompts/index.d.ts +5 -4
- package/dist/src/server/prompts/index.d.ts.map +1 -1
- package/dist/src/server/resources/index.d.ts +43 -24
- package/dist/src/server/resources/index.d.ts.map +1 -1
- package/dist/src/server/sessions/session-manager.d.ts +11 -5
- package/dist/src/server/sessions/session-manager.d.ts.map +1 -1
- package/dist/src/server/tools/tool-execution-helpers.d.ts +31 -8
- package/dist/src/server/tools/tool-execution-helpers.d.ts.map +1 -1
- package/dist/src/server/tools/tool-registration.d.ts +21 -7
- package/dist/src/server/tools/tool-registration.d.ts.map +1 -1
- package/dist/src/server/types/common.d.ts +25 -9
- package/dist/src/server/types/common.d.ts.map +1 -1
- package/dist/src/server/types/index.d.ts +3 -3
- package/dist/src/server/types/index.d.ts.map +1 -1
- package/dist/src/server/types/prompt.d.ts +2 -1
- package/dist/src/server/types/prompt.d.ts.map +1 -1
- package/dist/src/server/types/resource.d.ts +54 -9
- package/dist/src/server/types/resource.d.ts.map +1 -1
- package/dist/src/server/types/tool-context.d.ts +115 -0
- package/dist/src/server/types/tool-context.d.ts.map +1 -1
- package/dist/src/server/types/tool.d.ts +1 -1
- package/dist/src/server/types/tool.d.ts.map +1 -1
- package/dist/src/server/types/widget.d.ts +2 -1
- package/dist/src/server/types/widget.d.ts.map +1 -1
- package/dist/src/server/widgets/index.d.ts +3 -3
- package/dist/src/server/widgets/index.d.ts.map +1 -1
- package/dist/src/server/widgets/mount-widgets-dev.d.ts.map +1 -1
- package/dist/src/server/widgets/ui-resource-registration.d.ts +11 -25
- package/dist/src/server/widgets/ui-resource-registration.d.ts.map +1 -1
- package/dist/src/server/widgets/widget-helpers.d.ts +11 -6
- package/dist/src/server/widgets/widget-helpers.d.ts.map +1 -1
- package/dist/src/server/widgets/widget-types.d.ts +3 -3
- package/dist/src/server/widgets/widget-types.d.ts.map +1 -1
- package/dist/src/session.d.ts +337 -2
- package/dist/src/session.d.ts.map +1 -1
- package/dist/{tool-execution-helpers-BQJTPWPN.js → tool-execution-helpers-2LGVSS7L.js} +1 -1
- package/package.json +3 -3
package/dist/src/browser.cjs
CHANGED
|
@@ -1467,7 +1467,7 @@ var BaseConnector = class {
|
|
|
1467
1467
|
}
|
|
1468
1468
|
logger.debug("Caching server capabilities & tools");
|
|
1469
1469
|
const capabilities = this.client.getServerCapabilities();
|
|
1470
|
-
this.capabilitiesCache = capabilities;
|
|
1470
|
+
this.capabilitiesCache = capabilities || null;
|
|
1471
1471
|
const serverInfo = this.client.getServerVersion();
|
|
1472
1472
|
this.serverInfoCache = serverInfo || null;
|
|
1473
1473
|
const listToolsRes = await this.client.listTools(
|
|
@@ -1489,7 +1489,7 @@ var BaseConnector = class {
|
|
|
1489
1489
|
}
|
|
1490
1490
|
/** Expose cached server capabilities. */
|
|
1491
1491
|
get serverCapabilities() {
|
|
1492
|
-
return this.capabilitiesCache;
|
|
1492
|
+
return this.capabilitiesCache || {};
|
|
1493
1493
|
}
|
|
1494
1494
|
/** Expose cached server info. */
|
|
1495
1495
|
get serverInfo() {
|
|
@@ -1556,7 +1556,8 @@ var BaseConnector = class {
|
|
|
1556
1556
|
} while (cursor);
|
|
1557
1557
|
return { resources: allResources };
|
|
1558
1558
|
} catch (err) {
|
|
1559
|
-
|
|
1559
|
+
const error = err;
|
|
1560
|
+
if (error.code === -32601) {
|
|
1560
1561
|
logger.debug("Server advertised resources but method not found");
|
|
1561
1562
|
return { resources: [] };
|
|
1562
1563
|
}
|
|
@@ -1623,7 +1624,8 @@ var BaseConnector = class {
|
|
|
1623
1624
|
logger.debug("Listing prompts");
|
|
1624
1625
|
return await this.client.listPrompts();
|
|
1625
1626
|
} catch (err) {
|
|
1626
|
-
|
|
1627
|
+
const error = err;
|
|
1628
|
+
if (error.code === -32601) {
|
|
1627
1629
|
logger.debug("Server advertised prompts but method not found");
|
|
1628
1630
|
return { prompts: [] };
|
|
1629
1631
|
}
|
|
@@ -2307,6 +2309,190 @@ var MCPSession = class {
|
|
|
2307
2309
|
getRoots() {
|
|
2308
2310
|
return this.connector.getRoots();
|
|
2309
2311
|
}
|
|
2312
|
+
/**
|
|
2313
|
+
* Get the cached list of tools from the server.
|
|
2314
|
+
*
|
|
2315
|
+
* @returns Array of available tools
|
|
2316
|
+
*
|
|
2317
|
+
* @example
|
|
2318
|
+
* ```typescript
|
|
2319
|
+
* const tools = session.tools;
|
|
2320
|
+
* console.log(`Available tools: ${tools.map(t => t.name).join(", ")}`);
|
|
2321
|
+
* ```
|
|
2322
|
+
*/
|
|
2323
|
+
get tools() {
|
|
2324
|
+
return this.connector.tools;
|
|
2325
|
+
}
|
|
2326
|
+
/**
|
|
2327
|
+
* Get the server capabilities advertised during initialization.
|
|
2328
|
+
*
|
|
2329
|
+
* @returns Server capabilities object
|
|
2330
|
+
*/
|
|
2331
|
+
get serverCapabilities() {
|
|
2332
|
+
return this.connector.serverCapabilities;
|
|
2333
|
+
}
|
|
2334
|
+
/**
|
|
2335
|
+
* Get the server information (name and version).
|
|
2336
|
+
*
|
|
2337
|
+
* @returns Server info object or null if not available
|
|
2338
|
+
*/
|
|
2339
|
+
get serverInfo() {
|
|
2340
|
+
return this.connector.serverInfo;
|
|
2341
|
+
}
|
|
2342
|
+
/**
|
|
2343
|
+
* Call a tool on the server.
|
|
2344
|
+
*
|
|
2345
|
+
* @param name - Name of the tool to call
|
|
2346
|
+
* @param args - Arguments to pass to the tool
|
|
2347
|
+
* @param options - Optional request options (timeout, progress handlers, etc.)
|
|
2348
|
+
* @returns Result from the tool execution
|
|
2349
|
+
*
|
|
2350
|
+
* @example
|
|
2351
|
+
* ```typescript
|
|
2352
|
+
* const result = await session.callTool("add", { a: 5, b: 3 });
|
|
2353
|
+
* console.log(`Result: ${result.content[0].text}`);
|
|
2354
|
+
* ```
|
|
2355
|
+
*/
|
|
2356
|
+
async callTool(name, args, options) {
|
|
2357
|
+
return this.connector.callTool(name, args, options);
|
|
2358
|
+
}
|
|
2359
|
+
/**
|
|
2360
|
+
* List resources from the server with optional pagination.
|
|
2361
|
+
*
|
|
2362
|
+
* @param cursor - Optional cursor for pagination
|
|
2363
|
+
* @param options - Request options
|
|
2364
|
+
* @returns Resource list with optional nextCursor for pagination
|
|
2365
|
+
*
|
|
2366
|
+
* @example
|
|
2367
|
+
* ```typescript
|
|
2368
|
+
* const result = await session.listResources();
|
|
2369
|
+
* console.log(`Found ${result.resources.length} resources`);
|
|
2370
|
+
* ```
|
|
2371
|
+
*/
|
|
2372
|
+
async listResources(cursor, options) {
|
|
2373
|
+
return this.connector.listResources(cursor, options);
|
|
2374
|
+
}
|
|
2375
|
+
/**
|
|
2376
|
+
* List all resources from the server, automatically handling pagination.
|
|
2377
|
+
*
|
|
2378
|
+
* @param options - Request options
|
|
2379
|
+
* @returns Complete list of all resources
|
|
2380
|
+
*
|
|
2381
|
+
* @example
|
|
2382
|
+
* ```typescript
|
|
2383
|
+
* const result = await session.listAllResources();
|
|
2384
|
+
* console.log(`Total resources: ${result.resources.length}`);
|
|
2385
|
+
* ```
|
|
2386
|
+
*/
|
|
2387
|
+
async listAllResources(options) {
|
|
2388
|
+
return this.connector.listAllResources(options);
|
|
2389
|
+
}
|
|
2390
|
+
/**
|
|
2391
|
+
* List resource templates from the server.
|
|
2392
|
+
*
|
|
2393
|
+
* @param options - Request options
|
|
2394
|
+
* @returns List of available resource templates
|
|
2395
|
+
*
|
|
2396
|
+
* @example
|
|
2397
|
+
* ```typescript
|
|
2398
|
+
* const result = await session.listResourceTemplates();
|
|
2399
|
+
* console.log(`Available templates: ${result.resourceTemplates.length}`);
|
|
2400
|
+
* ```
|
|
2401
|
+
*/
|
|
2402
|
+
async listResourceTemplates(options) {
|
|
2403
|
+
return this.connector.listResourceTemplates(options);
|
|
2404
|
+
}
|
|
2405
|
+
/**
|
|
2406
|
+
* Read a resource by URI.
|
|
2407
|
+
*
|
|
2408
|
+
* @param uri - URI of the resource to read
|
|
2409
|
+
* @param options - Request options
|
|
2410
|
+
* @returns Resource content
|
|
2411
|
+
*
|
|
2412
|
+
* @example
|
|
2413
|
+
* ```typescript
|
|
2414
|
+
* const resource = await session.readResource("file:///path/to/file.txt");
|
|
2415
|
+
* console.log(resource.contents);
|
|
2416
|
+
* ```
|
|
2417
|
+
*/
|
|
2418
|
+
async readResource(uri, options) {
|
|
2419
|
+
return this.connector.readResource(uri, options);
|
|
2420
|
+
}
|
|
2421
|
+
/**
|
|
2422
|
+
* Subscribe to resource updates.
|
|
2423
|
+
*
|
|
2424
|
+
* @param uri - URI of the resource to subscribe to
|
|
2425
|
+
* @param options - Request options
|
|
2426
|
+
*
|
|
2427
|
+
* @example
|
|
2428
|
+
* ```typescript
|
|
2429
|
+
* await session.subscribeToResource("file:///path/to/file.txt");
|
|
2430
|
+
* // Now you'll receive notifications when this resource changes
|
|
2431
|
+
* ```
|
|
2432
|
+
*/
|
|
2433
|
+
async subscribeToResource(uri, options) {
|
|
2434
|
+
return this.connector.subscribeToResource(uri, options);
|
|
2435
|
+
}
|
|
2436
|
+
/**
|
|
2437
|
+
* Unsubscribe from resource updates.
|
|
2438
|
+
*
|
|
2439
|
+
* @param uri - URI of the resource to unsubscribe from
|
|
2440
|
+
* @param options - Request options
|
|
2441
|
+
*
|
|
2442
|
+
* @example
|
|
2443
|
+
* ```typescript
|
|
2444
|
+
* await session.unsubscribeFromResource("file:///path/to/file.txt");
|
|
2445
|
+
* ```
|
|
2446
|
+
*/
|
|
2447
|
+
async unsubscribeFromResource(uri, options) {
|
|
2448
|
+
return this.connector.unsubscribeFromResource(uri, options);
|
|
2449
|
+
}
|
|
2450
|
+
/**
|
|
2451
|
+
* List available prompts from the server.
|
|
2452
|
+
*
|
|
2453
|
+
* @returns List of available prompts
|
|
2454
|
+
*
|
|
2455
|
+
* @example
|
|
2456
|
+
* ```typescript
|
|
2457
|
+
* const result = await session.listPrompts();
|
|
2458
|
+
* console.log(`Available prompts: ${result.prompts.length}`);
|
|
2459
|
+
* ```
|
|
2460
|
+
*/
|
|
2461
|
+
async listPrompts() {
|
|
2462
|
+
return this.connector.listPrompts();
|
|
2463
|
+
}
|
|
2464
|
+
/**
|
|
2465
|
+
* Get a specific prompt with arguments.
|
|
2466
|
+
*
|
|
2467
|
+
* @param name - Name of the prompt to get
|
|
2468
|
+
* @param args - Arguments for the prompt
|
|
2469
|
+
* @returns Prompt result
|
|
2470
|
+
*
|
|
2471
|
+
* @example
|
|
2472
|
+
* ```typescript
|
|
2473
|
+
* const prompt = await session.getPrompt("greeting", { name: "Alice" });
|
|
2474
|
+
* console.log(prompt.messages);
|
|
2475
|
+
* ```
|
|
2476
|
+
*/
|
|
2477
|
+
async getPrompt(name, args) {
|
|
2478
|
+
return this.connector.getPrompt(name, args);
|
|
2479
|
+
}
|
|
2480
|
+
/**
|
|
2481
|
+
* Send a raw request through the client.
|
|
2482
|
+
*
|
|
2483
|
+
* @param method - MCP method name
|
|
2484
|
+
* @param params - Request parameters
|
|
2485
|
+
* @param options - Request options
|
|
2486
|
+
* @returns Response from the server
|
|
2487
|
+
*
|
|
2488
|
+
* @example
|
|
2489
|
+
* ```typescript
|
|
2490
|
+
* const result = await session.request("custom/method", { key: "value" });
|
|
2491
|
+
* ```
|
|
2492
|
+
*/
|
|
2493
|
+
async request(method, params = null, options) {
|
|
2494
|
+
return this.connector.request(method, params, options);
|
|
2495
|
+
}
|
|
2310
2496
|
};
|
|
2311
2497
|
|
|
2312
2498
|
// src/client/base.ts
|
|
@@ -5346,7 +5532,7 @@ var MCPAgent = class {
|
|
|
5346
5532
|
const historyToUse = externalHistory ?? this.conversationHistory;
|
|
5347
5533
|
const langchainHistory = [];
|
|
5348
5534
|
for (const msg of historyToUse) {
|
|
5349
|
-
if (this._isHumanMessageLike(msg) || this._isAIMessageLike(msg)) {
|
|
5535
|
+
if (this._isHumanMessageLike(msg) || this._isAIMessageLike(msg) || this._isToolMessageLike(msg)) {
|
|
5350
5536
|
langchainHistory.push(msg);
|
|
5351
5537
|
}
|
|
5352
5538
|
}
|
|
@@ -5479,9 +5665,9 @@ var MCPAgent = class {
|
|
|
5479
5665
|
}
|
|
5480
5666
|
}
|
|
5481
5667
|
if (this.memoryEnabled) {
|
|
5482
|
-
|
|
5483
|
-
|
|
5484
|
-
this.addToHistory(
|
|
5668
|
+
const newMessages = accumulatedMessages.slice(langchainHistory.length);
|
|
5669
|
+
for (const msg of newMessages) {
|
|
5670
|
+
this.addToHistory(msg);
|
|
5485
5671
|
}
|
|
5486
5672
|
}
|
|
5487
5673
|
if (outputSchema && finalOutput) {
|
|
@@ -5916,7 +6102,9 @@ ${formatPrompt}`
|
|
|
5916
6102
|
let chunkCount = 0;
|
|
5917
6103
|
for await (const chunk of stream) {
|
|
5918
6104
|
chunkCount++;
|
|
5919
|
-
logger.
|
|
6105
|
+
logger.debug(
|
|
6106
|
+
`Chunk ${chunkCount}: ${JSON.stringify(chunk, null, 2)}`
|
|
6107
|
+
);
|
|
5920
6108
|
if (typeof chunk === "string") {
|
|
5921
6109
|
try {
|
|
5922
6110
|
structuredResult = JSON.parse(chunk);
|
|
@@ -5933,7 +6121,9 @@ ${formatPrompt}`
|
|
|
5933
6121
|
}
|
|
5934
6122
|
}
|
|
5935
6123
|
if (chunkCount % 10 === 0) {
|
|
5936
|
-
logger.
|
|
6124
|
+
logger.debug(
|
|
6125
|
+
`\u{1F504} Structured output streaming: ${chunkCount} chunks`
|
|
6126
|
+
);
|
|
5937
6127
|
}
|
|
5938
6128
|
}
|
|
5939
6129
|
logger.info(
|
package/dist/src/browser.js
CHANGED
|
@@ -9,25 +9,25 @@ import {
|
|
|
9
9
|
MCPAgent,
|
|
10
10
|
ObservabilityManager,
|
|
11
11
|
RemoteAgent
|
|
12
|
-
} from "../chunk-
|
|
12
|
+
} from "../chunk-YMJL66MY.js";
|
|
13
13
|
import "../chunk-CPG2WZUL.js";
|
|
14
14
|
import {
|
|
15
15
|
BrowserMCPClient,
|
|
16
16
|
HttpConnector,
|
|
17
17
|
MCPSession,
|
|
18
18
|
WebSocketConnector
|
|
19
|
-
} from "../chunk-
|
|
20
|
-
import {
|
|
21
|
-
BrowserOAuthClientProvider,
|
|
22
|
-
onMcpAuthorization
|
|
23
|
-
} from "../chunk-3R5PDYIN.js";
|
|
19
|
+
} from "../chunk-QBTQXCAI.js";
|
|
24
20
|
import {
|
|
25
21
|
BaseConnector
|
|
26
|
-
} from "../chunk-
|
|
22
|
+
} from "../chunk-LTA4LQTH.js";
|
|
27
23
|
import {
|
|
28
24
|
Logger,
|
|
29
25
|
logger
|
|
30
26
|
} from "../chunk-34R6SIER.js";
|
|
27
|
+
import {
|
|
28
|
+
BrowserOAuthClientProvider,
|
|
29
|
+
onMcpAuthorization
|
|
30
|
+
} from "../chunk-3R5PDYIN.js";
|
|
31
31
|
import "../chunk-MTHLLDCX.js";
|
|
32
32
|
import "../chunk-3GQAWCBQ.js";
|
|
33
33
|
export {
|
|
@@ -54,7 +54,7 @@ export declare abstract class BaseConnector {
|
|
|
54
54
|
protected client: Client | null;
|
|
55
55
|
protected connectionManager: ConnectionManager<any> | null;
|
|
56
56
|
protected toolsCache: Tool[] | null;
|
|
57
|
-
protected capabilitiesCache:
|
|
57
|
+
protected capabilitiesCache: Record<string, unknown> | null;
|
|
58
58
|
protected serverInfoCache: {
|
|
59
59
|
name: string;
|
|
60
60
|
version?: string;
|
|
@@ -149,7 +149,7 @@ export declare abstract class BaseConnector {
|
|
|
149
149
|
/** Lazily expose the cached tools list. */
|
|
150
150
|
get tools(): Tool[];
|
|
151
151
|
/** Expose cached server capabilities. */
|
|
152
|
-
get serverCapabilities():
|
|
152
|
+
get serverCapabilities(): Record<string, unknown>;
|
|
153
153
|
/** Expose cached server info. */
|
|
154
154
|
get serverInfo(): {
|
|
155
155
|
name: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../../src/connectors/base.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,MAAM,EACN,aAAa,EACd,MAAM,2CAA2C,CAAC;AACnD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8CAA8C,CAAC;AAMnF,OAAO,KAAK,EACV,cAAc,EACd,oBAAoB,EACpB,mBAAmB,EACnB,uBAAuB,EACvB,sBAAsB,EACtB,YAAY,EACZ,YAAY,EACZ,IAAI,EACJ,IAAI,EACL,MAAM,oCAAoC,CAAC;AAC5C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAGlE;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAAG,CAChC,YAAY,EAAE,YAAY,KACvB,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AAE1B,MAAM,WAAW,oBAAoB;IACnC;;OAEG;IACH,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B;;;OAGG;IACH,qBAAqB,CAAC,EAAE,cAAc,CAAC;IACvC;;OAEG;IACH,YAAY,CAAC,EAAE,GAAG,CAAC;IACnB;;;OAGG;IACH,aAAa,CAAC,EAAE,CAAC,SAAS,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,KAAK,GAAG,CAAC;IAC1D;;;OAGG;IACH,KAAK,CAAC,EAAE,IAAI,EAAE,CAAC;IACf;;;;OA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","sources":["../../../src/react/WidgetControls.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAsC,MAAM,OAAO,CAAC;AAG3D,KAAK,QAAQ,GACT,UAAU,GACV,YAAY,GACZ,WAAW,GACX,aAAa,GACb,cAAc,GACd,aAAa,GACb,eAAe,GACf,cAAc,CAAC;AAEnB,UAAU,mBAAmB;IAC3B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,QAAQ,CAAC,EAAE,WAAW,GAAG,IAAI,CAAC;IAC9B,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;;;OAMG;IACH,YAAY,CAAC,EAAE,OAAO,GAAG,KAAK,GAAG,YAAY,CAAC;CAC/C;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,cAAc,CAAC,EAC7B,QAAQ,EACR,SAAc,EACd,QAAsB,EACtB,QAAQ,EACR,UAAiB,EACjB,QAAQ,EAAE,cAAsB,EAChC,YAAoB,GACrB,EAAE,mBAAmB,
|
|
1
|
+
{"version":3,"file":"WidgetControls.d.ts","sourceRoot":"","sources":["../../../src/react/WidgetControls.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAsC,MAAM,OAAO,CAAC;AAG3D,KAAK,QAAQ,GACT,UAAU,GACV,YAAY,GACZ,WAAW,GACX,aAAa,GACb,cAAc,GACd,aAAa,GACb,eAAe,GACf,cAAc,CAAC;AAEnB,UAAU,mBAAmB;IAC3B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,QAAQ,CAAC,EAAE,WAAW,GAAG,IAAI,CAAC;IAC9B,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;;;OAMG;IACH,YAAY,CAAC,EAAE,OAAO,GAAG,KAAK,GAAG,YAAY,CAAC;CAC/C;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,cAAc,CAAC,EAC7B,QAAQ,EACR,SAAc,EACd,QAAsB,EACtB,QAAQ,EACR,UAAiB,EACjB,QAAQ,EAAE,cAAsB,EAChC,YAAoB,GACrB,EAAE,mBAAmB,qBAwrBrB"}
|
package/dist/src/react/index.cjs
CHANGED
|
@@ -741,7 +741,7 @@ var BaseConnector = class {
|
|
|
741
741
|
}
|
|
742
742
|
logger.debug("Caching server capabilities & tools");
|
|
743
743
|
const capabilities = this.client.getServerCapabilities();
|
|
744
|
-
this.capabilitiesCache = capabilities;
|
|
744
|
+
this.capabilitiesCache = capabilities || null;
|
|
745
745
|
const serverInfo = this.client.getServerVersion();
|
|
746
746
|
this.serverInfoCache = serverInfo || null;
|
|
747
747
|
const listToolsRes = await this.client.listTools(
|
|
@@ -763,7 +763,7 @@ var BaseConnector = class {
|
|
|
763
763
|
}
|
|
764
764
|
/** Expose cached server capabilities. */
|
|
765
765
|
get serverCapabilities() {
|
|
766
|
-
return this.capabilitiesCache;
|
|
766
|
+
return this.capabilitiesCache || {};
|
|
767
767
|
}
|
|
768
768
|
/** Expose cached server info. */
|
|
769
769
|
get serverInfo() {
|
|
@@ -830,7 +830,8 @@ var BaseConnector = class {
|
|
|
830
830
|
} while (cursor);
|
|
831
831
|
return { resources: allResources };
|
|
832
832
|
} catch (err) {
|
|
833
|
-
|
|
833
|
+
const error = err;
|
|
834
|
+
if (error.code === -32601) {
|
|
834
835
|
logger.debug("Server advertised resources but method not found");
|
|
835
836
|
return { resources: [] };
|
|
836
837
|
}
|
|
@@ -897,7 +898,8 @@ var BaseConnector = class {
|
|
|
897
898
|
logger.debug("Listing prompts");
|
|
898
899
|
return await this.client.listPrompts();
|
|
899
900
|
} catch (err) {
|
|
900
|
-
|
|
901
|
+
const error = err;
|
|
902
|
+
if (error.code === -32601) {
|
|
901
903
|
logger.debug("Server advertised prompts but method not found");
|
|
902
904
|
return { prompts: [] };
|
|
903
905
|
}
|
|
@@ -1574,6 +1576,190 @@ var MCPSession = class {
|
|
|
1574
1576
|
getRoots() {
|
|
1575
1577
|
return this.connector.getRoots();
|
|
1576
1578
|
}
|
|
1579
|
+
/**
|
|
1580
|
+
* Get the cached list of tools from the server.
|
|
1581
|
+
*
|
|
1582
|
+
* @returns Array of available tools
|
|
1583
|
+
*
|
|
1584
|
+
* @example
|
|
1585
|
+
* ```typescript
|
|
1586
|
+
* const tools = session.tools;
|
|
1587
|
+
* console.log(`Available tools: ${tools.map(t => t.name).join(", ")}`);
|
|
1588
|
+
* ```
|
|
1589
|
+
*/
|
|
1590
|
+
get tools() {
|
|
1591
|
+
return this.connector.tools;
|
|
1592
|
+
}
|
|
1593
|
+
/**
|
|
1594
|
+
* Get the server capabilities advertised during initialization.
|
|
1595
|
+
*
|
|
1596
|
+
* @returns Server capabilities object
|
|
1597
|
+
*/
|
|
1598
|
+
get serverCapabilities() {
|
|
1599
|
+
return this.connector.serverCapabilities;
|
|
1600
|
+
}
|
|
1601
|
+
/**
|
|
1602
|
+
* Get the server information (name and version).
|
|
1603
|
+
*
|
|
1604
|
+
* @returns Server info object or null if not available
|
|
1605
|
+
*/
|
|
1606
|
+
get serverInfo() {
|
|
1607
|
+
return this.connector.serverInfo;
|
|
1608
|
+
}
|
|
1609
|
+
/**
|
|
1610
|
+
* Call a tool on the server.
|
|
1611
|
+
*
|
|
1612
|
+
* @param name - Name of the tool to call
|
|
1613
|
+
* @param args - Arguments to pass to the tool
|
|
1614
|
+
* @param options - Optional request options (timeout, progress handlers, etc.)
|
|
1615
|
+
* @returns Result from the tool execution
|
|
1616
|
+
*
|
|
1617
|
+
* @example
|
|
1618
|
+
* ```typescript
|
|
1619
|
+
* const result = await session.callTool("add", { a: 5, b: 3 });
|
|
1620
|
+
* console.log(`Result: ${result.content[0].text}`);
|
|
1621
|
+
* ```
|
|
1622
|
+
*/
|
|
1623
|
+
async callTool(name, args, options) {
|
|
1624
|
+
return this.connector.callTool(name, args, options);
|
|
1625
|
+
}
|
|
1626
|
+
/**
|
|
1627
|
+
* List resources from the server with optional pagination.
|
|
1628
|
+
*
|
|
1629
|
+
* @param cursor - Optional cursor for pagination
|
|
1630
|
+
* @param options - Request options
|
|
1631
|
+
* @returns Resource list with optional nextCursor for pagination
|
|
1632
|
+
*
|
|
1633
|
+
* @example
|
|
1634
|
+
* ```typescript
|
|
1635
|
+
* const result = await session.listResources();
|
|
1636
|
+
* console.log(`Found ${result.resources.length} resources`);
|
|
1637
|
+
* ```
|
|
1638
|
+
*/
|
|
1639
|
+
async listResources(cursor, options) {
|
|
1640
|
+
return this.connector.listResources(cursor, options);
|
|
1641
|
+
}
|
|
1642
|
+
/**
|
|
1643
|
+
* List all resources from the server, automatically handling pagination.
|
|
1644
|
+
*
|
|
1645
|
+
* @param options - Request options
|
|
1646
|
+
* @returns Complete list of all resources
|
|
1647
|
+
*
|
|
1648
|
+
* @example
|
|
1649
|
+
* ```typescript
|
|
1650
|
+
* const result = await session.listAllResources();
|
|
1651
|
+
* console.log(`Total resources: ${result.resources.length}`);
|
|
1652
|
+
* ```
|
|
1653
|
+
*/
|
|
1654
|
+
async listAllResources(options) {
|
|
1655
|
+
return this.connector.listAllResources(options);
|
|
1656
|
+
}
|
|
1657
|
+
/**
|
|
1658
|
+
* List resource templates from the server.
|
|
1659
|
+
*
|
|
1660
|
+
* @param options - Request options
|
|
1661
|
+
* @returns List of available resource templates
|
|
1662
|
+
*
|
|
1663
|
+
* @example
|
|
1664
|
+
* ```typescript
|
|
1665
|
+
* const result = await session.listResourceTemplates();
|
|
1666
|
+
* console.log(`Available templates: ${result.resourceTemplates.length}`);
|
|
1667
|
+
* ```
|
|
1668
|
+
*/
|
|
1669
|
+
async listResourceTemplates(options) {
|
|
1670
|
+
return this.connector.listResourceTemplates(options);
|
|
1671
|
+
}
|
|
1672
|
+
/**
|
|
1673
|
+
* Read a resource by URI.
|
|
1674
|
+
*
|
|
1675
|
+
* @param uri - URI of the resource to read
|
|
1676
|
+
* @param options - Request options
|
|
1677
|
+
* @returns Resource content
|
|
1678
|
+
*
|
|
1679
|
+
* @example
|
|
1680
|
+
* ```typescript
|
|
1681
|
+
* const resource = await session.readResource("file:///path/to/file.txt");
|
|
1682
|
+
* console.log(resource.contents);
|
|
1683
|
+
* ```
|
|
1684
|
+
*/
|
|
1685
|
+
async readResource(uri, options) {
|
|
1686
|
+
return this.connector.readResource(uri, options);
|
|
1687
|
+
}
|
|
1688
|
+
/**
|
|
1689
|
+
* Subscribe to resource updates.
|
|
1690
|
+
*
|
|
1691
|
+
* @param uri - URI of the resource to subscribe to
|
|
1692
|
+
* @param options - Request options
|
|
1693
|
+
*
|
|
1694
|
+
* @example
|
|
1695
|
+
* ```typescript
|
|
1696
|
+
* await session.subscribeToResource("file:///path/to/file.txt");
|
|
1697
|
+
* // Now you'll receive notifications when this resource changes
|
|
1698
|
+
* ```
|
|
1699
|
+
*/
|
|
1700
|
+
async subscribeToResource(uri, options) {
|
|
1701
|
+
return this.connector.subscribeToResource(uri, options);
|
|
1702
|
+
}
|
|
1703
|
+
/**
|
|
1704
|
+
* Unsubscribe from resource updates.
|
|
1705
|
+
*
|
|
1706
|
+
* @param uri - URI of the resource to unsubscribe from
|
|
1707
|
+
* @param options - Request options
|
|
1708
|
+
*
|
|
1709
|
+
* @example
|
|
1710
|
+
* ```typescript
|
|
1711
|
+
* await session.unsubscribeFromResource("file:///path/to/file.txt");
|
|
1712
|
+
* ```
|
|
1713
|
+
*/
|
|
1714
|
+
async unsubscribeFromResource(uri, options) {
|
|
1715
|
+
return this.connector.unsubscribeFromResource(uri, options);
|
|
1716
|
+
}
|
|
1717
|
+
/**
|
|
1718
|
+
* List available prompts from the server.
|
|
1719
|
+
*
|
|
1720
|
+
* @returns List of available prompts
|
|
1721
|
+
*
|
|
1722
|
+
* @example
|
|
1723
|
+
* ```typescript
|
|
1724
|
+
* const result = await session.listPrompts();
|
|
1725
|
+
* console.log(`Available prompts: ${result.prompts.length}`);
|
|
1726
|
+
* ```
|
|
1727
|
+
*/
|
|
1728
|
+
async listPrompts() {
|
|
1729
|
+
return this.connector.listPrompts();
|
|
1730
|
+
}
|
|
1731
|
+
/**
|
|
1732
|
+
* Get a specific prompt with arguments.
|
|
1733
|
+
*
|
|
1734
|
+
* @param name - Name of the prompt to get
|
|
1735
|
+
* @param args - Arguments for the prompt
|
|
1736
|
+
* @returns Prompt result
|
|
1737
|
+
*
|
|
1738
|
+
* @example
|
|
1739
|
+
* ```typescript
|
|
1740
|
+
* const prompt = await session.getPrompt("greeting", { name: "Alice" });
|
|
1741
|
+
* console.log(prompt.messages);
|
|
1742
|
+
* ```
|
|
1743
|
+
*/
|
|
1744
|
+
async getPrompt(name, args) {
|
|
1745
|
+
return this.connector.getPrompt(name, args);
|
|
1746
|
+
}
|
|
1747
|
+
/**
|
|
1748
|
+
* Send a raw request through the client.
|
|
1749
|
+
*
|
|
1750
|
+
* @param method - MCP method name
|
|
1751
|
+
* @param params - Request parameters
|
|
1752
|
+
* @param options - Request options
|
|
1753
|
+
* @returns Response from the server
|
|
1754
|
+
*
|
|
1755
|
+
* @example
|
|
1756
|
+
* ```typescript
|
|
1757
|
+
* const result = await session.request("custom/method", { key: "value" });
|
|
1758
|
+
* ```
|
|
1759
|
+
*/
|
|
1760
|
+
async request(method, params = null, options) {
|
|
1761
|
+
return this.connector.request(method, params, options);
|
|
1762
|
+
}
|
|
1577
1763
|
};
|
|
1578
1764
|
|
|
1579
1765
|
// src/client/base.ts
|
|
@@ -2237,8 +2423,9 @@ function useMcp(options) {
|
|
|
2237
2423
|
}
|
|
2238
2424
|
return "success";
|
|
2239
2425
|
} catch (err) {
|
|
2240
|
-
const
|
|
2241
|
-
|
|
2426
|
+
const error2 = err;
|
|
2427
|
+
const errorMessage = error2?.message || String(err);
|
|
2428
|
+
if (error2.code === 401 || errorMessage.includes("401") || errorMessage.includes("Unauthorized")) {
|
|
2242
2429
|
if (authProviderRef.current) {
|
|
2243
2430
|
addLog(
|
|
2244
2431
|
"info",
|
|
@@ -2286,7 +2473,10 @@ function useMcp(options) {
|
|
|
2286
2473
|
);
|
|
2287
2474
|
return "failed";
|
|
2288
2475
|
}
|
|
2289
|
-
failConnection(
|
|
2476
|
+
failConnection(
|
|
2477
|
+
errorMessage,
|
|
2478
|
+
error2 instanceof Error ? error2 : new Error(String(error2))
|
|
2479
|
+
);
|
|
2290
2480
|
return "failed";
|
|
2291
2481
|
}
|
|
2292
2482
|
}, "tryConnectWithTransport");
|
|
@@ -3290,7 +3480,8 @@ function WidgetControls({
|
|
|
3290
3480
|
const result = await callTool(toolName, args);
|
|
3291
3481
|
setActionResult(`Success: ${JSON.stringify(result, null, 2)}`);
|
|
3292
3482
|
} catch (error) {
|
|
3293
|
-
|
|
3483
|
+
const err = error;
|
|
3484
|
+
setActionResult(`Error: ${err.message}`);
|
|
3294
3485
|
}
|
|
3295
3486
|
}, "handleCallTool");
|
|
3296
3487
|
const handleSendFollowUpMessage = /* @__PURE__ */ __name(async () => {
|
|
@@ -3299,7 +3490,8 @@ function WidgetControls({
|
|
|
3299
3490
|
await sendFollowUpMessage(followUpMessage);
|
|
3300
3491
|
setActionResult("Follow-up message sent successfully");
|
|
3301
3492
|
} catch (error) {
|
|
3302
|
-
|
|
3493
|
+
const err = error;
|
|
3494
|
+
setActionResult(`Error: ${err.message}`);
|
|
3303
3495
|
}
|
|
3304
3496
|
}, "handleSendFollowUpMessage");
|
|
3305
3497
|
const handleOpenExternal = /* @__PURE__ */ __name(() => {
|
|
@@ -3307,7 +3499,8 @@ function WidgetControls({
|
|
|
3307
3499
|
openExternal(externalUrl);
|
|
3308
3500
|
setActionResult(`Opened external link: ${externalUrl}`);
|
|
3309
3501
|
} catch (error) {
|
|
3310
|
-
|
|
3502
|
+
const err = error;
|
|
3503
|
+
setActionResult(`Error: ${err.message}`);
|
|
3311
3504
|
}
|
|
3312
3505
|
}, "handleOpenExternal");
|
|
3313
3506
|
const handleRequestDisplayMode = /* @__PURE__ */ __name(async (mode) => {
|
|
@@ -3316,7 +3509,8 @@ function WidgetControls({
|
|
|
3316
3509
|
const result = await requestDisplayMode(mode);
|
|
3317
3510
|
setActionResult(`Display mode granted: ${result.mode}`);
|
|
3318
3511
|
} catch (error) {
|
|
3319
|
-
|
|
3512
|
+
const err = error;
|
|
3513
|
+
setActionResult(`Error: ${err.message}`);
|
|
3320
3514
|
}
|
|
3321
3515
|
}, "handleRequestDisplayMode");
|
|
3322
3516
|
const handleSetState = /* @__PURE__ */ __name(async () => {
|
|
@@ -3326,7 +3520,8 @@ function WidgetControls({
|
|
|
3326
3520
|
await setState(newState);
|
|
3327
3521
|
setActionResult(`State updated: ${JSON.stringify(newState, null, 2)}`);
|
|
3328
3522
|
} catch (error) {
|
|
3329
|
-
|
|
3523
|
+
const err = error;
|
|
3524
|
+
setActionResult(`Error: ${err.message}`);
|
|
3330
3525
|
}
|
|
3331
3526
|
}, "handleSetState");
|
|
3332
3527
|
const handleFullscreen = /* @__PURE__ */ __name(async () => {
|