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
+12 -7
View File
@@ -1,6 +1,6 @@
import test from 'node:test'
import assert from 'node:assert/strict'
import { readFileSync } from 'node:fs'
import { existsSync, readFileSync } from 'node:fs'
import { fileURLToPath } from 'node:url'
import { dirname, join } from 'node:path'
import {
@@ -75,7 +75,9 @@ test('aigen routes exist, stay on the studio-2 enqueue path, and 404 on xAIGen',
assert.match(job, /stillAbsoluteUrl/)
assert.match(middleware, /aigenBearerAuthorized/)
assert.match(middleware, /aigenApiPathAllowed/)
assert.match(middleware, /\/\.well-known\/oauth-protected-resource/)
assert.match(middleware, /\/\.well-known\/oauth-authorization-server/)
assert.match(middleware, /\/\.well-known\/openid-configuration/)
assert.doesNotMatch(middleware, /oauth-protected-resource/)
assert.match(authPaths, /path === '\/mcp'/)
assert.match(mcp, /mcpBearerOk/)
assert.match(mcp, /text\/event-stream/)
@@ -88,15 +90,18 @@ test('aigen routes exist, stay on the studio-2 enqueue path, and 404 on xAIGen',
assert.match(mcpUtil, /aigen_job/)
assert.match(mcpUtil, /queueAigenGenerate/)
assert.match(mcpUtil, /readAigenJob/)
assert.match(mcpUtil, /authorization_servers/)
assert.match(mcpUtil, /removeResponseHeader\(event,\s*'WWW-Authenticate'\)/)
assert.doesNotMatch(mcpUtil, /authorization_servers/)
assert.match(mcpUtil, /2025-06-18/)
assert.match(nuxt, /aigenApiKey:\s*process\.env\.AIGEN_API_KEY/)
assert.match(bench, /studio2EngineDefaults/)
const oauthRoot = readFileSync(join(root, 'server/routes/.well-known/oauth-protected-resource.get.ts'), 'utf8')
const oauthMcp = readFileSync(join(root, 'server/routes/.well-known/oauth-protected-resource/mcp.get.ts'), 'utf8')
assert.match(oauthRoot, /mcpOauthProtectedResource/)
assert.match(oauthMcp, /mcpOauthProtectedResource/)
const as = readFileSync(join(root, 'server/routes/.well-known/oauth-authorization-server.get.ts'), 'utf8')
const oidc = readFileSync(join(root, 'server/routes/.well-known/openid-configuration.get.ts'), 'utf8')
assert.match(as, /not found/)
assert.match(oidc, /not found/)
assert.equal(existsSync(join(root, 'server/routes/.well-known/oauth-protected-resource.get.ts')), false)
assert.equal(existsSync(join(root, 'server/routes/.well-known/oauth-protected-resource/mcp.get.ts')), false)
})
test('defaultLibraryFolderId prefers Inbox then the first folder', () => {