File tree Expand file tree Collapse file tree
workspace/[workspaceId]/settings/components/mcp/components/mcp-server-form-modal Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ import { db } from '@sim/db'
33import { mcpServers } from '@sim/db/schema'
44import { createLogger } from '@sim/logger'
55import { toError } from '@sim/utils/errors'
6- import { eq } from 'drizzle-orm'
6+ import { and , eq , isNull } from 'drizzle-orm'
77import type { NextRequest } from 'next/server'
88import { NextResponse } from 'next/server'
99import { getSession } from '@/lib/auth'
@@ -74,7 +74,7 @@ export const GET = withRouteHandler(async (request: NextRequest) => {
7474 const [ server ] = await db
7575 . select ( { id : mcpServers . id , url : mcpServers . url , workspaceId : mcpServers . workspaceId } )
7676 . from ( mcpServers )
77- . where ( eq ( mcpServers . id , row . mcpServerId ) )
77+ . where ( and ( eq ( mcpServers . id , row . mcpServerId ) , isNull ( mcpServers . deletedAt ) ) )
7878 . limit ( 1 )
7979 if ( ! server || ! server . url ) {
8080 return htmlClose ( 'Server no longer exists.' , false )
Original file line number Diff line number Diff line change @@ -61,6 +61,9 @@ export const PATCH = withRouteHandler(
6161 ? ( await encryptSecret ( oauthClientSecret ) ) . encrypted
6262 : null
6363 }
64+ if ( updateData . oauthClientId !== undefined ) {
65+ finalUpdateData . oauthClientId = updateData . oauthClientId || null
66+ }
6467
6568 if ( updateData . url ) {
6669 try {
Original file line number Diff line number Diff line change @@ -536,8 +536,9 @@ export function McpServerFormModal({
536536 url : formData . url ! ,
537537 headers,
538538 timeout : formData . timeout || 30000 ,
539- oauthClientId : oauthClientId || undefined ,
540- oauthClientSecret : oauthClientSecret || undefined ,
539+ oauthClientId : mode === 'edit' ? ( oauthClientId ?? '' ) : oauthClientId || undefined ,
540+ oauthClientSecret :
541+ mode === 'edit' ? ( oauthClientSecret ?? '' ) : oauthClientSecret || undefined ,
541542 } )
542543
543544 onOpenChange ( false )
Original file line number Diff line number Diff line change @@ -135,8 +135,8 @@ export const createMcpServerBodySchema = z
135135 enabled : z . boolean ( ) . optional ( ) ,
136136 source : z . string ( ) . optional ( ) ,
137137 workspaceId : z . string ( ) . optional ( ) ,
138- oauthClientId : z . string ( ) . optional ( ) ,
139- oauthClientSecret : z . string ( ) . optional ( ) ,
138+ oauthClientId : z . string ( ) . nullable ( ) . optional ( ) ,
139+ oauthClientSecret : z . string ( ) . nullable ( ) . optional ( ) ,
140140 } )
141141 . passthrough ( )
142142
You can’t perform that action at this time.
0 commit comments