mcp-use 2.0.0-beta.12 → 2.0.0-beta.13
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/branding.d.ts +7 -10
- package/dist/branding.d.ts.map +1 -1
- package/dist/{chunk-GTOOHAI2.js → chunk-JEVBOMCE.js} +4 -3
- package/dist/chunk-JEVBOMCE.js.map +1 -0
- package/dist/{chunk-DQ7LE4ZA.js → chunk-XKJP5S7C.js} +17 -14
- package/dist/chunk-XKJP5S7C.js.map +1 -0
- package/dist/cli/build.d.ts +1 -1
- package/dist/cli/dev.d.ts.map +1 -1
- package/dist/cli/mcp-env-declaration.d.ts +20 -0
- package/dist/cli/mcp-env-declaration.d.ts.map +1 -0
- package/dist/cli/tunnel.d.ts.map +1 -1
- package/dist/cli/views.d.ts +7 -5
- package/dist/cli/views.d.ts.map +1 -1
- package/dist/commands/build.js +4 -4
- package/dist/commands/build.js.map +1 -1
- package/dist/commands/dev.js +79 -12
- package/dist/commands/dev.js.map +1 -1
- package/dist/config.d.ts +8 -8
- package/dist/index.js +32 -51
- package/dist/index.js.map +1 -1
- package/dist/inspector-shell.d.ts +3 -0
- package/dist/inspector-shell.d.ts.map +1 -1
- package/dist/{landing-handler-3VN4BMR2.js → landing-handler-Z7WDR4S2.js} +6 -3
- package/dist/landing-handler-Z7WDR4S2.js.map +1 -0
- package/dist/landing-handler.d.ts +1 -1
- package/dist/landing-handler.d.ts.map +1 -1
- package/dist/landing.d.ts +2 -0
- package/dist/landing.d.ts.map +1 -1
- package/dist/landing.js +1 -1
- package/dist/react/types/register.d.ts +1 -1
- package/dist/react/types/register.d.ts.map +1 -1
- package/dist/server.d.ts +2 -3
- package/dist/server.d.ts.map +1 -1
- package/package.json +3 -3
- package/dist/chunk-DQ7LE4ZA.js.map +0 -1
- package/dist/chunk-GTOOHAI2.js.map +0 -1
- package/dist/cli/tools-declaration.d.ts +0 -22
- package/dist/cli/tools-declaration.d.ts.map +0 -1
- package/dist/landing-handler-3VN4BMR2.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -68,41 +68,8 @@ function publicAssetPath(basePath, source) {
|
|
|
68
68
|
function isLocalPublicSource(source) {
|
|
69
69
|
return protocolOf(source) === void 0;
|
|
70
70
|
}
|
|
71
|
-
function extensionPath(source) {
|
|
72
|
-
const protocol = protocolOf(source);
|
|
73
|
-
if (protocol === "data") {
|
|
74
|
-
return "";
|
|
75
|
-
}
|
|
76
|
-
if (protocol === "http" || protocol === "https") {
|
|
77
|
-
return new URL(source).pathname.toLowerCase();
|
|
78
|
-
}
|
|
79
|
-
return source.toLowerCase();
|
|
80
|
-
}
|
|
81
|
-
function dataUrlMimeType(source) {
|
|
82
|
-
if (protocolOf(source) !== "data") {
|
|
83
|
-
return void 0;
|
|
84
|
-
}
|
|
85
|
-
const comma = source.indexOf(",");
|
|
86
|
-
if (comma < 0) {
|
|
87
|
-
return void 0;
|
|
88
|
-
}
|
|
89
|
-
const mimeType = source.slice(5, comma).split(";", 1)[0]?.toLowerCase();
|
|
90
|
-
return mimeType === "" ? void 0 : mimeType;
|
|
91
|
-
}
|
|
92
|
-
function iconMimeType(icon) {
|
|
93
|
-
return icon.mimeType?.toLowerCase() ?? dataUrlMimeType(icon.src);
|
|
94
|
-
}
|
|
95
|
-
function isIco(icon) {
|
|
96
|
-
const mimeType = iconMimeType(icon);
|
|
97
|
-
return mimeType === "image/x-icon" || mimeType === "image/vnd.microsoft.icon" || extensionPath(icon.src).endsWith(".ico");
|
|
98
|
-
}
|
|
99
|
-
function isPng(icon) {
|
|
100
|
-
return iconMimeType(icon) === "image/png" || extensionPath(icon.src).endsWith(".png");
|
|
101
|
-
}
|
|
102
71
|
function selectFaviconFromIcons(icons) {
|
|
103
|
-
return icons
|
|
104
|
-
(icon) => isPng(icon) && icon.sizes?.some((size) => size === "16x16" || size === "32x32")
|
|
105
|
-
) ?? icons.find(isPng) ?? icons[0];
|
|
72
|
+
return icons[0];
|
|
106
73
|
}
|
|
107
74
|
function assertLocalPublicSource(source, field) {
|
|
108
75
|
if (source.startsWith("/") || source.includes("\\") || source.includes("?") || source.includes("#") || source.split("/").some((segment) => segment === "" || segment === "..")) {
|
|
@@ -703,7 +670,14 @@ function serializeForInlineScript(value) {
|
|
|
703
670
|
return JSON.stringify(value).replaceAll("<", "\\u003c");
|
|
704
671
|
}
|
|
705
672
|
function renderInspectorShell(options) {
|
|
706
|
-
const {
|
|
673
|
+
const {
|
|
674
|
+
serverName,
|
|
675
|
+
basePath,
|
|
676
|
+
faviconHref,
|
|
677
|
+
faviconType,
|
|
678
|
+
assetsUrl,
|
|
679
|
+
manufactChatUrl
|
|
680
|
+
} = options;
|
|
707
681
|
const serializedBasePath = serializeForInlineScript(basePath);
|
|
708
682
|
const serializedManufactChatUrl = manufactChatUrl ? serializeForInlineScript(manufactChatUrl) : null;
|
|
709
683
|
const rawUrl = assetsUrl ?? DEFAULT_INSPECTOR_ASSETS_URL;
|
|
@@ -716,7 +690,7 @@ function renderInspectorShell(options) {
|
|
|
716
690
|
<meta charset="utf-8" />
|
|
717
691
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
718
692
|
<title>${escapeHtml(serverName)} \u2014 MCP Inspector</title>
|
|
719
|
-
${faviconHref !== void 0 ? `<link rel="icon" href="${escapeHtml(faviconHref)}" />` : ""}
|
|
693
|
+
${faviconHref !== void 0 ? `<link rel="icon"${faviconType !== void 0 ? ` type="${escapeHtml(faviconType)}"` : ""} href="${escapeHtml(faviconHref)}" />` : ""}
|
|
720
694
|
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
|
721
695
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
|
722
696
|
<link
|
|
@@ -780,6 +754,9 @@ function createInspectorHandler(inspector, options) {
|
|
|
780
754
|
...options.faviconHref !== void 0 && {
|
|
781
755
|
faviconHref: options.faviconHref
|
|
782
756
|
},
|
|
757
|
+
...options.faviconType !== void 0 && {
|
|
758
|
+
faviconType: options.faviconType
|
|
759
|
+
},
|
|
783
760
|
assetsUrl,
|
|
784
761
|
manufactChatUrl
|
|
785
762
|
};
|
|
@@ -1808,9 +1785,8 @@ var MCPServer = class _MCPServer {
|
|
|
1808
1785
|
* Serve over HTTP on Node. Pass port `0` for an ephemeral port.
|
|
1809
1786
|
*
|
|
1810
1787
|
* Binds `config.host` (default `127.0.0.1`). Localhost-class binds get
|
|
1811
|
-
* DNS-rebinding protection automatically
|
|
1812
|
-
* `
|
|
1813
|
-
* `Origin: null` on asset GETs). To serve publicly set `host: "0.0.0.0"`;
|
|
1788
|
+
* DNS-rebinding Host protection automatically. Origin validation is off
|
|
1789
|
+
* unless `allowedOrigins` is set. To serve publicly set `host: "0.0.0.0"`;
|
|
1814
1790
|
* behind a platform edge that is all that's needed, and `allowedHosts`
|
|
1815
1791
|
* restricts direct exposure (additive — localhost-class values stay allowed).
|
|
1816
1792
|
*
|
|
@@ -2009,17 +1985,17 @@ var MCPServer = class _MCPServer {
|
|
|
2009
1985
|
*
|
|
2010
1986
|
* Configured lists are additive to the localhost-class allowlists, so local
|
|
2011
1987
|
* runs keep working when a deployment hostname is added. With nothing
|
|
2012
|
-
* configured, `listen()` on a localhost-class bind validates against the
|
|
1988
|
+
* configured, `listen()` on a localhost-class bind validates Host against the
|
|
2013
1989
|
* localhost lists (the DNS-rebinding threat model), while `getHandler()` —
|
|
2014
|
-
* which never binds — applies no validation.
|
|
2015
|
-
*
|
|
2016
|
-
* non-GET/HEAD requests.
|
|
1990
|
+
* which never binds — applies no validation. Origin validation is off unless
|
|
1991
|
+
* `allowedOrigins` is set explicitly (SDK-aligned: the handler is open by
|
|
1992
|
+
* default). When enabled, Origin is checked only on non-GET/HEAD requests.
|
|
2017
1993
|
*/
|
|
2018
1994
|
#validationPolicy(mode) {
|
|
2019
1995
|
const { host = "127.0.0.1", allowedHosts, allowedOrigins } = this.#config;
|
|
2020
1996
|
const localhostBind = ["127.0.0.1", "localhost", "::1"].includes(host);
|
|
2021
1997
|
const hosts = allowedHosts !== void 0 ? [.../* @__PURE__ */ new Set([...localhostAllowedHostnames(), ...allowedHosts])] : mode === "listen" && localhostBind ? localhostAllowedHostnames() : void 0;
|
|
2022
|
-
const origins = allowedOrigins !== void 0 ? [.../* @__PURE__ */ new Set([...localhostAllowedOrigins(), ...allowedOrigins])] :
|
|
1998
|
+
const origins = allowedOrigins !== void 0 ? [.../* @__PURE__ */ new Set([...localhostAllowedOrigins(), ...allowedOrigins])] : void 0;
|
|
2023
1999
|
return { hosts, origins };
|
|
2024
2000
|
}
|
|
2025
2001
|
#ensureMounted(mode, listenPort, bus) {
|
|
@@ -2039,11 +2015,11 @@ var MCPServer = class _MCPServer {
|
|
|
2039
2015
|
const deferViewCors = isGlobalCorsEnabled(corsConfig);
|
|
2040
2016
|
if (hosts !== void 0) {
|
|
2041
2017
|
middlewares.unshift(hostValidationMiddleware(hosts));
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2018
|
+
}
|
|
2019
|
+
if (origins !== void 0) {
|
|
2020
|
+
middlewares.push(originValidationMiddleware(origins));
|
|
2021
|
+
}
|
|
2022
|
+
if (hosts === void 0) {
|
|
2047
2023
|
if (mode === "listen") {
|
|
2048
2024
|
console.warn(
|
|
2049
2025
|
`[mcp-use] listen() is serving on ${this.#config.host} without Host validation. Behind a platform edge that only routes your own domains this is expected; if this process is reachable directly, set allowedHosts to restrict it.`
|
|
@@ -2100,7 +2076,7 @@ var MCPServer = class _MCPServer {
|
|
|
2100
2076
|
return mcpRouteHandler(request);
|
|
2101
2077
|
}
|
|
2102
2078
|
const respond = async () => {
|
|
2103
|
-
const { createLandingPageResponse } = await import("./landing-handler-
|
|
2079
|
+
const { createLandingPageResponse } = await import("./landing-handler-Z7WDR4S2.js");
|
|
2104
2080
|
return createLandingPageResponse(
|
|
2105
2081
|
request,
|
|
2106
2082
|
basePath,
|
|
@@ -2161,7 +2137,12 @@ var MCPServer = class _MCPServer {
|
|
|
2161
2137
|
const inspectorHandler = createInspectorHandler(this.#config.inspector, {
|
|
2162
2138
|
serverName: this.#config.name,
|
|
2163
2139
|
basePath,
|
|
2164
|
-
...faviconHandler !== void 0 && {
|
|
2140
|
+
...faviconHandler !== void 0 && {
|
|
2141
|
+
faviconHref: "/favicon.ico",
|
|
2142
|
+
...this.#branding.faviconMimeType !== void 0 && {
|
|
2143
|
+
faviconType: this.#branding.faviconMimeType
|
|
2144
|
+
}
|
|
2145
|
+
}
|
|
2165
2146
|
});
|
|
2166
2147
|
if (inspectorHandler !== void 0) {
|
|
2167
2148
|
routes.push({
|