@mcp-use/client 2.3.1-canary.0 → 2.3.1-canary.1
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 +1 -1
- package/dist/index.js +1 -1
- package/dist/react/index.js +52 -5
- package/dist/react/index.js.map +1 -1
- package/dist/react/useMcp-helpers.d.ts +21 -0
- package/dist/react/useMcp-helpers.d.ts.map +1 -1
- package/dist/react/useMcp.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index-browser.js
CHANGED
package/dist/index.js
CHANGED
package/dist/react/index.js
CHANGED
|
@@ -1905,7 +1905,7 @@ var HttpConnector = class extends BaseConnector {
|
|
|
1905
1905
|
};
|
|
1906
1906
|
|
|
1907
1907
|
// src/utils/version.ts
|
|
1908
|
-
var VERSION = "2.3.1-canary.
|
|
1908
|
+
var VERSION = "2.3.1-canary.1";
|
|
1909
1909
|
function getPackageVersion() {
|
|
1910
1910
|
return VERSION;
|
|
1911
1911
|
}
|
|
@@ -4725,6 +4725,26 @@ function assert(condition, message) {
|
|
|
4725
4725
|
throw new Error(message);
|
|
4726
4726
|
}
|
|
4727
4727
|
}
|
|
4728
|
+
function serializeClientIcons(icons) {
|
|
4729
|
+
if (icons === void 0) return "null";
|
|
4730
|
+
if (icons.length === 0) return "[]";
|
|
4731
|
+
return JSON.stringify(
|
|
4732
|
+
icons.map((icon) => [
|
|
4733
|
+
icon.src,
|
|
4734
|
+
icon.mimeType === void 0 ? null : icon.mimeType,
|
|
4735
|
+
icon.sizes === void 0 ? null : [...icon.sizes].sort()
|
|
4736
|
+
])
|
|
4737
|
+
);
|
|
4738
|
+
}
|
|
4739
|
+
function serializeProxyHeaders(headers, customHeaders) {
|
|
4740
|
+
if (headers === void 0 && customHeaders === void 0) return "";
|
|
4741
|
+
const serializeEntries = (record) => {
|
|
4742
|
+
if (record === void 0) return "null";
|
|
4743
|
+
const keys = Object.keys(record).sort();
|
|
4744
|
+
return JSON.stringify(keys.map((k) => [k, record[k]]));
|
|
4745
|
+
};
|
|
4746
|
+
return `${serializeEntries(headers)}|${serializeEntries(customHeaders)}`;
|
|
4747
|
+
}
|
|
4728
4748
|
async function loadServerIcon(params) {
|
|
4729
4749
|
try {
|
|
4730
4750
|
const iconUrl = params.serverInfo.icons?.[0]?.src;
|
|
@@ -5171,7 +5191,7 @@ function useMcp(options) {
|
|
|
5171
5191
|
storageKeyPrefix = "mcp:auth",
|
|
5172
5192
|
authProvider: providedAuthProvider,
|
|
5173
5193
|
headers: headersOption,
|
|
5174
|
-
proxyConfig,
|
|
5194
|
+
proxyConfig: rawProxyConfig,
|
|
5175
5195
|
oauthProxyUrl: oauthProxyUrlOption,
|
|
5176
5196
|
connectionMode,
|
|
5177
5197
|
autoProxyFallback = false,
|
|
@@ -5197,6 +5217,34 @@ function useMcp(options) {
|
|
|
5197
5217
|
onElicitation: onElicitationOption,
|
|
5198
5218
|
oauth: oauthOptions
|
|
5199
5219
|
} = options;
|
|
5220
|
+
const rawClientInfo = options.clientInfo;
|
|
5221
|
+
const clientInfoName = rawClientInfo?.name;
|
|
5222
|
+
const clientInfoTitle = rawClientInfo?.title;
|
|
5223
|
+
const clientInfoVersion = rawClientInfo?.version;
|
|
5224
|
+
const clientInfoDescription = rawClientInfo?.description;
|
|
5225
|
+
const clientInfoWebsiteUrl = rawClientInfo?.websiteUrl;
|
|
5226
|
+
const serializedClientIcons = serializeClientIcons(rawClientInfo?.icons);
|
|
5227
|
+
const clientInfo = useMemo(() => {
|
|
5228
|
+
if (!rawClientInfo) return void 0;
|
|
5229
|
+
return { ...rawClientInfo };
|
|
5230
|
+
}, [
|
|
5231
|
+
clientInfoName,
|
|
5232
|
+
clientInfoTitle,
|
|
5233
|
+
clientInfoVersion,
|
|
5234
|
+
clientInfoDescription,
|
|
5235
|
+
clientInfoWebsiteUrl,
|
|
5236
|
+
serializedClientIcons
|
|
5237
|
+
]);
|
|
5238
|
+
const rawProxyAddress = rawProxyConfig?.proxyAddress;
|
|
5239
|
+
const serializedProxyHeaders = serializeProxyHeaders(
|
|
5240
|
+
rawProxyConfig?.headers,
|
|
5241
|
+
rawProxyConfig?.customHeaders
|
|
5242
|
+
);
|
|
5243
|
+
const proxyConfig = useMemo(() => {
|
|
5244
|
+
if (!rawProxyConfig) return void 0;
|
|
5245
|
+
return { ...rawProxyConfig };
|
|
5246
|
+
}, [rawProxyAddress, serializedProxyHeaders]);
|
|
5247
|
+
const headers = headersOption ?? {};
|
|
5200
5248
|
const transportType = "http";
|
|
5201
5249
|
const requestedProxyAddress = proxyConfig?.proxyAddress;
|
|
5202
5250
|
const oauthClientId = oauthOptions?.clientId?.trim() || void 0;
|
|
@@ -5214,7 +5262,6 @@ function useMcp(options) {
|
|
|
5214
5262
|
}
|
|
5215
5263
|
return inst;
|
|
5216
5264
|
}, [url, logLevelOption]);
|
|
5217
|
-
const headers = headersOption ?? {};
|
|
5218
5265
|
const effectiveClientOptions = useMemo(
|
|
5219
5266
|
() => resolveClientOptions(clientOptions),
|
|
5220
5267
|
[clientOptions]
|
|
@@ -5237,8 +5284,8 @@ function useMcp(options) {
|
|
|
5237
5284
|
[]
|
|
5238
5285
|
);
|
|
5239
5286
|
const mergedClientInfo = useMemo(
|
|
5240
|
-
() =>
|
|
5241
|
-
[
|
|
5287
|
+
() => clientInfo ? { ...defaultClientInfo, ...clientInfo } : defaultClientInfo,
|
|
5288
|
+
[clientInfo, defaultClientInfo]
|
|
5242
5289
|
);
|
|
5243
5290
|
const derivedOAuthClientConfig = useMemo(
|
|
5244
5291
|
() => deriveOAuthClientConfigFromClientInfo(mergedClientInfo),
|