@mcp-use/client 2.0.0-beta.15 → 2.0.0-beta.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/.tsbuildinfo +1 -1
- package/dist/auth/browser.d.ts +51 -2
- package/dist/auth/browser.d.ts.map +1 -1
- package/dist/auth/node.d.ts +99 -4
- package/dist/auth/node.d.ts.map +1 -1
- package/dist/auth/session-store.d.ts +6 -0
- package/dist/auth/session-store.d.ts.map +1 -1
- package/dist/core/base.d.ts +4 -8
- package/dist/core/base.d.ts.map +1 -1
- package/dist/core/browser.d.ts +14 -2
- package/dist/core/browser.d.ts.map +1 -1
- package/dist/core/config.d.ts +82 -20
- package/dist/core/config.d.ts.map +1 -1
- package/dist/core/node.d.ts +7 -10
- package/dist/core/node.d.ts.map +1 -1
- package/dist/core/session.d.ts +18 -4
- package/dist/core/session.d.ts.map +1 -1
- package/dist/index-browser.d.ts +1 -0
- package/dist/index-browser.d.ts.map +1 -1
- package/dist/index-browser.js +142 -21
- package/dist/index-browser.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +218 -31
- package/dist/index.js.map +1 -1
- package/dist/react/McpClientProvider.d.ts +22 -10
- package/dist/react/McpClientProvider.d.ts.map +1 -1
- package/dist/react/index.d.ts +2 -0
- package/dist/react/index.d.ts.map +1 -1
- package/dist/react/index.js +164 -21
- package/dist/react/index.js.map +1 -1
- package/dist/react/rpc-logger.d.ts +5 -0
- package/dist/react/rpc-logger.d.ts.map +1 -1
- package/dist/react/storage.d.ts +47 -0
- package/dist/react/storage.d.ts.map +1 -1
- package/dist/react/types.d.ts +107 -16
- package/dist/react/types.d.ts.map +1 -1
- package/dist/react/useMcp-operations.d.ts.map +1 -1
- package/dist/react/view/ViewRenderer.d.ts +7 -0
- package/dist/react/view/ViewRenderer.d.ts.map +1 -1
- package/dist/react/view/parse-custom-props.d.ts +8 -0
- package/dist/react/view/parse-custom-props.d.ts.map +1 -1
- package/dist/react/view/resolve-view-resource.d.ts +10 -0
- package/dist/react/view/resolve-view-resource.d.ts.map +1 -1
- package/dist/react/view/types.d.ts +89 -0
- package/dist/react/view/types.d.ts.map +1 -1
- package/dist/react/view/view-detection.d.ts +18 -0
- package/dist/react/view/view-detection.d.ts.map +1 -1
- package/dist/react/view/view-host-policy.d.ts +35 -0
- package/dist/react/view/view-host-policy.d.ts.map +1 -1
- package/dist/sandbox.d.ts +2 -0
- package/dist/sandbox.d.ts.map +1 -0
- package/dist/sandbox.js +283 -0
- package/dist/sandbox.js.map +1 -0
- package/dist/telemetry/telemetry.d.ts +5 -1
- package/dist/telemetry/telemetry.d.ts.map +1 -1
- package/dist/transport/base.d.ts +85 -13
- package/dist/transport/base.d.ts.map +1 -1
- package/dist/transport/connection-manager.d.ts +1 -1
- package/dist/transport/http.d.ts +51 -2
- package/dist/transport/http.d.ts.map +1 -1
- package/dist/transport/stdio.d.ts +29 -1
- package/dist/transport/stdio.d.ts.map +1 -1
- package/dist/utils/elicitation.d.ts +4 -2
- package/dist/utils/elicitation.d.ts.map +1 -1
- package/dist/utils/logging.d.ts +1 -0
- package/dist/utils/logging.d.ts.map +1 -1
- package/dist/utils/version.d.ts +6 -0
- package/dist/utils/version.d.ts.map +1 -1
- package/package.json +8 -4
package/dist/index-browser.js
CHANGED
|
@@ -128,7 +128,7 @@ var Logger = class {
|
|
|
128
128
|
var logger = Logger.get();
|
|
129
129
|
|
|
130
130
|
// src/utils/version.ts
|
|
131
|
-
var VERSION = "2.0.0-beta.
|
|
131
|
+
var VERSION = "2.0.0-beta.17";
|
|
132
132
|
function getPackageVersion() {
|
|
133
133
|
return VERSION;
|
|
134
134
|
}
|
|
@@ -1159,11 +1159,14 @@ function trimTrailingSlashes(value) {
|
|
|
1159
1159
|
return value.slice(0, end);
|
|
1160
1160
|
}
|
|
1161
1161
|
var BrowserOAuthClientProvider = class {
|
|
1162
|
+
/** Protected MCP server URL associated with this provider. */
|
|
1162
1163
|
serverUrl;
|
|
1164
|
+
/** Pre-registered public client information, when configured. */
|
|
1163
1165
|
staticClientInfo;
|
|
1164
1166
|
session;
|
|
1165
1167
|
storage;
|
|
1166
1168
|
// Browser-only state
|
|
1169
|
+
/** Whether initial connection waits for explicit authentication. */
|
|
1167
1170
|
preventAutoAuth;
|
|
1168
1171
|
useRedirectFlow;
|
|
1169
1172
|
oauthProxyUrl;
|
|
@@ -1171,6 +1174,7 @@ var BrowserOAuthClientProvider = class {
|
|
|
1171
1174
|
proxyOAuthRequests;
|
|
1172
1175
|
lastAttemptedAuthUrl = null;
|
|
1173
1176
|
authorizationPending = false;
|
|
1177
|
+
/** Callback invoked immediately before an authorization popup opens. */
|
|
1174
1178
|
onPopupWindow;
|
|
1175
1179
|
constructor(serverUrl, options = {}) {
|
|
1176
1180
|
if (options.staticClientInfo?.client_secret) {
|
|
@@ -1194,36 +1198,51 @@ var BrowserOAuthClientProvider = class {
|
|
|
1194
1198
|
this.onPopupWindow = options.onPopupWindow;
|
|
1195
1199
|
}
|
|
1196
1200
|
// --- Identity / key fields exposed for callback handling ---
|
|
1201
|
+
/** Prefix used for persisted OAuth keys. */
|
|
1197
1202
|
get storageKeyPrefix() {
|
|
1198
1203
|
return this.session.storageKeyPrefix;
|
|
1199
1204
|
}
|
|
1205
|
+
/** Stable hash used to namespace storage for this server. */
|
|
1200
1206
|
get serverUrlHash() {
|
|
1201
1207
|
return this.session.serverUrlHash;
|
|
1202
1208
|
}
|
|
1209
|
+
/** Human-readable OAuth client name. */
|
|
1203
1210
|
get clientName() {
|
|
1204
1211
|
return this.session.clientName;
|
|
1205
1212
|
}
|
|
1213
|
+
/** Public website describing the OAuth client. */
|
|
1206
1214
|
get clientUri() {
|
|
1207
1215
|
return this.session.clientUri;
|
|
1208
1216
|
}
|
|
1217
|
+
/** Public OAuth client logo URL. */
|
|
1209
1218
|
get logoUri() {
|
|
1210
1219
|
return this.session.logoUri;
|
|
1211
1220
|
}
|
|
1221
|
+
/** OAuth redirect URI. */
|
|
1212
1222
|
get callbackUrl() {
|
|
1213
1223
|
return this.session.callbackUrl;
|
|
1214
1224
|
}
|
|
1225
|
+
/** Space-delimited OAuth scopes requested by the client. */
|
|
1215
1226
|
get scope() {
|
|
1216
1227
|
return this.session.scope;
|
|
1217
1228
|
}
|
|
1218
1229
|
get clientMetadataUrl() {
|
|
1219
1230
|
return this.session.clientMetadataUrl;
|
|
1220
1231
|
}
|
|
1232
|
+
/**
|
|
1233
|
+
* Returns a provider-scoped storage key.
|
|
1234
|
+
*
|
|
1235
|
+
* @param keySuffix - Suffix identifying the stored value.
|
|
1236
|
+
* @returns Namespaced storage key.
|
|
1237
|
+
*/
|
|
1221
1238
|
getKey(keySuffix) {
|
|
1222
1239
|
return this.session.getKey(keySuffix);
|
|
1223
1240
|
}
|
|
1241
|
+
/** Whether an authorization flow is awaiting completion. */
|
|
1224
1242
|
get hasPendingFlow() {
|
|
1225
1243
|
return this.authorizationPending;
|
|
1226
1244
|
}
|
|
1245
|
+
/** Marks the current authorization flow as complete. */
|
|
1227
1246
|
markFlowComplete() {
|
|
1228
1247
|
this.authorizationPending = false;
|
|
1229
1248
|
}
|
|
@@ -1410,10 +1429,25 @@ var BrowserOAuthClientProvider = class {
|
|
|
1410
1429
|
this.authorizationPending = false;
|
|
1411
1430
|
return this.session.saveTokens(tokens, ctx);
|
|
1412
1431
|
}
|
|
1432
|
+
/**
|
|
1433
|
+
* Returns the configured or dynamically registered OAuth client information.
|
|
1434
|
+
*
|
|
1435
|
+
* @param ctx - Optional registration context.
|
|
1436
|
+
* @returns OAuth client information, or `undefined` when not registered.
|
|
1437
|
+
*/
|
|
1413
1438
|
async clientInformation(ctx) {
|
|
1414
1439
|
if (this.staticClientInfo) return this.staticClientInfo;
|
|
1415
1440
|
return this.session.clientInformation(ctx);
|
|
1416
1441
|
}
|
|
1442
|
+
/**
|
|
1443
|
+
* Persists public OAuth client registration information.
|
|
1444
|
+
*
|
|
1445
|
+
* Static client configuration takes precedence, and browser providers discard
|
|
1446
|
+
* any client secret returned for a public client.
|
|
1447
|
+
*
|
|
1448
|
+
* @param clientInformation - Registration information to save.
|
|
1449
|
+
* @param ctx - Optional registration context.
|
|
1450
|
+
*/
|
|
1417
1451
|
async saveClientInformation(clientInformation, ctx) {
|
|
1418
1452
|
if (this.staticClientInfo) return;
|
|
1419
1453
|
const { client_secret: discardedClientSecret, ...publicClientInformation } = clientInformation;
|
|
@@ -1493,7 +1527,7 @@ var BrowserOAuthClientProvider = class {
|
|
|
1493
1527
|
}
|
|
1494
1528
|
/**
|
|
1495
1529
|
* Redirects the user agent to the authorization URL, storing necessary state.
|
|
1496
|
-
* @param authorizationUrl The fully constructed authorization URL from the SDK.
|
|
1530
|
+
* @param authorizationUrl - The fully constructed authorization URL from the SDK.
|
|
1497
1531
|
*/
|
|
1498
1532
|
async redirectToAuthorization(authorizationUrl) {
|
|
1499
1533
|
const sanitizedAuthUrl = await this.prepareAuthorizationUrl(authorizationUrl);
|
|
@@ -1543,6 +1577,11 @@ var BrowserOAuthClientProvider = class {
|
|
|
1543
1577
|
getLastAttemptedAuthUrl() {
|
|
1544
1578
|
return this.lastAttemptedAuthUrl;
|
|
1545
1579
|
}
|
|
1580
|
+
/**
|
|
1581
|
+
* Removes OAuth state stored for this server.
|
|
1582
|
+
*
|
|
1583
|
+
* @returns The number of storage entries removed.
|
|
1584
|
+
*/
|
|
1546
1585
|
clearStorage() {
|
|
1547
1586
|
this.lastAttemptedAuthUrl = null;
|
|
1548
1587
|
this.authorizationPending = false;
|
|
@@ -2053,6 +2092,11 @@ var BaseConnector = class {
|
|
|
2053
2092
|
notificationHandlers = [];
|
|
2054
2093
|
rootsCache = [];
|
|
2055
2094
|
activeProgressHandlers = /* @__PURE__ */ new Set();
|
|
2095
|
+
/**
|
|
2096
|
+
* Creates a connector with shared SDK and callback options.
|
|
2097
|
+
*
|
|
2098
|
+
* @param opts - Connector initialization options.
|
|
2099
|
+
*/
|
|
2056
2100
|
constructor(opts = {}) {
|
|
2057
2101
|
this.opts = opts;
|
|
2058
2102
|
if (opts.roots) {
|
|
@@ -2235,7 +2279,9 @@ var BaseConnector = class {
|
|
|
2235
2279
|
}
|
|
2236
2280
|
}
|
|
2237
2281
|
/**
|
|
2238
|
-
*
|
|
2282
|
+
* Returns the roots currently advertised to the server.
|
|
2283
|
+
*
|
|
2284
|
+
* @returns A copy of the configured roots.
|
|
2239
2285
|
*/
|
|
2240
2286
|
getRoots() {
|
|
2241
2287
|
return [...this.rootsCache];
|
|
@@ -2304,7 +2350,11 @@ var BaseConnector = class {
|
|
|
2304
2350
|
"setupElicitationHandler: Elicitation handler registered successfully"
|
|
2305
2351
|
);
|
|
2306
2352
|
}
|
|
2307
|
-
/**
|
|
2353
|
+
/**
|
|
2354
|
+
* Disconnects the SDK client and releases transport resources.
|
|
2355
|
+
*
|
|
2356
|
+
* @returns A promise that resolves after cleanup completes.
|
|
2357
|
+
*/
|
|
2308
2358
|
async disconnect() {
|
|
2309
2359
|
if (!this.connected) {
|
|
2310
2360
|
logger.debug("Not connected to MCP implementation");
|
|
@@ -2315,7 +2365,7 @@ var BaseConnector = class {
|
|
|
2315
2365
|
this.connected = false;
|
|
2316
2366
|
logger.debug("Disconnected from MCP implementation");
|
|
2317
2367
|
}
|
|
2318
|
-
/**
|
|
2368
|
+
/** Whether an SDK client currently exists for this connector. */
|
|
2319
2369
|
get isClientConnected() {
|
|
2320
2370
|
return this.client != null;
|
|
2321
2371
|
}
|
|
@@ -2325,6 +2375,10 @@ var BaseConnector = class {
|
|
|
2325
2375
|
* In the SDK, `Client.connect(transport)` automatically performs the
|
|
2326
2376
|
* protocol‑level `initialize` handshake, so we only need to cache the list of
|
|
2327
2377
|
* tools and expose some server info.
|
|
2378
|
+
*
|
|
2379
|
+
* @param defaultRequestOptions - Options used while fetching the initial tool list.
|
|
2380
|
+
* @returns The capabilities advertised by the server.
|
|
2381
|
+
* @throws When {@link BaseConnector.connect} has not completed.
|
|
2328
2382
|
*/
|
|
2329
2383
|
async initialize(defaultRequestOptions = this.opts.defaultRequestOptions ?? {}) {
|
|
2330
2384
|
if (!this.client) {
|
|
@@ -2362,18 +2416,22 @@ var BaseConnector = class {
|
|
|
2362
2416
|
logger.debug("Server info:", serverInfo);
|
|
2363
2417
|
return capabilities;
|
|
2364
2418
|
}
|
|
2365
|
-
/**
|
|
2419
|
+
/**
|
|
2420
|
+
* Returns the tool list cached during initialization.
|
|
2421
|
+
*
|
|
2422
|
+
* @throws When {@link BaseConnector.initialize} has not completed.
|
|
2423
|
+
*/
|
|
2366
2424
|
get tools() {
|
|
2367
2425
|
if (!this.toolsCache) {
|
|
2368
2426
|
throw new Error("MCP client is not initialized; call initialize() first");
|
|
2369
2427
|
}
|
|
2370
2428
|
return this.toolsCache;
|
|
2371
2429
|
}
|
|
2372
|
-
/**
|
|
2430
|
+
/** Capabilities cached during initialization, or an empty object. */
|
|
2373
2431
|
get serverCapabilities() {
|
|
2374
2432
|
return this.capabilitiesCache || {};
|
|
2375
2433
|
}
|
|
2376
|
-
/**
|
|
2434
|
+
/** Server identity cached during initialization, or `null`. */
|
|
2377
2435
|
get serverInfo() {
|
|
2378
2436
|
return this.serverInfoCache;
|
|
2379
2437
|
}
|
|
@@ -2394,7 +2452,15 @@ var BaseConnector = class {
|
|
|
2394
2452
|
get negotiatedProtocolVersion() {
|
|
2395
2453
|
return this.client?.getNegotiatedProtocolVersion?.();
|
|
2396
2454
|
}
|
|
2397
|
-
/**
|
|
2455
|
+
/**
|
|
2456
|
+
* Calls a tool on the connected server.
|
|
2457
|
+
*
|
|
2458
|
+
* @param name - Tool name.
|
|
2459
|
+
* @param args - Tool arguments.
|
|
2460
|
+
* @param options - Per-request timeout, cancellation, and progress options.
|
|
2461
|
+
* @returns The tool result returned by the server.
|
|
2462
|
+
* @throws When the connector is not connected or the tool call fails.
|
|
2463
|
+
*/
|
|
2398
2464
|
async callTool(name, args, options) {
|
|
2399
2465
|
if (!this.client) {
|
|
2400
2466
|
throw new Error("MCP client is not connected");
|
|
@@ -2519,7 +2585,13 @@ var BaseConnector = class {
|
|
|
2519
2585
|
);
|
|
2520
2586
|
return result;
|
|
2521
2587
|
}
|
|
2522
|
-
/**
|
|
2588
|
+
/**
|
|
2589
|
+
* Reads a resource by URI.
|
|
2590
|
+
*
|
|
2591
|
+
* @param uri - Resource URI to read.
|
|
2592
|
+
* @param options - Per-request options.
|
|
2593
|
+
* @returns The resource contents returned by the server.
|
|
2594
|
+
*/
|
|
2523
2595
|
async readResource(uri, options) {
|
|
2524
2596
|
if (!this.client) {
|
|
2525
2597
|
throw new Error("MCP client is not connected");
|
|
@@ -2554,6 +2626,11 @@ var BaseConnector = class {
|
|
|
2554
2626
|
logger.debug(`Unsubscribing from resource: ${uri}`);
|
|
2555
2627
|
return await this.client.unsubscribeResource({ uri }, options);
|
|
2556
2628
|
}
|
|
2629
|
+
/**
|
|
2630
|
+
* Lists prompts exposed by the server.
|
|
2631
|
+
*
|
|
2632
|
+
* @returns The prompt list, or an empty list when prompts are unsupported.
|
|
2633
|
+
*/
|
|
2557
2634
|
async listPrompts() {
|
|
2558
2635
|
if (!this.client) {
|
|
2559
2636
|
throw new Error("MCP client is not connected");
|
|
@@ -2574,6 +2651,13 @@ var BaseConnector = class {
|
|
|
2574
2651
|
throw err;
|
|
2575
2652
|
}
|
|
2576
2653
|
}
|
|
2654
|
+
/**
|
|
2655
|
+
* Gets a prompt with the supplied arguments.
|
|
2656
|
+
*
|
|
2657
|
+
* @param name - Prompt name.
|
|
2658
|
+
* @param args - Prompt arguments.
|
|
2659
|
+
* @returns The rendered prompt returned by the server.
|
|
2660
|
+
*/
|
|
2577
2661
|
async getPrompt(name, args) {
|
|
2578
2662
|
if (!this.client) {
|
|
2579
2663
|
throw new Error("MCP client is not connected");
|
|
@@ -2581,7 +2665,14 @@ var BaseConnector = class {
|
|
|
2581
2665
|
logger.debug(`Getting prompt ${name}`);
|
|
2582
2666
|
return await this.client.getPrompt({ name, arguments: args });
|
|
2583
2667
|
}
|
|
2584
|
-
/**
|
|
2668
|
+
/**
|
|
2669
|
+
* Sends a raw, potentially non-standard request through the SDK client.
|
|
2670
|
+
*
|
|
2671
|
+
* @param method - JSON-RPC method name.
|
|
2672
|
+
* @param params - Request parameters. Defaults to an empty object.
|
|
2673
|
+
* @param options - Per-request options.
|
|
2674
|
+
* @returns The unvalidated result returned by the server.
|
|
2675
|
+
*/
|
|
2585
2676
|
async request(method, params = null, options) {
|
|
2586
2677
|
if (!this.client) {
|
|
2587
2678
|
throw new Error("MCP client is not connected");
|
|
@@ -2680,6 +2771,12 @@ var HttpConnector = class extends BaseConnector {
|
|
|
2680
2771
|
reconnectionOptions;
|
|
2681
2772
|
transportType = null;
|
|
2682
2773
|
streamableTransport = null;
|
|
2774
|
+
/**
|
|
2775
|
+
* Creates an HTTP connector.
|
|
2776
|
+
*
|
|
2777
|
+
* @param baseUrl - MCP endpoint URL.
|
|
2778
|
+
* @param opts - Authentication, transport, SDK, and reconnection options.
|
|
2779
|
+
*/
|
|
2683
2780
|
constructor(baseUrl, opts = {}) {
|
|
2684
2781
|
super(opts);
|
|
2685
2782
|
const originalUrl = baseUrl.replace(/\/$/, "");
|
|
@@ -2797,7 +2894,12 @@ var HttpConnector = class extends BaseConnector {
|
|
|
2797
2894
|
}
|
|
2798
2895
|
return { fallbackReason, is401Error, httpStatusCode };
|
|
2799
2896
|
}
|
|
2800
|
-
/**
|
|
2897
|
+
/**
|
|
2898
|
+
* Establishes a streamable HTTP connection to the MCP server.
|
|
2899
|
+
*
|
|
2900
|
+
* @returns A promise that resolves after protocol negotiation completes.
|
|
2901
|
+
* @throws An error with `code: 401` when authentication is required.
|
|
2902
|
+
*/
|
|
2801
2903
|
async connect() {
|
|
2802
2904
|
if (this.connected) {
|
|
2803
2905
|
logger.debug("Already connected to MCP implementation");
|
|
@@ -3025,6 +3127,11 @@ var HttpConnector = class extends BaseConnector {
|
|
|
3025
3127
|
throw err;
|
|
3026
3128
|
}
|
|
3027
3129
|
}
|
|
3130
|
+
/**
|
|
3131
|
+
* Returns fields that identify the endpoint and negotiated transport.
|
|
3132
|
+
*
|
|
3133
|
+
* @returns HTTP connector identity metadata.
|
|
3134
|
+
*/
|
|
3028
3135
|
get publicIdentifier() {
|
|
3029
3136
|
return {
|
|
3030
3137
|
type: "http",
|
|
@@ -3033,7 +3140,11 @@ var HttpConnector = class extends BaseConnector {
|
|
|
3033
3140
|
protocolEra: this.protocolEra ?? "unknown"
|
|
3034
3141
|
};
|
|
3035
3142
|
}
|
|
3036
|
-
/**
|
|
3143
|
+
/**
|
|
3144
|
+
* Returns the active transport type.
|
|
3145
|
+
*
|
|
3146
|
+
* @returns `"streamable-http"` after connection, otherwise `null`.
|
|
3147
|
+
*/
|
|
3037
3148
|
getTransportType() {
|
|
3038
3149
|
return this.transportType;
|
|
3039
3150
|
}
|
|
@@ -3401,7 +3512,7 @@ var MCPConnection = class {
|
|
|
3401
3512
|
/**
|
|
3402
3513
|
* Normalized server metadata for this ready connection.
|
|
3403
3514
|
*
|
|
3404
|
-
* @throws
|
|
3515
|
+
* @throws When called before protocol negotiation completes.
|
|
3405
3516
|
*/
|
|
3406
3517
|
get info() {
|
|
3407
3518
|
const protocolEra = this.protocolEra;
|
|
@@ -3613,12 +3724,10 @@ function isOAuthClientProvider(provider) {
|
|
|
3613
3724
|
var BaseMCPClient = class {
|
|
3614
3725
|
/**
|
|
3615
3726
|
* Internal configuration object containing MCP server definitions.
|
|
3616
|
-
* @protected
|
|
3617
3727
|
*/
|
|
3618
3728
|
config = {};
|
|
3619
3729
|
/**
|
|
3620
3730
|
* Map of server names to their active sessions.
|
|
3621
|
-
* @protected
|
|
3622
3731
|
*/
|
|
3623
3732
|
sessions = {};
|
|
3624
3733
|
/**
|
|
@@ -3662,7 +3771,7 @@ var BaseMCPClient = class {
|
|
|
3662
3771
|
*
|
|
3663
3772
|
* @param _cfg - Configuration dictionary
|
|
3664
3773
|
* @returns Client instance
|
|
3665
|
-
* @throws
|
|
3774
|
+
* @throws If called on the base class instead of a concrete implementation
|
|
3666
3775
|
*
|
|
3667
3776
|
* @example
|
|
3668
3777
|
* ```typescript
|
|
@@ -3804,7 +3913,7 @@ var BaseMCPClient = class {
|
|
|
3804
3913
|
* @param serverName - The name of the server as defined in the client configuration
|
|
3805
3914
|
* @param autoInitialize - Whether to automatically initialize the session (default: true)
|
|
3806
3915
|
* @returns A promise that resolves to the created MCPSession instance
|
|
3807
|
-
* @throws
|
|
3916
|
+
* @throws If the server is not found in the configuration
|
|
3808
3917
|
*
|
|
3809
3918
|
* @example
|
|
3810
3919
|
* ```typescript
|
|
@@ -3974,7 +4083,7 @@ var BaseMCPClient = class {
|
|
|
3974
4083
|
*
|
|
3975
4084
|
* @param serverName - Name of the server
|
|
3976
4085
|
* @returns The session instance
|
|
3977
|
-
* @throws
|
|
4086
|
+
* @throws If the session is not found
|
|
3978
4087
|
*
|
|
3979
4088
|
* @example
|
|
3980
4089
|
* ```typescript
|
|
@@ -4143,16 +4252,28 @@ function trackBrowserClientInit(config) {
|
|
|
4143
4252
|
}
|
|
4144
4253
|
var BrowserMCPClient = class _BrowserMCPClient extends BaseMCPClient {
|
|
4145
4254
|
/**
|
|
4146
|
-
*
|
|
4147
|
-
*
|
|
4255
|
+
* Returns the installed `@mcp-use/client` package version.
|
|
4256
|
+
*
|
|
4257
|
+
* @returns The package version string.
|
|
4148
4258
|
*/
|
|
4149
4259
|
static getPackageVersion() {
|
|
4150
4260
|
return getPackageVersion();
|
|
4151
4261
|
}
|
|
4262
|
+
/**
|
|
4263
|
+
* Creates a browser MCP client.
|
|
4264
|
+
*
|
|
4265
|
+
* @param config - Client configuration containing an optional `mcpServers` map.
|
|
4266
|
+
*/
|
|
4152
4267
|
constructor(config) {
|
|
4153
4268
|
super(config);
|
|
4154
4269
|
trackBrowserClientInit(this.config);
|
|
4155
4270
|
}
|
|
4271
|
+
/**
|
|
4272
|
+
* Creates a browser client from an inline configuration object.
|
|
4273
|
+
*
|
|
4274
|
+
* @param cfg - Client configuration containing an optional `mcpServers` map.
|
|
4275
|
+
* @returns A browser client initialized with `cfg`.
|
|
4276
|
+
*/
|
|
4156
4277
|
static fromDict(cfg) {
|
|
4157
4278
|
return new _BrowserMCPClient(cfg);
|
|
4158
4279
|
}
|