@mastra/mcp 1.4.2-alpha.0 → 1.4.2-alpha.1
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 +6 -0
- package/dist/client/error-utils.d.ts.map +1 -1
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/index.cjs +15 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +15 -2
- package/dist/index.js.map +1 -1
- package/dist/server/server.d.ts.map +1 -1
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @mastra/mcp
|
|
2
2
|
|
|
3
|
+
## 1.4.2-alpha.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Fixed MCP server to return HTTP 404 (instead of 400) when a client sends a stale or unknown session ID. Per the MCP spec, this tells clients to re-initialize with a new session, which fixes broken tool calls after server redeploys. ([#15160](https://github.com/mastra-ai/mastra/pull/15160))
|
|
8
|
+
|
|
3
9
|
## 1.4.2-alpha.0
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error-utils.d.ts","sourceRoot":"","sources":["../../src/client/error-utils.ts"],"names":[],"mappings":"AAAA,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,
|
|
1
|
+
{"version":3,"file":"error-utils.d.ts","sourceRoot":"","sources":["../../src/client/error-utils.ts"],"names":[],"mappings":"AAAA,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAuB/D"}
|
package/dist/docs/SKILL.md
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -394,7 +394,7 @@ function isReconnectableMCPError(error) {
|
|
|
394
394
|
return false;
|
|
395
395
|
}
|
|
396
396
|
const errorMessage = error.message.toLowerCase();
|
|
397
|
-
return errorMessage.includes("no valid session") || errorMessage.includes("session") || errorMessage.includes("server not initialized") || errorMessage.includes("not connected") || errorMessage.includes("http 400") || errorMessage.includes("http 401") || errorMessage.includes("http 403") || errorMessage.includes("econnrefused") || errorMessage.includes("fetch failed") || errorMessage.includes("connection refused") || errorMessage.includes("connection closed") || errorMessage.includes("sse stream disconnected") || errorMessage.includes("typeerror: terminated");
|
|
397
|
+
return errorMessage.includes("no valid session") || errorMessage.includes("session") || errorMessage.includes("server not initialized") || errorMessage.includes("not connected") || errorMessage.includes("http 400") || errorMessage.includes("http 401") || errorMessage.includes("http 403") || errorMessage.includes("http 404") || errorMessage.includes("econnrefused") || errorMessage.includes("fetch failed") || errorMessage.includes("connection refused") || errorMessage.includes("connection closed") || errorMessage.includes("sse stream disconnected") || errorMessage.includes("typeerror: terminated");
|
|
398
398
|
}
|
|
399
399
|
|
|
400
400
|
// src/client/client.ts
|
|
@@ -3616,8 +3616,21 @@ Provided arguments: ${JSON.stringify(request.params.arguments, null, 2)}`
|
|
|
3616
3616
|
}
|
|
3617
3617
|
const body = req.method === "POST" ? await this.readJsonBody(req) : void 0;
|
|
3618
3618
|
await transport.handleRequest(req, res, body);
|
|
3619
|
+
} else if (sessionId) {
|
|
3620
|
+
this.logger.warn("Session ID not found, returning 404", { sessionId, method: req.method });
|
|
3621
|
+
res.writeHead(404, { "Content-Type": "application/json" });
|
|
3622
|
+
res.end(
|
|
3623
|
+
JSON.stringify({
|
|
3624
|
+
jsonrpc: "2.0",
|
|
3625
|
+
error: {
|
|
3626
|
+
code: -32e3,
|
|
3627
|
+
message: "Session not found"
|
|
3628
|
+
},
|
|
3629
|
+
id: null
|
|
3630
|
+
})
|
|
3631
|
+
);
|
|
3619
3632
|
} else {
|
|
3620
|
-
this.logger.debug("No
|
|
3633
|
+
this.logger.debug("No session ID provided", { method: req.method });
|
|
3621
3634
|
if (req.method === "POST") {
|
|
3622
3635
|
const body = await this.readJsonBody(req);
|
|
3623
3636
|
const { isInitializeRequest } = await import('@modelcontextprotocol/sdk/types.js');
|