fix(mcp): eager-auth flag on the Grok connector links so Grok starts OAuth (#2167)
* fix(mcp): eager-auth flag on the Grok connector links so Grok starts OAuth Live test after #2158: pasting the Grok URL into grok.com's custom connector dialog listed all 150+ tools and never opened the sign-in. Grok probes the URL without credentials, like claude.ai, and reads the lazy 200 on initialize as an authless server; only the 401 challenge starts OAuth (#2159 fixed the same thing for the claude.ai link). - lib/onboarding/checklist.ts: mcpServerUrl() builds the server URL with an optional eagerAuth flag; sideDoorServerUrl() gives the Grok side door auth=required and keeps ChatGPT lazy; claudeConnectorLink() reuses it. SIDE_DOORS / SideDoor move here from the component. Tests for all three. - NewUserChecklist copies the door-specific URL (now with a client marker). - ApiKeysPanel's Grok row copies the flagged URL, mirroring the Claude one. - auth-mode.ts comment records the second consumer; registry entry's Grok step carries the flag; DECISIONS. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LhTJcwgzmN3TsLR8tVHwdi Signed-off-by: Emil <emilmattsson14@gmail.com> * docs(mcp): registry Claude.ai step carries auth=required too Review pass on #2167: the registry entry flagged the Grok install URL but left the Claude.ai step on the bare URL, which pre-fills "None" in claude.ai's dialog (#2159). Same file, same flag, now consistent. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LhTJcwgzmN3TsLR8tVHwdi Signed-off-by: Emil <emilmattsson14@gmail.com> --------- Signed-off-by: Emil <emilmattsson14@gmail.com> Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Fable 5.1
parent
f1230282a9
commit
a80ce54b78
@@ -2,6 +2,9 @@ import { describe, expect, it } from 'vitest'
|
||||
import {
|
||||
checklistNumbers,
|
||||
claudeConnectorLink,
|
||||
mcpServerUrl,
|
||||
sideDoorServerUrl,
|
||||
SIDE_DOORS,
|
||||
claudeStepDone,
|
||||
completionPatchBody,
|
||||
vatDeadlineLine,
|
||||
@@ -105,6 +108,39 @@ describe('claudeStepDone', () => {
|
||||
})
|
||||
})
|
||||
|
||||
describe('mcpServerUrl', () => {
|
||||
it('builds the namespaced URL with the client marker and no auth flag by default', () => {
|
||||
expect(mcpServerUrl({ origin: 'https://app.testbrand.example', client: 'cursor' })).toBe(
|
||||
'https://app.testbrand.example/api/extensions/ext/mcp-server/mcp?tool_namespace=accounted&client=cursor',
|
||||
)
|
||||
})
|
||||
|
||||
it('appends auth=required when eagerAuth is set', () => {
|
||||
const url = new URL(mcpServerUrl({ origin: 'http://localhost:3000', client: 'grok', eagerAuth: true }))
|
||||
expect(url.searchParams.get('tool_namespace')).toBe('accounted')
|
||||
expect(url.searchParams.get('client')).toBe('grok')
|
||||
expect(url.searchParams.get('auth')).toBe('required')
|
||||
})
|
||||
})
|
||||
|
||||
describe('sideDoorServerUrl', () => {
|
||||
it('lists chatgpt then grok', () => {
|
||||
expect(SIDE_DOORS).toEqual(['chatgpt', 'grok'])
|
||||
})
|
||||
|
||||
it('gives Grok the eager-auth flag: its dialog reads a 200 probe as "no auth" and never starts OAuth', () => {
|
||||
const url = new URL(sideDoorServerUrl({ origin: 'https://app.testbrand.example', door: 'grok' }))
|
||||
expect(url.searchParams.get('client')).toBe('grok')
|
||||
expect(url.searchParams.get('auth')).toBe('required')
|
||||
})
|
||||
|
||||
it('keeps ChatGPT on the lazy URL', () => {
|
||||
const url = new URL(sideDoorServerUrl({ origin: 'https://app.testbrand.example', door: 'chatgpt' }))
|
||||
expect(url.searchParams.get('client')).toBe('chatgpt')
|
||||
expect(url.searchParams.get('auth')).toBeNull()
|
||||
})
|
||||
})
|
||||
|
||||
describe('claudeConnectorLink', () => {
|
||||
it('builds the claude.ai deep link with namespace, client marker and eager-auth flag, from the page origin', () => {
|
||||
const link = claudeConnectorLink({ origin: 'https://app.testbrand.example', appName: 'Testbrand' })
|
||||
|
||||
Reference in New Issue
Block a user