Stop advertising OAuth so Claude MCP discovery can succeed.

Drop empty authorization_servers well-known ads, 404 discovery probes as JSON, and keep bearer-only /mcp auth.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Towsty
2026-11-02 22:25:17 -06:00
co-authored by Cursor
parent 8c9b4d5f7d
commit 7fd040ad62
5 changed files with 23 additions and 24 deletions
+2 -9
View File
@@ -8,7 +8,6 @@ import { readAigenJob } from '~/server/utils/aigenJob'
export const MCP_PROTOCOL_VERSION = '2025-03-26'
export const MCP_SERVER_INFO = { name: 'aigen', version: '1.0.0' }
export const MCP_SUPPORTED_PROTOCOL_VERSIONS = ['2025-03-26', '2025-06-18', '2025-11-25'] as const
export const MCP_RESOURCE = 'https://aigen.carrgarage.com/mcp'
const ENGINE_ENUM = [...STUDIO2_IMAGE_ENGINES]
@@ -68,13 +67,6 @@ export function applyMcpCors(event: H3Event) {
if (origin) setResponseHeader(event, 'Vary', 'Origin')
}
export function mcpOauthProtectedResource() {
return {
resource: MCP_RESOURCE,
authorization_servers: [] as string[]
}
}
export function resolveMcpProtocolVersion(requested: unknown) {
const version = String(requested || '').trim()
if ((MCP_SUPPORTED_PROTOCOL_VERSIONS as readonly string[]).includes(version)) return version
@@ -97,11 +89,12 @@ export function jsonRpcResult(id: unknown, result: unknown) {
}
}
/** 401 with JSON-RPC body — never a Nuxt error page. */
/** 401 with JSON-RPC body — never a Nuxt error page, never WWW-Authenticate (no OAuth). */
export function mcpUnauthorized(event: H3Event, id: unknown = null) {
applyMcpCors(event)
setResponseStatus(event, 401)
setResponseHeader(event, 'Content-Type', 'application/json')
removeResponseHeader(event, 'WWW-Authenticate')
return jsonRpcError(id, -32001, 'Unauthorized')
}