@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/react/index.js
CHANGED
|
@@ -1734,23 +1734,15 @@ var HttpConnector = class extends BaseConnector {
|
|
|
1734
1734
|
authProviderUrl: this.opts.authProvider && "serverUrl" in this.opts.authProvider && typeof this.opts.authProvider.serverUrl === "string" ? this.opts.authProvider.serverUrl : "none",
|
|
1735
1735
|
headers: this.headers
|
|
1736
1736
|
});
|
|
1737
|
-
let markPushStreamReady;
|
|
1738
|
-
const pushStreamReady = new Promise((resolve) => {
|
|
1739
|
-
markPushStreamReady = resolve;
|
|
1740
|
-
});
|
|
1741
1737
|
const baseFetch = this.customFetch ?? globalThis.fetch.bind(globalThis);
|
|
1742
1738
|
const observedFetch = async (input, init) => {
|
|
1743
1739
|
const response = await baseFetch(input, init);
|
|
1744
|
-
const method = init?.method ?? (input instanceof Request ? input.method : "GET");
|
|
1745
1740
|
const requestHeaders = new Headers(
|
|
1746
1741
|
input instanceof Request ? input.headers : void 0
|
|
1747
1742
|
);
|
|
1748
1743
|
new Headers(init?.headers).forEach((value, key) => {
|
|
1749
1744
|
requestHeaders.set(key, value);
|
|
1750
1745
|
});
|
|
1751
|
-
if (method.toUpperCase() === "GET" && response.ok && response.headers.get("content-type")?.includes("text/event-stream")) {
|
|
1752
|
-
markPushStreamReady?.();
|
|
1753
|
-
}
|
|
1754
1746
|
return requestHeaders.get("mcp-method") === "subscriptions/listen" ? response : this.observeSseProgress(response);
|
|
1755
1747
|
};
|
|
1756
1748
|
const streamableTransport = new StreamableHTTPClientTransport(
|
|
@@ -1789,8 +1781,9 @@ var HttpConnector = class extends BaseConnector {
|
|
|
1789
1781
|
this.setupRootsHandler();
|
|
1790
1782
|
this.setupSamplingHandler();
|
|
1791
1783
|
this.setupElicitationHandler();
|
|
1784
|
+
this.setupNotificationHandler();
|
|
1792
1785
|
logger.debug(
|
|
1793
|
-
"Roots/sampling/elicitation handlers registered before connect"
|
|
1786
|
+
"Roots/sampling/elicitation/notification handlers registered before connect"
|
|
1794
1787
|
);
|
|
1795
1788
|
try {
|
|
1796
1789
|
let connectTimeout;
|
|
@@ -1807,24 +1800,6 @@ var HttpConnector = class extends BaseConnector {
|
|
|
1807
1800
|
]).finally(() => {
|
|
1808
1801
|
if (connectTimeout !== void 0) clearTimeout(connectTimeout);
|
|
1809
1802
|
});
|
|
1810
|
-
if ((this.client.getProtocolEra?.() ?? "legacy") === "legacy" && streamableTransport.sessionId) {
|
|
1811
|
-
let readinessTimeout;
|
|
1812
|
-
const attached = await Promise.race([
|
|
1813
|
-
pushStreamReady.then(() => true),
|
|
1814
|
-
new Promise(
|
|
1815
|
-
(resolve) => readinessTimeout = setTimeout(
|
|
1816
|
-
() => resolve(false),
|
|
1817
|
-
Math.min(this.timeout, 5e3)
|
|
1818
|
-
)
|
|
1819
|
-
)
|
|
1820
|
-
]);
|
|
1821
|
-
if (readinessTimeout) clearTimeout(readinessTimeout);
|
|
1822
|
-
if (!attached) {
|
|
1823
|
-
logger.warn(
|
|
1824
|
-
"Legacy server push stream did not attach before connect completed"
|
|
1825
|
-
);
|
|
1826
|
-
}
|
|
1827
|
-
}
|
|
1828
1803
|
const sessionId2 = streamableTransport.sessionId;
|
|
1829
1804
|
if (sessionId2) {
|
|
1830
1805
|
logger.debug(`Session ID obtained: ${sessionId2}`);
|
|
@@ -1858,7 +1833,6 @@ var HttpConnector = class extends BaseConnector {
|
|
|
1858
1833
|
};
|
|
1859
1834
|
this.connected = true;
|
|
1860
1835
|
this.transportType = "streamable-http";
|
|
1861
|
-
this.setupNotificationHandler();
|
|
1862
1836
|
logger.debug(
|
|
1863
1837
|
`Successfully connected to MCP implementation via streamable HTTP: ${baseUrl}`
|
|
1864
1838
|
);
|
|
@@ -1926,7 +1900,7 @@ var HttpConnector = class extends BaseConnector {
|
|
|
1926
1900
|
};
|
|
1927
1901
|
|
|
1928
1902
|
// src/utils/version.ts
|
|
1929
|
-
var VERSION = "2.1.3
|
|
1903
|
+
var VERSION = "2.1.3";
|
|
1930
1904
|
function getPackageVersion() {
|
|
1931
1905
|
return VERSION;
|
|
1932
1906
|
}
|