@mcp-use/client 2.1.3-canary.0 → 2.1.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/dist/.tsbuildinfo +1 -1
- package/dist/index-browser.js +3 -29
- package/dist/index-browser.js.map +1 -1
- package/dist/index.js +3 -29
- package/dist/index.js.map +1 -1
- package/dist/react/index.js +3 -29
- package/dist/react/index.js.map +1 -1
- package/dist/transport/http.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1525,7 +1525,7 @@ init_connector_telemetry();
|
|
|
1525
1525
|
init_logging();
|
|
1526
1526
|
|
|
1527
1527
|
// src/utils/version.ts
|
|
1528
|
-
var VERSION = "2.1.3
|
|
1528
|
+
var VERSION = "2.1.3";
|
|
1529
1529
|
function getPackageVersion() {
|
|
1530
1530
|
return VERSION;
|
|
1531
1531
|
}
|
|
@@ -3359,23 +3359,15 @@ var HttpConnector = class extends BaseConnector {
|
|
|
3359
3359
|
authProviderUrl: this.opts.authProvider && "serverUrl" in this.opts.authProvider && typeof this.opts.authProvider.serverUrl === "string" ? this.opts.authProvider.serverUrl : "none",
|
|
3360
3360
|
headers: this.headers
|
|
3361
3361
|
});
|
|
3362
|
-
let markPushStreamReady;
|
|
3363
|
-
const pushStreamReady = new Promise((resolve) => {
|
|
3364
|
-
markPushStreamReady = resolve;
|
|
3365
|
-
});
|
|
3366
3362
|
const baseFetch = this.customFetch ?? globalThis.fetch.bind(globalThis);
|
|
3367
3363
|
const observedFetch = async (input, init) => {
|
|
3368
3364
|
const response = await baseFetch(input, init);
|
|
3369
|
-
const method = init?.method ?? (input instanceof Request ? input.method : "GET");
|
|
3370
3365
|
const requestHeaders = new Headers(
|
|
3371
3366
|
input instanceof Request ? input.headers : void 0
|
|
3372
3367
|
);
|
|
3373
3368
|
new Headers(init?.headers).forEach((value, key) => {
|
|
3374
3369
|
requestHeaders.set(key, value);
|
|
3375
3370
|
});
|
|
3376
|
-
if (method.toUpperCase() === "GET" && response.ok && response.headers.get("content-type")?.includes("text/event-stream")) {
|
|
3377
|
-
markPushStreamReady?.();
|
|
3378
|
-
}
|
|
3379
3371
|
return requestHeaders.get("mcp-method") === "subscriptions/listen" ? response : this.observeSseProgress(response);
|
|
3380
3372
|
};
|
|
3381
3373
|
const streamableTransport = new StreamableHTTPClientTransport(
|
|
@@ -3414,8 +3406,9 @@ var HttpConnector = class extends BaseConnector {
|
|
|
3414
3406
|
this.setupRootsHandler();
|
|
3415
3407
|
this.setupSamplingHandler();
|
|
3416
3408
|
this.setupElicitationHandler();
|
|
3409
|
+
this.setupNotificationHandler();
|
|
3417
3410
|
logger.debug(
|
|
3418
|
-
"Roots/sampling/elicitation handlers registered before connect"
|
|
3411
|
+
"Roots/sampling/elicitation/notification handlers registered before connect"
|
|
3419
3412
|
);
|
|
3420
3413
|
try {
|
|
3421
3414
|
let connectTimeout;
|
|
@@ -3432,24 +3425,6 @@ var HttpConnector = class extends BaseConnector {
|
|
|
3432
3425
|
]).finally(() => {
|
|
3433
3426
|
if (connectTimeout !== void 0) clearTimeout(connectTimeout);
|
|
3434
3427
|
});
|
|
3435
|
-
if ((this.client.getProtocolEra?.() ?? "legacy") === "legacy" && streamableTransport.sessionId) {
|
|
3436
|
-
let readinessTimeout;
|
|
3437
|
-
const attached = await Promise.race([
|
|
3438
|
-
pushStreamReady.then(() => true),
|
|
3439
|
-
new Promise(
|
|
3440
|
-
(resolve) => readinessTimeout = setTimeout(
|
|
3441
|
-
() => resolve(false),
|
|
3442
|
-
Math.min(this.timeout, 5e3)
|
|
3443
|
-
)
|
|
3444
|
-
)
|
|
3445
|
-
]);
|
|
3446
|
-
if (readinessTimeout) clearTimeout(readinessTimeout);
|
|
3447
|
-
if (!attached) {
|
|
3448
|
-
logger.warn(
|
|
3449
|
-
"Legacy server push stream did not attach before connect completed"
|
|
3450
|
-
);
|
|
3451
|
-
}
|
|
3452
|
-
}
|
|
3453
3428
|
const sessionId2 = streamableTransport.sessionId;
|
|
3454
3429
|
if (sessionId2) {
|
|
3455
3430
|
logger.debug(`Session ID obtained: ${sessionId2}`);
|
|
@@ -3483,7 +3458,6 @@ var HttpConnector = class extends BaseConnector {
|
|
|
3483
3458
|
};
|
|
3484
3459
|
this.connected = true;
|
|
3485
3460
|
this.transportType = "streamable-http";
|
|
3486
|
-
this.setupNotificationHandler();
|
|
3487
3461
|
logger.debug(
|
|
3488
3462
|
`Successfully connected to MCP implementation via streamable HTTP: ${baseUrl}`
|
|
3489
3463
|
);
|