7
7
Card ,
8
8
CardContent ,
9
9
CardHeader ,
10
+ Chip ,
10
11
CircularProgress ,
11
12
Collapse ,
12
13
Divider ,
@@ -15,6 +16,7 @@ import {
15
16
ListItem ,
16
17
ListItemText ,
17
18
Stack ,
19
+ Theme ,
18
20
Typography
19
21
} from '@mui/material' ;
20
22
import { useEffect , useState } from 'react' ;
@@ -24,6 +26,7 @@ import ContinueIcon from '../../assets/continue.svg';
24
26
import CursorIcon from '../../assets/cursor.svg' ;
25
27
import GordonIcon from '../../assets/gordon-icon.png' ;
26
28
import { CATALOG_LAYOUT_SX , DOCKER_MCP_COMMAND } from '../../Constants' ;
29
+ import { LinkOffOutlined , LinkOutlined } from '@mui/icons-material' ;
27
30
28
31
// Initialize the Docker Desktop client
29
32
const client = createDockerDesktopClient ( ) ;
@@ -39,6 +42,16 @@ const iconMap = {
39
42
'Continue.dev' : ContinueIcon ,
40
43
} ;
41
44
45
+ const ConnectButtonStyle = ( theme : Theme ) => ( {
46
+ fontSize : '1.3em' ,
47
+ p : 1 ,
48
+ alignItems : 'center' ,
49
+ justifyContent : 'center' ,
50
+ [ theme . breakpoints . down ( 'sm' ) ] : {
51
+ fontSize : '1em' ,
52
+ } ,
53
+ } ) ;
54
+
42
55
const MCPClientSettings = ( { appProps } : MCPClientSettingsProps ) => {
43
56
// Extract all the values we need from appProps
44
57
const { mcpClientStates, updateMCPClientStates } = appProps ;
@@ -127,6 +140,7 @@ function ClientSetting({
127
140
mcpClientState : any ;
128
141
appProps : any ;
129
142
} ) {
143
+
130
144
const [ expanded , setExpanded ] = useState ( false ) ;
131
145
132
146
// Extract all the values we need from appProps
@@ -149,75 +163,68 @@ function ClientSetting({
149
163
/>
150
164
)
151
165
}
152
- title = { < Typography variant = "subtitle2" > { name } </ Typography > }
166
+ title = { < Typography variant = "subtitle2" > { name } { mcpClientState . exists ? '' : < Chip sx = { { ml : 1 } } label = "Not detected" color = "error" size = "small" /> } </ Typography > }
153
167
subheader = {
154
- mcpClientState . exists ? (
155
- < Typography
156
- variant = "body2"
157
- sx = { {
158
- color : 'text.secondary ' ,
159
- alignItems : 'center ' ,
160
- display : 'flex ' ,
161
- cursor : 'pointer' ,
162
- } }
163
- onClick = { ( ) => setExpanded ( ! expanded ) }
164
- >
165
- Manual configuration
166
- { expanded ? (
168
+ < Typography
169
+ variant = "body2"
170
+ sx = { {
171
+ color : 'text.secondary' ,
172
+ alignItems : 'center ' ,
173
+ display : 'flex ' ,
174
+ cursor : 'pointer ' ,
175
+ } }
176
+ onClick = { ( ) => setExpanded ( ! expanded ) }
177
+ >
178
+ Manual configuration
179
+ {
180
+ expanded ? (
167
181
< KeyboardArrowDownIcon fontSize = "small" />
168
182
) : (
169
183
< KeyboardArrowRightIcon fontSize = "small" />
170
- ) }
171
- </ Typography >
172
- ) : (
173
- < Typography
174
- variant = "body2"
175
- sx = { {
176
- color : 'text.secondary' ,
177
- } }
178
- >
179
- Client not installed
180
- </ Typography >
181
- )
184
+ )
185
+ }
186
+ </ Typography >
182
187
}
183
188
action = {
184
- < Stack direction = "row" spacing = { 1 } >
185
- { mcpClientState . exists && mcpClientState . configured && (
186
- < Button
187
- onClick = { async ( ) => {
188
- setButtonsLoading ( {
189
- ...buttonsLoading ,
190
- [ name ] : true ,
191
- } ) ;
192
- try {
193
- await disconnectClient ( name ) ;
194
- } finally {
189
+ < Stack direction = "row" spacing = { 1 } >
190
+ {
191
+ mcpClientState . exists && mcpClientState . configured && (
192
+ < Button
193
+ onClick = { async ( ) => {
195
194
setButtonsLoading ( {
196
195
...buttonsLoading ,
197
- [ name ] : false ,
196
+ [ name ] : true ,
198
197
} ) ;
198
+ try {
199
+ await disconnectClient ( name ) ;
200
+ } finally {
201
+ setButtonsLoading ( {
202
+ ...buttonsLoading ,
203
+ [ name ] : false ,
204
+ } ) ;
205
+ }
206
+ } }
207
+ disabled = {
208
+ buttonsLoading [ name ] ||
209
+ Boolean ( mcpClientState . preventAutoConnectMessage )
199
210
}
200
- } }
201
- disabled = { buttonsLoading [ name ] }
202
- color = "warning"
203
- size = "small"
204
- >
205
- < Stack direction = "row" alignItems = "center" spacing = { 1 } >
206
- { ( buttonsLoading [ name ] && (
207
- < >
208
- < Typography sx = { { fontSize : 12 , width : 70 } } >
209
- Connect
210
- </ Typography >
211
- < CircularProgress size = { 12 } />
212
- </ >
213
- ) ) || (
214
- < Typography sx = { { fontSize : 12 , width : 90 } } >
215
- Disconnect
216
- </ Typography >
217
- ) }
218
- </ Stack >
219
- </ Button >
220
- ) }
211
+ >
212
+ < Stack direction = "row" alignItems = "center" spacing = { 1 } sx = { ConnectButtonStyle } >
213
+ { ( buttonsLoading [ name ] && (
214
+ < >
215
+ < Typography sx = { { fontSize : 12 , width : 70 } } >
216
+ Connect
217
+ </ Typography >
218
+ < CircularProgress size = { 12 } />
219
+ </ >
220
+ ) ) || (
221
+ < Typography sx = { { fontSize : 12 , width : 90 } } >
222
+ Disconnect
223
+ </ Typography >
224
+ ) }
225
+ </ Stack >
226
+ </ Button >
227
+ ) }
221
228
{ mcpClientState . exists && ! mcpClientState . configured && (
222
229
< Button
223
230
sx = { { fontSize : 12 } }
@@ -231,15 +238,23 @@ function ClientSetting({
231
238
} finally {
232
239
setButtonsLoading ( {
233
240
...buttonsLoading ,
234
- [ name ] : false ,
241
+ [ name ] : true ,
235
242
} ) ;
243
+ try {
244
+ await connectClient ( name ) ;
245
+ } finally {
246
+ setButtonsLoading ( {
247
+ ...buttonsLoading ,
248
+ [ name ] : false ,
249
+ } ) ;
250
+ }
236
251
}
237
252
} }
238
253
disabled = { buttonsLoading [ name ] }
239
254
color = "primary"
240
255
size = "small"
241
256
>
242
- < Stack direction = "row" alignItems = "center" spacing = { 1 } >
257
+ < Stack direction = "row" alignItems = "center" spacing = { 1 } sx = { ConnectButtonStyle } >
243
258
{ ( buttonsLoading [ name ] && (
244
259
< >
245
260
< Typography sx = { { fontSize : 12 , width : 70 } } >
@@ -255,46 +270,47 @@ function ClientSetting({
255
270
</ Stack >
256
271
</ Button >
257
272
) }
258
- { ! mcpClientState . exists && (
259
- < Button
260
- sx = { { fontSize : 12 } }
261
- size = "small"
262
- disabled
263
- onClick = { async ( ) => {
264
- setButtonsLoading ( {
265
- ...buttonsLoading ,
266
- [ name ] : true ,
267
- } ) ;
268
- try {
269
- await connectClient ( name ) ;
270
- } finally {
273
+ {
274
+ ! mcpClientState . exists && (
275
+ < Button
276
+ sx = { { fontSize : 12 } }
277
+ size = "small"
278
+ disabled
279
+ onClick = { async ( ) => {
271
280
setButtonsLoading ( {
272
281
...buttonsLoading ,
273
- [ name ] : false ,
282
+ [ name ] : true ,
274
283
} ) ;
275
- }
276
- } }
277
- >
278
- < Stack direction = "row" alignItems = "center" spacing = { 1 } >
279
- { ( buttonsLoading [ name ] && (
280
- < >
281
- < Typography sx = { { fontSize : 12 , width : 70 } } >
282
- Disconnect
283
- </ Typography >
284
- < CircularProgress size = { 12 } />
285
- </ >
286
- ) ) || (
287
- < Typography sx = { { fontSize : 12 , width : 90 } } >
288
- Connect
289
- </ Typography >
290
- ) }
291
- </ Stack >
292
- </ Button >
293
- ) }
294
- </ Stack >
284
+ try {
285
+ await connectClient ( name ) ;
286
+ } finally {
287
+ setButtonsLoading ( {
288
+ ...buttonsLoading ,
289
+ [ name ] : true ,
290
+ } ) ;
291
+ }
292
+ } }
293
+ >
294
+ < Stack direction = "row" alignItems = "center" spacing = { 1 } sx = { ConnectButtonStyle } >
295
+ { ( buttonsLoading [ name ] && (
296
+ < >
297
+ < Typography sx = { { fontSize : 12 , width : 70 } } >
298
+ Disconnect
299
+ </ Typography >
300
+ < CircularProgress size = { 12 } />
301
+ </ >
302
+ ) ) || (
303
+ < Typography sx = { { fontSize : 12 , width : 90 } } >
304
+ Connect
305
+ </ Typography >
306
+ ) }
307
+ </ Stack >
308
+ </ Button >
309
+ ) }
310
+ </ Stack >
295
311
}
296
312
/>
297
- < Collapse in = { expanded } timeout = "auto" unmountOnExit >
313
+ < Collapse in = { expanded } timeout = "auto" unmountOnExit >
298
314
< CardContent >
299
315
< Stack direction = "column" justifyContent = "center" spacing = { 1 } >
300
316
< Stack direction = "row" alignItems = "center" spacing = { 1 } >
@@ -345,8 +361,8 @@ function ClientSetting({
345
361
) }
346
362
</ List >
347
363
</ CardContent >
348
- </ Collapse >
349
- </ Card >
364
+ </ Collapse >
365
+ </ Card >
350
366
) ;
351
367
}
352
368
0 commit comments