@angular-modernizer/adapter-mcp 0.3.0 → 1.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 (298) hide show
  1. package/README.md +181 -282
  2. package/dist/cli.js +21 -13
  3. package/dist/core/project-analyzer.d.ts +3 -12
  4. package/dist/core/project-analyzer.js +3 -12
  5. package/dist/index.d.ts +122 -6
  6. package/dist/index.js +49 -5
  7. package/dist/mcp-watcher.d.ts +32 -7
  8. package/dist/mcp-watcher.js +16 -15
  9. package/dist/scan-host/scan-host.d.ts +119 -0
  10. package/dist/scan-host/scan-host.js +376 -0
  11. package/dist/scan-host/scan-protocol.d.ts +35 -0
  12. package/dist/scan-host/scan-protocol.js +6 -0
  13. package/dist/scan-host/scan-worker.d.ts +14 -0
  14. package/dist/scan-host/scan-worker.js +48 -0
  15. package/dist/server/limited-stdio-transport.d.ts +75 -0
  16. package/dist/server/limited-stdio-transport.js +115 -0
  17. package/dist/server/mcp-server.d.ts +20 -18
  18. package/dist/server/mcp-server.js +42 -79
  19. package/dist/server/package-version.d.ts +16 -0
  20. package/dist/server/package-version.js +37 -0
  21. package/dist/server/sdk-server.d.ts +71 -0
  22. package/dist/server/sdk-server.js +113 -0
  23. package/dist/server/tool-registry.d.ts +6 -9
  24. package/dist/server/tool-registry.js +6 -12
  25. package/dist/streaming/progress-store.d.ts +22 -5
  26. package/dist/streaming/progress-store.js +9 -5
  27. package/dist/tools/analyze-build-impact.d.ts +276 -35
  28. package/dist/tools/analyze-build-impact.js +175 -28
  29. package/dist/tools/analyze-core-to-shared.d.ts +176 -16
  30. package/dist/tools/analyze-core-to-shared.js +124 -19
  31. package/dist/tools/analyze-parser-performance.d.ts +209 -15
  32. package/dist/tools/analyze-parser-performance.js +119 -56
  33. package/dist/tools/analyze-project.d.ts +349 -17
  34. package/dist/tools/analyze-project.js +282 -97
  35. package/dist/tools/check-incremental-compatibility.d.ts +74 -12
  36. package/dist/tools/check-incremental-compatibility.js +69 -10
  37. package/dist/tools/collect-feedback.d.ts +225 -21
  38. package/dist/tools/collect-feedback.js +199 -118
  39. package/dist/tools/compare-health.d.ts +413 -0
  40. package/dist/tools/compare-health.js +479 -0
  41. package/dist/tools/extract-libraries.d.ts +200 -24
  42. package/dist/tools/extract-libraries.js +131 -27
  43. package/dist/tools/find-angular-symbol.d.ts +92 -24
  44. package/dist/tools/find-angular-symbol.js +70 -20
  45. package/dist/tools/find-component-hosts.d.ts +603 -27
  46. package/dist/tools/find-component-hosts.js +223 -19
  47. package/dist/tools/find-usages.d.ts +102 -22
  48. package/dist/tools/find-usages.js +81 -21
  49. package/dist/tools/get-bootstrap-execution.d.ts +183 -25
  50. package/dist/tools/get-bootstrap-execution.js +109 -25
  51. package/dist/tools/get-call-graph.d.ts +127 -12
  52. package/dist/tools/get-call-graph.js +84 -19
  53. package/dist/tools/get-operation-progress-tool.d.ts +126 -8
  54. package/dist/tools/get-operation-progress-tool.js +124 -12
  55. package/dist/tools/get-operation-progress.d.ts +27 -1
  56. package/dist/tools/get-operation-progress.js +5 -5
  57. package/dist/tools/helpers/analysis-output.d.ts +182 -0
  58. package/dist/tools/helpers/analysis-output.js +165 -0
  59. package/dist/tools/helpers/batch-kernel.d.ts +14 -0
  60. package/dist/tools/helpers/batch-kernel.js +12 -0
  61. package/dist/tools/helpers/build-schemas.d.ts +36 -0
  62. package/dist/tools/helpers/build-schemas.js +23 -0
  63. package/dist/tools/helpers/citation-file-source.d.ts +10 -0
  64. package/dist/tools/helpers/citation-file-source.js +82 -0
  65. package/dist/tools/helpers/compact-output.d.ts +2 -1
  66. package/dist/tools/helpers/compact-output.js +2 -1
  67. package/dist/tools/helpers/finding-window.d.ts +43 -0
  68. package/dist/tools/helpers/finding-window.js +64 -0
  69. package/dist/tools/helpers/health-delta.d.ts +99 -0
  70. package/dist/tools/helpers/health-delta.js +236 -0
  71. package/dist/tools/helpers/investigation-schemas.d.ts +93 -0
  72. package/dist/tools/helpers/investigation-schemas.js +48 -0
  73. package/dist/tools/helpers/library-imports.d.ts +57 -0
  74. package/dist/tools/helpers/library-imports.js +151 -0
  75. package/dist/tools/helpers/load-source-files.d.ts +30 -0
  76. package/dist/tools/helpers/load-source-files.js +34 -0
  77. package/dist/tools/helpers/output-contract.d.ts +32 -0
  78. package/dist/tools/helpers/output-contract.js +32 -0
  79. package/dist/tools/helpers/platform-root-resolver.d.ts +55 -25
  80. package/dist/tools/helpers/platform-root-resolver.js +75 -48
  81. package/dist/tools/helpers/process-output.d.ts +19 -0
  82. package/dist/tools/helpers/process-output.js +31 -0
  83. package/dist/tools/helpers/project-cache.d.ts +60 -37
  84. package/dist/tools/helpers/project-cache.js +54 -37
  85. package/dist/tools/helpers/project-decorators.d.ts +14 -0
  86. package/dist/tools/helpers/project-decorators.js +22 -0
  87. package/dist/tools/helpers/rule-matcher.js +5 -0
  88. package/dist/tools/helpers/rule-runner.d.ts +25 -13
  89. package/dist/tools/helpers/rule-runner.js +45 -24
  90. package/dist/tools/helpers/scan-cache.d.ts +22 -0
  91. package/dist/tools/helpers/scan-cache.js +34 -0
  92. package/dist/tools/helpers/scan-engine.d.ts +107 -0
  93. package/dist/tools/helpers/scan-engine.js +197 -0
  94. package/dist/tools/helpers/scan-plan.d.ts +5 -2
  95. package/dist/tools/helpers/scan-plan.js +18 -3
  96. package/dist/tools/helpers/scope-paths.d.ts +17 -0
  97. package/dist/tools/helpers/scope-paths.js +32 -0
  98. package/dist/tools/helpers/suggestion-generator.d.ts +9 -13
  99. package/dist/tools/helpers/suggestion-generator.js +0 -12
  100. package/dist/tools/helpers/tool-cache.d.ts +11 -0
  101. package/dist/tools/helpers/tool-cache.js +15 -0
  102. package/dist/tools/helpers/tool-context.d.ts +63 -0
  103. package/dist/tools/helpers/tool-context.js +79 -0
  104. package/dist/tools/helpers/transform-safety.d.ts +40 -0
  105. package/dist/tools/helpers/transform-safety.js +87 -0
  106. package/dist/tools/helpers/validation-output.d.ts +53 -0
  107. package/dist/tools/helpers/validation-output.js +48 -0
  108. package/dist/tools/inspect-form-group.d.ts +262 -24
  109. package/dist/tools/inspect-form-group.js +134 -13
  110. package/dist/tools/inspect-i18n.d.ts +410 -23
  111. package/dist/tools/inspect-i18n.js +213 -13
  112. package/dist/tools/inspect-template.d.ts +260 -22
  113. package/dist/tools/inspect-template.js +174 -13
  114. package/dist/tools/learn-patterns.d.ts +210 -13
  115. package/dist/tools/learn-patterns.js +113 -12
  116. package/dist/tools/list-imports.d.ts +152 -34
  117. package/dist/tools/list-imports.js +124 -18
  118. package/dist/tools/orchestrate-migration.d.ts +159 -14
  119. package/dist/tools/orchestrate-migration.js +147 -20
  120. package/dist/tools/parse-stack-trace.d.ts +78 -21
  121. package/dist/tools/parse-stack-trace.js +44 -7
  122. package/dist/tools/plan-migration.d.ts +395 -26
  123. package/dist/tools/plan-migration.js +173 -22
  124. package/dist/tools/resolve-type.d.ts +57 -9
  125. package/dist/tools/resolve-type.js +49 -12
  126. package/dist/tools/review-feedback.d.ts +214 -16
  127. package/dist/tools/review-feedback.js +142 -57
  128. package/dist/tools/rollback-changes.d.ts +88 -7
  129. package/dist/tools/rollback-changes.js +74 -19
  130. package/dist/tools/run-angular-cli.d.ts +57 -12
  131. package/dist/tools/run-angular-cli.js +76 -13
  132. package/dist/tools/run-build.d.ts +127 -13
  133. package/dist/tools/run-build.js +128 -16
  134. package/dist/tools/run-schematic.d.ts +82 -12
  135. package/dist/tools/run-schematic.js +115 -18
  136. package/dist/tools/scan-all.d.ts +88 -23
  137. package/dist/tools/scan-all.js +161 -220
  138. package/dist/tools/scan-angular.d.ts +60 -19
  139. package/dist/tools/scan-angular.js +100 -141
  140. package/dist/tools/scan-architecture.d.ts +92 -24
  141. package/dist/tools/scan-architecture.js +268 -211
  142. package/dist/tools/scan-solid.d.ts +59 -19
  143. package/dist/tools/scan-solid.js +98 -139
  144. package/dist/tools/search-codebase.d.ts +110 -23
  145. package/dist/tools/search-codebase.js +67 -11
  146. package/dist/tools/server-status.d.ts +392 -26
  147. package/dist/tools/server-status.js +260 -27
  148. package/dist/tools/suggest-improvements.d.ts +105 -10
  149. package/dist/tools/suggest-improvements.js +91 -51
  150. package/dist/tools/trace-output-flow.d.ts +713 -26
  151. package/dist/tools/trace-output-flow.js +396 -33
  152. package/dist/tools/transform-code-batch.d.ts +3 -0
  153. package/dist/tools/transform-code-batch.js +10 -5
  154. package/dist/tools/transform-code.d.ts +402 -18
  155. package/dist/tools/transform-code.js +708 -649
  156. package/dist/tools/validate-before-transform.d.ts +136 -7
  157. package/dist/tools/validate-before-transform.js +65 -9
  158. package/dist/tools/validate-project-compatibility.d.ts +82 -15
  159. package/dist/tools/validate-project-compatibility.js +84 -15
  160. package/dist/tools/validate-transformation.d.ts +243 -8
  161. package/dist/tools/validate-transformation.js +127 -23
  162. package/dist/tools/verify-citations.d.ts +202 -0
  163. package/dist/tools/verify-citations.js +221 -0
  164. package/dist/types.d.ts +78 -11
  165. package/dist/types.js +0 -5
  166. package/dist/utils/format-tool-response.d.ts +22 -59
  167. package/dist/utils/format-tool-response.js +25 -134
  168. package/package.json +31 -20
  169. package/dist/cli.d.ts.map +0 -1
  170. package/dist/cli.js.map +0 -1
  171. package/dist/core/project-analyzer.d.ts.map +0 -1
  172. package/dist/core/project-analyzer.js.map +0 -1
  173. package/dist/index.d.ts.map +0 -1
  174. package/dist/index.js.map +0 -1
  175. package/dist/mcp-watcher.d.ts.map +0 -1
  176. package/dist/mcp-watcher.js.map +0 -1
  177. package/dist/server/json-rpc-handler.d.ts +0 -98
  178. package/dist/server/json-rpc-handler.d.ts.map +0 -1
  179. package/dist/server/json-rpc-handler.js +0 -301
  180. package/dist/server/json-rpc-handler.js.map +0 -1
  181. package/dist/server/mcp-server.d.ts.map +0 -1
  182. package/dist/server/mcp-server.js.map +0 -1
  183. package/dist/server/stdio-guard.d.ts.map +0 -1
  184. package/dist/server/stdio-guard.js.map +0 -1
  185. package/dist/server/tool-registry.d.ts.map +0 -1
  186. package/dist/server/tool-registry.js.map +0 -1
  187. package/dist/streaming/progress-store.d.ts.map +0 -1
  188. package/dist/streaming/progress-store.js.map +0 -1
  189. package/dist/tools/analyze-build-impact.d.ts.map +0 -1
  190. package/dist/tools/analyze-build-impact.js.map +0 -1
  191. package/dist/tools/analyze-core-to-shared.d.ts.map +0 -1
  192. package/dist/tools/analyze-core-to-shared.js.map +0 -1
  193. package/dist/tools/analyze-parser-performance.d.ts.map +0 -1
  194. package/dist/tools/analyze-parser-performance.js.map +0 -1
  195. package/dist/tools/analyze-project.d.ts.map +0 -1
  196. package/dist/tools/analyze-project.js.map +0 -1
  197. package/dist/tools/check-incremental-compatibility.d.ts.map +0 -1
  198. package/dist/tools/check-incremental-compatibility.js.map +0 -1
  199. package/dist/tools/collect-feedback.d.ts.map +0 -1
  200. package/dist/tools/collect-feedback.js.map +0 -1
  201. package/dist/tools/extract-libraries.d.ts.map +0 -1
  202. package/dist/tools/extract-libraries.js.map +0 -1
  203. package/dist/tools/find-angular-symbol.d.ts.map +0 -1
  204. package/dist/tools/find-angular-symbol.js.map +0 -1
  205. package/dist/tools/find-component-hosts.d.ts.map +0 -1
  206. package/dist/tools/find-component-hosts.js.map +0 -1
  207. package/dist/tools/find-usages.d.ts.map +0 -1
  208. package/dist/tools/find-usages.js.map +0 -1
  209. package/dist/tools/get-bootstrap-execution.d.ts.map +0 -1
  210. package/dist/tools/get-bootstrap-execution.js.map +0 -1
  211. package/dist/tools/get-call-graph.d.ts.map +0 -1
  212. package/dist/tools/get-call-graph.js.map +0 -1
  213. package/dist/tools/get-operation-progress-tool.d.ts.map +0 -1
  214. package/dist/tools/get-operation-progress-tool.js.map +0 -1
  215. package/dist/tools/get-operation-progress.d.ts.map +0 -1
  216. package/dist/tools/get-operation-progress.js.map +0 -1
  217. package/dist/tools/helpers/compact-output.d.ts.map +0 -1
  218. package/dist/tools/helpers/compact-output.js.map +0 -1
  219. package/dist/tools/helpers/feedback-analyzer.d.ts.map +0 -1
  220. package/dist/tools/helpers/feedback-analyzer.js.map +0 -1
  221. package/dist/tools/helpers/find-ts-config.d.ts.map +0 -1
  222. package/dist/tools/helpers/find-ts-config.js.map +0 -1
  223. package/dist/tools/helpers/platform-root-resolver.d.ts.map +0 -1
  224. package/dist/tools/helpers/platform-root-resolver.js.map +0 -1
  225. package/dist/tools/helpers/project-cache.d.ts.map +0 -1
  226. package/dist/tools/helpers/project-cache.js.map +0 -1
  227. package/dist/tools/helpers/rule-matcher.d.ts.map +0 -1
  228. package/dist/tools/helpers/rule-matcher.js.map +0 -1
  229. package/dist/tools/helpers/rule-runner.d.ts.map +0 -1
  230. package/dist/tools/helpers/rule-runner.js.map +0 -1
  231. package/dist/tools/helpers/scan-plan.d.ts.map +0 -1
  232. package/dist/tools/helpers/scan-plan.js.map +0 -1
  233. package/dist/tools/helpers/stack-frame-file-index.d.ts.map +0 -1
  234. package/dist/tools/helpers/stack-frame-file-index.js.map +0 -1
  235. package/dist/tools/helpers/suggestion-generator.d.ts.map +0 -1
  236. package/dist/tools/helpers/suggestion-generator.js.map +0 -1
  237. package/dist/tools/inspect-form-group.d.ts.map +0 -1
  238. package/dist/tools/inspect-form-group.js.map +0 -1
  239. package/dist/tools/inspect-i18n.d.ts.map +0 -1
  240. package/dist/tools/inspect-i18n.js.map +0 -1
  241. package/dist/tools/inspect-template.d.ts.map +0 -1
  242. package/dist/tools/inspect-template.js.map +0 -1
  243. package/dist/tools/learn-patterns.d.ts.map +0 -1
  244. package/dist/tools/learn-patterns.js.map +0 -1
  245. package/dist/tools/list-imports.d.ts.map +0 -1
  246. package/dist/tools/list-imports.js.map +0 -1
  247. package/dist/tools/orchestrate-migration.d.ts.map +0 -1
  248. package/dist/tools/orchestrate-migration.js.map +0 -1
  249. package/dist/tools/parse-stack-trace.d.ts.map +0 -1
  250. package/dist/tools/parse-stack-trace.js.map +0 -1
  251. package/dist/tools/plan-migration.d.ts.map +0 -1
  252. package/dist/tools/plan-migration.js.map +0 -1
  253. package/dist/tools/resolve-type.d.ts.map +0 -1
  254. package/dist/tools/resolve-type.js.map +0 -1
  255. package/dist/tools/review-feedback.d.ts.map +0 -1
  256. package/dist/tools/review-feedback.js.map +0 -1
  257. package/dist/tools/rollback-changes.d.ts.map +0 -1
  258. package/dist/tools/rollback-changes.js.map +0 -1
  259. package/dist/tools/run-angular-cli.d.ts.map +0 -1
  260. package/dist/tools/run-angular-cli.js.map +0 -1
  261. package/dist/tools/run-build.d.ts.map +0 -1
  262. package/dist/tools/run-build.js.map +0 -1
  263. package/dist/tools/run-schematic.d.ts.map +0 -1
  264. package/dist/tools/run-schematic.js.map +0 -1
  265. package/dist/tools/scan-all.d.ts.map +0 -1
  266. package/dist/tools/scan-all.js.map +0 -1
  267. package/dist/tools/scan-angular.d.ts.map +0 -1
  268. package/dist/tools/scan-angular.js.map +0 -1
  269. package/dist/tools/scan-architecture.d.ts.map +0 -1
  270. package/dist/tools/scan-architecture.js.map +0 -1
  271. package/dist/tools/scan-solid.d.ts.map +0 -1
  272. package/dist/tools/scan-solid.js.map +0 -1
  273. package/dist/tools/search-codebase.d.ts.map +0 -1
  274. package/dist/tools/search-codebase.js.map +0 -1
  275. package/dist/tools/server-status.d.ts.map +0 -1
  276. package/dist/tools/server-status.js.map +0 -1
  277. package/dist/tools/shared/scan-types.d.ts +0 -200
  278. package/dist/tools/shared/scan-types.d.ts.map +0 -1
  279. package/dist/tools/shared/scan-types.js +0 -7
  280. package/dist/tools/shared/scan-types.js.map +0 -1
  281. package/dist/tools/suggest-improvements.d.ts.map +0 -1
  282. package/dist/tools/suggest-improvements.js.map +0 -1
  283. package/dist/tools/trace-output-flow.d.ts.map +0 -1
  284. package/dist/tools/trace-output-flow.js.map +0 -1
  285. package/dist/tools/transform-code-batch.d.ts.map +0 -1
  286. package/dist/tools/transform-code-batch.js.map +0 -1
  287. package/dist/tools/transform-code.d.ts.map +0 -1
  288. package/dist/tools/transform-code.js.map +0 -1
  289. package/dist/tools/validate-before-transform.d.ts.map +0 -1
  290. package/dist/tools/validate-before-transform.js.map +0 -1
  291. package/dist/tools/validate-project-compatibility.d.ts.map +0 -1
  292. package/dist/tools/validate-project-compatibility.js.map +0 -1
  293. package/dist/tools/validate-transformation.d.ts.map +0 -1
  294. package/dist/tools/validate-transformation.js.map +0 -1
  295. package/dist/types.d.ts.map +0 -1
  296. package/dist/types.js.map +0 -1
  297. package/dist/utils/format-tool-response.d.ts.map +0 -1
  298. package/dist/utils/format-tool-response.js.map +0 -1
@@ -1,21 +1,25 @@
1
- /**
2
- * @angular-modernizer/adapter-mcp - MCP Server
3
- *
4
- * Main MCP server implementation that coordinates tool registry,
5
- * JSON-RPC handling, and stdio communication.
6
- */
1
+ import { type ProtocolInfo } from './sdk-server.js';
2
+ import { type ResponseStats } from './limited-stdio-transport.js';
7
3
  import { type MCPTool, type MCPServerConfig } from '../types.js';
8
- import { type ResponseStats } from './json-rpc-handler.js';
9
4
  /** Runtime figures for the `server-status` tool. */
10
5
  export interface ServerRuntimeStats {
6
+ /** Start time of the server (ISO 8601). */
11
7
  startedAt: string;
8
+ /** Number of registered tools. */
12
9
  toolCount: number;
10
+ /** Response sizes measured by the stdio transport. */
13
11
  responses: ResponseStats;
12
+ /** Era and protocol revision of the connection, once a client spoke. */
13
+ protocol: ProtocolInfo;
14
14
  }
15
15
  /**
16
16
  * Main MCP server class that handles the complete MCP protocol lifecycle.
17
17
  *
18
18
  * @remarks
19
+ * Owns the stdio server lifecycle. The protocol is served by the MCP SDK
20
+ * (`serveStdio`, both eras) over a size-limited stdio transport; the tools
21
+ * come from the tool registry.
22
+ *
19
23
  * The stdio server ends when the client goes away: stdin `end`, `close` or
20
24
  * `error`, a failing stdout (EPIPE), SIGINT, SIGTERM, SIGHUP, or its parent
21
25
  * process disappearing. The last check covers clients that die while another
@@ -23,11 +27,11 @@ export interface ServerRuntimeStats {
23
27
  */
24
28
  export declare class MCPServer {
25
29
  private readonly registry;
26
- private readonly handler;
27
30
  private readonly config;
31
+ private readonly protocol;
32
+ private transport;
33
+ private handle;
28
34
  private running;
29
- /** Accumulates incomplete JSON-RPC lines across stdin data events (BUG-6). */
30
- private inputBuffer;
31
35
  private shuttingDown;
32
36
  private parentWatch;
33
37
  private startedAt;
@@ -53,9 +57,13 @@ export declare class MCPServer {
53
57
  * Get server statistics.
54
58
  */
55
59
  getStats(): {
60
+ /** Whether `start()` ran and the server has not stopped. */
56
61
  running: boolean;
62
+ /** Registered tools. */
57
63
  tools: {
64
+ /** Number of registered tools. */
58
65
  totalTools: number;
66
+ /** Names of the registered tools. */
59
67
  toolNames: string[];
60
68
  };
61
69
  };
@@ -64,7 +72,8 @@ export declare class MCPServer {
64
72
  */
65
73
  getRuntimeStats(): ServerRuntimeStats;
66
74
  /**
67
- * Ends the process once: stops the watcher, flushes stdout/stderr and
75
+ * Ends the process once: closes the SDK connection (requests in flight are
76
+ * aborted, not answered), stops the watcher, flushes stdout/stderr and
68
77
  * exits. A dead pipe must not block the exit, so the flush is capped.
69
78
  */
70
79
  private shutdown;
@@ -78,13 +87,6 @@ export declare class MCPServer {
78
87
  * Get all registered tools as a map.
79
88
  */
80
89
  getToolsMap(): Map<string, MCPTool>;
81
- /**
82
- * Handle incoming data from stdin.
83
- * Accumulates chunks in a buffer and processes only complete newline-terminated
84
- * JSON-RPC lines. The remainder of an incomplete line is carried forward to the
85
- * next data event (BUG-6).
86
- */
87
- private handleInput;
88
90
  /**
89
91
  * Log a message based on configured log level.
90
92
  */
@@ -1,23 +1,13 @@
1
- /**
2
- * @angular-modernizer/adapter-mcp - MCP Server
3
- *
4
- * Main MCP server implementation that coordinates tool registry,
5
- * JSON-RPC handling, and stdio communication.
6
- */
1
+ import { serveStdio } from '@modelcontextprotocol/server/stdio';
7
2
  import { ToolRegistry } from './tool-registry.js';
8
- import { JsonRpcHandler } from './json-rpc-handler.js';
9
- import { startMCPWatcher, stopMCPWatcher, getMCPWatcher, } from '../mcp-watcher.js';
3
+ import { createServerFactory } from './sdk-server.js';
4
+ import { LimitedStdioTransport } from './limited-stdio-transport.js';
5
+ import { isDebugEnabled, startMCPWatcher, stopMCPWatcher, getMCPWatcher, } from '../mcp-watcher.js';
10
6
  /**
11
- * Write debug message to MCP log file via watcher
7
+ * Write debug message to the MCP log file; only with the debug watcher on.
12
8
  */
13
9
  function debugLog(message) {
14
- const watcher = getMCPWatcher();
15
- if (watcher) {
16
- watcher.log('DEBUG', message);
17
- }
18
- else {
19
- console.error(`[DEBUG] ${message}`);
20
- }
10
+ getMCPWatcher()?.log('DEBUG', message);
21
11
  }
22
12
  /** Longest wait for stdout/stderr to flush before a shutdown exits anyway. */
23
13
  const SHUTDOWN_FLUSH_TIMEOUT_MS = 1000;
@@ -25,6 +15,10 @@ const SHUTDOWN_FLUSH_TIMEOUT_MS = 1000;
25
15
  * Main MCP server class that handles the complete MCP protocol lifecycle.
26
16
  *
27
17
  * @remarks
18
+ * Owns the stdio server lifecycle. The protocol is served by the MCP SDK
19
+ * (`serveStdio`, both eras) over a size-limited stdio transport; the tools
20
+ * come from the tool registry.
21
+ *
28
22
  * The stdio server ends when the client goes away: stdin `end`, `close` or
29
23
  * `error`, a failing stdout (EPIPE), SIGINT, SIGTERM, SIGHUP, or its parent
30
24
  * process disappearing. The last check covers clients that die while another
@@ -32,11 +26,11 @@ const SHUTDOWN_FLUSH_TIMEOUT_MS = 1000;
32
26
  */
33
27
  export class MCPServer {
34
28
  registry;
35
- handler;
36
29
  config;
30
+ protocol = {};
31
+ transport;
32
+ handle;
37
33
  running = false;
38
- /** Accumulates incomplete JSON-RPC lines across stdin data events (BUG-6). */
39
- inputBuffer = '';
40
34
  shuttingDown = false;
41
35
  parentWatch;
42
36
  startedAt;
@@ -50,7 +44,6 @@ export class MCPServer {
50
44
  ...config,
51
45
  };
52
46
  this.registry = new ToolRegistry();
53
- this.handler = new JsonRpcHandler(this.registry);
54
47
  }
55
48
  /**
56
49
  * Register an MCP tool with the server.
@@ -69,20 +62,22 @@ export class MCPServer {
69
62
  this.running = true;
70
63
  this.startedAt = new Date();
71
64
  this.log('info', 'MCP server starting...');
72
- // Start MCP Watcher for debugging (3 second heartbeat, health check on port 9999)
73
- startMCPWatcher('./mcp-server.log', 3000, 9999);
74
- this.log('info', 'MCP Watcher started (heartbeat: 3s, health check: http://localhost:9999)');
75
- debugLog('MCP start() called, setting up stdio handlers');
76
- // Set up stdio handlers
77
- process.stdin.setEncoding('utf8');
78
- debugLog('MCP stdin encoding set to utf8');
79
- process.stdin.on('data', (chunk) => {
80
- debugLog(`MCP stdin data event - chunk length: ${chunk.length}, first 200 chars: ${chunk.substring(0, 200)}`);
81
- this.handleInput(chunk).catch((error) => {
82
- this.log('error', 'Error handling input:', error);
83
- });
65
+ // Debug log ./mcp-server.log and the health check on :9999 write into the
66
+ // client's working directory and open a port; opt-in only
67
+ if (isDebugEnabled()) {
68
+ startMCPWatcher('./mcp-server.log', 3000, 9999);
69
+ this.log('info', 'MCP Watcher started (heartbeat: 3s, health check: http://localhost:9999)');
70
+ }
71
+ const transport = new LimitedStdioTransport();
72
+ this.transport = transport;
73
+ this.handle = serveStdio(createServerFactory(this.registry, {
74
+ onToolCall: (id, tool) => transport.trackToolCall(id, tool),
75
+ protocol: this.protocol,
76
+ }), {
77
+ transport,
78
+ onerror: (error) => this.log('error', 'MCP protocol error:', error.message),
84
79
  });
85
- debugLog('MCP stdin data handler registered');
80
+ debugLog('MCP serveStdio started');
86
81
  process.stdin.on('end', () => this.shutdown('stdin ended'));
87
82
  process.stdin.on('close', () => this.shutdown('stdin closed'));
88
83
  process.stdin.on('error', (error) => this.shutdown(`stdin error: ${error.message}`));
@@ -100,6 +95,9 @@ export class MCPServer {
100
95
  */
101
96
  stop() {
102
97
  this.stopParentWatch();
98
+ this.handle?.close().catch(() => {
99
+ // Already closed
100
+ });
103
101
  stopMCPWatcher();
104
102
  this.running = false;
105
103
  this.log('info', 'MCP server stopped');
@@ -126,11 +124,17 @@ export class MCPServer {
126
124
  return {
127
125
  startedAt: (this.startedAt ?? new Date()).toISOString(),
128
126
  toolCount: this.registry.getStats().totalTools,
129
- responses: this.handler.getResponseStats(),
127
+ responses: this.transport?.getResponseStats() ?? {
128
+ count: 0,
129
+ totalBytes: 0,
130
+ oversized: 0,
131
+ },
132
+ protocol: { ...this.protocol },
130
133
  };
131
134
  }
132
135
  /**
133
- * Ends the process once: stops the watcher, flushes stdout/stderr and
136
+ * Ends the process once: closes the SDK connection (requests in flight are
137
+ * aborted, not answered), stops the watcher, flushes stdout/stderr and
134
138
  * exits. A dead pipe must not block the exit, so the flush is capped.
135
139
  */
136
140
  shutdown(reason) {
@@ -140,6 +144,9 @@ export class MCPServer {
140
144
  this.shuttingDown = true;
141
145
  this.log('info', `MCP server shutting down (${reason})`);
142
146
  this.stopParentWatch();
147
+ this.handle?.close().catch(() => {
148
+ // The transport may already be gone (EPIPE, stdin closed)
149
+ });
143
150
  stopMCPWatcher();
144
151
  this.running = false;
145
152
  setTimeout(() => process.exit(0), SHUTDOWN_FLUSH_TIMEOUT_MS).unref();
@@ -178,50 +185,6 @@ export class MCPServer {
178
185
  getToolsMap() {
179
186
  return this.registry.getAllToolsMap();
180
187
  }
181
- /**
182
- * Handle incoming data from stdin.
183
- * Accumulates chunks in a buffer and processes only complete newline-terminated
184
- * JSON-RPC lines. The remainder of an incomplete line is carried forward to the
185
- * next data event (BUG-6).
186
- */
187
- async handleInput(chunk) {
188
- this.inputBuffer += chunk;
189
- // Split on newlines; the last element is either empty (complete line) or an
190
- // incomplete fragment that must be held back until more data arrives.
191
- const lines = this.inputBuffer.split('\n');
192
- // Keep the trailing incomplete fragment in the buffer.
193
- this.inputBuffer = lines.pop() ?? '';
194
- for (const line of lines) {
195
- if (line.trim()) {
196
- try {
197
- debugLog(`MCP handleInput: Received line (first 150 chars): ${line.trim().substring(0, 150)}`);
198
- const response = await this.handler.processMessage(line.trim());
199
- debugLog(`MCP handleInput: processMessage returned ${response ? `response with id=${response.id}` : 'NULL'}`);
200
- if (response) {
201
- debugLog(`MCP handleInput: Calling sendResponse with id=${response.id}`);
202
- await this.handler.sendResponse(response);
203
- }
204
- else {
205
- debugLog('MCP handleInput: No response to send (processMessage returned null)');
206
- }
207
- }
208
- catch (error) {
209
- this.log('error', 'Error processing message:', error);
210
- // Send error response
211
- const errorResponse = {
212
- jsonrpc: '2.0',
213
- id: null,
214
- error: {
215
- code: -32603,
216
- message: 'Internal error',
217
- data: error instanceof Error ? error.message : String(error),
218
- },
219
- };
220
- await this.handler.sendResponse(errorResponse);
221
- }
222
- }
223
- }
224
- }
225
188
  /**
226
189
  * Log a message based on configured log level.
227
190
  */
@@ -0,0 +1,16 @@
1
+ /**
2
+ * @angular-modernizer/adapter-mcp - Package version
3
+ *
4
+ * The version the server reports in `initialize` and `server-status`, read
5
+ * from this package's package.json so it cannot drift from the release.
6
+ */
7
+ /**
8
+ * Walks up from `startDir` to the package.json named `PACKAGE_NAME` and
9
+ * returns its version. The walk covers both `dist/server/` at runtime and
10
+ * `src/` under Jest, where `import.meta.url` is mocked to `src/index.ts`.
11
+ * Returns `'0.0.0'` when no matching package.json is found.
12
+ */
13
+ export declare function readPackageVersion(startDir: string): string;
14
+ /** Version of `@angular-modernizer/adapter-mcp`, resolved once at load. */
15
+ export declare const PACKAGE_VERSION: string;
16
+ //# sourceMappingURL=package-version.d.ts.map
@@ -0,0 +1,37 @@
1
+ /**
2
+ * @angular-modernizer/adapter-mcp - Package version
3
+ *
4
+ * The version the server reports in `initialize` and `server-status`, read
5
+ * from this package's package.json so it cannot drift from the release.
6
+ */
7
+ import { existsSync, readFileSync } from 'node:fs';
8
+ import { dirname, join } from 'node:path';
9
+ import { fileURLToPath } from 'node:url';
10
+ const PACKAGE_NAME = '@angular-modernizer/adapter-mcp';
11
+ /**
12
+ * Walks up from `startDir` to the package.json named `PACKAGE_NAME` and
13
+ * returns its version. The walk covers both `dist/server/` at runtime and
14
+ * `src/` under Jest, where `import.meta.url` is mocked to `src/index.ts`.
15
+ * Returns `'0.0.0'` when no matching package.json is found.
16
+ */
17
+ export function readPackageVersion(startDir) {
18
+ let dir = startDir;
19
+ for (;;) {
20
+ const candidate = join(dir, 'package.json');
21
+ if (existsSync(candidate)) {
22
+ const manifest = JSON.parse(readFileSync(candidate, 'utf8'));
23
+ if (manifest.name === PACKAGE_NAME &&
24
+ typeof manifest.version === 'string') {
25
+ return manifest.version;
26
+ }
27
+ }
28
+ const parent = dirname(dir);
29
+ if (parent === dir) {
30
+ return '0.0.0';
31
+ }
32
+ dir = parent;
33
+ }
34
+ }
35
+ /** Version of `@angular-modernizer/adapter-mcp`, resolved once at load. */
36
+ export const PACKAGE_VERSION = readPackageVersion(dirname(fileURLToPath(import.meta.url)));
37
+ //# sourceMappingURL=package-version.js.map
@@ -0,0 +1,71 @@
1
+ /**
2
+ * @angular-modernizer/adapter-mcp - SDK server factory
3
+ *
4
+ * Builds the `McpServer` instances `serveStdio` asks for: one per connection
5
+ * (plus a discarded probe for `server/discover`). Every registered `MCPTool`
6
+ * is exposed through `registerTool` with its JSON Schemas as they are; the
7
+ * arguments are validated against the input schema (Ajv, JSON Schema 2020-12)
8
+ * before the tool runs, so invalid arguments come back as an `isError` result
9
+ * without reaching the tool. A tool with an `outputSchema` has its
10
+ * `structuredContent` validated the same way; the SDK replaces a result that
11
+ * does not match with an `isError` result (results that already report
12
+ * `isError` are not checked). The response format is the one of
13
+ * `ToolRegistry.executeTool`.
14
+ *
15
+ * Every call gets the request's abort signal (`notifications/cancelled`; the
16
+ * SDK sends no response for an aborted request) and, when the client sent a
17
+ * `progressToken`, a throttled `progress` that sends `notifications/progress`.
18
+ */
19
+ import { type McpServerFactory, type RequestId, type jsonSchemaValidator } from '@modelcontextprotocol/server';
20
+ import { type ToolRegistry } from './tool-registry.js';
21
+ import { type ToolContext } from '../types.js';
22
+ /** Protocol era of a connection: 2025 handshake or 2026-07-28 envelope. */
23
+ export type ProtocolEra = 'legacy' | 'modern';
24
+ /** What the client negotiated, as far as it is known. */
25
+ export interface ProtocolInfo {
26
+ /** Protocol era of the connection. */
27
+ era?: ProtocolEra;
28
+ /** Protocol revision the last request was served with. */
29
+ version?: string;
30
+ }
31
+ export interface SdkServerHooks {
32
+ /** Called with the request id when a tool call starts. */
33
+ onToolCall?: (id: RequestId, tool: string) => void;
34
+ /** Updated on `initialize` and on every tool call. */
35
+ protocol?: ProtocolInfo;
36
+ }
37
+ /**
38
+ * Validates tool arguments. One instance for all connections: Ajv caches the
39
+ * compiled schema per schema object, so every input schema compiles once.
40
+ * Defaults of the SDK: `strict: false`, `allErrors: true`, formats registered.
41
+ */
42
+ export declare const INPUT_VALIDATOR: jsonSchemaValidator;
43
+ /**
44
+ * Validates `structuredContent` against the output schema, same settings as
45
+ * the input validator. Output schemas leave objects open, so a new result
46
+ * field never fails; a missing required field or a wrong type does.
47
+ */
48
+ export declare const OUTPUT_VALIDATOR: jsonSchemaValidator;
49
+ /**
50
+ * Factory for `serveStdio`: registers every tool of `registry` on a fresh
51
+ * `McpServer` for the era the SDK asks for.
52
+ */
53
+ export declare function createServerFactory(registry: ToolRegistry, hooks?: SdkServerHooks): McpServerFactory;
54
+ /** The parts of the SDK request context a tool call needs. */
55
+ interface RequestContext {
56
+ signal: AbortSignal;
57
+ _meta?: {
58
+ progressToken?: string | number;
59
+ };
60
+ notify: (notification: {
61
+ method: 'notifications/progress';
62
+ params: Record<string, unknown>;
63
+ }) => Promise<void>;
64
+ }
65
+ /**
66
+ * Tool context of one request: its abort signal and, only with a
67
+ * `progressToken`, a throttled sender of `notifications/progress`.
68
+ */
69
+ export declare function toolContext(req: RequestContext): ToolContext;
70
+ export {};
71
+ //# sourceMappingURL=sdk-server.d.ts.map
@@ -0,0 +1,113 @@
1
+ /**
2
+ * @angular-modernizer/adapter-mcp - SDK server factory
3
+ *
4
+ * Builds the `McpServer` instances `serveStdio` asks for: one per connection
5
+ * (plus a discarded probe for `server/discover`). Every registered `MCPTool`
6
+ * is exposed through `registerTool` with its JSON Schemas as they are; the
7
+ * arguments are validated against the input schema (Ajv, JSON Schema 2020-12)
8
+ * before the tool runs, so invalid arguments come back as an `isError` result
9
+ * without reaching the tool. A tool with an `outputSchema` has its
10
+ * `structuredContent` validated the same way; the SDK replaces a result that
11
+ * does not match with an `isError` result (results that already report
12
+ * `isError` are not checked). The response format is the one of
13
+ * `ToolRegistry.executeTool`.
14
+ *
15
+ * Every call gets the request's abort signal (`notifications/cancelled`; the
16
+ * SDK sends no response for an aborted request) and, when the client sent a
17
+ * `progressToken`, a throttled `progress` that sends `notifications/progress`.
18
+ */
19
+ import { McpServer, fromJsonSchema, } from '@modelcontextprotocol/server';
20
+ import { AjvJsonSchemaValidator } from '@modelcontextprotocol/server/validators/ajv';
21
+ import { PACKAGE_VERSION } from './package-version.js';
22
+ import { throttleProgress } from '../tools/helpers/tool-context.js';
23
+ /**
24
+ * Validates tool arguments. One instance for all connections: Ajv caches the
25
+ * compiled schema per schema object, so every input schema compiles once.
26
+ * Defaults of the SDK: `strict: false`, `allErrors: true`, formats registered.
27
+ */
28
+ export const INPUT_VALIDATOR = new AjvJsonSchemaValidator();
29
+ /**
30
+ * Validates `structuredContent` against the output schema, same settings as
31
+ * the input validator. Output schemas leave objects open, so a new result
32
+ * field never fails; a missing required field or a wrong type does.
33
+ */
34
+ export const OUTPUT_VALIDATOR = new AjvJsonSchemaValidator();
35
+ /**
36
+ * Factory for `serveStdio`: registers every tool of `registry` on a fresh
37
+ * `McpServer` for the era the SDK asks for.
38
+ */
39
+ export function createServerFactory(registry, hooks = {}) {
40
+ return ({ era }) => {
41
+ const mcp = new McpServer({ name: 'angular-modernizer', version: PACKAGE_VERSION });
42
+ const noteProtocol = () => {
43
+ if (hooks.protocol !== undefined) {
44
+ hooks.protocol.era = era;
45
+ hooks.protocol.version = mcp.server.getNegotiatedProtocolVersion();
46
+ }
47
+ };
48
+ mcp.server.oninitialized = () => {
49
+ noteProtocol();
50
+ console.error('[MCP] Server initialized and ready');
51
+ };
52
+ for (const tool of registry.getAllTools()) {
53
+ mcp.registerTool(tool.name, {
54
+ ...(tool.title === undefined ? {} : { title: tool.title }),
55
+ description: tool.description,
56
+ inputSchema: fromJsonSchema(tool.inputSchema, INPUT_VALIDATOR),
57
+ ...(tool.outputSchema === undefined
58
+ ? {}
59
+ : {
60
+ outputSchema: fromJsonSchema(tool.outputSchema, OUTPUT_VALIDATOR),
61
+ }),
62
+ ...(tool.annotations === undefined ? {} : { annotations: tool.annotations }),
63
+ }, async (args, ctx) => {
64
+ hooks.onToolCall?.(ctx.mcpReq.id, tool.name);
65
+ noteProtocol();
66
+ try {
67
+ return (await registry.executeTool(tool.name, (args ?? {}), toolContext(ctx.mcpReq)));
68
+ }
69
+ catch (error) {
70
+ const message = error instanceof Error ? error.message : 'Tool execution failed';
71
+ return {
72
+ content: [{ type: 'text', text: `Tool execution error: ${message}` }],
73
+ isError: true,
74
+ };
75
+ }
76
+ });
77
+ }
78
+ return mcp;
79
+ };
80
+ }
81
+ /**
82
+ * Tool context of one request: its abort signal and, only with a
83
+ * `progressToken`, a throttled sender of `notifications/progress`.
84
+ */
85
+ export function toolContext(req) {
86
+ const token = req._meta?.progressToken;
87
+ if (token === undefined) {
88
+ return { signal: req.signal };
89
+ }
90
+ let lastProgress = -1;
91
+ const progress = throttleProgress((value, total, message) => {
92
+ // The spec requires a growing value; a tool that restarts a phase must not go back.
93
+ if (value <= lastProgress || req.signal.aborted) {
94
+ return;
95
+ }
96
+ lastProgress = value;
97
+ req
98
+ .notify({
99
+ method: 'notifications/progress',
100
+ params: {
101
+ progressToken: token,
102
+ progress: value,
103
+ ...(total === undefined ? {} : { total }),
104
+ ...(message === undefined ? {} : { message }),
105
+ },
106
+ })
107
+ .catch((error) => {
108
+ console.error('[MCP] Progress notification failed:', error);
109
+ });
110
+ });
111
+ return { signal: req.signal, progress };
112
+ }
113
+ //# sourceMappingURL=sdk-server.js.map
@@ -1,12 +1,6 @@
1
+ import { type MCPTool, type ToolContext } from '../types.js';
1
2
  /**
2
- * @angular-modernizer/adapter-mcp - Tool Registry
3
- *
4
- * Central registry for MCP tools. Manages tool registration,
5
- * discovery, and execution coordination.
6
- */
7
- import { type MCPTool } from '../types.js';
8
- /**
9
- * Registry for MCP tools with registration and discovery capabilities.
3
+ * Central registry for MCP tools: registration, discovery and execution.
10
4
  */
11
5
  export declare class ToolRegistry {
12
6
  private readonly tools;
@@ -47,10 +41,11 @@ export declare class ToolRegistry {
47
41
  * Execute a tool by name with given arguments.
48
42
  * @param name - Tool name
49
43
  * @param args - Tool arguments
44
+ * @param ctx - Cancellation and progress of the request
50
45
  * @returns Tool execution result in MCP format
51
46
  * @throws Error if tool not found
52
47
  */
53
- executeTool(name: string, args: Record<string, unknown>): Promise<unknown>;
48
+ executeTool(name: string, args: Record<string, unknown>, ctx?: ToolContext): Promise<unknown>;
54
49
  /**
55
50
  * Unregister a tool.
56
51
  * @param name - Tool name
@@ -66,7 +61,9 @@ export declare class ToolRegistry {
66
61
  * @returns Statistics about registered tools
67
62
  */
68
63
  getStats(): {
64
+ /** Number of registered tools. */
69
65
  totalTools: number;
66
+ /** Names of the registered tools. */
70
67
  toolNames: string[];
71
68
  };
72
69
  }
@@ -1,12 +1,6 @@
1
+ import { formatStructuredToolResponse } from '../utils/format-tool-response.js';
1
2
  /**
2
- * @angular-modernizer/adapter-mcp - Tool Registry
3
- *
4
- * Central registry for MCP tools. Manages tool registration,
5
- * discovery, and execution coordination.
6
- */
7
- import { formatToolResponse } from '../utils/format-tool-response.js';
8
- /**
9
- * Registry for MCP tools with registration and discovery capabilities.
3
+ * Central registry for MCP tools: registration, discovery and execution.
10
4
  */
11
5
  export class ToolRegistry {
12
6
  tools = new Map();
@@ -62,17 +56,17 @@ export class ToolRegistry {
62
56
  * Execute a tool by name with given arguments.
63
57
  * @param name - Tool name
64
58
  * @param args - Tool arguments
59
+ * @param ctx - Cancellation and progress of the request
65
60
  * @returns Tool execution result in MCP format
66
61
  * @throws Error if tool not found
67
62
  */
68
- async executeTool(name, args) {
63
+ async executeTool(name, args, ctx) {
69
64
  const tool = this.getTool(name);
70
65
  if (!tool) {
71
66
  throw new Error(`Unknown tool: ${name}`);
72
67
  }
73
- const result = await tool.execute(args);
74
- // Format response according to MCP spec with human-readable summary
75
- return formatToolResponse(name, result);
68
+ const result = (await tool.execute(args, ctx));
69
+ return formatStructuredToolResponse(result);
76
70
  }
77
71
  /**
78
72
  * Unregister a tool.
@@ -1,28 +1,40 @@
1
- /**
2
- * @angular-modernizer/adapter-mcp - Progress Store
3
- */
4
1
  import type { StreamingProgressEvent } from '@angular-modernizer/core';
5
2
  /**
6
3
  * Metadata for tracking operation lifecycle
7
4
  */
8
5
  export interface OperationMetadata {
6
+ /** Operation id returned to the client. */
9
7
  readonly operationId: string;
8
+ /** Kind of operation. */
10
9
  readonly type: 'transformation' | 'analysis';
10
+ /** Start time in milliseconds since the epoch. */
11
11
  readonly startTime: number;
12
+ /** Lifecycle status; starts as `'running'`. */
12
13
  status: 'running' | 'completed' | 'failed' | 'cancelled';
14
+ /** Error message of a failed operation. */
13
15
  error?: string;
14
16
  }
15
17
  /**
16
18
  * Complete operation state including events and metadata
17
19
  */
18
20
  export interface OperationState {
21
+ /** Lifecycle metadata. */
19
22
  metadata: OperationMetadata;
23
+ /** Progress events in the order they were added. */
20
24
  events: StreamingProgressEvent[];
25
+ /** Final result, stored with `setResult` before `markComplete`. */
21
26
  result?: unknown;
22
27
  }
23
28
  /**
24
- * Thread-safe singleton store for streaming operation progress
25
- * Provides TTL-based cleanup and efficient event querying
29
+ * Singleton store for the progress of streaming operations (deprecated
30
+ * `streaming` path and get-operation-progress), with TTL-based cleanup:
31
+ * finished operations are deleted after 5 minutes, running ones are marked
32
+ * failed with a timeout event after 10.
33
+ *
34
+ * @remarks
35
+ * Call `setResult(operationId, result)` before `markComplete(operationId)`:
36
+ * get-operation-progress returns `result` only for completed operations that
37
+ * have one.
26
38
  */
27
39
  export declare class ProgressStore {
28
40
  private static instance;
@@ -110,10 +122,15 @@ export declare class ProgressStore {
110
122
  * Get store statistics (for monitoring)
111
123
  */
112
124
  getStats(): {
125
+ /** Number of stored operations. */
113
126
  totalOperations: number;
127
+ /** Operations with status `'running'`. */
114
128
  runningOperations: number;
129
+ /** Operations with status `'completed'`. */
115
130
  completedOperations: number;
131
+ /** Operations with status `'failed'`. */
116
132
  failedOperations: number;
133
+ /** Operations with status `'cancelled'`. */
117
134
  cancelledOperations: number;
118
135
  };
119
136
  }
@@ -1,9 +1,13 @@
1
1
  /**
2
- * @angular-modernizer/adapter-mcp - Progress Store
3
- */
4
- /**
5
- * Thread-safe singleton store for streaming operation progress
6
- * Provides TTL-based cleanup and efficient event querying
2
+ * Singleton store for the progress of streaming operations (deprecated
3
+ * `streaming` path and get-operation-progress), with TTL-based cleanup:
4
+ * finished operations are deleted after 5 minutes, running ones are marked
5
+ * failed with a timeout event after 10.
6
+ *
7
+ * @remarks
8
+ * Call `setResult(operationId, result)` before `markComplete(operationId)`:
9
+ * get-operation-progress returns `result` only for completed operations that
10
+ * have one.
7
11
  */
8
12
  export class ProgressStore {
9
13
  static instance = null;