Allow unauthenticated GET /mcp for Claude connector probes.

Claude checks the endpoint without Authorization; POST still requires the bearer for Cursor and tools.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Towsty
2026-11-02 22:08:07 -06:00
co-authored by Cursor
parent 1834ac4af9
commit 8c9b4d5f7d
+2 -4
View File
@@ -21,14 +21,12 @@ export default defineEventHandler(async (event) => {
}
if (method === 'GET') {
if (!mcpBearerOk(event)) {
return mcpUnauthorized(event)
}
// Claude probes GET /mcp with no Authorization; Cursor always sends bearer.
// Never auth-check GET — always open a short SSE stream and end.
setResponseStatus(event, 200)
setResponseHeader(event, 'Content-Type', 'text/event-stream')
setResponseHeader(event, 'Cache-Control', 'no-cache, no-transform')
setResponseHeader(event, 'Connection', 'keep-alive')
// Short SSE stream Claude opens after initialize; comment then end.
return ': connected\n\n'
}