Skip to content

Commit 9542541

Browse files
waleedlatif1claude
andcommitted
perf(mcp): thread test-connection authType through to create, drop duplicate probe
test-connection already probes the URL and returns `authType` as part of its structured signal. Pass it through to the create call so performCreateMcpServer skips its own probe — one network round-trip per add instead of two. server-lifecycle already short-circuits when params.authType is set, so no route changes needed; this is purely UI plumbing. Falls back to the existing probe if authType is omitted (e.g. server-to-server callers or older clients), so behavior is unchanged for those paths. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent a295d84 commit 9542541

2 files changed

Lines changed: 11 additions & 0 deletions

File tree

apps/sim/app/workspace/[workspaceId]/settings/components/mcp/components/mcp-server-form-modal/mcp-server-form-modal.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,13 @@ export interface McpServerFormConfig {
5252
timeout: number
5353
oauthClientId?: string
5454
oauthClientSecret?: string
55+
/**
56+
* Auth type detected by the pre-submit `test-connection` probe. When set,
57+
* the create route uses this directly and skips its own probe (the route
58+
* still falls back to its own probe if omitted, so this is purely a perf
59+
* win — one network round-trip per add instead of two).
60+
*/
61+
authType?: 'none' | 'headers' | 'oauth'
5562
}
5663

5764
export interface McpServerFormModalProps {
@@ -531,6 +538,7 @@ export function McpServerFormModal({
531538
url: formData.url!,
532539
headers,
533540
timeout: formData.timeout || 30000,
541+
authType: connectionResult.authType,
534542
oauthClientId:
535543
mode === 'edit'
536544
? oauthClientIdChanged
@@ -593,6 +601,7 @@ export function McpServerFormModal({
593601
url: config.url,
594602
headers: config.headers,
595603
timeout: 30000,
604+
authType: connectionResult.authType,
596605
})
597606

598607
onOpenChange(false)

apps/sim/hooks/queries/mcp.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ export interface McpServerInput {
5454
enabled: boolean
5555
oauthClientId?: string
5656
oauthClientSecret?: string
57+
/** Pre-detected by `test-connection`; lets the create route skip its own probe. */
58+
authType?: 'none' | 'headers' | 'oauth'
5759
}
5860

5961
async function fetchMcpServers(workspaceId: string, signal?: AbortSignal): Promise<McpServer[]> {

0 commit comments

Comments
 (0)