mcp-use 1.7.0-canary.2 → 1.7.0-canary.4
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-VTXOGI7C.js} +43 -20
- package/dist/index.cjs +35 -18
- 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 -18
- 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,19 +1490,13 @@ function WidgetControls({
|
|
|
1490
1490
|
__name(WidgetControls, "WidgetControls");
|
|
1491
1491
|
|
|
1492
1492
|
// src/react/McpUseProvider.tsx
|
|
1493
|
-
import React5, {
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
} catch (error) {
|
|
1501
|
-
routerError = new Error(
|
|
1502
|
-
"\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'."
|
|
1503
|
-
);
|
|
1504
|
-
}
|
|
1505
|
-
})();
|
|
1493
|
+
import React5, {
|
|
1494
|
+
StrictMode,
|
|
1495
|
+
useCallback as useCallback3,
|
|
1496
|
+
useEffect as useEffect5,
|
|
1497
|
+
useRef as useRef3,
|
|
1498
|
+
useState as useState5
|
|
1499
|
+
} from "react";
|
|
1506
1500
|
function getBasename() {
|
|
1507
1501
|
if (typeof window === "undefined") return "/";
|
|
1508
1502
|
const path = window.location.pathname;
|
|
@@ -1526,6 +1520,33 @@ function McpUseProvider({
|
|
|
1526
1520
|
const lastHeightRef = useRef3(0);
|
|
1527
1521
|
const debounceTimeoutRef = useRef3(null);
|
|
1528
1522
|
const notificationInProgressRef = useRef3(false);
|
|
1523
|
+
const [BrowserRouter, setBrowserRouter] = useState5(null);
|
|
1524
|
+
const [routerError, setRouterError] = useState5(null);
|
|
1525
|
+
const [isRouterLoading, setIsRouterLoading] = useState5(true);
|
|
1526
|
+
useEffect5(() => {
|
|
1527
|
+
let mounted = true;
|
|
1528
|
+
(async () => {
|
|
1529
|
+
try {
|
|
1530
|
+
const routerModule = await import("react-router-dom");
|
|
1531
|
+
if (mounted) {
|
|
1532
|
+
setBrowserRouter(() => routerModule.BrowserRouter);
|
|
1533
|
+
setIsRouterLoading(false);
|
|
1534
|
+
}
|
|
1535
|
+
} catch (error) {
|
|
1536
|
+
if (mounted) {
|
|
1537
|
+
setRouterError(
|
|
1538
|
+
new Error(
|
|
1539
|
+
"\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'."
|
|
1540
|
+
)
|
|
1541
|
+
);
|
|
1542
|
+
setIsRouterLoading(false);
|
|
1543
|
+
}
|
|
1544
|
+
}
|
|
1545
|
+
})();
|
|
1546
|
+
return () => {
|
|
1547
|
+
mounted = false;
|
|
1548
|
+
};
|
|
1549
|
+
}, []);
|
|
1529
1550
|
const notifyHeight = useCallback3((height) => {
|
|
1530
1551
|
if (typeof window !== "undefined" && window.openai?.notifyIntrinsicHeight) {
|
|
1531
1552
|
notificationInProgressRef.current = true;
|
|
@@ -1591,18 +1612,20 @@ function McpUseProvider({
|
|
|
1591
1612
|
notificationInProgressRef.current = false;
|
|
1592
1613
|
};
|
|
1593
1614
|
}, [autoSize, debouncedNotifyHeight]);
|
|
1615
|
+
if (isRouterLoading) {
|
|
1616
|
+
return /* @__PURE__ */ React5.createElement(StrictMode, null, /* @__PURE__ */ React5.createElement(ThemeProvider, null, /* @__PURE__ */ React5.createElement("div", { style: { padding: "20px", textAlign: "center" } }, "Loading...")));
|
|
1617
|
+
}
|
|
1618
|
+
if (routerError) {
|
|
1619
|
+
throw routerError;
|
|
1620
|
+
}
|
|
1594
1621
|
let content = children;
|
|
1595
1622
|
content = /* @__PURE__ */ React5.createElement(ErrorBoundary, null, content);
|
|
1596
1623
|
if (enableDebugger || viewControls) {
|
|
1597
1624
|
content = /* @__PURE__ */ React5.createElement(WidgetControls, { debugger: enableDebugger, viewControls }, content);
|
|
1598
1625
|
}
|
|
1599
|
-
if (
|
|
1600
|
-
|
|
1601
|
-
}
|
|
1602
|
-
if (!BrowserRouter) {
|
|
1603
|
-
throw new Error("react-router-dom is still loading, please try again.");
|
|
1626
|
+
if (BrowserRouter) {
|
|
1627
|
+
content = /* @__PURE__ */ React5.createElement(BrowserRouter, { basename }, content);
|
|
1604
1628
|
}
|
|
1605
|
-
content = /* @__PURE__ */ React5.createElement(BrowserRouter, { basename }, content);
|
|
1606
1629
|
content = /* @__PURE__ */ React5.createElement(ThemeProvider, null, content);
|
|
1607
1630
|
if (autoSize) {
|
|
1608
1631
|
const containerStyle = {
|
package/dist/index.cjs
CHANGED
|
@@ -9529,18 +9529,6 @@ __name(WidgetControls, "WidgetControls");
|
|
|
9529
9529
|
|
|
9530
9530
|
// src/react/McpUseProvider.tsx
|
|
9531
9531
|
var import_react7 = __toESM(require("react"), 1);
|
|
9532
|
-
var BrowserRouter = null;
|
|
9533
|
-
var routerError = null;
|
|
9534
|
-
(async () => {
|
|
9535
|
-
try {
|
|
9536
|
-
const routerModule = await import("react-router-dom");
|
|
9537
|
-
BrowserRouter = routerModule.BrowserRouter;
|
|
9538
|
-
} catch (error) {
|
|
9539
|
-
routerError = new Error(
|
|
9540
|
-
"\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'."
|
|
9541
|
-
);
|
|
9542
|
-
}
|
|
9543
|
-
})();
|
|
9544
9532
|
function getBasename() {
|
|
9545
9533
|
if (typeof window === "undefined") return "/";
|
|
9546
9534
|
const path4 = window.location.pathname;
|
|
@@ -9564,6 +9552,33 @@ function McpUseProvider({
|
|
|
9564
9552
|
const lastHeightRef = (0, import_react7.useRef)(0);
|
|
9565
9553
|
const debounceTimeoutRef = (0, import_react7.useRef)(null);
|
|
9566
9554
|
const notificationInProgressRef = (0, import_react7.useRef)(false);
|
|
9555
|
+
const [BrowserRouter, setBrowserRouter] = (0, import_react7.useState)(null);
|
|
9556
|
+
const [routerError, setRouterError] = (0, import_react7.useState)(null);
|
|
9557
|
+
const [isRouterLoading, setIsRouterLoading] = (0, import_react7.useState)(true);
|
|
9558
|
+
(0, import_react7.useEffect)(() => {
|
|
9559
|
+
let mounted = true;
|
|
9560
|
+
(async () => {
|
|
9561
|
+
try {
|
|
9562
|
+
const routerModule = await import("react-router-dom");
|
|
9563
|
+
if (mounted) {
|
|
9564
|
+
setBrowserRouter(() => routerModule.BrowserRouter);
|
|
9565
|
+
setIsRouterLoading(false);
|
|
9566
|
+
}
|
|
9567
|
+
} catch (error) {
|
|
9568
|
+
if (mounted) {
|
|
9569
|
+
setRouterError(
|
|
9570
|
+
new Error(
|
|
9571
|
+
"\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'."
|
|
9572
|
+
)
|
|
9573
|
+
);
|
|
9574
|
+
setIsRouterLoading(false);
|
|
9575
|
+
}
|
|
9576
|
+
}
|
|
9577
|
+
})();
|
|
9578
|
+
return () => {
|
|
9579
|
+
mounted = false;
|
|
9580
|
+
};
|
|
9581
|
+
}, []);
|
|
9567
9582
|
const notifyHeight = (0, import_react7.useCallback)((height) => {
|
|
9568
9583
|
if (typeof window !== "undefined" && window.openai?.notifyIntrinsicHeight) {
|
|
9569
9584
|
notificationInProgressRef.current = true;
|
|
@@ -9629,18 +9644,20 @@ function McpUseProvider({
|
|
|
9629
9644
|
notificationInProgressRef.current = false;
|
|
9630
9645
|
};
|
|
9631
9646
|
}, [autoSize, debouncedNotifyHeight]);
|
|
9647
|
+
if (isRouterLoading) {
|
|
9648
|
+
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...")));
|
|
9649
|
+
}
|
|
9650
|
+
if (routerError) {
|
|
9651
|
+
throw routerError;
|
|
9652
|
+
}
|
|
9632
9653
|
let content = children;
|
|
9633
9654
|
content = /* @__PURE__ */ import_react7.default.createElement(ErrorBoundary, null, content);
|
|
9634
9655
|
if (enableDebugger || viewControls) {
|
|
9635
9656
|
content = /* @__PURE__ */ import_react7.default.createElement(WidgetControls, { debugger: enableDebugger, viewControls }, content);
|
|
9636
9657
|
}
|
|
9637
|
-
if (
|
|
9638
|
-
|
|
9639
|
-
}
|
|
9640
|
-
if (!BrowserRouter) {
|
|
9641
|
-
throw new Error("react-router-dom is still loading, please try again.");
|
|
9658
|
+
if (BrowserRouter) {
|
|
9659
|
+
content = /* @__PURE__ */ import_react7.default.createElement(BrowserRouter, { basename }, content);
|
|
9642
9660
|
}
|
|
9643
|
-
content = /* @__PURE__ */ import_react7.default.createElement(BrowserRouter, { basename }, content);
|
|
9644
9661
|
content = /* @__PURE__ */ import_react7.default.createElement(ThemeProvider, null, content);
|
|
9645
9662
|
if (autoSize) {
|
|
9646
9663
|
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-VTXOGI7C.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,
|