mcp-use 1.7.0-canary.2 → 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-BG2APH43.js → chunk-BBEY6HHN.js} +43 -8
- package/dist/index.cjs +35 -6
- package/dist/index.js +7 -7
- package/dist/src/agents/index.js +1 -1
- package/dist/src/browser.js +2 -2
- package/dist/src/connectors/base.d.ts +63 -332
- package/dist/src/connectors/base.d.ts.map +1 -1
- package/dist/src/react/McpUseProvider.d.ts.map +1 -1
- package/dist/src/react/index.cjs +35 -6
- package/dist/src/react/index.js +3 -3
- package/dist/src/server/connect-adapter.d.ts.map +1 -1
- package/dist/src/server/index.cjs +23 -8
- package/dist/src/server/index.js +23 -8
- package/dist/src/server/mcp-server.d.ts.map +1 -1
- package/package.json +4 -4
- package/dist/{chunk-AGKMD2ZM.js → chunk-PSO6HYXH.js} +3 -3
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
BrowserMCPClient
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-PSO6HYXH.js";
|
|
4
4
|
import {
|
|
5
5
|
BrowserOAuthClientProvider,
|
|
6
6
|
sanitizeUrl
|
|
@@ -1490,7 +1490,13 @@ function WidgetControls({
|
|
|
1490
1490
|
__name(WidgetControls, "WidgetControls");
|
|
1491
1491
|
|
|
1492
1492
|
// src/react/McpUseProvider.tsx
|
|
1493
|
-
import React5, {
|
|
1493
|
+
import React5, {
|
|
1494
|
+
StrictMode,
|
|
1495
|
+
useCallback as useCallback3,
|
|
1496
|
+
useEffect as useEffect5,
|
|
1497
|
+
useRef as useRef3,
|
|
1498
|
+
useState as useState5
|
|
1499
|
+
} from "react";
|
|
1494
1500
|
var BrowserRouter = null;
|
|
1495
1501
|
var routerError = null;
|
|
1496
1502
|
(async () => {
|
|
@@ -1526,6 +1532,33 @@ function McpUseProvider({
|
|
|
1526
1532
|
const lastHeightRef = useRef3(0);
|
|
1527
1533
|
const debounceTimeoutRef = useRef3(null);
|
|
1528
1534
|
const notificationInProgressRef = useRef3(false);
|
|
1535
|
+
const [BrowserRouter2, setBrowserRouter] = useState5(null);
|
|
1536
|
+
const [routerError2, setRouterError] = useState5(null);
|
|
1537
|
+
const [isRouterLoading, setIsRouterLoading] = useState5(true);
|
|
1538
|
+
useEffect5(() => {
|
|
1539
|
+
let mounted = true;
|
|
1540
|
+
(async () => {
|
|
1541
|
+
try {
|
|
1542
|
+
const routerModule = await import("react-router-dom");
|
|
1543
|
+
if (mounted) {
|
|
1544
|
+
setBrowserRouter(() => routerModule.BrowserRouter);
|
|
1545
|
+
setIsRouterLoading(false);
|
|
1546
|
+
}
|
|
1547
|
+
} catch (error) {
|
|
1548
|
+
if (mounted) {
|
|
1549
|
+
setRouterError(
|
|
1550
|
+
new Error(
|
|
1551
|
+
"\u274C react-router-dom not installed!\n\nTo use MCP widgets with McpUseProvider, you need to install:\n\n npm install react-router-dom\n # or\n pnpm add react-router-dom\n\nThis dependency is automatically included in projects created with 'create-mcp-use-app'."
|
|
1552
|
+
)
|
|
1553
|
+
);
|
|
1554
|
+
setIsRouterLoading(false);
|
|
1555
|
+
}
|
|
1556
|
+
}
|
|
1557
|
+
})();
|
|
1558
|
+
return () => {
|
|
1559
|
+
mounted = false;
|
|
1560
|
+
};
|
|
1561
|
+
}, []);
|
|
1529
1562
|
const notifyHeight = useCallback3((height) => {
|
|
1530
1563
|
if (typeof window !== "undefined" && window.openai?.notifyIntrinsicHeight) {
|
|
1531
1564
|
notificationInProgressRef.current = true;
|
|
@@ -1591,18 +1624,20 @@ function McpUseProvider({
|
|
|
1591
1624
|
notificationInProgressRef.current = false;
|
|
1592
1625
|
};
|
|
1593
1626
|
}, [autoSize, debouncedNotifyHeight]);
|
|
1627
|
+
if (isRouterLoading) {
|
|
1628
|
+
return /* @__PURE__ */ React5.createElement(StrictMode, null, /* @__PURE__ */ React5.createElement(ThemeProvider, null, /* @__PURE__ */ React5.createElement("div", { style: { padding: "20px", textAlign: "center" } }, "Loading...")));
|
|
1629
|
+
}
|
|
1630
|
+
if (routerError2) {
|
|
1631
|
+
throw routerError2;
|
|
1632
|
+
}
|
|
1594
1633
|
let content = children;
|
|
1595
1634
|
content = /* @__PURE__ */ React5.createElement(ErrorBoundary, null, content);
|
|
1596
1635
|
if (enableDebugger || viewControls) {
|
|
1597
1636
|
content = /* @__PURE__ */ React5.createElement(WidgetControls, { debugger: enableDebugger, viewControls }, content);
|
|
1598
1637
|
}
|
|
1599
|
-
if (
|
|
1600
|
-
|
|
1601
|
-
}
|
|
1602
|
-
if (!BrowserRouter) {
|
|
1603
|
-
throw new Error("react-router-dom is still loading, please try again.");
|
|
1638
|
+
if (BrowserRouter2) {
|
|
1639
|
+
content = /* @__PURE__ */ React5.createElement(BrowserRouter2, { basename }, content);
|
|
1604
1640
|
}
|
|
1605
|
-
content = /* @__PURE__ */ React5.createElement(BrowserRouter, { basename }, content);
|
|
1606
1641
|
content = /* @__PURE__ */ React5.createElement(ThemeProvider, null, content);
|
|
1607
1642
|
if (autoSize) {
|
|
1608
1643
|
const containerStyle = {
|
package/dist/index.cjs
CHANGED
|
@@ -9564,6 +9564,33 @@ function McpUseProvider({
|
|
|
9564
9564
|
const lastHeightRef = (0, import_react7.useRef)(0);
|
|
9565
9565
|
const debounceTimeoutRef = (0, import_react7.useRef)(null);
|
|
9566
9566
|
const notificationInProgressRef = (0, import_react7.useRef)(false);
|
|
9567
|
+
const [BrowserRouter2, setBrowserRouter] = (0, import_react7.useState)(null);
|
|
9568
|
+
const [routerError2, setRouterError] = (0, import_react7.useState)(null);
|
|
9569
|
+
const [isRouterLoading, setIsRouterLoading] = (0, import_react7.useState)(true);
|
|
9570
|
+
(0, import_react7.useEffect)(() => {
|
|
9571
|
+
let mounted = true;
|
|
9572
|
+
(async () => {
|
|
9573
|
+
try {
|
|
9574
|
+
const routerModule = await import("react-router-dom");
|
|
9575
|
+
if (mounted) {
|
|
9576
|
+
setBrowserRouter(() => routerModule.BrowserRouter);
|
|
9577
|
+
setIsRouterLoading(false);
|
|
9578
|
+
}
|
|
9579
|
+
} catch (error) {
|
|
9580
|
+
if (mounted) {
|
|
9581
|
+
setRouterError(
|
|
9582
|
+
new Error(
|
|
9583
|
+
"\u274C react-router-dom not installed!\n\nTo use MCP widgets with McpUseProvider, you need to install:\n\n npm install react-router-dom\n # or\n pnpm add react-router-dom\n\nThis dependency is automatically included in projects created with 'create-mcp-use-app'."
|
|
9584
|
+
)
|
|
9585
|
+
);
|
|
9586
|
+
setIsRouterLoading(false);
|
|
9587
|
+
}
|
|
9588
|
+
}
|
|
9589
|
+
})();
|
|
9590
|
+
return () => {
|
|
9591
|
+
mounted = false;
|
|
9592
|
+
};
|
|
9593
|
+
}, []);
|
|
9567
9594
|
const notifyHeight = (0, import_react7.useCallback)((height) => {
|
|
9568
9595
|
if (typeof window !== "undefined" && window.openai?.notifyIntrinsicHeight) {
|
|
9569
9596
|
notificationInProgressRef.current = true;
|
|
@@ -9629,18 +9656,20 @@ function McpUseProvider({
|
|
|
9629
9656
|
notificationInProgressRef.current = false;
|
|
9630
9657
|
};
|
|
9631
9658
|
}, [autoSize, debouncedNotifyHeight]);
|
|
9659
|
+
if (isRouterLoading) {
|
|
9660
|
+
return /* @__PURE__ */ import_react7.default.createElement(import_react7.StrictMode, null, /* @__PURE__ */ import_react7.default.createElement(ThemeProvider, null, /* @__PURE__ */ import_react7.default.createElement("div", { style: { padding: "20px", textAlign: "center" } }, "Loading...")));
|
|
9661
|
+
}
|
|
9662
|
+
if (routerError2) {
|
|
9663
|
+
throw routerError2;
|
|
9664
|
+
}
|
|
9632
9665
|
let content = children;
|
|
9633
9666
|
content = /* @__PURE__ */ import_react7.default.createElement(ErrorBoundary, null, content);
|
|
9634
9667
|
if (enableDebugger || viewControls) {
|
|
9635
9668
|
content = /* @__PURE__ */ import_react7.default.createElement(WidgetControls, { debugger: enableDebugger, viewControls }, content);
|
|
9636
9669
|
}
|
|
9637
|
-
if (
|
|
9638
|
-
|
|
9639
|
-
}
|
|
9640
|
-
if (!BrowserRouter) {
|
|
9641
|
-
throw new Error("react-router-dom is still loading, please try again.");
|
|
9670
|
+
if (BrowserRouter2) {
|
|
9671
|
+
content = /* @__PURE__ */ import_react7.default.createElement(BrowserRouter2, { basename }, content);
|
|
9642
9672
|
}
|
|
9643
|
-
content = /* @__PURE__ */ import_react7.default.createElement(BrowserRouter, { basename }, content);
|
|
9644
9673
|
content = /* @__PURE__ */ import_react7.default.createElement(ThemeProvider, null, content);
|
|
9645
9674
|
if (autoSize) {
|
|
9646
9675
|
const containerStyle = {
|
package/dist/index.js
CHANGED
|
@@ -20,6 +20,10 @@ import {
|
|
|
20
20
|
setTelemetrySource
|
|
21
21
|
} from "./chunk-S6K5QZBJ.js";
|
|
22
22
|
import "./chunk-JQKKMUCT.js";
|
|
23
|
+
import {
|
|
24
|
+
CodeModeConnector,
|
|
25
|
+
PROMPTS
|
|
26
|
+
} from "./chunk-2AOGMX4T.js";
|
|
23
27
|
import {
|
|
24
28
|
ErrorBoundary,
|
|
25
29
|
Image,
|
|
@@ -31,26 +35,22 @@ import {
|
|
|
31
35
|
useWidgetProps,
|
|
32
36
|
useWidgetState,
|
|
33
37
|
useWidgetTheme
|
|
34
|
-
} from "./chunk-
|
|
38
|
+
} from "./chunk-BBEY6HHN.js";
|
|
35
39
|
import {
|
|
36
40
|
BaseMCPClient,
|
|
37
41
|
ConnectionManager,
|
|
38
42
|
HttpConnector,
|
|
39
43
|
MCPSession,
|
|
40
44
|
WebSocketConnector
|
|
41
|
-
} from "./chunk-
|
|
45
|
+
} from "./chunk-PSO6HYXH.js";
|
|
42
46
|
import {
|
|
43
47
|
BrowserOAuthClientProvider,
|
|
44
48
|
onMcpAuthorization
|
|
45
49
|
} from "./chunk-3R5PDYIN.js";
|
|
46
|
-
import "./chunk-MTHLLDCX.js";
|
|
47
|
-
import {
|
|
48
|
-
CodeModeConnector,
|
|
49
|
-
PROMPTS
|
|
50
|
-
} from "./chunk-2AOGMX4T.js";
|
|
51
50
|
import {
|
|
52
51
|
BaseConnector
|
|
53
52
|
} from "./chunk-2JBWOW4S.js";
|
|
53
|
+
import "./chunk-MTHLLDCX.js";
|
|
54
54
|
import "./chunk-CPG2WZUL.js";
|
|
55
55
|
import {
|
|
56
56
|
Logger,
|
package/dist/src/agents/index.js
CHANGED
|
@@ -5,11 +5,11 @@ import {
|
|
|
5
5
|
MCPAgent,
|
|
6
6
|
RemoteAgent
|
|
7
7
|
} from "../../chunk-S6K5QZBJ.js";
|
|
8
|
-
import "../../chunk-MTHLLDCX.js";
|
|
9
8
|
import {
|
|
10
9
|
PROMPTS
|
|
11
10
|
} from "../../chunk-2AOGMX4T.js";
|
|
12
11
|
import "../../chunk-2JBWOW4S.js";
|
|
12
|
+
import "../../chunk-MTHLLDCX.js";
|
|
13
13
|
import "../../chunk-CPG2WZUL.js";
|
|
14
14
|
import "../../chunk-34R6SIER.js";
|
|
15
15
|
import "../../chunk-3GQAWCBQ.js";
|
package/dist/src/browser.js
CHANGED
|
@@ -15,15 +15,15 @@ import {
|
|
|
15
15
|
HttpConnector,
|
|
16
16
|
MCPSession,
|
|
17
17
|
WebSocketConnector
|
|
18
|
-
} from "../chunk-
|
|
18
|
+
} from "../chunk-PSO6HYXH.js";
|
|
19
19
|
import {
|
|
20
20
|
BrowserOAuthClientProvider,
|
|
21
21
|
onMcpAuthorization
|
|
22
22
|
} from "../chunk-3R5PDYIN.js";
|
|
23
|
-
import "../chunk-MTHLLDCX.js";
|
|
24
23
|
import {
|
|
25
24
|
BaseConnector
|
|
26
25
|
} from "../chunk-2JBWOW4S.js";
|
|
26
|
+
import "../chunk-MTHLLDCX.js";
|
|
27
27
|
import "../chunk-CPG2WZUL.js";
|
|
28
28
|
import {
|
|
29
29
|
Logger,
|