mcp-use 2.0.0-beta.64 → 2.0.0-beta.66

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.
@@ -459,7 +459,6 @@ var defaultToolSnapshot = {
459
459
  toolOutput: void 0,
460
460
  content: void 0,
461
461
  toolInput: void 0,
462
- isToolInputPartial: false,
463
462
  meta: void 0,
464
463
  error: void 0
465
464
  };
@@ -601,17 +600,11 @@ function createMcpAppRuntime(config, options) {
601
600
  function installRuntimeEventHandlers(app2) {
602
601
  app2.ontoolinput = (params) => {
603
602
  if (disposed || toolSnapshot.status !== "pending") return;
604
- patchTool({
605
- toolInput: params.arguments ?? {},
606
- isToolInputPartial: false
607
- });
603
+ patchTool({ toolInput: params.arguments ?? {} });
608
604
  };
609
605
  app2.ontoolinputpartial = (params) => {
610
606
  if (disposed || toolSnapshot.status !== "pending") return;
611
- patchTool({
612
- toolInput: params.arguments ?? {},
613
- isToolInputPartial: true
614
- });
607
+ patchTool({ toolInput: params.arguments ?? {} });
615
608
  };
616
609
  app2.ontoolresult = (params) => {
617
610
  if (disposed || toolSnapshot.status !== "pending") return;
@@ -627,8 +620,7 @@ function createMcpAppRuntime(config, options) {
627
620
  error: new ToolError(result),
628
621
  toolOutput: void 0,
629
622
  content,
630
- meta,
631
- isToolInputPartial: false
623
+ meta
632
624
  });
633
625
  return;
634
626
  }
@@ -637,8 +629,7 @@ function createMcpAppRuntime(config, options) {
637
629
  error: void 0,
638
630
  toolOutput: params.structuredContent,
639
631
  content,
640
- meta,
641
- isToolInputPartial: false
632
+ meta
642
633
  });
643
634
  };
644
635
  app2.ontoolcancelled = () => {
@@ -947,7 +938,7 @@ async function disposeView() {
947
938
  _registerDisposeViewForTesting(disposeView);
948
939
 
949
940
  // src/react/public-assets.ts
950
- function getPublicBase() {
941
+ function getPublicBaseUrl() {
951
942
  if (typeof globalThis === "undefined") {
952
943
  return "";
953
944
  }
@@ -961,7 +952,7 @@ function publicAsset(path) {
961
952
  return path;
962
953
  }
963
954
  if (path.startsWith("/")) {
964
- const publicBase = getPublicBase();
955
+ const publicBase = getPublicBaseUrl();
965
956
  if (publicBase === "") {
966
957
  return path;
967
958
  }
@@ -1619,174 +1610,16 @@ function useViewTool(definition, handler) {
1619
1610
  }
1620
1611
  }, [enabled]);
1621
1612
  }
1622
-
1623
- // src/react/compat-v1.tsx
1624
- import {
1625
- StrictMode,
1626
- useCallback as useCallback5,
1627
- useEffect as useEffect4,
1628
- useMemo as useMemo2,
1629
- useRef as useRef5,
1630
- useState as useState4
1631
- } from "react";
1632
- import { jsx as jsx8 } from "react/jsx-runtime";
1633
- function McpUseProvider({
1634
- children,
1635
- debugger: enableDebugger = false,
1636
- viewControls = false,
1637
- colorScheme = true
1638
- }) {
1639
- let content = children;
1640
- if (enableDebugger || viewControls) {
1641
- content = /* @__PURE__ */ jsx8(ViewControls, { debugger: enableDebugger, viewControls, children: content });
1642
- }
1643
- return /* @__PURE__ */ jsx8(StrictMode, { children: /* @__PURE__ */ jsx8(ThemeProvider, { colorScheme, children: content }) });
1644
- }
1645
- function useWidget(defaultProps) {
1646
- const runtime = useViewRuntime();
1647
- const tool = useToolContext();
1648
- const host = useHostContext();
1649
- const display = useDisplayMode();
1650
- const [state, setLocalState] = useState4(null);
1651
- const stateRef = useRef5(null);
1652
- const stateUpdateQueue = useRef5(Promise.resolve());
1653
- const structured = tool.status === "ready" && isRecord(tool.toolOutput) ? tool.toolOutput : void 0;
1654
- const input = isRecord(tool.toolInput) ? tool.toolInput : {};
1655
- const props = useMemo2(
1656
- () => ({
1657
- ...isRecord(defaultProps) ? defaultProps : {},
1658
- ...input,
1659
- ...structured ?? {}
1660
- }),
1661
- [defaultProps, input, structured]
1662
- );
1663
- const callTool = useCallback5(
1664
- async (name, args) => {
1665
- const result = await runtime.callServerTool({ name, arguments: args });
1666
- return {
1667
- ...result,
1668
- result: result.content.flatMap(
1669
- (block) => block.type === "text" && "text" in block ? [block.text] : []
1670
- ).join("\n")
1671
- };
1672
- },
1673
- [runtime]
1674
- );
1675
- const setState = useCallback5(
1676
- async (next) => {
1677
- const resolved = typeof next === "function" ? next(stateRef.current) : next;
1678
- stateRef.current = resolved;
1679
- setLocalState(resolved);
1680
- const update = stateUpdateQueue.current.then(async () => {
1681
- const app = await runtime.connect();
1682
- if (app.getHostCapabilities()?.updateModelContext !== void 0) {
1683
- await app.updateModelContext({
1684
- content: [{ type: "text", text: JSON.stringify(resolved) }],
1685
- structuredContent: resolved
1686
- });
1687
- }
1688
- });
1689
- stateUpdateQueue.current = update.catch(() => {
1690
- });
1691
- await update;
1692
- },
1693
- [runtime]
1694
- );
1695
- const sendFollowUpMessage = useCallback5(
1696
- async (content) => {
1697
- await runtime.sendMessage({
1698
- role: "user",
1699
- content: typeof content === "string" ? [{ type: "text", text: content }] : content
1700
- });
1701
- },
1702
- [runtime]
1703
- );
1704
- const openExternal = useCallback5(
1705
- (href) => {
1706
- void runtime.openLink({ url: href });
1707
- },
1708
- [runtime]
1709
- );
1710
- const requestDisplayMode = useCallback5(
1711
- async (mode) => {
1712
- await display.requestDisplayMode({ mode });
1713
- return { mode };
1714
- },
1715
- [display]
1716
- );
1717
- const pendingInput = tool.status === "pending" && runtime.getToolSnapshot().isToolInputPartial && Object.keys(input).length > 0;
1718
- const browserPlatform = host.platform === "mobile" ? "mobile" : "desktop";
1719
- const publicUrl = typeof window === "undefined" ? "" : window.__mcpPublicUrl ?? "";
1720
- return {
1721
- props,
1722
- isPending: tool.status === "pending",
1723
- toolInput: input,
1724
- output: structured ?? null,
1725
- metadata: tool.status === "ready" || tool.status === "error" ? tool.meta ?? null : null,
1726
- state,
1727
- setState,
1728
- theme: host.theme,
1729
- displayMode: host.displayMode,
1730
- safeArea: { insets: host.safeArea },
1731
- maxHeight: host.maxHeight ?? 600,
1732
- ...host.maxWidth !== void 0 && { maxWidth: host.maxWidth },
1733
- userAgent: {
1734
- device: { type: browserPlatform },
1735
- capabilities: {
1736
- hover: typeof window !== "undefined" && window.matchMedia("(hover: hover)").matches,
1737
- touch: typeof navigator !== "undefined" && navigator.maxTouchPoints > 0
1738
- }
1739
- },
1740
- locale: host.locale,
1741
- timeZone: host.timeZone,
1742
- mcp_url: publicUrl,
1743
- callTool,
1744
- sendFollowUpMessage,
1745
- openExternal,
1746
- requestDisplayMode,
1747
- isAvailable: host.isAvailable,
1748
- partialToolInput: pendingInput ? input : null,
1749
- isStreaming: pendingInput,
1750
- ...host.hostInfo !== void 0 && { hostInfo: host.hostInfo },
1751
- ...host.hostCapabilities !== void 0 && {
1752
- hostCapabilities: host.hostCapabilities
1753
- },
1754
- ...host.hostContext !== void 0 && {
1755
- hostContext: host.hostContext
1756
- }
1757
- };
1758
- }
1759
- function useWidgetProps(defaultProps) {
1760
- return useWidget(defaultProps).props;
1761
- }
1762
- function useWidgetTheme() {
1763
- return useViewTheme();
1764
- }
1765
- function useWidgetState(defaultState) {
1766
- const widget = useWidget();
1767
- const { isAvailable, setState, state } = widget;
1768
- useEffect4(() => {
1769
- if (state === null && defaultState !== void 0 && isAvailable) {
1770
- void setState(defaultState);
1771
- }
1772
- }, [defaultState, isAvailable, setState, state]);
1773
- return [state, setState];
1774
- }
1775
- var WidgetControls = ViewControls;
1776
- function isRecord(value) {
1777
- return typeof value === "object" && value !== null && !Array.isArray(value);
1778
- }
1779
1613
  export {
1780
1614
  ErrorBoundary,
1781
1615
  Image,
1782
- McpUseProvider,
1783
1616
  ModelContext,
1784
1617
  ThemeProvider,
1785
1618
  ToolError,
1786
1619
  ViewControls,
1787
- WidgetControls,
1788
1620
  bootstrapView,
1789
1621
  disposeView,
1622
+ getPublicBaseUrl,
1790
1623
  toolResultText,
1791
1624
  useCallTool,
1792
1625
  useDisplayMode,
@@ -1799,9 +1632,5 @@ export {
1799
1632
  useToolContext,
1800
1633
  useViewState,
1801
1634
  useViewTheme,
1802
- useViewTool,
1803
- useWidget,
1804
- useWidgetProps,
1805
- useWidgetState,
1806
- useWidgetTheme
1635
+ useViewTool
1807
1636
  };
@@ -22,14 +22,30 @@ declare global {
22
22
  var __mcpUseViewConfig: McpUseViewConfig | undefined;
23
23
  }
24
24
  /**
25
- * Read the injected public asset base URL, if present.
25
+ * Return the request-resolved base URL for files in the project's `public/`
26
+ * directory.
26
27
  *
27
- * @returns The request-resolved `publicBase`, or an empty string outside a
28
- * synthesized view document.
28
+ * @remarks
29
+ * The returned URL always includes a trailing slash. Append public-folder
30
+ * paths without a leading slash. The URL is resolved for the current request,
31
+ * so it remains correct behind proxies, tunnels, and `MCP_ASSETS_URL`.
29
32
  *
30
- * @internal
33
+ * Outside a synthesized browser view document, the function returns an empty
34
+ * string.
35
+ *
36
+ * @example
37
+ * ```ts
38
+ * import { getPublicBaseUrl } from "mcp-use/react";
39
+ *
40
+ * const publicBaseUrl = getPublicBaseUrl();
41
+ * const stylesheetUrl = `${publicBaseUrl}assets/vendor.css`;
42
+ * const wasmUrl = `${publicBaseUrl}doom/websockets-doom.wasm`;
43
+ * ```
44
+ *
45
+ * @returns The absolute public-folder base URL with a trailing slash, or an
46
+ * empty string when no injected view configuration is available.
31
47
  */
32
- export declare function getPublicBase(): string;
48
+ export declare function getPublicBaseUrl(): string;
33
49
  /**
34
50
  * Resolve a root-relative path from the project's `public/` folder to an
35
51
  * absolute URL for the current view iframe.
@@ -29,8 +29,6 @@ export interface ToolSnapshot {
29
29
  * notifications replace the same snapshot; last write wins.
30
30
  */
31
31
  toolInput: Record<string, unknown> | undefined;
32
- /** Whether the latest pending input notification was progressive/partial. */
33
- isToolInputPartial: boolean;
34
32
  /** View-only result `_meta` channel. */
35
33
  meta: Record<string, unknown> | undefined;
36
34
  /**
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mcp-use",
3
3
  "type": "module",
4
- "version": "2.0.0-beta.64",
4
+ "version": "2.0.0-beta.66",
5
5
  "description": "MCP framework and CLI built on the official v2 SDK",
6
6
  "author": "mcp-use, Inc.",
7
7
  "license": "MIT",
@@ -36,10 +36,6 @@
36
36
  "node": "./dist/index-node.js",
37
37
  "import": "./dist/index.js"
38
38
  },
39
- "./server": {
40
- "types": "./dist/compat-v1.d.ts",
41
- "import": "./dist/compat-v1.js"
42
- },
43
39
  "./react": {
44
40
  "types": "./dist/react/index.d.ts",
45
41
  "import": "./dist/react/index.js"
@@ -108,7 +104,7 @@
108
104
  "hono": "^4.12.27",
109
105
  "jose": "^6.1.3",
110
106
  "@mcp-use/cli": "4.0.0-beta.15",
111
- "@mcp-use/inspector": "20.0.0-beta.56"
107
+ "@mcp-use/inspector": "20.0.0-beta.58"
112
108
  },
113
109
  "peerDependencies": {
114
110
  "@mcp-use/client": "^2.0.0-alpha.0",
@@ -142,8 +138,8 @@
142
138
  "vite": "^8.0.16",
143
139
  "vitest": "^4.1.9",
144
140
  "zod": "^4.4.3",
145
- "@mcp-use/client": "2.0.0-beta.17",
146
- "mcp-use": "2.0.0-beta.64"
141
+ "mcp-use": "2.0.0-beta.66",
142
+ "@mcp-use/client": "2.0.0-beta.17"
147
143
  },
148
144
  "publishConfig": {
149
145
  "access": "public"
@@ -1 +0,0 @@
1
- function d(e){return e.replace(/\/+$/,"")}function o(e){if(typeof process>"u")return;let n=process.env[e];return n!==void 0&&n!==""?n:void 0}function c(e){for(let n of e.split(",")){let t=new Map;for(let i of n.split(";")){let[u,...f]=i.trim().split("=");u===void 0||f.length===0||t.set(u.toLowerCase(),f.join("=").replace(/^"|"$/g,""))}let s=t.get("proto"),r=t.get("host");if(s!==void 0&&r!==void 0)return`${s}://${r}`}}function a(e){let n=e.headers.get("forwarded");if(n!==null){let r=c(n);if(r!==void 0)return r}let t=e.headers.get("x-forwarded-proto"),s=e.headers.get("x-forwarded-host");if(t!==null&&s!==null){let r=s.split(",")[0]?.trim(),i=t.split(",")[0]?.trim();if(r!==void 0&&i!==void 0&&r!=="")return`${i}://${r}`}return new URL(e.url).origin}function l(e){let n=o("MCP_URL");if(n!==void 0)try{return new URL(n).origin}catch{}return a(e)}function p(e){try{return new URL(e).origin}catch{return e}}function g(e){return d(e)}function h(e){let n=o("MCP_ASSETS_URL");if(n!==void 0)try{return g(new URL(n).href.replace(/\/$/,""))}catch{}return l(e)}function R(){let e=o("MCP_ASSETS_URL");if(e===void 0)return!1;try{return new URL(e),!0}catch{return!1}}export{l as a,p as b,h as c,R as d};
@@ -1 +0,0 @@
1
- var c={".css":"text/css",".gif":"image/gif",".html":"text/html",".ico":"image/x-icon",".jpeg":"image/jpeg",".jpg":"image/jpeg",".js":"application/javascript",".json":"application/json",".map":"application/json",".png":"image/png",".svg":"image/svg+xml",".txt":"text/plain",".webp":"image/webp",".woff":"font/woff",".woff2":"font/woff2"};async function p(i,t){let{stat:r}=await import("fs/promises"),{resolve:o,sep:a}=await import("path");if(t===""||t.includes("\\")||t.split("/").some(l=>l===".."))return null;let e=t.replace(/^\/+/,"");if(e===""||e.endsWith("/"))return null;let n=o(i),s=o(n,e);if(s!==n&&!s.startsWith(n+a))return null;try{if(!(await r(s)).isFile())return null}catch{return null}return s}async function g(i,t={}){let{readFile:r}=await import("fs/promises"),{extname:o}=await import("path"),a=o(i).toLowerCase(),e=c[a]??"application/octet-stream",n=t.head===!0?null:new Uint8Array(await r(i));return new Response(n,{status:200,headers:{"Content-Type":e,"Cache-Control":"public, max-age=0, must-revalidate",...t.deferCors!==!0&&{"Access-Control-Allow-Origin":"*"}}})}export{p as a,g as b};
@@ -1,37 +0,0 @@
1
- /**
2
- * v1 OAuth provider factories with legacy env fallbacks.
3
- *
4
- * @deprecated Import from `mcp-use/oauth/*`. Removed in mcp-use v3.
5
- */
6
- import { type Auth0OAuthProviderOptions } from "../oauth/auth0.js";
7
- import { type BetterAuthOAuthProviderOptions } from "../oauth/better-auth.js";
8
- import { type ClerkOAuthProviderOptions } from "../oauth/clerk.js";
9
- import { type KeycloakOAuthProviderOptions } from "../oauth/keycloak.js";
10
- import type { OAuthProvider } from "../oauth/provider.js";
11
- import { type SupabaseOAuthProviderOptions } from "../oauth/supabase.js";
12
- import { type WorkOSOAuthProviderOptions } from "../oauth/workos.js";
13
- /** @deprecated Removed in mcp-use v3. */
14
- export declare function oauthSupabaseProvider(options?: Partial<SupabaseOAuthProviderOptions>): OAuthProvider<unknown>;
15
- /** @deprecated Removed in mcp-use v3. */
16
- export declare function oauthAuth0Provider(options?: Partial<Auth0OAuthProviderOptions> & {
17
- audience?: string;
18
- verifyJwt?: boolean;
19
- }): OAuthProvider<unknown>;
20
- /** @deprecated Removed in mcp-use v3. */
21
- export declare function oauthKeycloakProvider(options?: Partial<KeycloakOAuthProviderOptions> & {
22
- audience?: string;
23
- verifyJwt?: boolean;
24
- }): OAuthProvider<unknown>;
25
- /** @deprecated Removed in mcp-use v3. */
26
- export declare function oauthWorkOSProvider(options?: Partial<WorkOSOAuthProviderOptions> & {
27
- verifyJwt?: boolean;
28
- }): OAuthProvider<unknown>;
29
- /** @deprecated Removed in mcp-use v3. */
30
- export declare function oauthClerkProvider(options?: Partial<ClerkOAuthProviderOptions> & {
31
- audience?: string;
32
- verifyJwt?: boolean;
33
- }): OAuthProvider<unknown>;
34
- /** @deprecated Removed in mcp-use v3. */
35
- export declare function oauthBetterAuthProvider(options?: Partial<BetterAuthOAuthProviderOptions> & {
36
- verifyJwt?: boolean;
37
- }): OAuthProvider<unknown>;