Commit a295d84
fix(mcp): detect OAuth in test-connection and surface structured signal
Test-connection used to attempt an unauthenticated McpClient.connect and
surface the resulting transport error to the modal. For spec-compliant
OAuth servers (Semrush, Linear, Notion, Atlassian) this produced
misleading "Streamable HTTP error: Error POSTing to endpoint:" messages
and aborted the create flow before the OAuth dance could start. The form
path had a string-regex escape hatch; the JSON path didn't.
Replaces the regex with a structured signal — the same `detectMcpAuthType`
probe the create flow uses. When the probe returns 'oauth', the route
short-circuits with `{ success: false, authRequired: true, authType:
'oauth' }`. Both modal submit paths check `authRequired` explicitly to
continue into the normal create + OAuth start flow.
Matches the pattern Claude Code / Cursor's MCP clients use: see the
OAuth challenge, skip the unauth attempt, run the OAuth handshake.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>1 parent 37da441 commit a295d84
3 files changed
Lines changed: 37 additions & 19 deletions
File tree
- apps/sim
- app
- api/mcp/servers/test-connection
- workspace/[workspaceId]/settings/components/mcp/components/mcp-server-form-modal
- lib/api/contracts
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
| |||
31 | 32 | | |
32 | 33 | | |
33 | 34 | | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
34 | 42 | | |
35 | 43 | | |
36 | 44 | | |
| |||
163 | 171 | | |
164 | 172 | | |
165 | 173 | | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
166 | 192 | | |
167 | 193 | | |
168 | 194 | | |
| |||
Lines changed: 4 additions & 19 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | 70 | | |
87 | 71 | | |
88 | 72 | | |
| |||
125 | 109 | | |
126 | 110 | | |
127 | 111 | | |
128 | | - | |
| 112 | + | |
129 | 113 | | |
130 | 114 | | |
131 | 115 | | |
132 | 116 | | |
| 117 | + | |
133 | 118 | | |
134 | 119 | | |
135 | 120 | | |
| |||
533 | 518 | | |
534 | 519 | | |
535 | 520 | | |
536 | | - | |
| 521 | + | |
537 | 522 | | |
538 | 523 | | |
539 | 524 | | |
| |||
595 | 580 | | |
596 | 581 | | |
597 | 582 | | |
598 | | - | |
| 583 | + | |
599 | 584 | | |
600 | 585 | | |
601 | 586 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
252 | 252 | | |
253 | 253 | | |
254 | 254 | | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
255 | 262 | | |
256 | 263 | | |
257 | 264 | | |
| |||
0 commit comments