Skip to content

Commit 821ab25

Browse files
Dumbrisclaude
andcommitted
fix: use correct API for canonical path imports in web UI
When importing servers from a canonical config path (e.g., Claude Desktop, Claude Code), the handleImport function incorrectly used the JSON content API instead of the path API, causing "Content is required" errors. The fix tracks when a canonical path import is active and uses the appropriate importServersFromPath API endpoint for the actual import. Changes: - Add activeCanonicalImport state to track canonical path imports - Set activeCanonicalImport when preview from canonical path succeeds - Update handleImport to check activeCanonicalImport first and use path API - Clear activeCanonicalImport on file/paste preview and modal close Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent f2af455 commit 821ab25

1 file changed

Lines changed: 17 additions & 1 deletion

File tree

frontend/src/components/AddServerModal.vue

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -612,6 +612,8 @@ const validationError = ref<{ message: string; line?: number; column?: number; h
612612
// Canonical config paths for quick import
613613
const canonicalPaths = ref<CanonicalConfigPath[]>([])
614614
const importingCanonicalPath = ref<string | null>(null)
615+
// Track the active canonical path when importing (to use correct API in handleImport)
616+
const activeCanonicalImport = ref<{ path: string; format: string } | null>(null)
615617
616618
// Editor refs for line numbers
617619
const textareaRef = ref<HTMLTextAreaElement | null>(null)
@@ -870,6 +872,8 @@ async function triggerPreview() {
870872
previewResult.value = null
871873
selectedServers.value.clear()
872874
validationError.value = null
875+
// Clear canonical import when doing file/paste preview
876+
activeCanonicalImport.value = null
873877
874878
if (importMode.value === 'file' && importFile.value) {
875879
await previewFromFile()
@@ -964,7 +968,15 @@ async function handleImport() {
964968
const serverNames = Array.from(selectedServers.value)
965969
966970
let response
967-
if (importMode.value === 'file' && importFile.value) {
971+
if (activeCanonicalImport.value) {
972+
// Import from canonical path (e.g., Claude Desktop config)
973+
response = await api.importServersFromPath({
974+
path: activeCanonicalImport.value.path,
975+
format: activeCanonicalImport.value.format,
976+
server_names: serverNames,
977+
preview: false
978+
})
979+
} else if (importMode.value === 'file' && importFile.value) {
968980
response = await api.importServersFromFile(importFile.value, {
969981
format: importFormat.value || undefined,
970982
server_names: serverNames,
@@ -1036,6 +1048,9 @@ async function importFromCanonicalPath(config: CanonicalConfigPath) {
10361048
// Show preview result
10371049
previewResult.value = previewResponse.data
10381050
1051+
// Store the canonical path info for use in handleImport
1052+
activeCanonicalImport.value = { path: config.path, format: config.format }
1053+
10391054
// Select all servers by default
10401055
selectedServers.value.clear()
10411056
previewResponse.data.imported.forEach(s => selectedServers.value.add(s.name))
@@ -1078,6 +1093,7 @@ function handleClose() {
10781093
importError.value = ''
10791094
validationError.value = null
10801095
selectedServers.value.clear()
1096+
activeCanonicalImport.value = null
10811097
10821098
// Reset tab
10831099
activeTab.value = 'manual'

0 commit comments

Comments
 (0)