react-native-mcp-kit 1.0.0

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.
Files changed (271) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +868 -0
  3. package/dist/babel/index.d.ts +3 -0
  4. package/dist/babel/index.d.ts.map +1 -0
  5. package/dist/babel/index.js +11 -0
  6. package/dist/babel/index.js.map +1 -0
  7. package/dist/babel/stripPlugin.d.ts +5 -0
  8. package/dist/babel/stripPlugin.d.ts.map +1 -0
  9. package/dist/babel/stripPlugin.js +100 -0
  10. package/dist/babel/stripPlugin.js.map +1 -0
  11. package/dist/babel/testIdPlugin.d.ts +5 -0
  12. package/dist/babel/testIdPlugin.d.ts.map +1 -0
  13. package/dist/babel/testIdPlugin.js +69 -0
  14. package/dist/babel/testIdPlugin.js.map +1 -0
  15. package/dist/client/contexts/McpContext/McpContext.d.ts +3 -0
  16. package/dist/client/contexts/McpContext/McpContext.d.ts.map +1 -0
  17. package/dist/client/contexts/McpContext/McpContext.js +6 -0
  18. package/dist/client/contexts/McpContext/McpContext.js.map +1 -0
  19. package/dist/client/contexts/McpContext/McpProvider.d.ts +3 -0
  20. package/dist/client/contexts/McpContext/McpProvider.d.ts.map +1 -0
  21. package/dist/client/contexts/McpContext/McpProvider.js +28 -0
  22. package/dist/client/contexts/McpContext/McpProvider.js.map +1 -0
  23. package/dist/client/contexts/McpContext/index.d.ts +4 -0
  24. package/dist/client/contexts/McpContext/index.d.ts.map +1 -0
  25. package/dist/client/contexts/McpContext/index.js +8 -0
  26. package/dist/client/contexts/McpContext/index.js.map +1 -0
  27. package/dist/client/contexts/McpContext/types.d.ts +12 -0
  28. package/dist/client/contexts/McpContext/types.d.ts.map +1 -0
  29. package/dist/client/contexts/McpContext/types.js +3 -0
  30. package/dist/client/contexts/McpContext/types.js.map +1 -0
  31. package/dist/client/contexts/McpTreeContext/McpTracker.d.ts +10 -0
  32. package/dist/client/contexts/McpTreeContext/McpTracker.d.ts.map +1 -0
  33. package/dist/client/contexts/McpTreeContext/McpTracker.js +101 -0
  34. package/dist/client/contexts/McpTreeContext/McpTracker.js.map +1 -0
  35. package/dist/client/contexts/McpTreeContext/McpTreeContext.d.ts +2 -0
  36. package/dist/client/contexts/McpTreeContext/McpTreeContext.d.ts.map +1 -0
  37. package/dist/client/contexts/McpTreeContext/McpTreeContext.js +6 -0
  38. package/dist/client/contexts/McpTreeContext/McpTreeContext.js.map +1 -0
  39. package/dist/client/contexts/McpTreeContext/McpTreeRegistry.d.ts +16 -0
  40. package/dist/client/contexts/McpTreeContext/McpTreeRegistry.d.ts.map +1 -0
  41. package/dist/client/contexts/McpTreeContext/McpTreeRegistry.js +96 -0
  42. package/dist/client/contexts/McpTreeContext/McpTreeRegistry.js.map +1 -0
  43. package/dist/client/contexts/McpTreeContext/index.d.ts +5 -0
  44. package/dist/client/contexts/McpTreeContext/index.d.ts.map +1 -0
  45. package/dist/client/contexts/McpTreeContext/index.js +10 -0
  46. package/dist/client/contexts/McpTreeContext/index.js.map +1 -0
  47. package/dist/client/contexts/McpTreeContext/types.d.ts +14 -0
  48. package/dist/client/contexts/McpTreeContext/types.d.ts.map +1 -0
  49. package/dist/client/contexts/McpTreeContext/types.js +3 -0
  50. package/dist/client/contexts/McpTreeContext/types.js.map +1 -0
  51. package/dist/client/core/McpClient.d.ts +25 -0
  52. package/dist/client/core/McpClient.d.ts.map +1 -0
  53. package/dist/client/core/McpClient.js +183 -0
  54. package/dist/client/core/McpClient.js.map +1 -0
  55. package/dist/client/hooks/useMcpModule.d.ts +4 -0
  56. package/dist/client/hooks/useMcpModule.d.ts.map +1 -0
  57. package/dist/client/hooks/useMcpModule.js +17 -0
  58. package/dist/client/hooks/useMcpModule.js.map +1 -0
  59. package/dist/client/hooks/useMcpState.d.ts +3 -0
  60. package/dist/client/hooks/useMcpState.d.ts.map +1 -0
  61. package/dist/client/hooks/useMcpState.js +20 -0
  62. package/dist/client/hooks/useMcpState.js.map +1 -0
  63. package/dist/client/hooks/useMcpTool.d.ts +4 -0
  64. package/dist/client/hooks/useMcpTool.d.ts.map +1 -0
  65. package/dist/client/hooks/useMcpTool.js +20 -0
  66. package/dist/client/hooks/useMcpTool.js.map +1 -0
  67. package/dist/client/index.d.ts +8 -0
  68. package/dist/client/index.d.ts.map +1 -0
  69. package/dist/client/index.js +15 -0
  70. package/dist/client/index.js.map +1 -0
  71. package/dist/client/models/types.d.ts +12 -0
  72. package/dist/client/models/types.d.ts.map +1 -0
  73. package/dist/client/models/types.js +3 -0
  74. package/dist/client/models/types.js.map +1 -0
  75. package/dist/client/utils/connection.d.ts +17 -0
  76. package/dist/client/utils/connection.d.ts.map +1 -0
  77. package/dist/client/utils/connection.js +71 -0
  78. package/dist/client/utils/connection.js.map +1 -0
  79. package/dist/client/utils/moduleRunner.d.ts +13 -0
  80. package/dist/client/utils/moduleRunner.d.ts.map +1 -0
  81. package/dist/client/utils/moduleRunner.js +59 -0
  82. package/dist/client/utils/moduleRunner.js.map +1 -0
  83. package/dist/index.d.ts +5 -0
  84. package/dist/index.d.ts.map +1 -0
  85. package/dist/index.js +25 -0
  86. package/dist/index.js.map +1 -0
  87. package/dist/modules/alert/alert.d.ts +3 -0
  88. package/dist/modules/alert/alert.d.ts.map +1 -0
  89. package/dist/modules/alert/alert.js +50 -0
  90. package/dist/modules/alert/alert.js.map +1 -0
  91. package/dist/modules/alert/index.d.ts +2 -0
  92. package/dist/modules/alert/index.d.ts.map +1 -0
  93. package/dist/modules/alert/index.js +6 -0
  94. package/dist/modules/alert/index.js.map +1 -0
  95. package/dist/modules/components/components.d.ts +8 -0
  96. package/dist/modules/components/components.d.ts.map +1 -0
  97. package/dist/modules/components/components.js +315 -0
  98. package/dist/modules/components/components.js.map +1 -0
  99. package/dist/modules/components/index.d.ts +3 -0
  100. package/dist/modules/components/index.d.ts.map +1 -0
  101. package/dist/modules/components/index.js +6 -0
  102. package/dist/modules/components/index.js.map +1 -0
  103. package/dist/modules/components/types.d.ts +18 -0
  104. package/dist/modules/components/types.d.ts.map +1 -0
  105. package/dist/modules/components/types.js +3 -0
  106. package/dist/modules/components/types.js.map +1 -0
  107. package/dist/modules/components/utils.d.ts +18 -0
  108. package/dist/modules/components/utils.d.ts.map +1 -0
  109. package/dist/modules/components/utils.js +386 -0
  110. package/dist/modules/components/utils.js.map +1 -0
  111. package/dist/modules/console/console.d.ts +4 -0
  112. package/dist/modules/console/console.d.ts.map +1 -0
  113. package/dist/modules/console/console.js +176 -0
  114. package/dist/modules/console/console.js.map +1 -0
  115. package/dist/modules/console/index.d.ts +3 -0
  116. package/dist/modules/console/index.d.ts.map +1 -0
  117. package/dist/modules/console/index.js +6 -0
  118. package/dist/modules/console/index.js.map +1 -0
  119. package/dist/modules/console/types.d.ts +13 -0
  120. package/dist/modules/console/types.d.ts.map +1 -0
  121. package/dist/modules/console/types.js +3 -0
  122. package/dist/modules/console/types.js.map +1 -0
  123. package/dist/modules/device/device.d.ts +3 -0
  124. package/dist/modules/device/device.d.ts.map +1 -0
  125. package/dist/modules/device/device.js +182 -0
  126. package/dist/modules/device/device.js.map +1 -0
  127. package/dist/modules/device/index.d.ts +3 -0
  128. package/dist/modules/device/index.d.ts.map +1 -0
  129. package/dist/modules/device/index.js +6 -0
  130. package/dist/modules/device/index.js.map +1 -0
  131. package/dist/modules/device/types.d.ts +24 -0
  132. package/dist/modules/device/types.d.ts.map +1 -0
  133. package/dist/modules/device/types.js +3 -0
  134. package/dist/modules/device/types.js.map +1 -0
  135. package/dist/modules/errors/errors.d.ts +4 -0
  136. package/dist/modules/errors/errors.d.ts.map +1 -0
  137. package/dist/modules/errors/errors.js +133 -0
  138. package/dist/modules/errors/errors.js.map +1 -0
  139. package/dist/modules/errors/index.d.ts +3 -0
  140. package/dist/modules/errors/index.d.ts.map +1 -0
  141. package/dist/modules/errors/index.js +6 -0
  142. package/dist/modules/errors/index.js.map +1 -0
  143. package/dist/modules/errors/types.d.ts +12 -0
  144. package/dist/modules/errors/types.d.ts.map +1 -0
  145. package/dist/modules/errors/types.js +3 -0
  146. package/dist/modules/errors/types.js.map +1 -0
  147. package/dist/modules/fiberTree/fiberTree.d.ts +8 -0
  148. package/dist/modules/fiberTree/fiberTree.d.ts.map +1 -0
  149. package/dist/modules/fiberTree/fiberTree.js +337 -0
  150. package/dist/modules/fiberTree/fiberTree.js.map +1 -0
  151. package/dist/modules/fiberTree/index.d.ts +3 -0
  152. package/dist/modules/fiberTree/index.d.ts.map +1 -0
  153. package/dist/modules/fiberTree/index.js +6 -0
  154. package/dist/modules/fiberTree/index.js.map +1 -0
  155. package/dist/modules/fiberTree/types.d.ts +18 -0
  156. package/dist/modules/fiberTree/types.d.ts.map +1 -0
  157. package/dist/modules/fiberTree/types.js +3 -0
  158. package/dist/modules/fiberTree/types.js.map +1 -0
  159. package/dist/modules/fiberTree/utils.d.ts +18 -0
  160. package/dist/modules/fiberTree/utils.d.ts.map +1 -0
  161. package/dist/modules/fiberTree/utils.js +386 -0
  162. package/dist/modules/fiberTree/utils.js.map +1 -0
  163. package/dist/modules/i18next/i18next.d.ts +4 -0
  164. package/dist/modules/i18next/i18next.d.ts.map +1 -0
  165. package/dist/modules/i18next/i18next.js +133 -0
  166. package/dist/modules/i18next/i18next.js.map +1 -0
  167. package/dist/modules/i18next/index.d.ts +3 -0
  168. package/dist/modules/i18next/index.d.ts.map +1 -0
  169. package/dist/modules/i18next/index.js +6 -0
  170. package/dist/modules/i18next/index.js.map +1 -0
  171. package/dist/modules/i18next/types.d.ts +12 -0
  172. package/dist/modules/i18next/types.d.ts.map +1 -0
  173. package/dist/modules/i18next/types.js +3 -0
  174. package/dist/modules/i18next/types.js.map +1 -0
  175. package/dist/modules/index.d.ts +12 -0
  176. package/dist/modules/index.d.ts.map +1 -0
  177. package/dist/modules/index.js +26 -0
  178. package/dist/modules/index.js.map +1 -0
  179. package/dist/modules/navigation/index.d.ts +3 -0
  180. package/dist/modules/navigation/index.d.ts.map +1 -0
  181. package/dist/modules/navigation/index.js +6 -0
  182. package/dist/modules/navigation/index.js.map +1 -0
  183. package/dist/modules/navigation/navigation.d.ts +4 -0
  184. package/dist/modules/navigation/navigation.d.ts.map +1 -0
  185. package/dist/modules/navigation/navigation.js +240 -0
  186. package/dist/modules/navigation/navigation.js.map +1 -0
  187. package/dist/modules/navigation/types.d.ts +34 -0
  188. package/dist/modules/navigation/types.d.ts.map +1 -0
  189. package/dist/modules/navigation/types.js +3 -0
  190. package/dist/modules/navigation/types.js.map +1 -0
  191. package/dist/modules/network/index.d.ts +3 -0
  192. package/dist/modules/network/index.d.ts.map +1 -0
  193. package/dist/modules/network/index.js +6 -0
  194. package/dist/modules/network/index.js.map +1 -0
  195. package/dist/modules/network/network.d.ts +4 -0
  196. package/dist/modules/network/network.d.ts.map +1 -0
  197. package/dist/modules/network/network.js +276 -0
  198. package/dist/modules/network/network.js.map +1 -0
  199. package/dist/modules/network/types.d.ts +26 -0
  200. package/dist/modules/network/types.d.ts.map +1 -0
  201. package/dist/modules/network/types.js +3 -0
  202. package/dist/modules/network/types.js.map +1 -0
  203. package/dist/modules/reactQuery/index.d.ts +3 -0
  204. package/dist/modules/reactQuery/index.d.ts.map +1 -0
  205. package/dist/modules/reactQuery/index.js +6 -0
  206. package/dist/modules/reactQuery/index.js.map +1 -0
  207. package/dist/modules/reactQuery/reactQuery.d.ts +4 -0
  208. package/dist/modules/reactQuery/reactQuery.d.ts.map +1 -0
  209. package/dist/modules/reactQuery/reactQuery.js +160 -0
  210. package/dist/modules/reactQuery/reactQuery.js.map +1 -0
  211. package/dist/modules/reactQuery/types.d.ts +29 -0
  212. package/dist/modules/reactQuery/types.d.ts.map +1 -0
  213. package/dist/modules/reactQuery/types.js +3 -0
  214. package/dist/modules/reactQuery/types.js.map +1 -0
  215. package/dist/modules/screenshot/index.d.ts +3 -0
  216. package/dist/modules/screenshot/index.d.ts.map +1 -0
  217. package/dist/modules/screenshot/index.js +6 -0
  218. package/dist/modules/screenshot/index.js.map +1 -0
  219. package/dist/modules/screenshot/screenshot.d.ts +4 -0
  220. package/dist/modules/screenshot/screenshot.d.ts.map +1 -0
  221. package/dist/modules/screenshot/screenshot.js +89 -0
  222. package/dist/modules/screenshot/screenshot.js.map +1 -0
  223. package/dist/modules/screenshot/types.d.ts +5 -0
  224. package/dist/modules/screenshot/types.d.ts.map +1 -0
  225. package/dist/modules/screenshot/types.js +3 -0
  226. package/dist/modules/screenshot/types.js.map +1 -0
  227. package/dist/modules/storage/index.d.ts +3 -0
  228. package/dist/modules/storage/index.d.ts.map +1 -0
  229. package/dist/modules/storage/index.js +6 -0
  230. package/dist/modules/storage/index.js.map +1 -0
  231. package/dist/modules/storage/storage.d.ts +4 -0
  232. package/dist/modules/storage/storage.d.ts.map +1 -0
  233. package/dist/modules/storage/storage.js +124 -0
  234. package/dist/modules/storage/storage.js.map +1 -0
  235. package/dist/modules/storage/types.d.ts +11 -0
  236. package/dist/modules/storage/types.d.ts.map +1 -0
  237. package/dist/modules/storage/types.js +3 -0
  238. package/dist/modules/storage/types.js.map +1 -0
  239. package/dist/modules/tree/index.d.ts +2 -0
  240. package/dist/modules/tree/index.d.ts.map +1 -0
  241. package/dist/modules/tree/index.js +6 -0
  242. package/dist/modules/tree/index.js.map +1 -0
  243. package/dist/modules/tree/tree.d.ts +3 -0
  244. package/dist/modules/tree/tree.d.ts.map +1 -0
  245. package/dist/modules/tree/tree.js +274 -0
  246. package/dist/modules/tree/tree.js.map +1 -0
  247. package/dist/server/bridge.d.ts +24 -0
  248. package/dist/server/bridge.d.ts.map +1 -0
  249. package/dist/server/bridge.js +152 -0
  250. package/dist/server/bridge.js.map +1 -0
  251. package/dist/server/cli.d.ts +3 -0
  252. package/dist/server/cli.d.ts.map +1 -0
  253. package/dist/server/cli.js +17 -0
  254. package/dist/server/cli.js.map +1 -0
  255. package/dist/server/index.d.ts +4 -0
  256. package/dist/server/index.d.ts.map +1 -0
  257. package/dist/server/index.js +30 -0
  258. package/dist/server/index.js.map +1 -0
  259. package/dist/server/mcpServer.d.ts +19 -0
  260. package/dist/server/mcpServer.d.ts.map +1 -0
  261. package/dist/server/mcpServer.js +303 -0
  262. package/dist/server/mcpServer.js.map +1 -0
  263. package/dist/server/types.d.ts +12 -0
  264. package/dist/server/types.d.ts.map +1 -0
  265. package/dist/server/types.js +3 -0
  266. package/dist/server/types.js.map +1 -0
  267. package/dist/shared/protocol.d.ts +54 -0
  268. package/dist/shared/protocol.d.ts.map +1 -0
  269. package/dist/shared/protocol.js +8 -0
  270. package/dist/shared/protocol.js.map +1 -0
  271. package/package.json +95 -0
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.McpTreeRegistry = exports.McpTreeContext = exports.McpTracker = void 0;
4
+ var McpTracker_1 = require("./McpTracker");
5
+ Object.defineProperty(exports, "McpTracker", { enumerable: true, get: function () { return McpTracker_1.McpTracker; } });
6
+ var McpTreeContext_1 = require("./McpTreeContext");
7
+ Object.defineProperty(exports, "McpTreeContext", { enumerable: true, get: function () { return McpTreeContext_1.McpTreeContext; } });
8
+ var McpTreeRegistry_1 = require("./McpTreeRegistry");
9
+ Object.defineProperty(exports, "McpTreeRegistry", { enumerable: true, get: function () { return McpTreeRegistry_1.McpTreeRegistry; } });
10
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/client/contexts/McpTreeContext/index.ts"],"names":[],"mappings":";;;AAAA,2CAA0C;AAAjC,wGAAA,UAAU,OAAA;AACnB,mDAAkD;AAAzC,gHAAA,cAAc,OAAA;AACvB,qDAAoD;AAA3C,kHAAA,eAAe,OAAA"}
@@ -0,0 +1,14 @@
1
+ import { type MutableRefObject } from 'react';
2
+ export interface TreeNode {
3
+ childrenIds: string[];
4
+ file: string;
5
+ id: string;
6
+ line: number;
7
+ mountedAt: number;
8
+ name: string;
9
+ parentId: string | null;
10
+ props: Record<string, unknown>;
11
+ ref?: MutableRefObject<unknown>;
12
+ text?: string;
13
+ }
14
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/client/contexts/McpTreeContext/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,OAAO,CAAC;AAE9C,MAAM,WAAW,QAAQ;IACvB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B,GAAG,CAAC,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAC;IAChC,IAAI,CAAC,EAAE,MAAM,CAAC;CACf"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/client/contexts/McpTreeContext/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,25 @@
1
+ import { type McpModule, type ToolHandler } from '../../client/models/types';
2
+ export declare class McpClient {
3
+ private static instance;
4
+ private connection;
5
+ private debug;
6
+ private moduleRunner;
7
+ private constructor();
8
+ static initialize(options?: {
9
+ debug?: boolean;
10
+ host?: string;
11
+ port?: number;
12
+ }): McpClient;
13
+ static getInstance(): McpClient;
14
+ dispose(): void;
15
+ enableDebug(enabled: boolean): void;
16
+ registerModule(module: McpModule): void;
17
+ registerModules(modules: McpModule[]): void;
18
+ registerTool(name: string, tool: ToolHandler): void;
19
+ removeState(key: string): void;
20
+ setState(key: string, value: unknown): void;
21
+ unregisterTool(name: string): void;
22
+ private log;
23
+ private sendRegistration;
24
+ }
25
+ //# sourceMappingURL=McpClient.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"McpClient.d.ts","sourceRoot":"","sources":["../../../src/client/core/McpClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,WAAW,EAAE,MAAM,uBAAuB,CAAC;AA+CzE,qBAAa,SAAS;IACpB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAA0B;IAEjD,OAAO,CAAC,UAAU,CAAgB;IAClC,OAAO,CAAC,KAAK,CAAS;IACtB,OAAO,CAAC,YAAY,CAAsB;IAE1C,OAAO;IAmCP,MAAM,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,OAAO,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,SAAS;IAezF,MAAM,CAAC,WAAW,IAAI,SAAS;IAS/B,OAAO,IAAI,IAAI;IAMf,WAAW,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI;IAInC,cAAc,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI;IAMvC,eAAe,CAAC,OAAO,EAAE,SAAS,EAAE,GAAG,IAAI;IAa3C,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,GAAG,IAAI;IAcnD,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAQ9B,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI;IAS3C,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAUlC,OAAO,CAAC,GAAG;IASX,OAAO,CAAC,gBAAgB;CAezB"}
@@ -0,0 +1,183 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.McpClient = void 0;
4
+ const connection_1 = require("../../client/utils/connection");
5
+ const moduleRunner_1 = require("../../client/utils/moduleRunner");
6
+ const protocol_1 = require("../../shared/protocol");
7
+ const DEFAULT_PORT = 8347;
8
+ const TAG = '\x1b[1;35m[rn-mcp-kit]\x1b[0m';
9
+ const ARROW_IN = '\x1b[36m→\x1b[0m';
10
+ const ARROW_OUT = '\x1b[32m←\x1b[0m';
11
+ const CROSS = '\x1b[31m✕\x1b[0m';
12
+ const MODULE_COLORS = [
13
+ '\x1b[1;31m', // bold red
14
+ '\x1b[1;32m', // bold green
15
+ '\x1b[1;33m', // bold yellow
16
+ '\x1b[1;34m', // bold blue
17
+ '\x1b[1;35m', // bold magenta
18
+ '\x1b[1;36m', // bold cyan
19
+ '\x1b[1;94m', // bold bright blue
20
+ '\x1b[1;95m', // bold bright magenta
21
+ ];
22
+ const BOLD = '\x1b[1m';
23
+ const RESET = '\x1b[0m';
24
+ const moduleColorMap = new Map();
25
+ const getModuleColor = (moduleName) => {
26
+ const existing = moduleColorMap.get(moduleName);
27
+ if (existing) {
28
+ return existing;
29
+ }
30
+ const color = MODULE_COLORS[moduleColorMap.size % MODULE_COLORS.length];
31
+ moduleColorMap.set(moduleName, color);
32
+ return color;
33
+ };
34
+ const colorModule = (moduleName) => {
35
+ return `${getModuleColor(moduleName)}${moduleName}${RESET}`;
36
+ };
37
+ const formatTool = (moduleName, method) => {
38
+ return `${colorModule(moduleName)}.${BOLD}${method}${RESET}`;
39
+ };
40
+ // Capture original console.log before any module intercepts it
41
+ const originalConsoleLog = console.log.bind(console);
42
+ class McpClient {
43
+ static instance = null;
44
+ connection;
45
+ debug = false;
46
+ moduleRunner = new moduleRunner_1.ModuleRunner();
47
+ constructor(url) {
48
+ this.connection = new connection_1.McpConnection(url);
49
+ this.connection.onOpen(() => {
50
+ this.log('🚀 Connected to MCP server 🚀');
51
+ this.sendRegistration();
52
+ });
53
+ this.connection.onMessage((message) => {
54
+ if (message.type === 'tool_request') {
55
+ this.log(`${ARROW_IN} ${formatTool(message.module, message.method)}`, message.args);
56
+ this.moduleRunner
57
+ .handleRequest(message)
58
+ .then((result) => {
59
+ this.log(`${ARROW_OUT} ${formatTool(message.module, message.method)}`, result);
60
+ this.connection.send({
61
+ id: message.id,
62
+ result,
63
+ type: 'tool_response',
64
+ });
65
+ })
66
+ .catch((error) => {
67
+ this.log(`${CROSS} ${formatTool(message.module, message.method)}`, error.message);
68
+ this.connection.send({
69
+ error: error.message,
70
+ id: message.id,
71
+ type: 'tool_response',
72
+ });
73
+ });
74
+ }
75
+ });
76
+ this.connection.connect();
77
+ }
78
+ static initialize(options) {
79
+ if (McpClient.instance) {
80
+ if (options?.debug !== undefined) {
81
+ McpClient.instance.debug = options.debug;
82
+ }
83
+ return McpClient.instance;
84
+ }
85
+ const host = options?.host ?? 'localhost';
86
+ const port = options?.port ?? DEFAULT_PORT;
87
+ McpClient.instance = new McpClient(`ws://${host}:${port}`);
88
+ McpClient.instance.debug = options?.debug ?? false;
89
+ return McpClient.instance;
90
+ }
91
+ static getInstance() {
92
+ if (!McpClient.instance) {
93
+ console.error(`${TAG} McpClient is not initialized. Call McpClient.initialize() first.`);
94
+ throw new Error('McpClient is not initialized. Call McpClient.initialize() first.');
95
+ }
96
+ return McpClient.instance;
97
+ }
98
+ dispose() {
99
+ this.log('Disposing MCP client');
100
+ this.connection.dispose();
101
+ McpClient.instance = null;
102
+ }
103
+ enableDebug(enabled) {
104
+ this.debug = enabled;
105
+ }
106
+ registerModule(module) {
107
+ this.log(`Registering module: ${colorModule(module.name)}`, Object.keys(module.tools));
108
+ this.moduleRunner.registerModules([module]);
109
+ this.sendRegistration();
110
+ }
111
+ registerModules(modules) {
112
+ this.log('Registering modules: ' +
113
+ modules
114
+ .map((m) => {
115
+ return colorModule(m.name);
116
+ })
117
+ .join(', '));
118
+ this.moduleRunner.registerModules(modules);
119
+ this.sendRegistration();
120
+ }
121
+ registerTool(name, tool) {
122
+ this.log(`Registering dynamic tool: ${BOLD}${name}${RESET}`);
123
+ this.moduleRunner.registerDynamicTool(name, tool);
124
+ this.connection.send({
125
+ module: `${protocol_1.MODULE_SEPARATOR}dynamic`,
126
+ tool: {
127
+ description: tool.description,
128
+ inputSchema: tool.inputSchema,
129
+ name,
130
+ },
131
+ type: 'tool_register',
132
+ });
133
+ }
134
+ removeState(key) {
135
+ this.log(`Removing state: ${BOLD}${key}${RESET}`);
136
+ this.connection.send({
137
+ key,
138
+ type: 'state_remove',
139
+ });
140
+ }
141
+ setState(key, value) {
142
+ this.log(`Setting state: ${BOLD}${key}${RESET}`, value);
143
+ this.connection.send({
144
+ key,
145
+ type: 'state_update',
146
+ value,
147
+ });
148
+ }
149
+ unregisterTool(name) {
150
+ this.log(`Unregistering dynamic tool: ${name}`);
151
+ this.moduleRunner.unregisterDynamicTool(name);
152
+ this.connection.send({
153
+ module: `${protocol_1.MODULE_SEPARATOR}dynamic`,
154
+ toolName: name,
155
+ type: 'tool_unregister',
156
+ });
157
+ }
158
+ log(message, data) {
159
+ if (!this.debug)
160
+ return;
161
+ if (data !== undefined) {
162
+ originalConsoleLog(`${TAG} ${message}`, data);
163
+ }
164
+ else {
165
+ originalConsoleLog(`${TAG} ${message}`);
166
+ }
167
+ }
168
+ sendRegistration() {
169
+ const descriptors = this.moduleRunner.getModuleDescriptors();
170
+ this.log('Sending registration:\n ' +
171
+ descriptors
172
+ .map((m) => {
173
+ return `${colorModule(m.name.padEnd(12))} ${m.tools.length} tools`;
174
+ })
175
+ .join('\n '));
176
+ this.connection.send({
177
+ modules: descriptors,
178
+ type: 'registration',
179
+ });
180
+ }
181
+ }
182
+ exports.McpClient = McpClient;
183
+ //# sourceMappingURL=McpClient.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"McpClient.js","sourceRoot":"","sources":["../../../src/client/core/McpClient.ts"],"names":[],"mappings":";;;AACA,0DAA0D;AAC1D,8DAA2D;AAC3D,gDAAuE;AAEvE,MAAM,YAAY,GAAG,IAAI,CAAC;AAC1B,MAAM,GAAG,GAAG,+BAA+B,CAAC;AAC5C,MAAM,QAAQ,GAAG,kBAAkB,CAAC;AACpC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GAAG,CACN,0BAA0B;YACxB,WAAW;iBACR,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE;gBACT,OAAO,GAAG,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,MAAM,QAAQ,CAAC;YACrE,CAAC,CAAC;iBACD,IAAI,CAAC,KAAK,CAAC,CACjB,CAAC;QACF,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC;YACnB,OAAO,EAAE,WAAW;YACpB,IAAI,EAAE,cAAc;SACrB,CAAC,CAAC;IACL,CAAC;;AA/JH,8BAgKC"}
@@ -0,0 +1,4 @@
1
+ import { type DependencyList } from 'react';
2
+ import { type McpModule } from '../../client/models/types';
3
+ export declare const useMcpModule: (factory: () => McpModule, deps: DependencyList) => void;
4
+ //# sourceMappingURL=useMcpModule.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useMcpModule.d.ts","sourceRoot":"","sources":["../../../src/client/hooks/useMcpModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,KAAK,cAAc,EAAE,MAAM,OAAO,CAAC;AAGhE,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAEvD,eAAO,MAAM,YAAY,YAAa,MAAM,SAAS,QAAQ,cAAc,KAAG,IAU7E,CAAC"}
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useMcpModule = void 0;
4
+ const react_1 = require("react");
5
+ const McpClient_1 = require("../../client/core/McpClient");
6
+ const useMcpModule = (factory, deps) => {
7
+ const client = (0, react_1.useMemo)(() => {
8
+ return McpClient_1.McpClient.getInstance();
9
+ }, []);
10
+ // eslint-disable-next-line react-hooks/exhaustive-deps
11
+ const module = (0, react_1.useMemo)(factory, deps);
12
+ (0, react_1.useEffect)(() => {
13
+ client.registerModule(module);
14
+ }, [client, module]);
15
+ };
16
+ exports.useMcpModule = useMcpModule;
17
+ //# sourceMappingURL=useMcpModule.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useMcpModule.js","sourceRoot":"","sources":["../../../src/client/hooks/useMcpModule.ts"],"names":[],"mappings":";;;AAAA,iCAAgE;AAEhE,uDAAoD;AAG7C,MAAM,YAAY,GAAG,CAAC,OAAwB,EAAE,IAAoB,EAAQ,EAAE;IACnF,MAAM,MAAM,GAAG,IAAA,eAAO,EAAC,GAAG,EAAE;QAC1B,OAAO,qBAAS,CAAC,WAAW,EAAE,CAAC;IACjC,CAAC,EAAE,EAAE,CAAC,CAAC;IACP,uDAAuD;IACvD,MAAM,MAAM,GAAG,IAAA,eAAO,EAAC,OAAO,EAAE,IAAI,CAAC,CAAC;IAEtC,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;IAChC,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;AACvB,CAAC,CAAC;AAVW,QAAA,YAAY,gBAUvB"}
@@ -0,0 +1,3 @@
1
+ import { type DependencyList } from 'react';
2
+ export declare const useMcpState: (key: string, factory: () => unknown, deps: DependencyList) => void;
3
+ //# sourceMappingURL=useMcpState.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useMcpState.d.ts","sourceRoot":"","sources":["../../../src/client/hooks/useMcpState.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkC,KAAK,cAAc,EAAE,MAAM,OAAO,CAAC;AAI5E,eAAO,MAAM,WAAW,QAAS,MAAM,WAAW,MAAM,OAAO,QAAQ,cAAc,KAAG,IAYvF,CAAC"}
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useMcpState = void 0;
4
+ const react_1 = require("react");
5
+ const McpContext_1 = require("../../client/contexts/McpContext");
6
+ const useMcpState = (key, factory, deps) => {
7
+ const ctx = (0, react_1.useContext)(McpContext_1.McpContext);
8
+ // eslint-disable-next-line react-hooks/exhaustive-deps
9
+ const value = (0, react_1.useMemo)(factory, deps);
10
+ (0, react_1.useEffect)(() => {
11
+ if (!ctx)
12
+ return;
13
+ ctx.setState(key, value);
14
+ return () => {
15
+ ctx.removeState(key);
16
+ };
17
+ }, [ctx, key, value]);
18
+ };
19
+ exports.useMcpState = useMcpState;
20
+ //# sourceMappingURL=useMcpState.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useMcpState.js","sourceRoot":"","sources":["../../../src/client/hooks/useMcpState.ts"],"names":[],"mappings":";;;AAAA,iCAA4E;AAE5E,6DAA0D;AAEnD,MAAM,WAAW,GAAG,CAAC,GAAW,EAAE,OAAsB,EAAE,IAAoB,EAAQ,EAAE;IAC7F,MAAM,GAAG,GAAG,IAAA,kBAAU,EAAC,uBAAU,CAAC,CAAC;IACnC,uDAAuD;IACvD,MAAM,KAAK,GAAG,IAAA,eAAO,EAAC,OAAO,EAAE,IAAI,CAAC,CAAC;IAErC,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,IAAI,CAAC,GAAG;YAAE,OAAO;QACjB,GAAG,CAAC,QAAQ,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;QACzB,OAAO,GAAG,EAAE;YACV,GAAG,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;QACvB,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC;AACxB,CAAC,CAAC;AAZW,QAAA,WAAW,eAYtB"}
@@ -0,0 +1,4 @@
1
+ import { type DependencyList } from 'react';
2
+ import { type ToolHandler } from '../../client/models/types';
3
+ export declare const useMcpTool: (name: string, factory: () => ToolHandler, deps: DependencyList) => void;
4
+ //# sourceMappingURL=useMcpTool.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useMcpTool.d.ts","sourceRoot":"","sources":["../../../src/client/hooks/useMcpTool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkC,KAAK,cAAc,EAAE,MAAM,OAAO,CAAC;AAG5E,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEzD,eAAO,MAAM,UAAU,SACf,MAAM,WACH,MAAM,WAAW,QACpB,cAAc,KACnB,IAYF,CAAC"}
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useMcpTool = void 0;
4
+ const react_1 = require("react");
5
+ const McpContext_1 = require("../../client/contexts/McpContext");
6
+ const useMcpTool = (name, factory, deps) => {
7
+ const ctx = (0, react_1.useContext)(McpContext_1.McpContext);
8
+ // eslint-disable-next-line react-hooks/exhaustive-deps
9
+ const tool = (0, react_1.useMemo)(factory, deps);
10
+ (0, react_1.useEffect)(() => {
11
+ if (!ctx)
12
+ return;
13
+ ctx.registerTool(name, tool);
14
+ return () => {
15
+ ctx.unregisterTool(name);
16
+ };
17
+ }, [ctx, name, tool]);
18
+ };
19
+ exports.useMcpTool = useMcpTool;
20
+ //# sourceMappingURL=useMcpTool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useMcpTool.js","sourceRoot":"","sources":["../../../src/client/hooks/useMcpTool.ts"],"names":[],"mappings":";;;AAAA,iCAA4E;AAE5E,6DAA0D;AAGnD,MAAM,UAAU,GAAG,CACxB,IAAY,EACZ,OAA0B,EAC1B,IAAoB,EACd,EAAE;IACR,MAAM,GAAG,GAAG,IAAA,kBAAU,EAAC,uBAAU,CAAC,CAAC;IACnC,uDAAuD;IACvD,MAAM,IAAI,GAAG,IAAA,eAAO,EAAC,OAAO,EAAE,IAAI,CAAC,CAAC;IAEpC,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,IAAI,CAAC,GAAG;YAAE,OAAO;QACjB,GAAG,CAAC,YAAY,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QAC7B,OAAO,GAAG,EAAE;YACV,GAAG,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;QAC3B,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,GAAG,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;AACxB,CAAC,CAAC;AAhBW,QAAA,UAAU,cAgBrB"}
@@ -0,0 +1,8 @@
1
+ export { McpContext, McpProvider } from './contexts/McpContext';
2
+ export { McpClient } from './core/McpClient';
3
+ export { useMcpModule } from './hooks/useMcpModule';
4
+ export { useMcpState } from './hooks/useMcpState';
5
+ export { useMcpTool } from './hooks/useMcpTool';
6
+ export { type McpContextValue, type McpProviderProps } from './contexts/McpContext';
7
+ export { type McpModule, type ToolHandler } from './models/types';
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAChE,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEhD,OAAO,EAAE,KAAK,eAAe,EAAE,KAAK,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACpF,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,WAAW,EAAE,MAAM,gBAAgB,CAAC"}
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useMcpTool = exports.useMcpState = exports.useMcpModule = exports.McpClient = exports.McpProvider = exports.McpContext = void 0;
4
+ var McpContext_1 = require("./contexts/McpContext");
5
+ Object.defineProperty(exports, "McpContext", { enumerable: true, get: function () { return McpContext_1.McpContext; } });
6
+ Object.defineProperty(exports, "McpProvider", { enumerable: true, get: function () { return McpContext_1.McpProvider; } });
7
+ var McpClient_1 = require("./core/McpClient");
8
+ Object.defineProperty(exports, "McpClient", { enumerable: true, get: function () { return McpClient_1.McpClient; } });
9
+ var useMcpModule_1 = require("./hooks/useMcpModule");
10
+ Object.defineProperty(exports, "useMcpModule", { enumerable: true, get: function () { return useMcpModule_1.useMcpModule; } });
11
+ var useMcpState_1 = require("./hooks/useMcpState");
12
+ Object.defineProperty(exports, "useMcpState", { enumerable: true, get: function () { return useMcpState_1.useMcpState; } });
13
+ var useMcpTool_1 = require("./hooks/useMcpTool");
14
+ Object.defineProperty(exports, "useMcpTool", { enumerable: true, get: function () { return useMcpTool_1.useMcpTool; } });
15
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":";;;AAAA,oDAAgE;AAAvD,wGAAA,UAAU,OAAA;AAAE,yGAAA,WAAW,OAAA;AAChC,8CAA6C;AAApC,sGAAA,SAAS,OAAA;AAClB,qDAAoD;AAA3C,4GAAA,YAAY,OAAA;AACrB,mDAAkD;AAAzC,0GAAA,WAAW,OAAA;AACpB,iDAAgD;AAAvC,wGAAA,UAAU,OAAA"}
@@ -0,0 +1,12 @@
1
+ export interface ToolHandler {
2
+ description: string;
3
+ handler: (args: Record<string, unknown>) => unknown | Promise<unknown>;
4
+ inputSchema?: Record<string, unknown>;
5
+ timeout?: number;
6
+ }
7
+ export interface McpModule {
8
+ name: string;
9
+ tools: Record<string, ToolHandler>;
10
+ description?: string;
11
+ }
12
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/client/models/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,WAAW;IAC1B,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACvE,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACtC,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IACnC,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/client/models/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,17 @@
1
+ import { type ClientMessage, type ServerMessage } from '../../shared/protocol';
2
+ export declare class McpConnection {
3
+ private readonly url;
4
+ private ws;
5
+ private messageHandler;
6
+ private openHandler;
7
+ private reconnectTimer;
8
+ private disposed;
9
+ constructor(url: string);
10
+ connect(): void;
11
+ send(message: ClientMessage): void;
12
+ onMessage(handler: (message: ServerMessage) => void): void;
13
+ onOpen(handler: () => void): void;
14
+ dispose(): void;
15
+ private scheduleReconnect;
16
+ }
17
+ //# sourceMappingURL=connection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"connection.d.ts","sourceRoot":"","sources":["../../../src/client/utils/connection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAE,KAAK,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAI3E,qBAAa,aAAa;IAOZ,OAAO,CAAC,QAAQ,CAAC,GAAG;IANhC,OAAO,CAAC,EAAE,CAA0B;IACpC,OAAO,CAAC,cAAc,CAAmD;IACzE,OAAO,CAAC,WAAW,CAA6B;IAChD,OAAO,CAAC,cAAc,CAA8C;IACpE,OAAO,CAAC,QAAQ,CAAS;gBAEI,GAAG,EAAE,MAAM;IAExC,OAAO,IAAI,IAAI;IA+Bf,IAAI,CAAC,OAAO,EAAE,aAAa,GAAG,IAAI;IAMlC,SAAS,CAAC,OAAO,EAAE,CAAC,OAAO,EAAE,aAAa,KAAK,IAAI,GAAG,IAAI;IAI1D,MAAM,CAAC,OAAO,EAAE,MAAM,IAAI,GAAG,IAAI;IAIjC,OAAO,IAAI,IAAI;IASf,OAAO,CAAC,iBAAiB;CAM1B"}
@@ -0,0 +1,71 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.McpConnection = void 0;
4
+ const RECONNECT_INTERVAL = 3000;
5
+ class McpConnection {
6
+ url;
7
+ ws = null;
8
+ messageHandler = null;
9
+ openHandler = null;
10
+ reconnectTimer = null;
11
+ disposed = false;
12
+ constructor(url) {
13
+ this.url = url;
14
+ }
15
+ connect() {
16
+ if (this.disposed)
17
+ return;
18
+ try {
19
+ this.ws = new WebSocket(this.url);
20
+ this.ws.onopen = () => {
21
+ this.openHandler?.();
22
+ };
23
+ this.ws.onmessage = (event) => {
24
+ try {
25
+ const message = JSON.parse(String(event.data));
26
+ this.messageHandler?.(message);
27
+ }
28
+ catch {
29
+ // ignore malformed messages
30
+ }
31
+ };
32
+ this.ws.onclose = () => {
33
+ this.scheduleReconnect();
34
+ };
35
+ this.ws.onerror = () => {
36
+ this.ws?.close();
37
+ };
38
+ }
39
+ catch {
40
+ this.scheduleReconnect();
41
+ }
42
+ }
43
+ send(message) {
44
+ if (this.ws?.readyState === WebSocket.OPEN) {
45
+ this.ws.send(JSON.stringify(message));
46
+ }
47
+ }
48
+ onMessage(handler) {
49
+ this.messageHandler = handler;
50
+ }
51
+ onOpen(handler) {
52
+ this.openHandler = handler;
53
+ }
54
+ dispose() {
55
+ this.disposed = true;
56
+ if (this.reconnectTimer) {
57
+ clearTimeout(this.reconnectTimer);
58
+ }
59
+ this.ws?.close();
60
+ this.ws = null;
61
+ }
62
+ scheduleReconnect() {
63
+ if (this.disposed)
64
+ return;
65
+ this.reconnectTimer = setTimeout(() => {
66
+ this.connect();
67
+ }, RECONNECT_INTERVAL);
68
+ }
69
+ }
70
+ exports.McpConnection = McpConnection;
71
+ //# sourceMappingURL=connection.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"connection.js","sourceRoot":"","sources":["../../../src/client/utils/connection.ts"],"names":[],"mappings":";;;AAEA,MAAM,kBAAkB,GAAG,IAAI,CAAC;AAEhC,MAAa,aAAa;IAOK;IANrB,EAAE,GAAqB,IAAI,CAAC;IAC5B,cAAc,GAA8C,IAAI,CAAC;IACjE,WAAW,GAAwB,IAAI,CAAC;IACxC,cAAc,GAAyC,IAAI,CAAC;IAC5D,QAAQ,GAAG,KAAK,CAAC;IAEzB,YAA6B,GAAW;QAAX,QAAG,GAAH,GAAG,CAAQ;IAAG,CAAC;IAE5C,OAAO;QACL,IAAI,IAAI,CAAC,QAAQ;YAAE,OAAO;QAE1B,IAAI,CAAC;YACH,IAAI,CAAC,EAAE,GAAG,IAAI,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YAElC,IAAI,CAAC,EAAE,CAAC,MAAM,GAAG,GAAG,EAAE;gBACpB,IAAI,CAAC,WAAW,EAAE,EAAE,CAAC;YACvB,CAAC,CAAC;YAEF,IAAI,CAAC,EAAE,CAAC,SAAS,GAAG,CAAC,KAAK,EAAE,EAAE;gBAC5B,IAAI,CAAC;oBACH,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAkB,CAAC;oBAChE,IAAI,CAAC,cAAc,EAAE,CAAC,OAAO,CAAC,CAAC;gBACjC,CAAC;gBAAC,MAAM,CAAC;oBACP,4BAA4B;gBAC9B,CAAC;YACH,CAAC,CAAC;YAEF,IAAI,CAAC,EAAE,CAAC,OAAO,GAAG,GAAG,EAAE;gBACrB,IAAI,CAAC,iBAAiB,EAAE,CAAC;YAC3B,CAAC,CAAC;YAEF,IAAI,CAAC,EAAE,CAAC,OAAO,GAAG,GAAG,EAAE;gBACrB,IAAI,CAAC,EAAE,EAAE,KAAK,EAAE,CAAC;YACnB,CAAC,CAAC;QACJ,CAAC;QAAC,MAAM,CAAC;YACP,IAAI,CAAC,iBAAiB,EAAE,CAAC;QAC3B,CAAC;IACH,CAAC;IAED,IAAI,CAAC,OAAsB;QACzB,IAAI,IAAI,CAAC,EAAE,EAAE,UAAU,KAAK,SAAS,CAAC,IAAI,EAAE,CAAC;YAC3C,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC;QACxC,CAAC;IACH,CAAC;IAED,SAAS,CAAC,OAAyC;QACjD,IAAI,CAAC,cAAc,GAAG,OAAO,CAAC;IAChC,CAAC;IAED,MAAM,CAAC,OAAmB;QACxB,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC;IAC7B,CAAC;IAED,OAAO;QACL,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QACrB,IAAI,IAAI,CAAC,cAAc,EAAE,CAAC;YACxB,YAAY,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;QACpC,CAAC;QACD,IAAI,CAAC,EAAE,EAAE,KAAK,EAAE,CAAC;QACjB,IAAI,CAAC,EAAE,GAAG,IAAI,CAAC;IACjB,CAAC;IAEO,iBAAiB;QACvB,IAAI,IAAI,CAAC,QAAQ;YAAE,OAAO;QAC1B,IAAI,CAAC,cAAc,GAAG,UAAU,CAAC,GAAG,EAAE;YACpC,IAAI,CAAC,OAAO,EAAE,CAAC;QACjB,CAAC,EAAE,kBAAkB,CAAC,CAAC;IACzB,CAAC;CACF;AArED,sCAqEC"}
@@ -0,0 +1,13 @@
1
+ import { type McpModule, type ToolHandler } from '../../client/models/types';
2
+ import { type ModuleDescriptor, type ToolRequest } from '../../shared/protocol';
3
+ export declare class ModuleRunner {
4
+ private moduleDescriptions;
5
+ private modules;
6
+ private dynamicTools;
7
+ registerModules(modules: McpModule[]): void;
8
+ registerDynamicTool(name: string, tool: ToolHandler): void;
9
+ unregisterDynamicTool(name: string): void;
10
+ handleRequest(request: ToolRequest): Promise<unknown>;
11
+ getModuleDescriptors(): ModuleDescriptor[];
12
+ }
13
+ //# sourceMappingURL=moduleRunner.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"moduleRunner.d.ts","sourceRoot":"","sources":["../../../src/client/utils/moduleRunner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACzE,OAAO,EAAE,KAAK,gBAAgB,EAAE,KAAK,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAE5E,qBAAa,YAAY;IACvB,OAAO,CAAC,kBAAkB,CAA6B;IACvD,OAAO,CAAC,OAAO,CAAkD;IACjE,OAAO,CAAC,YAAY,CAAkC;IAEtD,eAAe,CAAC,OAAO,EAAE,SAAS,EAAE,GAAG,IAAI;IAS3C,mBAAmB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,GAAG,IAAI;IAI1D,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAInC,aAAa,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC;IAqB3D,oBAAoB,IAAI,gBAAgB,EAAE;CAoB3C"}
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ModuleRunner = void 0;
4
+ class ModuleRunner {
5
+ moduleDescriptions = new Map();
6
+ modules = new Map();
7
+ dynamicTools = new Map();
8
+ registerModules(modules) {
9
+ for (const mod of modules) {
10
+ this.modules.set(mod.name, mod.tools);
11
+ if (mod.description) {
12
+ this.moduleDescriptions.set(mod.name, mod.description);
13
+ }
14
+ }
15
+ }
16
+ registerDynamicTool(name, tool) {
17
+ this.dynamicTools.set(name, tool);
18
+ }
19
+ unregisterDynamicTool(name) {
20
+ this.dynamicTools.delete(name);
21
+ }
22
+ async handleRequest(request) {
23
+ // Check dynamic tools first — stored by name only
24
+ const dynamicTool = this.dynamicTools.get(request.method);
25
+ if (dynamicTool) {
26
+ return dynamicTool.handler(request.args);
27
+ }
28
+ // Check module tools (format: module + method)
29
+ const moduleTools = this.modules.get(request.module);
30
+ if (!moduleTools) {
31
+ throw new Error(`Module "${request.module}" not found`);
32
+ }
33
+ const tool = moduleTools[request.method];
34
+ if (!tool) {
35
+ throw new Error(`Tool "${request.method}" not found in module "${request.module}"`);
36
+ }
37
+ return tool.handler(request.args);
38
+ }
39
+ getModuleDescriptors() {
40
+ const descriptors = [];
41
+ for (const [name, tools] of this.modules) {
42
+ descriptors.push({
43
+ description: this.moduleDescriptions.get(name),
44
+ name,
45
+ tools: Object.entries(tools).map(([toolName, tool]) => {
46
+ return {
47
+ description: tool.description,
48
+ inputSchema: tool.inputSchema,
49
+ name: toolName,
50
+ timeout: tool.timeout,
51
+ };
52
+ }),
53
+ });
54
+ }
55
+ return descriptors;
56
+ }
57
+ }
58
+ exports.ModuleRunner = ModuleRunner;
59
+ //# sourceMappingURL=moduleRunner.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"moduleRunner.js","sourceRoot":"","sources":["../../../src/client/utils/moduleRunner.ts"],"names":[],"mappings":";;;AAGA,MAAa,YAAY;IACf,kBAAkB,GAAG,IAAI,GAAG,EAAkB,CAAC;IAC/C,OAAO,GAAG,IAAI,GAAG,EAAuC,CAAC;IACzD,YAAY,GAAG,IAAI,GAAG,EAAuB,CAAC;IAEtD,eAAe,CAAC,OAAoB;QAClC,KAAK,MAAM,GAAG,IAAI,OAAO,EAAE,CAAC;YAC1B,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC,KAAK,CAAC,CAAC;YACtC,IAAI,GAAG,CAAC,WAAW,EAAE,CAAC;gBACpB,IAAI,CAAC,kBAAkB,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC,WAAW,CAAC,CAAC;YACzD,CAAC;QACH,CAAC;IAC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C9C,IAAI;gBACJ,KAAK,EAAE,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,QAAQ,EAAE,IAAI,CAAC,EAAE,EAAE;oBACpD,OAAO;wBACL,WAAW,EAAE,IAAI,CAAC,WAAW;wBAC7B,WAAW,EAAE,IAAI,CAAC,WAAW;wBAC7B,IAAI,EAAE,QAAQ;wBACd,OAAO,EAAE,IAAI,CAAC,OAAO;qBACtB,CAAC;gBACJ,CAAC,CAAC;aACH,CAAC,CAAC;QACL,CAAC;QAED,OAAO,WAAW,CAAC;IACrB,CAAC;CACF;AA/DD,oCA+DC"}
@@ -0,0 +1,5 @@
1
+ export { McpClient, McpContext, McpProvider, useMcpModule, useMcpState, useMcpTool, } from './client/index';
2
+ export { type McpContextValue, type McpModule, type McpProviderProps, type ToolHandler, } from './client/index';
3
+ export { alertModule, fiberTreeModule, consoleModule, deviceModule, errorsModule, i18nextModule, navigationModule, networkModule, reactQueryModule, screenshotModule, storageModule, } from './modules/index';
4
+ export { type ClientMessage, type ModuleDescriptor, type ModuleToolDescriptor, type RegistrationMessage, type ServerMessage, type StateRemoveMessage, type StateUpdateMessage, type ToolRegisterMessage, type ToolRequest, type ToolResponse, type ToolUnregisterMessage, } from './shared/protocol';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,SAAS,EACT,UAAU,EACV,WAAW,EACX,YAAY,EACZ,WAAW,EACX,UAAU,GACX,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,KAAK,eAAe,EACpB,KAAK,SAAS,EACd,KAAK,gBAAgB,EACrB,KAAK,WAAW,GACjB,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EACL,WAAW,EACX,eAAe,EACf,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,gBAAgB,EAChB,aAAa,EACb,gBAAgB,EAChB,gBAAgB,EAChB,aAAa,GACd,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,gBAAgB,EACrB,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACxB,KAAK,aAAa,EAClB,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EACxB,KAAK,WAAW,EAChB,KAAK,YAAY,EACjB,KAAK,qBAAqB,GAC3B,MAAM,mBAAmB,CAAC"}