Skip to content

Commit 7acf8db

Browse files
committed
Return 405 on POST /sse for Streamable HTTP fallback to SSE
1 parent 4deecbc commit 7acf8db

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/mcp.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -586,6 +586,13 @@ export async function startMcpServer(
586586
});
587587
});
588588

589+
// ─── SSE endpoint — reject POST so clients fall back to SSE transport
590+
app.post("/sse", (_req: Request, res: Response) => {
591+
res.status(405).set("Allow", "GET").json({
592+
error: "Method Not Allowed. Use GET for SSE connection.",
593+
});
594+
});
595+
589596
// ─── SSE endpoint — MCP client connects here ─────────────────────
590597
app.get("/sse", async (req: Request, res: Response) => {
591598
mcpLogger.info(`New SSE connection from ${req.ip}`);

0 commit comments

Comments
 (0)