Skip to content

Commit 0d540a0

Browse files
committed
feat(frontend): add validation for user arguments and environment variables
1 parent cbbfcf6 commit 0d540a0

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

services/frontend/src/components/mcp-server/wizard/EnvironmentVariablesStep.vue

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,38 @@ const validateConfiguration = () => {
170170
}
171171
})
172172
173+
// Validate user arguments
174+
userArgsSchema.value.forEach((arg) => {
175+
if (arg.required && !modelValue.value.user_args[arg.name]?.trim()) {
176+
missingFields.push(arg.name)
177+
isValid = false
178+
}
179+
})
180+
181+
// Validate user environment variables
182+
userEnvSchema.value.forEach((envVar) => {
183+
if (envVar.required && !modelValue.value.user_env[envVar.name]?.trim()) {
184+
missingFields.push(envVar.name)
185+
isValid = false
186+
}
187+
})
188+
189+
// Validate user headers
190+
userHeadersSchema.value.forEach((header) => {
191+
if (header.required && !modelValue.value.user_headers[header.name]?.trim()) {
192+
missingFields.push(header.name)
193+
isValid = false
194+
}
195+
})
196+
197+
// Validate user query params
198+
userQueryParamsSchema.value.forEach((param) => {
199+
if (param.required && !modelValue.value.user_url_query_params[param.name]?.trim()) {
200+
missingFields.push(param.name)
201+
isValid = false
202+
}
203+
})
204+
173205
emit('validation-change', isValid, missingFields)
174206
return isValid
175207
}
@@ -190,6 +222,22 @@ watch(() => modelValue.value.team_url_query_params, () => {
190222
validateConfiguration()
191223
}, { deep: true })
192224
225+
watch(() => modelValue.value.user_args, () => {
226+
validateConfiguration()
227+
}, { deep: true })
228+
229+
watch(() => modelValue.value.user_env, () => {
230+
validateConfiguration()
231+
}, { deep: true })
232+
233+
watch(() => modelValue.value.user_headers, () => {
234+
validateConfiguration()
235+
}, { deep: true })
236+
237+
watch(() => modelValue.value.user_url_query_params, () => {
238+
validateConfiguration()
239+
}, { deep: true })
240+
193241
watch(() => props.serverData, (newData) => {
194242
if (newData) {
195243
const newTeamArgs: string[] = []

0 commit comments

Comments
 (0)