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:
@@ -21,14 +21,12 @@ export default defineEventHandler(async (event) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (method === 'GET') {
|
if (method === 'GET') {
|
||||||
if (!mcpBearerOk(event)) {
|
// Claude probes GET /mcp with no Authorization; Cursor always sends bearer.
|
||||||
return mcpUnauthorized(event)
|
// Never auth-check GET — always open a short SSE stream and end.
|
||||||
}
|
|
||||||
setResponseStatus(event, 200)
|
setResponseStatus(event, 200)
|
||||||
setResponseHeader(event, 'Content-Type', 'text/event-stream')
|
setResponseHeader(event, 'Content-Type', 'text/event-stream')
|
||||||
setResponseHeader(event, 'Cache-Control', 'no-cache, no-transform')
|
setResponseHeader(event, 'Cache-Control', 'no-cache, no-transform')
|
||||||
setResponseHeader(event, 'Connection', 'keep-alive')
|
setResponseHeader(event, 'Connection', 'keep-alive')
|
||||||
// Short SSE stream Claude opens after initialize; comment then end.
|
|
||||||
return ': connected\n\n'
|
return ': connected\n\n'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user