@@ -65,6 +65,8 @@ export interface McpServerFormModalProps {
6565 allowedMcpDomains : string [ ] | null
6666 domainPolicyUnavailable ?: boolean
6767 domainPolicyError ?: string
68+ /** False locks the URL field: the server refuses a destination change from a non-admin. */
69+ canChangeDestination ?: boolean
6870}
6971
7072const ENV_VAR_PATTERN = / \{ \{ [ ^ { } ] + \} \} /
@@ -130,6 +132,7 @@ interface FormattedInputProps {
130132 envVarProps : EnvVarDropdownConfig
131133 availableEnvVars ?: Set < string >
132134 className ?: string
135+ disabled ?: boolean
133136 onChange : ( e : React . ChangeEvent < HTMLInputElement > ) => void
134137 onScroll : ( scrollLeft : number ) => void
135138}
@@ -143,6 +146,7 @@ function FormattedInput({
143146 envVarProps,
144147 availableEnvVars,
145148 className,
149+ disabled,
146150 onChange,
147151 onScroll,
148152} : FormattedInputProps ) {
@@ -159,12 +163,18 @@ function FormattedInput({
159163 ref = { ref }
160164 placeholder = { placeholder }
161165 value = { value }
166+ disabled = { disabled }
162167 onChange = { onChange }
163168 onScroll = { handleScroll }
164169 onInput = { handleScroll }
165170 inputClassName = 'font-sans text-transparent caret-[var(--text-primary)]'
166171 />
167- < div className = 'pointer-events-none absolute inset-0 flex items-center overflow-hidden px-2 py-1.5 font-sans text-sm' >
172+ < div
173+ className = { cn (
174+ 'pointer-events-none absolute inset-0 flex items-center overflow-hidden px-2 py-1.5 font-sans text-sm' ,
175+ disabled && 'opacity-50'
176+ ) }
177+ >
168178 < div className = 'whitespace-nowrap' style = { { transform : `translateX(-${ scrollLeft } px)` } } >
169179 { formatDisplayText ( value , { availableEnvVars } ) }
170180 </ div >
@@ -316,6 +326,7 @@ export function McpServerFormModal({
316326 allowedMcpDomains,
317327 domainPolicyUnavailable = false ,
318328 domainPolicyError,
329+ canChangeDestination = true ,
319330} : McpServerFormModalProps ) {
320331 const urlInputRef = useRef < HTMLInputElement > ( null )
321332
@@ -715,6 +726,9 @@ export function McpServerFormModal({
715726 type = 'custom'
716727 title = 'Server URL'
717728 error = { isDomainBlocked ? 'Domain not permitted by server policy' : undefined }
729+ hint = {
730+ canChangeDestination ? undefined : 'Only workspace admins can change the server URL'
731+ }
718732 >
719733 < FormattedInput
720734 ref = { urlInputRef }
@@ -730,6 +744,7 @@ export function McpServerFormModal({
730744 onClose : resetEnvVarState ,
731745 } }
732746 availableEnvVars = { availableEnvVars }
747+ disabled = { ! canChangeDestination }
733748 onChange = { ( e ) => handleInputChange ( 'url' , e . target . value ) }
734749 onScroll = { setUrlScrollLeft }
735750 />
0 commit comments