Skip to content

Commit 111da6f

Browse files
fix(mcp): use GET redirect for consent callback instead of POST form
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent da9fa19 commit 111da6f

1 file changed

Lines changed: 8 additions & 23 deletions

File tree

app/[locale]/oauth/mcp-authorize/mcp-consent-form.tsx

Lines changed: 8 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -35,29 +35,14 @@ export function McpConsentForm({
3535
setError(null)
3636

3737
try {
38-
// POST to MCP server callback — this will redirect us
39-
// We use a form submission approach to follow the redirect
40-
const form = document.createElement("form")
41-
form.method = "POST"
42-
form.action = mcpCallbackUrl
43-
44-
const fields = {
45-
sessionId,
46-
userId,
47-
userRole,
48-
tenantId,
49-
}
50-
51-
for (const [key, value] of Object.entries(fields)) {
52-
const input = document.createElement("input")
53-
input.type = "hidden"
54-
input.name = key
55-
input.value = value
56-
form.appendChild(input)
57-
}
58-
59-
document.body.appendChild(form)
60-
form.submit()
38+
// Redirect to MCP server callback via GET with query params
39+
// The callback will generate an auth code and redirect back to Claude
40+
const url = new URL(mcpCallbackUrl)
41+
url.searchParams.set("session_id", sessionId)
42+
url.searchParams.set("user_id", userId)
43+
url.searchParams.set("user_role", userRole)
44+
url.searchParams.set("tenant_id", tenantId)
45+
window.location.href = url.toString()
6146
} catch (err) {
6247
setError(err instanceof Error ? err.message : "Failed to authorize")
6348
setLoading(null)

0 commit comments

Comments
 (0)