mcp-use 1.5.0-canary.0 → 1.5.0-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/index.js CHANGED
@@ -24,14 +24,17 @@ import {
24
24
  PROMPTS
25
25
  } from "./chunk-WERYJ6PF.js";
26
26
  import {
27
- WidgetDebugger,
28
- WidgetFullscreenWrapper,
27
+ ErrorBoundary,
28
+ Image,
29
+ McpUseProvider,
30
+ ThemeProvider,
31
+ WidgetControls,
29
32
  useMcp,
30
33
  useWidget,
31
34
  useWidgetProps,
32
35
  useWidgetState,
33
36
  useWidgetTheme
34
- } from "./chunk-RE7EYFDV.js";
37
+ } from "./chunk-5XVM4A23.js";
35
38
  import {
36
39
  BaseMCPClient,
37
40
  BrowserOAuthClientProvider,
@@ -1440,7 +1443,9 @@ export {
1440
1443
  BrowserOAuthClientProvider,
1441
1444
  ConnectMCPServerTool,
1442
1445
  E2BCodeExecutor,
1446
+ ErrorBoundary,
1443
1447
  HttpConnector,
1448
+ Image,
1444
1449
  LINEAR_OAUTH_CONFIG,
1445
1450
  LangChainAdapter,
1446
1451
  ListMCPServersTool,
@@ -1448,6 +1453,7 @@ export {
1448
1453
  MCPAgent,
1449
1454
  MCPClient,
1450
1455
  MCPSession,
1456
+ McpUseProvider,
1451
1457
  OAuthHelper,
1452
1458
  ObservabilityManager,
1453
1459
  PROMPTS,
@@ -1456,10 +1462,10 @@ export {
1456
1462
  ServerManager,
1457
1463
  StdioConnector,
1458
1464
  Telemetry,
1465
+ ThemeProvider,
1459
1466
  VMCodeExecutor,
1460
1467
  WebSocketConnector,
1461
- WidgetDebugger,
1462
- WidgetFullscreenWrapper,
1468
+ WidgetControls,
1463
1469
  createOAuthMCPConfig,
1464
1470
  createReadableStreamFromGenerator,
1465
1471
  isVMAvailable,
@@ -0,0 +1,24 @@
1
+ import React from "react";
2
+ /**
3
+ * ErrorBoundary that catches React errors and displays a friendly error message
4
+ *
5
+ * This component catches JavaScript errors anywhere in the child component tree,
6
+ * logs those errors, and displays a fallback UI instead of crashing the entire app.
7
+ */
8
+ export declare class ErrorBoundary extends React.Component<{
9
+ children: React.ReactNode;
10
+ }, {
11
+ hasError: boolean;
12
+ error: Error | null;
13
+ }> {
14
+ constructor(props: {
15
+ children: React.ReactNode;
16
+ });
17
+ static getDerivedStateFromError(error: Error): {
18
+ hasError: boolean;
19
+ error: Error;
20
+ };
21
+ componentDidCatch(error: Error, errorInfo: React.ErrorInfo): void;
22
+ render(): string | number | bigint | boolean | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> | React.JSX.Element | null | undefined;
23
+ }
24
+ //# sourceMappingURL=ErrorBoundary.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ErrorBoundary.d.ts","sourceRoot":"","sources":["../../../src/react/ErrorBoundary.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B;;;;;GAKG;AACH,qBAAa,aAAc,SAAQ,KAAK,CAAC,SAAS,CAChD;IAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,EAC7B;IAAE,QAAQ,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,KAAK,GAAG,IAAI,CAAA;CAAE,CAC3C;gBACa,KAAK,EAAE;QAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;KAAE;IAKhD,MAAM,CAAC,wBAAwB,CAAC,KAAK,EAAE,KAAK;;;;IAI5C,iBAAiB,CAAC,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,CAAC,SAAS;IAI1D,MAAM;CAcP"}
@@ -0,0 +1,11 @@
1
+ import React from "react";
2
+ /**
3
+ * Image component that automatically handles absolute paths using the MCP public URL.
4
+ *
5
+ * If the src starts with /, it will be prefixed with the MCP public URL (e.g. http://localhost:3000/mcp-use/public).
6
+ * If the src is already absolute (starts with http or data:), it will be used as is.
7
+ *
8
+ * @param props Standard img props
9
+ */
10
+ export declare const Image: React.FC<React.ImgHTMLAttributes<globalThis.HTMLImageElement>>;
11
+ //# sourceMappingURL=Image.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Image.d.ts","sourceRoot":"","sources":["../../../src/react/Image.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B;;;;;;;GAOG;AACH,eAAO,MAAM,KAAK,EAAE,KAAK,CAAC,EAAE,CAC1B,KAAK,CAAC,iBAAiB,CAAC,UAAU,CAAC,gBAAgB,CAAC,CAqCrD,CAAC"}
@@ -0,0 +1,46 @@
1
+ import React from "react";
2
+ interface McpUseProviderProps {
3
+ children: React.ReactNode;
4
+ /**
5
+ * Enable debug button in WidgetControls component
6
+ * @default false
7
+ */
8
+ debugger?: boolean;
9
+ /**
10
+ * Enable view controls (fullscreen/pip) in WidgetControls component
11
+ * - `true` = show both pip and fullscreen buttons
12
+ * - `"pip"` = show only pip button
13
+ * - `"fullscreen"` = show only fullscreen button
14
+ * @default false
15
+ */
16
+ viewControls?: boolean | "pip" | "fullscreen";
17
+ /**
18
+ * Automatically notify OpenAI about container height changes for auto-sizing
19
+ * Uses ResizeObserver to monitor the children container and calls window.openai.notifyIntrinsicHeight()
20
+ * @default false
21
+ */
22
+ autoSize?: boolean;
23
+ }
24
+ /**
25
+ * Unified provider component that combines all common React setup for mcp-use widgets.
26
+ *
27
+ * Includes:
28
+ * - StrictMode (always)
29
+ * - ThemeProvider (always)
30
+ * - BrowserRouter with automatic basename calculation (always)
31
+ * - WidgetControls (if debugger={true} or viewControls is set)
32
+ * - ErrorBoundary (always)
33
+ * - Auto-sizing (if autoSize={true})
34
+ *
35
+ * @example
36
+ * ```tsx
37
+ * <McpUseProvider debugger viewControls autoSize>
38
+ * <AppsSDKUIProvider linkComponent={Link}>
39
+ * <div>My widget content</div>
40
+ * </AppsSDKUIProvider>
41
+ * </McpUseProvider>
42
+ * ```
43
+ */
44
+ export declare function McpUseProvider({ children, debugger: enableDebugger, viewControls, autoSize, }: McpUseProviderProps): React.JSX.Element;
45
+ export {};
46
+ //# sourceMappingURL=McpUseProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"McpUseProvider.d.ts","sourceRoot":"","sources":["../../../src/react/McpUseProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqD,MAAM,OAAO,CAAC;AAwB1E,UAAU,mBAAmB;IAC3B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;;;OAMG;IACH,YAAY,CAAC,EAAE,OAAO,GAAG,KAAK,GAAG,YAAY,CAAC;IAC9C;;;;OAIG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,cAAc,CAAC,EAC7B,QAAQ,EACR,QAAQ,EAAE,cAAsB,EAChC,YAAoB,EACpB,QAAgB,GACjB,EAAE,mBAAmB,qBAkIrB"}
@@ -0,0 +1,14 @@
1
+ import React from "react";
2
+ /**
3
+ * ThemeProvider that manages dark mode class on document root
4
+ *
5
+ * Priority:
6
+ * 1. useWidget theme (from OpenAI Apps SDK)
7
+ * 2. System preference (prefers-color-scheme: dark)
8
+ *
9
+ * Sets the "dark" class on document.documentElement when dark mode is active
10
+ */
11
+ export declare const ThemeProvider: React.FC<{
12
+ children: React.ReactNode;
13
+ }>;
14
+ //# sourceMappingURL=ThemeProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ThemeProvider.d.ts","sourceRoot":"","sources":["../../../src/react/ThemeProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA+C,MAAM,OAAO,CAAC;AAGpE;;;;;;;;GAQG;AACH,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC;IAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,CA4CjE,CAAC"}
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Wrapper component that adds control buttons for widget debugging and view controls.
3
+ * Combines debug button and view controls (fullscreen/pip) with shared hover logic.
4
+ */
5
+ import React from "react";
6
+ type Position = "top-left" | "top-center" | "top-right" | "center-left" | "center-right" | "bottom-left" | "bottom-center" | "bottom-right";
7
+ interface WidgetControlsProps {
8
+ children: React.ReactNode;
9
+ className?: string;
10
+ position?: Position;
11
+ attachTo?: HTMLElement | null;
12
+ showLabels?: boolean;
13
+ /**
14
+ * Enable debug button to display widget debug information
15
+ * @default false
16
+ */
17
+ debugger?: boolean;
18
+ /**
19
+ * Enable fullscreen and pip view controls
20
+ * - `true` = show both pip and fullscreen buttons
21
+ * - `"pip"` = show only pip button
22
+ * - `"fullscreen"` = show only fullscreen button
23
+ * @default false
24
+ */
25
+ viewControls?: boolean | "pip" | "fullscreen";
26
+ }
27
+ /**
28
+ * Wrapper component that adds control buttons for widget debugging and view controls.
29
+ * All buttons share the same hover logic and are rendered together.
30
+ *
31
+ * @example
32
+ * ```tsx
33
+ * const MyWidget: React.FC = () => {
34
+ * return (
35
+ * <WidgetControls debugger viewControls position="top-right">
36
+ * <div>My widget content</div>
37
+ * </WidgetControls>
38
+ * );
39
+ * };
40
+ * ```
41
+ */
42
+ export declare function WidgetControls({ children, className, position, attachTo, showLabels, debugger: enableDebugger, viewControls, }: WidgetControlsProps): React.JSX.Element;
43
+ export {};
44
+ //# sourceMappingURL=WidgetControls.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WidgetControls.d.ts","sourceRoot":"","sources":["../../../src/react/WidgetControls.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAsC,MAAM,OAAO,CAAC;AAG3D,KAAK,QAAQ,GACT,UAAU,GACV,YAAY,GACZ,WAAW,GACX,aAAa,GACb,cAAc,GACd,aAAa,GACb,eAAe,GACf,cAAc,CAAC;AAEnB,UAAU,mBAAmB;IAC3B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,QAAQ,CAAC,EAAE,WAAW,GAAG,IAAI,CAAC;IAC9B,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;;;OAMG;IACH,YAAY,CAAC,EAAE,OAAO,GAAG,KAAK,GAAG,YAAY,CAAC;CAC/C;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,cAAc,CAAC,EAC7B,QAAQ,EACR,SAAc,EACd,QAAsB,EACtB,QAAQ,EACR,UAAiB,EACjB,QAAQ,EAAE,cAAsB,EAChC,YAAoB,GACrB,EAAE,mBAAmB,qBAmrBrB"}