@mtkn/mega-agent 0.1.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 (295) hide show
  1. package/dist/artifact/artifact.repository.d.ts +17 -0
  2. package/dist/artifact/artifact.repository.d.ts.map +1 -0
  3. package/dist/artifact/artifact.repository.js +66 -0
  4. package/dist/artifact/artifact.repository.js.map +1 -0
  5. package/dist/artifact/artifact.service.d.ts +22 -0
  6. package/dist/artifact/artifact.service.d.ts.map +1 -0
  7. package/dist/artifact/artifact.service.js +87 -0
  8. package/dist/artifact/artifact.service.js.map +1 -0
  9. package/dist/artifact/artifact.types.d.ts +41 -0
  10. package/dist/artifact/artifact.types.d.ts.map +1 -0
  11. package/dist/artifact/artifact.types.js +6 -0
  12. package/dist/artifact/artifact.types.js.map +1 -0
  13. package/dist/artifact/index.d.ts +6 -0
  14. package/dist/artifact/index.d.ts.map +1 -0
  15. package/dist/artifact/index.js +4 -0
  16. package/dist/artifact/index.js.map +1 -0
  17. package/dist/chat/chat-memory.integration.d.ts +59 -0
  18. package/dist/chat/chat-memory.integration.d.ts.map +1 -0
  19. package/dist/chat/chat-memory.integration.js +148 -0
  20. package/dist/chat/chat-memory.integration.js.map +1 -0
  21. package/dist/chat/chat.repository.d.ts +58 -0
  22. package/dist/chat/chat.repository.d.ts.map +1 -0
  23. package/dist/chat/chat.repository.js +128 -0
  24. package/dist/chat/chat.repository.js.map +1 -0
  25. package/dist/chat/chat.service.d.ts +28 -0
  26. package/dist/chat/chat.service.d.ts.map +1 -0
  27. package/dist/chat/chat.service.js +217 -0
  28. package/dist/chat/chat.service.js.map +1 -0
  29. package/dist/chat/chat.types.d.ts +198 -0
  30. package/dist/chat/chat.types.d.ts.map +1 -0
  31. package/dist/chat/chat.types.js +8 -0
  32. package/dist/chat/chat.types.js.map +1 -0
  33. package/dist/chat/index.d.ts +17 -0
  34. package/dist/chat/index.d.ts.map +1 -0
  35. package/dist/chat/index.js +16 -0
  36. package/dist/chat/index.js.map +1 -0
  37. package/dist/chat/memory-detector.d.ts +53 -0
  38. package/dist/chat/memory-detector.d.ts.map +1 -0
  39. package/dist/chat/memory-detector.js +172 -0
  40. package/dist/chat/memory-detector.js.map +1 -0
  41. package/dist/chat/prompts/index.d.ts +6 -0
  42. package/dist/chat/prompts/index.d.ts.map +1 -0
  43. package/dist/chat/prompts/index.js +6 -0
  44. package/dist/chat/prompts/index.js.map +1 -0
  45. package/dist/chat/prompts/system.prompts.d.ts +23 -0
  46. package/dist/chat/prompts/system.prompts.d.ts.map +1 -0
  47. package/dist/chat/prompts/system.prompts.js +102 -0
  48. package/dist/chat/prompts/system.prompts.js.map +1 -0
  49. package/dist/chat/response-parser.d.ts +24 -0
  50. package/dist/chat/response-parser.d.ts.map +1 -0
  51. package/dist/chat/response-parser.js +198 -0
  52. package/dist/chat/response-parser.js.map +1 -0
  53. package/dist/chat/response.types.d.ts +90 -0
  54. package/dist/chat/response.types.d.ts.map +1 -0
  55. package/dist/chat/response.types.js +6 -0
  56. package/dist/chat/response.types.js.map +1 -0
  57. package/dist/common/errors.d.ts +60 -0
  58. package/dist/common/errors.d.ts.map +1 -0
  59. package/dist/common/errors.js +105 -0
  60. package/dist/common/errors.js.map +1 -0
  61. package/dist/common/index.d.ts +3 -0
  62. package/dist/common/index.d.ts.map +1 -0
  63. package/dist/common/index.js +3 -0
  64. package/dist/common/index.js.map +1 -0
  65. package/dist/common/retry.d.ts +23 -0
  66. package/dist/common/retry.d.ts.map +1 -0
  67. package/dist/common/retry.js +57 -0
  68. package/dist/common/retry.js.map +1 -0
  69. package/dist/create-mega-agent.d.ts +100 -0
  70. package/dist/create-mega-agent.d.ts.map +1 -0
  71. package/dist/create-mega-agent.js +153 -0
  72. package/dist/create-mega-agent.js.map +1 -0
  73. package/dist/embedding/embedding.service.d.ts +34 -0
  74. package/dist/embedding/embedding.service.d.ts.map +1 -0
  75. package/dist/embedding/embedding.service.js +68 -0
  76. package/dist/embedding/embedding.service.js.map +1 -0
  77. package/dist/embedding/embedding.types.d.ts +38 -0
  78. package/dist/embedding/embedding.types.d.ts.map +1 -0
  79. package/dist/embedding/embedding.types.js +6 -0
  80. package/dist/embedding/embedding.types.js.map +1 -0
  81. package/dist/embedding/index.d.ts +9 -0
  82. package/dist/embedding/index.d.ts.map +1 -0
  83. package/dist/embedding/index.js +9 -0
  84. package/dist/embedding/index.js.map +1 -0
  85. package/dist/embedding/providers/base.provider.d.ts +29 -0
  86. package/dist/embedding/providers/base.provider.d.ts.map +1 -0
  87. package/dist/embedding/providers/base.provider.js +19 -0
  88. package/dist/embedding/providers/base.provider.js.map +1 -0
  89. package/dist/embedding/providers/index.d.ts +7 -0
  90. package/dist/embedding/providers/index.d.ts.map +1 -0
  91. package/dist/embedding/providers/index.js +7 -0
  92. package/dist/embedding/providers/index.js.map +1 -0
  93. package/dist/embedding/providers/openai.provider.d.ts +17 -0
  94. package/dist/embedding/providers/openai.provider.d.ts.map +1 -0
  95. package/dist/embedding/providers/openai.provider.js +73 -0
  96. package/dist/embedding/providers/openai.provider.js.map +1 -0
  97. package/dist/http/chat.controller.d.ts +30 -0
  98. package/dist/http/chat.controller.d.ts.map +1 -0
  99. package/dist/http/chat.controller.js +163 -0
  100. package/dist/http/chat.controller.js.map +1 -0
  101. package/dist/http/chat.routes.d.ts +5 -0
  102. package/dist/http/chat.routes.d.ts.map +1 -0
  103. package/dist/http/chat.routes.js +38 -0
  104. package/dist/http/chat.routes.js.map +1 -0
  105. package/dist/http/chat.validation.d.ts +70 -0
  106. package/dist/http/chat.validation.d.ts.map +1 -0
  107. package/dist/http/chat.validation.js +28 -0
  108. package/dist/http/chat.validation.js.map +1 -0
  109. package/dist/incident/incident.correlator.d.ts +39 -0
  110. package/dist/incident/incident.correlator.d.ts.map +1 -0
  111. package/dist/incident/incident.correlator.js +129 -0
  112. package/dist/incident/incident.correlator.js.map +1 -0
  113. package/dist/incident/incident.detector.d.ts +62 -0
  114. package/dist/incident/incident.detector.d.ts.map +1 -0
  115. package/dist/incident/incident.detector.js +192 -0
  116. package/dist/incident/incident.detector.js.map +1 -0
  117. package/dist/incident/incident.repository.d.ts +79 -0
  118. package/dist/incident/incident.repository.d.ts.map +1 -0
  119. package/dist/incident/incident.repository.js +216 -0
  120. package/dist/incident/incident.repository.js.map +1 -0
  121. package/dist/incident/incident.service.d.ts +71 -0
  122. package/dist/incident/incident.service.d.ts.map +1 -0
  123. package/dist/incident/incident.service.js +217 -0
  124. package/dist/incident/incident.service.js.map +1 -0
  125. package/dist/incident/incident.types.d.ts +115 -0
  126. package/dist/incident/incident.types.d.ts.map +1 -0
  127. package/dist/incident/incident.types.js +6 -0
  128. package/dist/incident/incident.types.js.map +1 -0
  129. package/dist/incident/index.d.ts +13 -0
  130. package/dist/incident/index.d.ts.map +1 -0
  131. package/dist/incident/index.js +13 -0
  132. package/dist/incident/index.js.map +1 -0
  133. package/dist/index.d.ts +26 -0
  134. package/dist/index.d.ts.map +1 -0
  135. package/dist/index.js +26 -0
  136. package/dist/index.js.map +1 -0
  137. package/dist/llm/index.d.ts +8 -0
  138. package/dist/llm/index.d.ts.map +1 -0
  139. package/dist/llm/index.js +9 -0
  140. package/dist/llm/index.js.map +1 -0
  141. package/dist/llm/llm.service.d.ts +52 -0
  142. package/dist/llm/llm.service.d.ts.map +1 -0
  143. package/dist/llm/llm.service.js +141 -0
  144. package/dist/llm/llm.service.js.map +1 -0
  145. package/dist/llm/llm.types.d.ts +77 -0
  146. package/dist/llm/llm.types.d.ts.map +1 -0
  147. package/dist/llm/llm.types.js +5 -0
  148. package/dist/llm/llm.types.js.map +1 -0
  149. package/dist/llm/providers/anthropic.provider.d.ts +16 -0
  150. package/dist/llm/providers/anthropic.provider.d.ts.map +1 -0
  151. package/dist/llm/providers/anthropic.provider.js +118 -0
  152. package/dist/llm/providers/anthropic.provider.js.map +1 -0
  153. package/dist/llm/providers/base.provider.d.ts +17 -0
  154. package/dist/llm/providers/base.provider.d.ts.map +1 -0
  155. package/dist/llm/providers/base.provider.js +18 -0
  156. package/dist/llm/providers/base.provider.js.map +1 -0
  157. package/dist/llm/providers/custom.provider.d.ts +15 -0
  158. package/dist/llm/providers/custom.provider.d.ts.map +1 -0
  159. package/dist/llm/providers/custom.provider.js +110 -0
  160. package/dist/llm/providers/custom.provider.js.map +1 -0
  161. package/dist/llm/providers/gemini.provider.d.ts +19 -0
  162. package/dist/llm/providers/gemini.provider.d.ts.map +1 -0
  163. package/dist/llm/providers/gemini.provider.js +98 -0
  164. package/dist/llm/providers/gemini.provider.js.map +1 -0
  165. package/dist/llm/providers/index.d.ts +10 -0
  166. package/dist/llm/providers/index.d.ts.map +1 -0
  167. package/dist/llm/providers/index.js +10 -0
  168. package/dist/llm/providers/index.js.map +1 -0
  169. package/dist/llm/providers/openai.provider.d.ts +15 -0
  170. package/dist/llm/providers/openai.provider.d.ts.map +1 -0
  171. package/dist/llm/providers/openai.provider.js +57 -0
  172. package/dist/llm/providers/openai.provider.js.map +1 -0
  173. package/dist/mcp/index.d.ts +13 -0
  174. package/dist/mcp/index.d.ts.map +1 -0
  175. package/dist/mcp/index.js +17 -0
  176. package/dist/mcp/index.js.map +1 -0
  177. package/dist/mcp/mcp.client.d.ts +57 -0
  178. package/dist/mcp/mcp.client.d.ts.map +1 -0
  179. package/dist/mcp/mcp.client.js +150 -0
  180. package/dist/mcp/mcp.client.js.map +1 -0
  181. package/dist/mcp/mcp.service.d.ts +64 -0
  182. package/dist/mcp/mcp.service.d.ts.map +1 -0
  183. package/dist/mcp/mcp.service.js +207 -0
  184. package/dist/mcp/mcp.service.js.map +1 -0
  185. package/dist/mcp/mcp.types.d.ts +142 -0
  186. package/dist/mcp/mcp.types.d.ts.map +1 -0
  187. package/dist/mcp/mcp.types.js +6 -0
  188. package/dist/mcp/mcp.types.js.map +1 -0
  189. package/dist/mcp/presets/common-sources.d.ts +28 -0
  190. package/dist/mcp/presets/common-sources.d.ts.map +1 -0
  191. package/dist/mcp/presets/common-sources.js +114 -0
  192. package/dist/mcp/presets/common-sources.js.map +1 -0
  193. package/dist/mcp/presets/index.d.ts +5 -0
  194. package/dist/mcp/presets/index.d.ts.map +1 -0
  195. package/dist/mcp/presets/index.js +5 -0
  196. package/dist/mcp/presets/index.js.map +1 -0
  197. package/dist/mcp/source.repository.d.ts +68 -0
  198. package/dist/mcp/source.repository.d.ts.map +1 -0
  199. package/dist/mcp/source.repository.js +114 -0
  200. package/dist/mcp/source.repository.js.map +1 -0
  201. package/dist/mcp/source.service.d.ts +74 -0
  202. package/dist/mcp/source.service.d.ts.map +1 -0
  203. package/dist/mcp/source.service.js +181 -0
  204. package/dist/mcp/source.service.js.map +1 -0
  205. package/dist/mcp/transports/http.transport.d.ts +45 -0
  206. package/dist/mcp/transports/http.transport.d.ts.map +1 -0
  207. package/dist/mcp/transports/http.transport.js +64 -0
  208. package/dist/mcp/transports/http.transport.js.map +1 -0
  209. package/dist/mcp/transports/index.d.ts +7 -0
  210. package/dist/mcp/transports/index.d.ts.map +1 -0
  211. package/dist/mcp/transports/index.js +7 -0
  212. package/dist/mcp/transports/index.js.map +1 -0
  213. package/dist/mcp/transports/stdio.transport.d.ts +21 -0
  214. package/dist/mcp/transports/stdio.transport.d.ts.map +1 -0
  215. package/dist/mcp/transports/stdio.transport.js +29 -0
  216. package/dist/mcp/transports/stdio.transport.js.map +1 -0
  217. package/dist/memory/index.d.ts +10 -0
  218. package/dist/memory/index.d.ts.map +1 -0
  219. package/dist/memory/index.js +10 -0
  220. package/dist/memory/index.js.map +1 -0
  221. package/dist/memory/memory.repository.d.ts +62 -0
  222. package/dist/memory/memory.repository.d.ts.map +1 -0
  223. package/dist/memory/memory.repository.js +148 -0
  224. package/dist/memory/memory.repository.js.map +1 -0
  225. package/dist/memory/memory.service.d.ts +63 -0
  226. package/dist/memory/memory.service.d.ts.map +1 -0
  227. package/dist/memory/memory.service.js +263 -0
  228. package/dist/memory/memory.service.js.map +1 -0
  229. package/dist/memory/memory.types.d.ts +104 -0
  230. package/dist/memory/memory.types.d.ts.map +1 -0
  231. package/dist/memory/memory.types.js +8 -0
  232. package/dist/memory/memory.types.js.map +1 -0
  233. package/dist/qdrant/index.d.ts +8 -0
  234. package/dist/qdrant/index.d.ts.map +1 -0
  235. package/dist/qdrant/index.js +6 -0
  236. package/dist/qdrant/index.js.map +1 -0
  237. package/dist/qdrant/qdrant.service.d.ts +63 -0
  238. package/dist/qdrant/qdrant.service.d.ts.map +1 -0
  239. package/dist/qdrant/qdrant.service.js +201 -0
  240. package/dist/qdrant/qdrant.service.js.map +1 -0
  241. package/dist/qdrant/qdrant.types.d.ts +55 -0
  242. package/dist/qdrant/qdrant.types.d.ts.map +1 -0
  243. package/dist/qdrant/qdrant.types.js +6 -0
  244. package/dist/qdrant/qdrant.types.js.map +1 -0
  245. package/dist/tools/core-tools.d.ts +7 -0
  246. package/dist/tools/core-tools.d.ts.map +1 -0
  247. package/dist/tools/core-tools.js +52 -0
  248. package/dist/tools/core-tools.js.map +1 -0
  249. package/dist/tools/index.d.ts +4 -0
  250. package/dist/tools/index.d.ts.map +1 -0
  251. package/dist/tools/index.js +3 -0
  252. package/dist/tools/index.js.map +1 -0
  253. package/dist/tools/tool-registry.d.ts +51 -0
  254. package/dist/tools/tool-registry.d.ts.map +1 -0
  255. package/dist/tools/tool-registry.js +50 -0
  256. package/dist/tools/tool-registry.js.map +1 -0
  257. package/dist/workflow/actions/base.action.d.ts +50 -0
  258. package/dist/workflow/actions/base.action.d.ts.map +1 -0
  259. package/dist/workflow/actions/base.action.js +59 -0
  260. package/dist/workflow/actions/base.action.js.map +1 -0
  261. package/dist/workflow/actions/incident.action.d.ts +13 -0
  262. package/dist/workflow/actions/incident.action.d.ts.map +1 -0
  263. package/dist/workflow/actions/incident.action.js +70 -0
  264. package/dist/workflow/actions/incident.action.js.map +1 -0
  265. package/dist/workflow/actions/index.d.ts +9 -0
  266. package/dist/workflow/actions/index.d.ts.map +1 -0
  267. package/dist/workflow/actions/index.js +11 -0
  268. package/dist/workflow/actions/index.js.map +1 -0
  269. package/dist/workflow/actions/notify.action.d.ts +18 -0
  270. package/dist/workflow/actions/notify.action.d.ts.map +1 -0
  271. package/dist/workflow/actions/notify.action.js +106 -0
  272. package/dist/workflow/actions/notify.action.js.map +1 -0
  273. package/dist/workflow/actions/report.action.d.ts +13 -0
  274. package/dist/workflow/actions/report.action.d.ts.map +1 -0
  275. package/dist/workflow/actions/report.action.js +64 -0
  276. package/dist/workflow/actions/report.action.js.map +1 -0
  277. package/dist/workflow/index.d.ts +10 -0
  278. package/dist/workflow/index.d.ts.map +1 -0
  279. package/dist/workflow/index.js +11 -0
  280. package/dist/workflow/index.js.map +1 -0
  281. package/dist/workflow/workflow.repository.d.ts +90 -0
  282. package/dist/workflow/workflow.repository.d.ts.map +1 -0
  283. package/dist/workflow/workflow.repository.js +238 -0
  284. package/dist/workflow/workflow.repository.js.map +1 -0
  285. package/dist/workflow/workflow.service.d.ts +98 -0
  286. package/dist/workflow/workflow.service.d.ts.map +1 -0
  287. package/dist/workflow/workflow.service.js +374 -0
  288. package/dist/workflow/workflow.service.js.map +1 -0
  289. package/dist/workflow/workflow.types.d.ts +146 -0
  290. package/dist/workflow/workflow.types.d.ts.map +1 -0
  291. package/dist/workflow/workflow.types.js +8 -0
  292. package/dist/workflow/workflow.types.js.map +1 -0
  293. package/package.json +67 -0
  294. package/prisma/schema.prisma +551 -0
  295. package/scripts/prisma-sync.mjs +187 -0
@@ -0,0 +1,68 @@
1
+ /**
2
+ * MCP Source Repository
3
+ * Data access layer for MCP source operations
4
+ */
5
+ import type { AiMcpSource, SourceStatus, Prisma, PrismaClient } from '@prisma/client';
6
+ import type { LoggerLike } from './mcp.types.js';
7
+ export interface CreateSourceDto {
8
+ userId: number;
9
+ name: string;
10
+ type: string;
11
+ description?: string;
12
+ endpoint?: string;
13
+ credentials?: Record<string, unknown>;
14
+ metadata?: Record<string, unknown>;
15
+ }
16
+ export interface UpdateSourceDto {
17
+ name?: string;
18
+ description?: string;
19
+ status?: SourceStatus;
20
+ endpoint?: string;
21
+ credentials?: Record<string, unknown>;
22
+ metadata?: Record<string, unknown>;
23
+ }
24
+ export interface SourceRepositoryDependencies {
25
+ prisma: Prisma.TransactionClient | PrismaClient;
26
+ logger: LoggerLike;
27
+ }
28
+ /**
29
+ * Initialize the Source Repository with dependencies
30
+ */
31
+ export declare function initSourceRepository(deps: SourceRepositoryDependencies): void;
32
+ export declare class SourceRepository {
33
+ private get prisma();
34
+ private get logger();
35
+ /**
36
+ * Create a new MCP source
37
+ */
38
+ create(data: CreateSourceDto): Promise<AiMcpSource>;
39
+ /**
40
+ * Find source by ID
41
+ */
42
+ findById(id: string): Promise<AiMcpSource | null>;
43
+ /**
44
+ * Find sources by user
45
+ */
46
+ findByUser(userId: number): Promise<AiMcpSource[]>;
47
+ /**
48
+ * Find sources by type
49
+ */
50
+ findByType(userId: number, type: string): Promise<AiMcpSource[]>;
51
+ /**
52
+ * Update a source
53
+ */
54
+ update(id: string, data: UpdateSourceDto): Promise<AiMcpSource>;
55
+ /**
56
+ * Update source status
57
+ */
58
+ updateStatus(id: string, status: SourceStatus, error?: string): Promise<AiMcpSource>;
59
+ /**
60
+ * Delete a source
61
+ */
62
+ delete(id: string): Promise<void>;
63
+ /**
64
+ * Count sources by user
65
+ */
66
+ countByUser(userId: number): Promise<number>;
67
+ }
68
+ //# sourceMappingURL=source.repository.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"source.repository.d.ts","sourceRoot":"","sources":["../../src/mcp/source.repository.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACtF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAEjD,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,WAAW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AAG,OAAO,CAAC,WAAW,CAAC;IAqBrE;;OAEG;IACG,YAAY,CAChB,EAAE,EAAE,MAAM,EACV,MAAM,EAAE,YAAY,EACpB,KAAK,CAAC,EAAE,MAAM,GACb,OAAO,CAAC,WAAW,CAAC;IAWvB;;OAEG;IACG,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAKvC;;OAEG;IACG,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;CAGnD"}
@@ -0,0 +1,114 @@
1
+ /**
2
+ * MCP Source Repository
3
+ * Data access layer for MCP source operations
4
+ */
5
+ let _deps = null;
6
+ /**
7
+ * Initialize the Source Repository with dependencies
8
+ */
9
+ export function initSourceRepository(deps) {
10
+ _deps = deps;
11
+ }
12
+ export class SourceRepository {
13
+ get prisma() {
14
+ if (!_deps)
15
+ throw new Error('[SourceRepository] Not initialized');
16
+ return _deps.prisma;
17
+ }
18
+ get logger() {
19
+ if (!_deps)
20
+ throw new Error('[SourceRepository] Not initialized');
21
+ return _deps.logger;
22
+ }
23
+ /**
24
+ * Create a new MCP source
25
+ */
26
+ async create(data) {
27
+ const source = await this.prisma.aiMcpSource.create({
28
+ data: {
29
+ userId: data.userId,
30
+ name: data.name,
31
+ type: data.type,
32
+ description: data.description,
33
+ status: 'PENDING',
34
+ endpoint: data.endpoint,
35
+ credentials: (data.credentials ?? {}),
36
+ metadata: (data.metadata ?? {}),
37
+ },
38
+ });
39
+ this.logger.debug('MCP source created', { id: source.id, type: source.type });
40
+ return source;
41
+ }
42
+ /**
43
+ * Find source by ID
44
+ */
45
+ async findById(id) {
46
+ return this.prisma.aiMcpSource.findUnique({ where: { id } });
47
+ }
48
+ /**
49
+ * Find sources by user
50
+ */
51
+ async findByUser(userId) {
52
+ return this.prisma.aiMcpSource.findMany({
53
+ where: { userId },
54
+ orderBy: { createdAt: 'desc' },
55
+ });
56
+ }
57
+ /**
58
+ * Find sources by type
59
+ */
60
+ async findByType(userId, type) {
61
+ return this.prisma.aiMcpSource.findMany({
62
+ where: { userId, type },
63
+ orderBy: { createdAt: 'desc' },
64
+ });
65
+ }
66
+ /**
67
+ * Update a source
68
+ */
69
+ async update(id, data) {
70
+ const updateData = {
71
+ name: data.name,
72
+ description: data.description,
73
+ status: data.status,
74
+ endpoint: data.endpoint,
75
+ };
76
+ if (data.credentials !== undefined) {
77
+ updateData.credentials = data.credentials;
78
+ }
79
+ if (data.metadata !== undefined) {
80
+ updateData.metadata = data.metadata;
81
+ }
82
+ return this.prisma.aiMcpSource.update({
83
+ where: { id },
84
+ data: updateData,
85
+ });
86
+ }
87
+ /**
88
+ * Update source status
89
+ */
90
+ async updateStatus(id, status, error) {
91
+ return this.prisma.aiMcpSource.update({
92
+ where: { id },
93
+ data: {
94
+ status,
95
+ lastSyncAt: status === 'CONNECTED' ? new Date() : undefined,
96
+ metadata: error ? { error } : undefined,
97
+ },
98
+ });
99
+ }
100
+ /**
101
+ * Delete a source
102
+ */
103
+ async delete(id) {
104
+ await this.prisma.aiMcpSource.delete({ where: { id } });
105
+ this.logger.debug('MCP source deleted', { id });
106
+ }
107
+ /**
108
+ * Count sources by user
109
+ */
110
+ async countByUser(userId) {
111
+ return this.prisma.aiMcpSource.count({ where: { userId } });
112
+ }
113
+ }
114
+ //# sourceMappingURL=source.repository.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"source.repository.js","sourceRoot":"","sources":["../../src/mcp/source.repository.ts"],"names":[],"mappings":"AAAA;;;GAGG;AA6BH,IAAI,KAAK,GAAwC,IAAI,CAAC;AAEtD;;GAEG;AACH,MAAM,UAAU,oBAAoB,CAAC,IAAkC;IACrE,KAAK,GAAG,IAAI,CAAC;AACf,CAAC;AAED,MAAM,OAAO,gBAAgB;IAC3B,IAAY,MAAM;QAChB,IAAI,CAAC,KAAK;YAAE,MAAM,IAAI,KAAK,CAAC,oCAAoC,CAAC,CAAC;QAClE,OAAO,KAAK,CAAC,MAAM,CAAC;I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AC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,SAAS;aACxC;SACF,CAAC,CAAC;IACL,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,MAAM,CAAC,EAAU;QACrB,MAAM,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;QACxD,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,oBAAoB,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;IAClD,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,WAAW,CAAC,MAAc;QAC9B,OAAO,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,EAAE,MAAM,EAAE,EAAE,CAAC,CAAC;IAC9D,CAAC;CACF"}
@@ -0,0 +1,74 @@
1
+ /**
2
+ * MCP Source Service
3
+ * Business logic for managing MCP sources
4
+ */
5
+ import type { AiMcpSource } from '@prisma/client';
6
+ import type { LoggerLike } from './mcp.types.js';
7
+ import type { McpService } from './mcp.service.js';
8
+ import { type CreateSourceDto, type UpdateSourceDto } from './source.repository.js';
9
+ export interface SourceServiceDependencies {
10
+ prisma: unknown;
11
+ logger: LoggerLike;
12
+ mcpService: McpService;
13
+ }
14
+ /**
15
+ * Initialize the Source service with dependencies
16
+ */
17
+ export declare function initSourceService(deps: SourceServiceDependencies): void;
18
+ /**
19
+ * Get the current service dependencies
20
+ */
21
+ export declare function getSourceServiceDeps(): SourceServiceDependencies | null;
22
+ export interface TestConnectionResult {
23
+ success: boolean;
24
+ tools?: number;
25
+ resources?: number;
26
+ error?: string;
27
+ }
28
+ export declare class SourceService {
29
+ private repository;
30
+ constructor();
31
+ private get logger();
32
+ private get mcpService();
33
+ /**
34
+ * Create a new source
35
+ */
36
+ createSource(data: CreateSourceDto): Promise<AiMcpSource>;
37
+ /**
38
+ * Get source by ID
39
+ */
40
+ getSource(id: string): Promise<AiMcpSource | null>;
41
+ /**
42
+ * Get user's sources
43
+ */
44
+ getUserSources(userId: number): Promise<AiMcpSource[]>;
45
+ /**
46
+ * Update a source
47
+ */
48
+ updateSource(id: string, data: UpdateSourceDto): Promise<AiMcpSource>;
49
+ /**
50
+ * Delete a source
51
+ */
52
+ deleteSource(id: string): Promise<void>;
53
+ /**
54
+ * Connect to a source
55
+ */
56
+ connectSource(id: string): Promise<AiMcpSource>;
57
+ /**
58
+ * Disconnect from a source
59
+ */
60
+ disconnectSource(id: string): Promise<AiMcpSource>;
61
+ /**
62
+ * Test source connection
63
+ */
64
+ testConnection(id: string): Promise<TestConnectionResult>;
65
+ /**
66
+ * Build MCP server config from source
67
+ */
68
+ private buildServerConfig;
69
+ /**
70
+ * Connect all user sources
71
+ */
72
+ connectAllUserSources(userId: number): Promise<void>;
73
+ }
74
+ //# sourceMappingURL=source.service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"source.service.d.ts","sourceRoot":"","sources":["../../src/mcp/source.service.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,KAAK,EAAmB,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAClE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAGL,KAAK,eAAe,EACpB,KAAK,eAAe,EACrB,MAAM,wBAAwB,CAAC;AAGhC,MAAM,WAAW,yBAAyB;IACxC,MAAM,EAAE,OAAO,CAAC;IAChB,MAAM,EAAE,UAAU,CAAC;IACnB,UAAU,EAAE,UAAU,CAAC;CACxB;AAID;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,yBAAyB,GAAG,IAAI,CAMvE;AAED;;GAEG;AACH,wBAAgB,oBAAoB,IAAI,yBAAyB,GAAG,IAAI,CAEvE;AAED,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,qBAAa,aAAa;IACxB,OAAO,CAAC,UAAU,CAAmB;;IAWrC,OAAO,KAAK,MAAM,GAEjB;IAED,OAAO,KAAK,UAAU,GAErB;IAED;;OAEG;IACG,YAAY,CAAC,IAAI,EAAE,eAAe,GAAG,OAAO,CAAC,WAAW,CAAC;IAI/D;;OAEG;IACG,SAAS,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC;IAIxD;;OAEG;IACG,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;IAI5D;;OAEG;IACG,YAAY,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,eAAe,GAAG,OAAO,CAAC,WAAW,CAAC;IAI3E;;OAEG;IACG,YAAY,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAW7C;;OAEG;IACG,aAAa,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;IA0BrD;;OAEG;IACG,gBAAgB,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;IAUxD;;OAEG;IACG,cAAc,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,oBAAoB,CAAC;IA+B/D;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAwBzB;;OAEG;IACG,qBAAqB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAgB3D"}
@@ -0,0 +1,181 @@
1
+ /**
2
+ * MCP Source Service
3
+ * Business logic for managing MCP sources
4
+ */
5
+ import { SourceRepository, initSourceRepository, } from './source.repository.js';
6
+ import { getPreset } from './presets/common-sources.js';
7
+ let _deps = null;
8
+ /**
9
+ * Initialize the Source service with dependencies
10
+ */
11
+ export function initSourceService(deps) {
12
+ _deps = deps;
13
+ initSourceRepository({
14
+ prisma: deps.prisma,
15
+ logger: deps.logger,
16
+ });
17
+ }
18
+ /**
19
+ * Get the current service dependencies
20
+ */
21
+ export function getSourceServiceDeps() {
22
+ return _deps;
23
+ }
24
+ export class SourceService {
25
+ repository;
26
+ constructor() {
27
+ if (!_deps) {
28
+ throw new Error('[SourceService] Service not initialized!');
29
+ }
30
+ this.repository = new SourceRepository();
31
+ _deps.logger.info('SourceService initialized');
32
+ }
33
+ get logger() {
34
+ return _deps.logger;
35
+ }
36
+ get mcpService() {
37
+ return _deps.mcpService;
38
+ }
39
+ /**
40
+ * Create a new source
41
+ */
42
+ async createSource(data) {
43
+ return this.repository.create(data);
44
+ }
45
+ /**
46
+ * Get source by ID
47
+ */
48
+ async getSource(id) {
49
+ return this.repository.findById(id);
50
+ }
51
+ /**
52
+ * Get user's sources
53
+ */
54
+ async getUserSources(userId) {
55
+ return this.repository.findByUser(userId);
56
+ }
57
+ /**
58
+ * Update a source
59
+ */
60
+ async updateSource(id, data) {
61
+ return this.repository.update(id, data);
62
+ }
63
+ /**
64
+ * Delete a source
65
+ */
66
+ async deleteSource(id) {
67
+ // Disconnect if connected
68
+ const source = await this.repository.findById(id);
69
+ if (source && source.status === 'CONNECTED') {
70
+ await this.disconnectSource(id);
71
+ }
72
+ await this.repository.delete(id);
73
+ this.logger.info('Source deleted', { id });
74
+ }
75
+ /**
76
+ * Connect to a source
77
+ */
78
+ async connectSource(id) {
79
+ const source = await this.repository.findById(id);
80
+ if (!source) {
81
+ throw new Error(`Source ${id} not found`);
82
+ }
83
+ try {
84
+ // Build config from source
85
+ const config = this.buildServerConfig(source);
86
+ // Connect via MCP service
87
+ await this.mcpService.connectServer(source.id, source.name, 'stdio', // TODO: Support other transports
88
+ config);
89
+ // Update status
90
+ return this.repository.updateStatus(id, 'CONNECTED');
91
+ }
92
+ catch (error) {
93
+ this.logger.error('Failed to connect source', { id, error: String(error) });
94
+ return this.repository.updateStatus(id, 'ERROR', String(error));
95
+ }
96
+ }
97
+ /**
98
+ * Disconnect from a source
99
+ */
100
+ async disconnectSource(id) {
101
+ const source = await this.repository.findById(id);
102
+ if (!source) {
103
+ throw new Error(`Source ${id} not found`);
104
+ }
105
+ await this.mcpService.disconnectServer(id);
106
+ return this.repository.updateStatus(id, 'DISCONNECTED');
107
+ }
108
+ /**
109
+ * Test source connection
110
+ */
111
+ async testConnection(id) {
112
+ try {
113
+ // Connect if not already
114
+ const source = await this.getSource(id);
115
+ if (!source) {
116
+ return { success: false, error: 'Source not found' };
117
+ }
118
+ if (source.status !== 'CONNECTED') {
119
+ await this.connectSource(id);
120
+ }
121
+ // List tools and resources
122
+ const server = this.mcpService.getServer(id);
123
+ if (!server || server.status !== 'connected') {
124
+ return { success: false, error: 'Failed to connect' };
125
+ }
126
+ const tools = await this.mcpService.listAllTools();
127
+ const resources = await this.mcpService.listAllResources();
128
+ return {
129
+ success: true,
130
+ tools: tools.filter(t => t.serverId === id).length,
131
+ resources: resources.filter(r => r.serverId === id).length,
132
+ };
133
+ }
134
+ catch (error) {
135
+ return { success: false, error: String(error) };
136
+ }
137
+ }
138
+ /**
139
+ * Build MCP server config from source
140
+ */
141
+ buildServerConfig(source) {
142
+ const preset = getPreset(source.type);
143
+ const credentials = source.credentials || {};
144
+ const metadata = source.metadata || {};
145
+ if (source.type === 'custom') {
146
+ return {
147
+ command: metadata.command || '',
148
+ args: metadata.args || [],
149
+ env: credentials,
150
+ };
151
+ }
152
+ if (preset) {
153
+ return {
154
+ command: preset.configTemplate.command,
155
+ args: preset.configTemplate.args,
156
+ env: credentials,
157
+ };
158
+ }
159
+ throw new Error(`Unknown source type: ${source.type}`);
160
+ }
161
+ /**
162
+ * Connect all user sources
163
+ */
164
+ async connectAllUserSources(userId) {
165
+ const sources = await this.repository.findByUser(userId);
166
+ for (const source of sources) {
167
+ if (source.status === 'DISCONNECTED' || source.status === 'PENDING') {
168
+ try {
169
+ await this.connectSource(source.id);
170
+ }
171
+ catch (error) {
172
+ this.logger.error('Failed to connect source', {
173
+ id: source.id,
174
+ error: String(error),
175
+ });
176
+ }
177
+ }
178
+ }
179
+ }
180
+ }
181
+ //# sourceMappingURL=source.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"source.service.js","sourceRoot":"","sources":["../../src/mcp/source.service.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EACL,gBAAgB,EAChB,oBAAoB,GAGrB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAQxD,IAAI,KAAK,GAAqC,IAAI,CAAC;AAEnD;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAAC,IAA+B;IAC/D,KAAK,GAAG,IAAI,CAAC;IACb,oBAAoB,CAAC;QACnB,MAAM,EAAE,IAAI,CAAC,MAA8D;QAC3E,MAAM,EAAE,IAAI,CAAC,MAAM;KACpB,CAAC,CAAC;AACL,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,oBAAoB;IAClC,OAAO,KAAK,CAAC;AACf,CAAC;AASD,MAAM,OAAO,aAAa;IAChB,UAAU,CAAmB;IAErC;QACE,IAAI,CAAC,KAAK,EAAE,CAAC;YACX,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAC;QAC9D,CAAC;QAED,IAAI,CAAC,UAAU,GAAG,IAAI,gBAAgB,EAAE,CAAC;QACzC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,2BAA2B,CAAC,CAAC;IACjD,CAAC;IAED,IAAY,MAAM;QAChB,OAAO,KAAM,CAAC,MAAM,CAAC;IACvB,CAAC;IAED,IAAY,UAAU;QACpB,OAAO,KAAM,CAAC,UAAU,CAAC;IAC3B,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,YAAY,CAAC,IAAqB;QACtC,OAAO,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACtC,CAAC;IAED;;OAEG;IACH,KAAK,C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AkB,IAAI,EAAE;gBAC3C,IAAI,EAAG,QAAQ,CAAC,IAAiB,IAAI,EAAE;gBACvC,GAAG,EAAE,WAAW;aACjB,CAAC;QACJ,CAAC;QAED,IAAI,MAAM,EAAE,CAAC;YACX,OAAO;gBACL,OAAO,EAAE,MAAM,CAAC,cAAc,CAAC,OAAO;gBACtC,IAAI,EAAE,MAAM,CAAC,cAAc,CAAC,IAAI;gBAChC,GAAG,EAAE,WAAW;aACjB,CAAC;QACJ,CAAC;QAED,MAAM,IAAI,KAAK,CAAC,wBAAwB,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC;IACzD,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,qBAAqB,CAAC,MAAc;QACxC,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;QAEzD,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;YAC7B,IAAI,MAAM,CAAC,MAAM,KAAK,cAAc,IAAI,MAAM,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;gBACpE,IAAI,CAAC;oBACH,MAAM,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;gBACtC,CAAC;gBAAC,OAAO,KAAK,EAAE,CAAC;oBACf,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,0BAA0B,EAAE;wBAC5C,EAAE,EAAE,MAAM,CAAC,EAAE;wBACb,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC;qBACrB,CAAC,CAAC;gBACL,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;CACF"}
@@ -0,0 +1,45 @@
1
+ /**
2
+ * HTTP Transport
3
+ * Transport implementation for HTTP/SSE-based MCP servers
4
+ *
5
+ * NOTE: This is a placeholder implementation.
6
+ * The MCP SDK's HTTP transport may require additional setup.
7
+ */
8
+ import type { McpServerConfig, LoggerLike } from '../mcp.types.js';
9
+ export interface HttpTransportOptions {
10
+ url: string;
11
+ headers?: Record<string, string>;
12
+ timeout?: number;
13
+ }
14
+ /**
15
+ * HTTP Transport placeholder
16
+ * TODO: Implement when MCP SDK provides stable HTTP transport
17
+ */
18
+ export declare class HttpTransport {
19
+ private readonly url;
20
+ private readonly headers;
21
+ private readonly logger;
22
+ private readonly timeout;
23
+ constructor(config: McpServerConfig, logger: LoggerLike);
24
+ /**
25
+ * Connect to the HTTP MCP server
26
+ */
27
+ connect(): Promise<void>;
28
+ /**
29
+ * Disconnect from the HTTP MCP server
30
+ */
31
+ disconnect(): Promise<void>;
32
+ /**
33
+ * Send a request to the HTTP MCP server
34
+ */
35
+ send(_message: unknown): Promise<unknown>;
36
+ }
37
+ /**
38
+ * Create an HTTP transport for MCP communication
39
+ */
40
+ export declare function createHttpTransport(config: McpServerConfig, logger: LoggerLike): HttpTransport;
41
+ /**
42
+ * Validate HTTP transport configuration
43
+ */
44
+ export declare function validateHttpConfig(config: McpServerConfig): boolean;
45
+ //# sourceMappingURL=http.transport.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http.transport.d.ts","sourceRoot":"","sources":["../../../src/mcp/transports/http.transport.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAEnE,MAAM,WAAW,oBAAoB;IACnC,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;GAGG;AACH,qBAAa,aAAa;IACxB,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAS;IAC7B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAyB;IACjD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAa;IACpC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;gBAErB,MAAM,EAAE,eAAe,EAAE,MAAM,EAAE,UAAU;IAkBvD;;OAEG;IACG,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAK9B;;OAEG;IACG,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAIjC;;OAEG;IACG,IAAI,CAAC,QAAQ,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;CAGhD;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,eAAe,EACvB,MAAM,EAAE,UAAU,GACjB,aAAa,CAEf;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAEnE"}
@@ -0,0 +1,64 @@
1
+ /**
2
+ * HTTP Transport
3
+ * Transport implementation for HTTP/SSE-based MCP servers
4
+ *
5
+ * NOTE: This is a placeholder implementation.
6
+ * The MCP SDK's HTTP transport may require additional setup.
7
+ */
8
+ /**
9
+ * HTTP Transport placeholder
10
+ * TODO: Implement when MCP SDK provides stable HTTP transport
11
+ */
12
+ export class HttpTransport {
13
+ url;
14
+ headers;
15
+ logger;
16
+ timeout;
17
+ constructor(config, logger) {
18
+ if (!config.url) {
19
+ throw new Error('URL is required for HTTP transport');
20
+ }
21
+ this.url = config.url;
22
+ this.headers = config.headers || {};
23
+ this.timeout = config.timeout || 30000;
24
+ this.logger = logger;
25
+ // Log configuration for debugging
26
+ this.logger.debug('HTTP transport configured', {
27
+ url: this.url,
28
+ timeout: this.timeout,
29
+ headerCount: Object.keys(this.headers).length,
30
+ });
31
+ }
32
+ /**
33
+ * Connect to the HTTP MCP server
34
+ */
35
+ async connect() {
36
+ this.logger.warn('HTTP transport is not yet implemented', { url: this.url });
37
+ throw new Error('HTTP transport not yet implemented');
38
+ }
39
+ /**
40
+ * Disconnect from the HTTP MCP server
41
+ */
42
+ async disconnect() {
43
+ // Placeholder
44
+ }
45
+ /**
46
+ * Send a request to the HTTP MCP server
47
+ */
48
+ async send(_message) {
49
+ throw new Error('HTTP transport not yet implemented');
50
+ }
51
+ }
52
+ /**
53
+ * Create an HTTP transport for MCP communication
54
+ */
55
+ export function createHttpTransport(config, logger) {
56
+ return new HttpTransport(config, logger);
57
+ }
58
+ /**
59
+ * Validate HTTP transport configuration
60
+ */
61
+ export function validateHttpConfig(config) {
62
+ return typeof config.url === 'string' && config.url.length > 0;
63
+ }
64
+ //# sourceMappingURL=http.transport.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http.transport.js","sourceRoot":"","sources":["../../../src/mcp/transports/http.transport.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAUH;;;GAGG;AACH,MAAM,OAAO,aAAa;IACP,GAAG,CAAS;IACZ,OAAO,CAAyB;IAChC,MAAM,CAAa;IACnB,OAAO,CAAS;IAEjC,YAAY,MAAuB,EAAE,MAAkB;QACrD,IAAI,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC;YAChB,MAAM,IAAI,KAAK,CAAC,oCAAoC,CAAC,CAAC;QACxD,CAAC;QAED,IAAI,CAAC,GAAG,GAAG,MAAM,CAAC,GAAG,CAAC;QACtB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,IAAI,EAAE,CAAC;QACpC,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,IAAI,KAAK,CAAC;QACvC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QAErB,kCAAkC;QAClC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,2BAA2B,EAAE;YAC7C,GAAG,EAAE,IAAI,CAAC,GAAG;YACb,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,WAAW,EAAE,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,MAAM;SAC9C,CAAC,CAAC;IACL,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,OAAO;QACX,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,uCAAuC,EAAE,EAAE,GAAG,EAAE,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC;QAC7E,MAAM,IAAI,KAAK,CAAC,oCAAoC,CAAC,CAAC;IACxD,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,UAAU;QACd,cAAc;IAChB,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,IAAI,CAAC,QAAiB;QAC1B,MAAM,IAAI,KAAK,CAAC,oCAAoC,CAAC,CAAC;IACxD,CAAC;CACF;AAED;;GAEG;AACH,MAAM,UAAU,mBAAmB,CACjC,MAAuB,EACvB,MAAkB;IAElB,OAAO,IAAI,aAAa,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAC3C,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,kBAAkB,CAAC,MAAuB;IACxD,OAAO,OAAO,MAAM,CAAC,GAAG,KAAK,QAAQ,IAAI,MAAM,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC;AACjE,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * MCP Transports
3
+ * Export all transport implementations
4
+ */
5
+ export * from './stdio.transport.js';
6
+ export * from './http.transport.js';
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/mcp/transports/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * MCP Transports
3
+ * Export all transport implementations
4
+ */
5
+ export * from './stdio.transport.js';
6
+ export * from './http.transport.js';
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/mcp/transports/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC"}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * STDIO Transport
3
+ * Transport implementation for stdio-based MCP servers
4
+ */
5
+ import { StdioClientTransport } from '@modelcontextprotocol/sdk/client/stdio.js';
6
+ import type { McpServerConfig, LoggerLike } from '../mcp.types.js';
7
+ export interface StdioTransportOptions {
8
+ command: string;
9
+ args?: string[];
10
+ env?: Record<string, string>;
11
+ timeout?: number;
12
+ }
13
+ /**
14
+ * Create a STDIO transport for MCP communication
15
+ */
16
+ export declare function createStdioTransport(config: McpServerConfig, logger: LoggerLike): StdioClientTransport;
17
+ /**
18
+ * Validate STDIO transport configuration
19
+ */
20
+ export declare function validateStdioConfig(config: McpServerConfig): boolean;
21
+ //# sourceMappingURL=stdio.transport.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stdio.transport.d.ts","sourceRoot":"","sources":["../../../src/mcp/transports/stdio.transport.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,KAAK,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAEnE,MAAM,WAAW,qBAAqB;IACpC,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC7B,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,eAAe,EACvB,MAAM,EAAE,UAAU,GACjB,oBAAoB,CAetB;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAEpE"}
@@ -0,0 +1,29 @@
1
+ /**
2
+ * STDIO Transport
3
+ * Transport implementation for stdio-based MCP servers
4
+ */
5
+ import { StdioClientTransport } from '@modelcontextprotocol/sdk/client/stdio.js';
6
+ /**
7
+ * Create a STDIO transport for MCP communication
8
+ */
9
+ export function createStdioTransport(config, logger) {
10
+ if (!config.command) {
11
+ throw new Error('Command is required for stdio transport');
12
+ }
13
+ logger.debug('Creating STDIO transport', {
14
+ command: config.command,
15
+ args: config.args,
16
+ });
17
+ return new StdioClientTransport({
18
+ command: config.command,
19
+ args: config.args || [],
20
+ env: config.env,
21
+ });
22
+ }
23
+ /**
24
+ * Validate STDIO transport configuration
25
+ */
26
+ export function validateStdioConfig(config) {
27
+ return typeof config.command === 'string' && config.command.length > 0;
28
+ }
29
+ //# sourceMappingURL=stdio.transport.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stdio.transport.js","sourceRoot":"","sources":["../../../src/mcp/transports/stdio.transport.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AAUjF;;GAEG;AACH,MAAM,UAAU,oBAAoB,CAClC,MAAuB,EACvB,MAAkB;IAElB,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;QACpB,MAAM,IAAI,KAAK,CAAC,yCAAyC,CAAC,CAAC;IAC7D,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,0BAA0B,EAAE;QACvC,OAAO,EAAE,MAAM,CAAC,OAAO;QACvB,IAAI,EAAE,MAAM,CAAC,IAAI;KAClB,CAAC,CAAC;IAEH,OAAO,IAAI,oBAAoB,CAAC;QAC9B,OAAO,EAAE,MAAM,CAAC,OAAO;QACvB,IAAI,EAAE,MAAM,CAAC,IAAI,IAAI,EAAE;QACvB,GAAG,EAAE,MAAM,CAAC,GAAG;KAChB,CAAC,CAAC;AACL,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,mBAAmB,CAAC,MAAuB;IACzD,OAAO,OAAO,MAAM,CAAC,OAAO,KAAK,QAAQ,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC;AACzE,CAAC"}