mirror of
https://github.com/morluto/rea.git
synced 2026-11-02 21:06:04 +00:00
fix(mcp): harden the streamable HTTP listener's session replacement and shutdown
Addresses the automated review findings on the PR: refuse requests once the session slot is closed and join an arming initialize during shutdown; retry failed close stages instead of replaying the rejection; classify loopback binds by address class and add the bind's own hostname to the Host and Origin allowlist; let only a POST with the streamable headers replace an open session; announce the bound URL at every log level; route `mcp -h --http` to the HTTP entry. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
1 parent
46dd8f0e2b
commit
b0ec63cc03
8 files changed
+283
-61
No files matched your search
+3
-2
@@ -15,10 +15,11 @@ process.env.REA_PACKAGE_VERSION = packageJson.version;
|
||||
const isMcpEntry = args[0] === "--mcp" || args[0] === "mcp";
|
||||
const isMcpMode = isMcpEntry && args.length === 1;
|
||||
const isMcpDoctorMode = args[0] === "mcp" && args[1] === "doctor";
|
||||
// Only flags may follow the entry: `mcp add --http` stays Incur's `mcp add`.
|
||||
// Only flags may follow the entry: `mcp add --http` stays Incur's `mcp add`,
|
||||
// while `mcp -h --http` reaches the HTTP entry's own help.
|
||||
const isMcpHttpMode =
|
||||
isMcpEntry &&
|
||||
(args[1]?.startsWith("--") ?? false) &&
|
||||
(args[1]?.startsWith("-") ?? false) &&
|
||||
args.slice(1).includes("--http");
|
||||
/** Exit status of a writer terminated by SIGPIPE (128 + 13). */
|
||||
const SIGPIPE_EXIT_STATUS = 141;
|
||||
|
||||
Reference in new issue
Block a user