@@ -8,12 +8,12 @@ import { ExecResult } from "@docker/extension-api-client-types/dist/v1";
8
8
const DOCKER_MCP_CONFIG = {
9
9
"command" : "docker" ,
10
10
"args" : [
11
- "run" ,
12
- "-i" ,
13
- "--rm" ,
14
- "alpine/socat" ,
15
- "STDIO" ,
16
- "TCP:host.docker.internal:8811"
11
+ "run" ,
12
+ "-i" ,
13
+ "--rm" ,
14
+ "alpine/socat" ,
15
+ "STDIO" ,
16
+ "TCP:host.docker.internal:8811"
17
17
]
18
18
}
19
19
@@ -99,21 +99,20 @@ export const ClaudeConfigSyncStatus = ({ client, setHasConfig }: { client: v1.Do
99
99
if ( claudeConfig === undefined ) {
100
100
return setStatus ( { state : 'missing claude config' , message : 'No claude desktop config found' , color : 'error' } )
101
101
}
102
- if ( claudeConfig ) {
102
+ else if ( claudeConfig === null || claudeConfig . mcpServers === null ) {
103
+ return setStatus ( { state : 'empty claude config' , message : 'No claude desktop config found' , color : 'error' } )
104
+ }
105
+ else {
103
106
const servers = claudeConfig . mcpServers
104
- if ( ! servers ) {
105
- setStatus ( { state : 'invalid' , message : 'No servers found in Claude Desktop Config' , color : 'error' } )
106
- }
107
- else {
108
- const hasDocker = Object . keys ( servers ) . some ( key => key === 'mcp_docker' )
109
- if ( hasDocker ) {
110
- setStatus ( { state : 'has docker_mcp' , message : 'Claude Desktop Config is valid' , color : 'success' } )
111
- setHasConfig ( true )
112
- } else {
113
- setStatus ( { state : 'missing docker_mcp' , message : 'No Docker servers found in Claude Desktop Config' , color : 'error' } )
114
- setHasConfig ( false )
115
- }
107
+ const hasDocker = Object . keys ( servers ) . some ( key => key === 'mcp_docker' )
108
+ if ( hasDocker ) {
109
+ setStatus ( { state : 'has docker_mcp' , message : 'Claude Desktop Config is valid' , color : 'success' } )
110
+ setHasConfig ( true )
111
+ } else {
112
+ setStatus ( { state : 'missing docker_mcp' , message : 'No Docker servers found in Claude Desktop Config' , color : 'error' } )
113
+ setHasConfig ( false )
116
114
}
115
+
117
116
}
118
117
} , [ claudeConfig ] )
119
118
@@ -148,7 +147,7 @@ export const ClaudeConfigSyncStatus = ({ client, setHasConfig }: { client: v1.Do
148
147
} } > Add Docker MCP</ Button >
149
148
}
150
149
{
151
- status . state === 'missing claude config' && < Button onClick = { async ( ) => {
150
+ status . state === 'missing claude config' || status . state === 'empty claude config' && < Button onClick = { async ( ) => {
152
151
trackEvent ( 'claude-config-changed' , { action : 'write' } )
153
152
await writeFilesToHost ( client , [ {
154
153
path : 'claude_desktop_config.json' , content : JSON . stringify ( {
@@ -167,7 +166,7 @@ export const ClaudeConfigSyncStatus = ({ client, setHasConfig }: { client: v1.Do
167
166
setDeleteReady ( true )
168
167
setTimeout ( ( ) => {
169
168
setDeleteReady ( false )
170
- } , 10000 )
169
+ } , 3000 )
171
170
}
172
171
else {
173
172
trackEvent ( 'claude-config-changed' , { action : 'delete' } )
@@ -176,18 +175,14 @@ export const ClaudeConfigSyncStatus = ({ client, setHasConfig }: { client: v1.Do
176
175
refreshConfig ( )
177
176
setDeleteReady ( false )
178
177
} catch ( error ) {
179
-
180
178
if ( ( error as ExecResult ) . stderr ) {
181
179
client . desktopUI . toast . error ( 'Error deleting config' + ( error as ExecResult ) . stderr )
182
180
console . error ( 'Error deleting config' , error )
183
181
}
184
-
185
-
186
182
}
187
183
}
188
184
}
189
185
} > { deleteReady ? 'Click again to confirm deletion' : 'Delete Claude Desktop Config' } </ Button > }
190
-
191
186
</ Stack >
192
187
< DialogContent >
193
188
< DialogContentText component = 'pre' >
0 commit comments