@mcp-fe/react-tools 0.1.9 → 0.1.11
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/hooks/useMCPTool.d.ts.map +1 -1
- package/index.js +1 -1
- package/index.mjs +96 -80
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useMCPTool.d.ts","sourceRoot":"","sources":["../../../../libs/react-tools/src/hooks/useMCPTool.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,EAEL,KAAK,WAAW,EAChB,KAAK,IAAI,EACT,KAAK,eAAe,EACpB,KAAK,aAAa,EACnB,MAAM,oBAAoB,CAAC;AAE5B,MAAM,WAAW,iBAAiB;IAChC;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAErC;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAEvC;;OAEG;IACH,OAAO,EAAE,WAAW,CAAC;IAErB;;;;;;;OAOG;IACH,WAAW,CAAC,EAAE,eAAe,CAAC;IAE9B;;;OAGG;IACH,SAAS,CAAC,EAAE,aAAa,CAAC;IAE1B;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAEhC;;OAEG;IACH,KAAK,CAAC,EAAE,IAAI,EAAE,CAAC;IAEf;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IAEvB;;;OAGG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED,MAAM,WAAW,gBAAgB;IAC/B;;OAEG;IACH,YAAY,EAAE,OAAO,CAAC;IAEtB;;OAEG;IACH,QAAQ,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAE9B;;OAEG;IACH,UAAU,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAEhC;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2DG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,iBAAiB,GAAG,gBAAgB,
|
|
1
|
+
{"version":3,"file":"useMCPTool.d.ts","sourceRoot":"","sources":["../../../../libs/react-tools/src/hooks/useMCPTool.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,EAEL,KAAK,WAAW,EAChB,KAAK,IAAI,EACT,KAAK,eAAe,EACpB,KAAK,aAAa,EACnB,MAAM,oBAAoB,CAAC;AAE5B,MAAM,WAAW,iBAAiB;IAChC;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAErC;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAEvC;;OAEG;IACH,OAAO,EAAE,WAAW,CAAC;IAErB;;;;;;;OAOG;IACH,WAAW,CAAC,EAAE,eAAe,CAAC;IAE9B;;;OAGG;IACH,SAAS,CAAC,EAAE,aAAa,CAAC;IAE1B;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAEhC;;OAEG;IACH,KAAK,CAAC,EAAE,IAAI,EAAE,CAAC;IAEf;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IAEvB;;;OAGG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED,MAAM,WAAW,gBAAgB;IAC/B;;OAEG;IACH,YAAY,EAAE,OAAO,CAAC;IAEtB;;OAEG;IACH,QAAQ,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAE9B;;OAEG;IACH,UAAU,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAEhC;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2DG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,iBAAiB,GAAG,gBAAgB,CA8LvE"}
|
package/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react"),c=require("@mcp-fe/mcp-worker"),W=require("react/jsx-runtime");function m(r){const{name:t,description:l,inputSchema:n,outputSchema:s,handler:f,annotations:C,execution:i,_meta:d,icons:P,title:g,autoRegister:p=!0,autoUnregister:T=!0}=r,[w,y]=e.useState(null),a=e.useRef(f),u=e.useRef(t),h=e.useRef(l),S=e.useRef(n),x=e.useRef(s),b=e.useRef(C),I=e.useRef(i),E=e.useRef(d),A=e.useRef(P),z=e.useRef(g),N=e.useRef(!0),k=e.useRef(!1),R=e.useRef(!1);e.useEffect(()=>{a.current=f,u.current=t,h.current=l,S.current=n,x.current=s,b.current=C,I.current=i,E.current=d,A.current=P,z.current=g},[f,t,l,n,s,C,i,d,P,g]);const $=e.useCallback(async o=>a.current(o),[]),q=e.useCallback(async()=>{const o=u.current;if(k.current||R.current){console.log(`[useMCPTool] Skipping registration for '${o}' (already registered or in progress)`);return}k.current=!0;const M=h.current,H=S.current,O=x.current,U=b.current,F=I.current,G=E.current,J=A.current,_=z.current;try{await c.workerClient.registerTool(o,M,H,$,{outputSchema:O,annotations:U,execution:F,_meta:G,icons:J,title:_}),R.current=!0,console.log(`[useMCPTool] Registered tool '${o}'`)}catch(D){throw console.error(`[useMCPTool] Failed to register tool '${o}':`,D),D}finally{k.current=!1}},[$]),j=e.useCallback(async()=>{const o=u.current;if(!R.current){console.log(`[useMCPTool] Skipping unregistration for '${o}' (not registered)`);return}try{await c.workerClient.unregisterTool(o),R.current=!1,console.log(`[useMCPTool] Unregistered tool '${o}'`)}catch(M){console.error(`[useMCPTool] Failed to unregister tool '${o}':`,M)}},[]);return e.useEffect(()=>c.workerClient.onToolChange(t,M=>{y(M)}),[t]),e.useEffect(()=>(p&&q().catch(o=>{console.error(`[useMCPTool] Auto-register failed for '${t}':`,o)}),()=>{N.current=!1,T&&R.current&&j().catch(o=>{console.error(`[useMCPTool] Auto-unregister failed for '${t}':`,o)})}),[t]),{isRegistered:w?.isRegistered??!1,refCount:w?.refCount??0,register:q,unregister:j}}function B(r){return c.workerClient.isToolRegistered(r)}function K(){return c.workerClient.getRegisteredTools()}function L(r){return c.workerClient.getToolInfo(r)}function Q(r){return c.workerClient.getToolDetails(r)}function V(r,t,l,n){const s=e.useCallback(async()=>{const f=await l();return{content:[{type:"text",text:JSON.stringify(f,null,2)}]}},[l]);return m({name:r,description:t,inputSchema:{type:"object",properties:{}},handler:s,...n})}function X(r,t,l,n,s){const f=e.useCallback(async C=>{const i=await n(C);return{content:[{type:"text",text:JSON.stringify(i,null,2)}]}},[n]);return m({name:r,description:t,inputSchema:{type:"object",properties:l,...s?.required&&{required:s.required}},handler:f,autoRegister:s?.autoRegister,autoUnregister:s?.autoUnregister})}const v=e.createContext(null);function Y({children:r,autoInit:t=!0,backendWsUrl:l="ws://localhost:3001",authToken:n,initOptions:s,onInitialized:f,onInitError:C}){const[i,d]=e.useState(!1),[P,g]=e.useState(!1),[p]=e.useState([]),T=e.useCallback(async a=>{if(i){console.log("[MCPToolsProvider] Already initialized");return}try{const u=a||s||{backendWsUrl:l};console.log("[MCPToolsProvider] Initializing worker client...",u),await c.workerClient.init(u),n&&(console.log("[MCPToolsProvider] Setting auth token..."),c.workerClient.setAuthToken(n)),d(!0);const h=await c.workerClient.getConnectionStatus();g(h),c.workerClient.onConnectionStatus(S=>{g(S)}),console.log("[MCPToolsProvider] Worker client initialized"),f?.()}catch(u){throw console.error("[MCPToolsProvider] Initialization failed:",u),C?.(u instanceof Error?u:new Error(String(u))),u}},[i,s,l,n,f,C]),w=e.useCallback(async()=>{const a=await c.workerClient.getConnectionStatus();return g(a),a},[]);e.useEffect(()=>{t&&T().catch(a=>{console.error("[MCPToolsProvider] Auto-init failed:",a)})},[t,T]),e.useEffect(()=>{i&&n&&(console.log("[MCPToolsProvider] Auth token changed, updating..."),c.workerClient.setAuthToken(n))},[n,i]),e.useEffect(()=>{if(!i)return;const a=setInterval(()=>{},5e3);return()=>clearInterval(a)},[i]);const y={isInitialized:i,isConnected:P,registeredTools:p,initialize:T,getConnectionStatus:w};return W.jsx(v.Provider,{value:y,children:r})}function Z(r=!1){const t=e.useContext(v);if(!t&&r)throw new Error("useMCPToolsContext must be used within MCPToolsProvider. Either wrap your component tree with <MCPToolsProvider> or set strict=false.");return t||{isInitialized:!1,isConnected:!1,registeredTools:[],initialize:async()=>{throw new Error("MCPToolsProvider not found")},getConnectionStatus:async()=>!1}}function ee(){return e.useContext(v)!==null}exports.MCPToolsProvider=Y;exports.getRegisteredTools=K;exports.getToolDetails=Q;exports.getToolInfo=L;exports.isToolRegistered=B;exports.useHasMCPProvider=ee;exports.useMCPAction=X;exports.useMCPGetter=V;exports.useMCPTool=m;exports.useMCPToolsContext=Z;
|
package/index.mjs
CHANGED
|
@@ -1,103 +1,119 @@
|
|
|
1
|
-
import { useState as
|
|
2
|
-
import { workerClient as
|
|
3
|
-
import { jsx as
|
|
4
|
-
function
|
|
1
|
+
import { useState as w, useRef as c, useEffect as P, useCallback as C, createContext as V, useContext as F } from "react";
|
|
2
|
+
import { workerClient as i } from "@mcp-fe/mcp-worker";
|
|
3
|
+
import { jsx as W } from "react/jsx-runtime";
|
|
4
|
+
function H(t) {
|
|
5
5
|
const {
|
|
6
6
|
name: e,
|
|
7
7
|
description: l,
|
|
8
8
|
inputSchema: o,
|
|
9
9
|
outputSchema: n,
|
|
10
10
|
handler: f,
|
|
11
|
-
annotations:
|
|
11
|
+
annotations: g,
|
|
12
12
|
execution: s,
|
|
13
13
|
_meta: T,
|
|
14
14
|
icons: h,
|
|
15
|
-
title:
|
|
16
|
-
autoRegister:
|
|
15
|
+
title: d,
|
|
16
|
+
autoRegister: x = !0,
|
|
17
17
|
autoUnregister: M = !0
|
|
18
|
-
} = t, [
|
|
18
|
+
} = t, [m, v] = w(null), a = c(f), u = c(e), y = c(l), S = c(o), b = c(n), z = c(g), $ = c(s), E = c(T), k = c(h), N = c(d), J = c(!0), I = c(!1), p = c(!1);
|
|
19
19
|
P(() => {
|
|
20
|
-
a.current = f,
|
|
20
|
+
a.current = f, u.current = e, y.current = l, S.current = o, b.current = n, z.current = g, $.current = s, E.current = T, k.current = h, N.current = d;
|
|
21
21
|
}, [
|
|
22
22
|
f,
|
|
23
23
|
e,
|
|
24
24
|
l,
|
|
25
25
|
o,
|
|
26
26
|
n,
|
|
27
|
-
|
|
27
|
+
g,
|
|
28
28
|
s,
|
|
29
29
|
T,
|
|
30
30
|
h,
|
|
31
|
-
|
|
31
|
+
d
|
|
32
32
|
]);
|
|
33
33
|
const j = C(async (r) => a.current(r), []), q = C(async () => {
|
|
34
|
-
const r =
|
|
34
|
+
const r = u.current;
|
|
35
|
+
if (I.current || p.current) {
|
|
36
|
+
console.log(
|
|
37
|
+
`[useMCPTool] Skipping registration for '${r}' (already registered or in progress)`
|
|
38
|
+
);
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
I.current = !0;
|
|
42
|
+
const R = y.current, O = S.current, _ = b.current, G = z.current, B = $.current, K = E.current, L = k.current, Q = N.current;
|
|
35
43
|
try {
|
|
36
|
-
await
|
|
44
|
+
await i.registerTool(
|
|
37
45
|
r,
|
|
38
|
-
|
|
39
|
-
|
|
46
|
+
R,
|
|
47
|
+
O,
|
|
40
48
|
j,
|
|
41
49
|
{
|
|
42
|
-
outputSchema:
|
|
43
|
-
annotations:
|
|
44
|
-
execution:
|
|
45
|
-
_meta:
|
|
46
|
-
icons:
|
|
47
|
-
title:
|
|
50
|
+
outputSchema: _,
|
|
51
|
+
annotations: G,
|
|
52
|
+
execution: B,
|
|
53
|
+
_meta: K,
|
|
54
|
+
icons: L,
|
|
55
|
+
title: Q
|
|
48
56
|
}
|
|
49
|
-
),
|
|
57
|
+
), p.current = !0, console.log(`[useMCPTool] Registered tool '${r}'`);
|
|
50
58
|
} catch (U) {
|
|
51
59
|
throw console.error(
|
|
52
60
|
`[useMCPTool] Failed to register tool '${r}':`,
|
|
53
61
|
U
|
|
54
62
|
), U;
|
|
63
|
+
} finally {
|
|
64
|
+
I.current = !1;
|
|
55
65
|
}
|
|
56
66
|
}, [j]), D = C(async () => {
|
|
57
|
-
const r =
|
|
67
|
+
const r = u.current;
|
|
68
|
+
if (!p.current) {
|
|
69
|
+
console.log(
|
|
70
|
+
`[useMCPTool] Skipping unregistration for '${r}' (not registered)`
|
|
71
|
+
);
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
58
74
|
try {
|
|
59
|
-
await
|
|
60
|
-
} catch (
|
|
75
|
+
await i.unregisterTool(r), p.current = !1, console.log(`[useMCPTool] Unregistered tool '${r}'`);
|
|
76
|
+
} catch (R) {
|
|
61
77
|
console.error(
|
|
62
78
|
`[useMCPTool] Failed to unregister tool '${r}':`,
|
|
63
|
-
|
|
79
|
+
R
|
|
64
80
|
);
|
|
65
81
|
}
|
|
66
82
|
}, []);
|
|
67
|
-
return P(() =>
|
|
68
|
-
|
|
69
|
-
}), [e]), P(() => (
|
|
83
|
+
return P(() => i.onToolChange(e, (R) => {
|
|
84
|
+
v(R);
|
|
85
|
+
}), [e]), P(() => (x && q().catch((r) => {
|
|
70
86
|
console.error(
|
|
71
87
|
`[useMCPTool] Auto-register failed for '${e}':`,
|
|
72
88
|
r
|
|
73
89
|
);
|
|
74
90
|
}), () => {
|
|
75
|
-
|
|
91
|
+
J.current = !1, M && p.current && D().catch((r) => {
|
|
76
92
|
console.error(
|
|
77
93
|
`[useMCPTool] Auto-unregister failed for '${e}':`,
|
|
78
94
|
r
|
|
79
95
|
);
|
|
80
96
|
});
|
|
81
97
|
}), [e]), {
|
|
82
|
-
isRegistered:
|
|
83
|
-
refCount:
|
|
98
|
+
isRegistered: m?.isRegistered ?? !1,
|
|
99
|
+
refCount: m?.refCount ?? 0,
|
|
84
100
|
register: q,
|
|
85
101
|
unregister: D
|
|
86
102
|
};
|
|
87
103
|
}
|
|
88
|
-
function
|
|
89
|
-
return
|
|
104
|
+
function ee(t) {
|
|
105
|
+
return i.isToolRegistered(t);
|
|
90
106
|
}
|
|
91
|
-
function
|
|
92
|
-
return
|
|
107
|
+
function te() {
|
|
108
|
+
return i.getRegisteredTools();
|
|
93
109
|
}
|
|
94
|
-
function
|
|
95
|
-
return
|
|
110
|
+
function re(t) {
|
|
111
|
+
return i.getToolInfo(t);
|
|
96
112
|
}
|
|
97
113
|
function oe(t) {
|
|
98
|
-
return
|
|
114
|
+
return i.getToolDetails(t);
|
|
99
115
|
}
|
|
100
|
-
function
|
|
116
|
+
function ne(t, e, l, o) {
|
|
101
117
|
const n = C(async () => {
|
|
102
118
|
const f = await l();
|
|
103
119
|
return {
|
|
@@ -109,7 +125,7 @@ function re(t, e, l, o) {
|
|
|
109
125
|
]
|
|
110
126
|
};
|
|
111
127
|
}, [l]);
|
|
112
|
-
return
|
|
128
|
+
return H({
|
|
113
129
|
name: t,
|
|
114
130
|
description: e,
|
|
115
131
|
inputSchema: {
|
|
@@ -120,10 +136,10 @@ function re(t, e, l, o) {
|
|
|
120
136
|
...o
|
|
121
137
|
});
|
|
122
138
|
}
|
|
123
|
-
function
|
|
139
|
+
function se(t, e, l, o, n) {
|
|
124
140
|
const f = C(
|
|
125
|
-
async (
|
|
126
|
-
const s = await o(
|
|
141
|
+
async (g) => {
|
|
142
|
+
const s = await o(g);
|
|
127
143
|
return {
|
|
128
144
|
content: [
|
|
129
145
|
{
|
|
@@ -135,7 +151,7 @@ function ne(t, e, l, o, n) {
|
|
|
135
151
|
},
|
|
136
152
|
[o]
|
|
137
153
|
);
|
|
138
|
-
return
|
|
154
|
+
return H({
|
|
139
155
|
name: t,
|
|
140
156
|
description: e,
|
|
141
157
|
inputSchema: {
|
|
@@ -148,33 +164,33 @@ function ne(t, e, l, o, n) {
|
|
|
148
164
|
autoUnregister: n?.autoUnregister
|
|
149
165
|
});
|
|
150
166
|
}
|
|
151
|
-
const
|
|
152
|
-
function
|
|
167
|
+
const A = V(null);
|
|
168
|
+
function ce({
|
|
153
169
|
children: t,
|
|
154
170
|
autoInit: e = !0,
|
|
155
171
|
backendWsUrl: l = "ws://localhost:3001",
|
|
156
172
|
authToken: o,
|
|
157
173
|
initOptions: n,
|
|
158
174
|
onInitialized: f,
|
|
159
|
-
onInitError:
|
|
175
|
+
onInitError: g
|
|
160
176
|
}) {
|
|
161
|
-
const [s, T] =
|
|
177
|
+
const [s, T] = w(!1), [h, d] = w(!1), [x] = w([]), M = C(
|
|
162
178
|
async (a) => {
|
|
163
179
|
if (s) {
|
|
164
180
|
console.log("[MCPToolsProvider] Already initialized");
|
|
165
181
|
return;
|
|
166
182
|
}
|
|
167
183
|
try {
|
|
168
|
-
const
|
|
169
|
-
console.log("[MCPToolsProvider] Initializing worker client...",
|
|
170
|
-
const
|
|
171
|
-
|
|
172
|
-
|
|
184
|
+
const u = a || n || { backendWsUrl: l };
|
|
185
|
+
console.log("[MCPToolsProvider] Initializing worker client...", u), await i.init(u), o && (console.log("[MCPToolsProvider] Setting auth token..."), i.setAuthToken(o)), T(!0);
|
|
186
|
+
const y = await i.getConnectionStatus();
|
|
187
|
+
d(y), i.onConnectionStatus((S) => {
|
|
188
|
+
d(S);
|
|
173
189
|
}), console.log("[MCPToolsProvider] Worker client initialized"), f?.();
|
|
174
|
-
} catch (
|
|
175
|
-
throw console.error("[MCPToolsProvider] Initialization failed:",
|
|
176
|
-
|
|
177
|
-
),
|
|
190
|
+
} catch (u) {
|
|
191
|
+
throw console.error("[MCPToolsProvider] Initialization failed:", u), g?.(
|
|
192
|
+
u instanceof Error ? u : new Error(String(u))
|
|
193
|
+
), u;
|
|
178
194
|
}
|
|
179
195
|
},
|
|
180
196
|
[
|
|
@@ -183,35 +199,35 @@ function se({
|
|
|
183
199
|
l,
|
|
184
200
|
o,
|
|
185
201
|
f,
|
|
186
|
-
|
|
202
|
+
g
|
|
187
203
|
]
|
|
188
|
-
),
|
|
189
|
-
const a = await
|
|
190
|
-
return
|
|
204
|
+
), m = C(async () => {
|
|
205
|
+
const a = await i.getConnectionStatus();
|
|
206
|
+
return d(a), a;
|
|
191
207
|
}, []);
|
|
192
208
|
P(() => {
|
|
193
209
|
e && M().catch((a) => {
|
|
194
210
|
console.error("[MCPToolsProvider] Auto-init failed:", a);
|
|
195
211
|
});
|
|
196
212
|
}, [e, M]), P(() => {
|
|
197
|
-
s && o && (console.log("[MCPToolsProvider] Auth token changed, updating..."),
|
|
213
|
+
s && o && (console.log("[MCPToolsProvider] Auth token changed, updating..."), i.setAuthToken(o));
|
|
198
214
|
}, [o, s]), P(() => {
|
|
199
215
|
if (!s) return;
|
|
200
216
|
const a = setInterval(() => {
|
|
201
217
|
}, 5e3);
|
|
202
218
|
return () => clearInterval(a);
|
|
203
219
|
}, [s]);
|
|
204
|
-
const
|
|
220
|
+
const v = {
|
|
205
221
|
isInitialized: s,
|
|
206
222
|
isConnected: h,
|
|
207
|
-
registeredTools:
|
|
223
|
+
registeredTools: x,
|
|
208
224
|
initialize: M,
|
|
209
|
-
getConnectionStatus:
|
|
225
|
+
getConnectionStatus: m
|
|
210
226
|
};
|
|
211
|
-
return /* @__PURE__ */
|
|
227
|
+
return /* @__PURE__ */ W(A.Provider, { value: v, children: t });
|
|
212
228
|
}
|
|
213
|
-
function
|
|
214
|
-
const e =
|
|
229
|
+
function ie(t = !1) {
|
|
230
|
+
const e = F(A);
|
|
215
231
|
if (!e && t)
|
|
216
232
|
throw new Error(
|
|
217
233
|
"useMCPToolsContext must be used within MCPToolsProvider. Either wrap your component tree with <MCPToolsProvider> or set strict=false."
|
|
@@ -226,18 +242,18 @@ function ce(t = !1) {
|
|
|
226
242
|
getConnectionStatus: async () => !1
|
|
227
243
|
};
|
|
228
244
|
}
|
|
229
|
-
function
|
|
230
|
-
return
|
|
245
|
+
function ue() {
|
|
246
|
+
return F(A) !== null;
|
|
231
247
|
}
|
|
232
248
|
export {
|
|
233
|
-
|
|
234
|
-
|
|
249
|
+
ce as MCPToolsProvider,
|
|
250
|
+
te as getRegisteredTools,
|
|
235
251
|
oe as getToolDetails,
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
252
|
+
re as getToolInfo,
|
|
253
|
+
ee as isToolRegistered,
|
|
254
|
+
ue as useHasMCPProvider,
|
|
255
|
+
se as useMCPAction,
|
|
256
|
+
ne as useMCPGetter,
|
|
257
|
+
H as useMCPTool,
|
|
258
|
+
ie as useMCPToolsContext
|
|
243
259
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mcp-fe/react-tools",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.11",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"homepage": "https://mcp-fe.ai",
|
|
6
6
|
"repository": {
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
}
|
|
20
20
|
},
|
|
21
21
|
"peerDependencies": {
|
|
22
|
-
"@mcp-fe/mcp-worker": "^0.1.
|
|
22
|
+
"@mcp-fe/mcp-worker": "^0.1.11",
|
|
23
23
|
"react": "^19.0.0",
|
|
24
24
|
"react-dom": "^19.0.0"
|
|
25
25
|
},
|