@mastra/hono 1.3.2-alpha.0 → 1.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,41 @@
1
1
  # @mastra/hono
2
2
 
3
+ ## 1.3.2
4
+
5
+ ### Patch Changes
6
+
7
+ - fix(hono): stream MCP HTTP notifications incrementally instead of buffering ([#14782](https://github.com/mastra-ai/mastra/pull/14782))
8
+
9
+ Do not await `server.startHTTP()` in the MCP HTTP transport handler so that
10
+ SSE notifications are streamed to the client as they are written, rather than
11
+ being buffered and delivered all at once when the final response completes.
12
+
13
+ - Updated dependencies [[`180aaaf`](https://github.com/mastra-ai/mastra/commit/180aaaf4d0903d33a49bc72de2d40ca69a5bc599), [`9140989`](https://github.com/mastra-ai/mastra/commit/91409890e83f4f1d9c1b39223f1af91a6a53b549), [`d7c98cf`](https://github.com/mastra-ai/mastra/commit/d7c98cfc9d75baba9ecbf1a8835b5183d0a0aec8), [`acf5fbc`](https://github.com/mastra-ai/mastra/commit/acf5fbcb890dc7ca7167bec386ce5874dfadb997), [`24ca2ae`](https://github.com/mastra-ai/mastra/commit/24ca2ae57538ec189fabb9daee6175ad27035853), [`0762516`](https://github.com/mastra-ai/mastra/commit/07625167e029a8268ea7aaf0402416e6d8832874), [`9c57f2f`](https://github.com/mastra-ai/mastra/commit/9c57f2f7241e9f94769aa99fc86c531e8207d0f9), [`5bfc691`](https://github.com/mastra-ai/mastra/commit/5bfc69104c07ba7a9b55c2f8536422c0878b9c57), [`2de3d36`](https://github.com/mastra-ai/mastra/commit/2de3d36932b7f73ad26bc403f7da26cfe89e903e), [`fce2cb1`](https://github.com/mastra-ai/mastra/commit/fce2cb1ac3c3d49302b35507448a85d6a0e614c1), [`d3736cb`](https://github.com/mastra-ai/mastra/commit/d3736cb9ce074d2b8e8b00218a01f790fe81a1b4), [`c627366`](https://github.com/mastra-ai/mastra/commit/c6273666f9ef4c8c617c68b7d07fe878a322f85c)]:
14
+ - @mastra/core@1.19.0
15
+ - @mastra/server@1.19.0
16
+
17
+ ## 1.3.2-alpha.2
18
+
19
+ ### Patch Changes
20
+
21
+ - Updated dependencies [[`9c57f2f`](https://github.com/mastra-ai/mastra/commit/9c57f2f7241e9f94769aa99fc86c531e8207d0f9), [`5bfc691`](https://github.com/mastra-ai/mastra/commit/5bfc69104c07ba7a9b55c2f8536422c0878b9c57)]:
22
+ - @mastra/core@1.19.0-alpha.2
23
+ - @mastra/server@1.19.0-alpha.2
24
+
25
+ ## 1.3.2-alpha.1
26
+
27
+ ### Patch Changes
28
+
29
+ - fix(hono): stream MCP HTTP notifications incrementally instead of buffering ([#14782](https://github.com/mastra-ai/mastra/pull/14782))
30
+
31
+ Do not await `server.startHTTP()` in the MCP HTTP transport handler so that
32
+ SSE notifications are streamed to the client as they are written, rather than
33
+ being buffered and delivered all at once when the final response completes.
34
+
35
+ - Updated dependencies [[`9140989`](https://github.com/mastra-ai/mastra/commit/91409890e83f4f1d9c1b39223f1af91a6a53b549), [`d7c98cf`](https://github.com/mastra-ai/mastra/commit/d7c98cfc9d75baba9ecbf1a8835b5183d0a0aec8), [`acf5fbc`](https://github.com/mastra-ai/mastra/commit/acf5fbcb890dc7ca7167bec386ce5874dfadb997), [`24ca2ae`](https://github.com/mastra-ai/mastra/commit/24ca2ae57538ec189fabb9daee6175ad27035853), [`0762516`](https://github.com/mastra-ai/mastra/commit/07625167e029a8268ea7aaf0402416e6d8832874), [`2de3d36`](https://github.com/mastra-ai/mastra/commit/2de3d36932b7f73ad26bc403f7da26cfe89e903e), [`fce2cb1`](https://github.com/mastra-ai/mastra/commit/fce2cb1ac3c3d49302b35507448a85d6a0e614c1), [`d3736cb`](https://github.com/mastra-ai/mastra/commit/d3736cb9ce074d2b8e8b00218a01f790fe81a1b4), [`c627366`](https://github.com/mastra-ai/mastra/commit/c6273666f9ef4c8c617c68b7d07fe878a322f85c)]:
36
+ - @mastra/core@1.18.1-alpha.1
37
+ - @mastra/server@1.18.1-alpha.1
38
+
3
39
  ## 1.3.2-alpha.0
4
40
 
5
41
  ### Patch Changes
package/dist/index.cjs CHANGED
@@ -657,30 +657,32 @@ var MastraServer = class extends serverAdapter.MastraServer {
657
657
  } else if (route.responseType === "mcp-http") {
658
658
  const { server, httpPath, mcpOptions: routeMcpOptions } = result;
659
659
  const { req, res } = fetchToNode.toReqRes(response.req.raw);
660
- try {
661
- const options = { ...this.mcpOptions, ...routeMcpOptions };
662
- await server.startHTTP({
663
- url: new URL(response.req.url),
664
- httpPath: `${resolvedPrefix}${httpPath}`,
665
- req,
666
- res,
667
- options: Object.keys(options).length > 0 ? options : void 0
660
+ const options = { ...this.mcpOptions, ...routeMcpOptions };
661
+ server.startHTTP({
662
+ url: new URL(response.req.url),
663
+ httpPath: `${resolvedPrefix}${httpPath}`,
664
+ req,
665
+ res,
666
+ options: Object.keys(options).length > 0 ? options : void 0
667
+ }).catch((e) => {
668
+ this.mastra.getLogger()?.error("[MCP HTTP] Error in background startHTTP:", {
669
+ error: e instanceof Error ? { message: e.message, stack: e.stack } : e
668
670
  });
669
- return await fetchToNode.toFetchResponse(res);
670
- } catch {
671
- if (!res.headersSent) {
672
- res.writeHead(500, { "Content-Type": "application/json" });
673
- res.end(
674
- JSON.stringify({
675
- jsonrpc: "2.0",
676
- error: { code: -32603, message: "Internal server error" },
677
- id: null
678
- })
679
- );
680
- return await fetchToNode.toFetchResponse(res);
671
+ try {
672
+ if (!res.headersSent) {
673
+ res.writeHead(500, { "Content-Type": "application/json" });
674
+ res.end(
675
+ JSON.stringify({
676
+ jsonrpc: "2.0",
677
+ error: { code: -32603, message: "Internal server error" },
678
+ id: null
679
+ })
680
+ );
681
+ }
682
+ } catch {
681
683
  }
682
- return await fetchToNode.toFetchResponse(res);
683
- }
684
+ });
685
+ return await fetchToNode.toFetchResponse(res);
684
686
  } else if (route.responseType === "mcp-sse") {
685
687
  const { server, ssePath, messagePath } = result;
686
688
  try {