mcp-use 1.7.0-canary.1 → 1.7.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/dist/.tsbuildinfo +1 -1
- package/dist/{chunk-PE7UMCVO.js → chunk-3R5PDYIN.js} +27 -1
- package/dist/{chunk-XN2PU4PS.js → chunk-BBEY6HHN.js} +59 -7
- package/dist/{chunk-YURRUCIM.js → chunk-CPG2WZUL.js} +9 -11
- package/dist/{chunk-R5DJJ4IV.js → chunk-F4UHAA5L.js} +3 -91
- package/dist/chunk-MTHLLDCX.js +97 -0
- package/dist/{chunk-QSLJXXMG.js → chunk-PSO6HYXH.js} +4 -4
- package/dist/{chunk-GVVPUU5K.js → chunk-S6K5QZBJ.js} +739 -29
- package/dist/{display-YIYC6WJE.js → display-A5IEINAP.js} +79 -17
- package/dist/index.cjs +952 -107
- package/dist/index.js +6 -5
- package/dist/{langfuse-C4HKZ3NL.js → langfuse-N5Y5BSXK.js} +1 -1
- package/dist/{oauth-CNGBFOZW.js → oauth-U4NNKN4B.js} +2 -1
- package/dist/src/agents/display.d.ts.map +1 -1
- package/dist/src/agents/index.cjs +854 -78
- package/dist/src/agents/index.js +3 -2
- package/dist/src/auth/index.cjs +30 -5
- package/dist/src/auth/index.js +1 -1
- package/dist/src/browser.cjs +888 -90
- package/dist/src/browser.js +5 -4
- package/dist/src/connectors/base.d.ts +53 -391
- package/dist/src/connectors/base.d.ts.map +1 -1
- package/dist/src/managers/server_manager.d.ts.map +1 -1
- package/dist/src/managers/tools/acquire_active_mcp_server.d.ts +2 -2
- package/dist/src/managers/tools/acquire_active_mcp_server.d.ts.map +1 -1
- package/dist/src/managers/tools/add_server_from_config.d.ts +1 -7
- package/dist/src/managers/tools/add_server_from_config.d.ts.map +1 -1
- package/dist/src/managers/tools/connect_mcp_server.d.ts +2 -10
- package/dist/src/managers/tools/connect_mcp_server.d.ts.map +1 -1
- package/dist/src/managers/tools/list_mcp_servers.d.ts +2 -2
- package/dist/src/managers/tools/list_mcp_servers.d.ts.map +1 -1
- package/dist/src/managers/tools/release_mcp_server_connection.d.ts +2 -2
- package/dist/src/managers/tools/release_mcp_server_connection.d.ts.map +1 -1
- package/dist/src/observability/langfuse.d.ts +4 -0
- package/dist/src/observability/langfuse.d.ts.map +1 -1
- package/dist/src/react/McpUseProvider.d.ts.map +1 -1
- package/dist/src/react/index.cjs +86 -12
- package/dist/src/react/index.js +4 -3
- package/dist/src/server/connect-adapter.d.ts.map +1 -1
- package/dist/src/server/index.cjs +28 -17
- package/dist/src/server/index.js +38 -25
- package/dist/src/server/mcp-server.d.ts.map +1 -1
- package/dist/src/utils/json-schema-to-zod/JSONSchemaToZod.d.ts +270 -0
- package/dist/src/utils/json-schema-to-zod/JSONSchemaToZod.d.ts.map +1 -0
- package/dist/src/utils/json-schema-to-zod/Type.d.ts +24 -0
- package/dist/src/utils/json-schema-to-zod/Type.d.ts.map +1 -0
- package/dist/src/utils/json-schema-to-zod/index.d.ts +3 -0
- package/dist/src/utils/json-schema-to-zod/index.d.ts.map +1 -0
- package/dist/src/utils/url-sanitize.d.ts +17 -0
- package/dist/src/utils/url-sanitize.d.ts.map +1 -0
- package/dist/tsup.config.d.ts.map +1 -1
- package/package.json +20 -37
package/dist/src/agents/index.js
CHANGED
|
@@ -4,12 +4,13 @@ import {
|
|
|
4
4
|
import {
|
|
5
5
|
MCPAgent,
|
|
6
6
|
RemoteAgent
|
|
7
|
-
} from "../../chunk-
|
|
7
|
+
} from "../../chunk-S6K5QZBJ.js";
|
|
8
8
|
import {
|
|
9
9
|
PROMPTS
|
|
10
10
|
} from "../../chunk-2AOGMX4T.js";
|
|
11
11
|
import "../../chunk-2JBWOW4S.js";
|
|
12
|
-
import "../../chunk-
|
|
12
|
+
import "../../chunk-MTHLLDCX.js";
|
|
13
|
+
import "../../chunk-CPG2WZUL.js";
|
|
13
14
|
import "../../chunk-34R6SIER.js";
|
|
14
15
|
import "../../chunk-3GQAWCBQ.js";
|
|
15
16
|
export {
|
package/dist/src/auth/index.cjs
CHANGED
|
@@ -26,8 +26,33 @@ __export(auth_exports, {
|
|
|
26
26
|
});
|
|
27
27
|
module.exports = __toCommonJS(auth_exports);
|
|
28
28
|
|
|
29
|
+
// src/utils/url-sanitize.ts
|
|
30
|
+
function sanitizeUrl(raw) {
|
|
31
|
+
const abort = /* @__PURE__ */ __name(() => {
|
|
32
|
+
throw new Error(`Invalid url to pass to open(): ${raw}`);
|
|
33
|
+
}, "abort");
|
|
34
|
+
let url;
|
|
35
|
+
try {
|
|
36
|
+
url = new URL(raw);
|
|
37
|
+
} catch (_) {
|
|
38
|
+
abort();
|
|
39
|
+
}
|
|
40
|
+
if (url.protocol !== "https:" && url.protocol !== "http:") abort();
|
|
41
|
+
if (url.hostname !== encodeURIComponent(url.hostname)) abort();
|
|
42
|
+
if (url.username) url.username = encodeURIComponent(url.username);
|
|
43
|
+
if (url.password) url.password = encodeURIComponent(url.password);
|
|
44
|
+
url.pathname = url.pathname.slice(0, 1) + encodeURIComponent(url.pathname.slice(1)).replace(/%2f/gi, "/");
|
|
45
|
+
url.search = url.search.slice(0, 1) + Array.from(url.searchParams.entries()).map(sanitizeParam).join("&");
|
|
46
|
+
url.hash = url.hash.slice(0, 1) + encodeURIComponent(url.hash.slice(1));
|
|
47
|
+
return url.href;
|
|
48
|
+
}
|
|
49
|
+
__name(sanitizeUrl, "sanitizeUrl");
|
|
50
|
+
function sanitizeParam([k, v]) {
|
|
51
|
+
return `${encodeURIComponent(k)}${v.length > 0 ? `=${encodeURIComponent(v)}` : ""}`;
|
|
52
|
+
}
|
|
53
|
+
__name(sanitizeParam, "sanitizeParam");
|
|
54
|
+
|
|
29
55
|
// src/auth/browser-provider.ts
|
|
30
|
-
var import_strict_url_sanitise = require("strict-url-sanitise");
|
|
31
56
|
var BrowserOAuthClientProvider = class {
|
|
32
57
|
static {
|
|
33
58
|
__name(this, "BrowserOAuthClientProvider");
|
|
@@ -47,7 +72,7 @@ var BrowserOAuthClientProvider = class {
|
|
|
47
72
|
this.serverUrlHash = this.hashString(serverUrl);
|
|
48
73
|
this.clientName = options.clientName || "mcp-use";
|
|
49
74
|
this.clientUri = options.clientUri || (typeof window !== "undefined" ? window.location.origin : "");
|
|
50
|
-
this.callbackUrl =
|
|
75
|
+
this.callbackUrl = sanitizeUrl(
|
|
51
76
|
options.callbackUrl || (typeof window !== "undefined" ? new URL("/oauth/callback", window.location.origin).toString() : "/oauth/callback")
|
|
52
77
|
);
|
|
53
78
|
this.preventAutoAuth = options.preventAutoAuth;
|
|
@@ -56,7 +81,7 @@ var BrowserOAuthClientProvider = class {
|
|
|
56
81
|
}
|
|
57
82
|
// --- SDK Interface Methods ---
|
|
58
83
|
get redirectUrl() {
|
|
59
|
-
return
|
|
84
|
+
return sanitizeUrl(this.callbackUrl);
|
|
60
85
|
}
|
|
61
86
|
get clientMetadata() {
|
|
62
87
|
return {
|
|
@@ -152,7 +177,7 @@ var BrowserOAuthClientProvider = class {
|
|
|
152
177
|
localStorage.setItem(stateKey, JSON.stringify(stateData));
|
|
153
178
|
authorizationUrl.searchParams.set("state", state);
|
|
154
179
|
const authUrlString = authorizationUrl.toString();
|
|
155
|
-
const sanitizedAuthUrl =
|
|
180
|
+
const sanitizedAuthUrl = sanitizeUrl(authUrlString);
|
|
156
181
|
localStorage.setItem(this.getKey("last_auth_url"), sanitizedAuthUrl);
|
|
157
182
|
return sanitizedAuthUrl;
|
|
158
183
|
}
|
|
@@ -209,7 +234,7 @@ var BrowserOAuthClientProvider = class {
|
|
|
209
234
|
*/
|
|
210
235
|
getLastAttemptedAuthUrl() {
|
|
211
236
|
const storedUrl = localStorage.getItem(this.getKey("last_auth_url"));
|
|
212
|
-
return storedUrl ?
|
|
237
|
+
return storedUrl ? sanitizeUrl(storedUrl) : null;
|
|
213
238
|
}
|
|
214
239
|
clearStorage() {
|
|
215
240
|
const prefixPattern = `${this.storageKeyPrefix}_${this.serverUrlHash}_`;
|
package/dist/src/auth/index.js
CHANGED