77 Card ,
88 CardContent ,
99 CardHeader ,
10+ Chip ,
1011 CircularProgress ,
1112 Collapse ,
1213 Divider ,
@@ -15,6 +16,7 @@ import {
1516 ListItem ,
1617 ListItemText ,
1718 Stack ,
19+ Theme ,
1820 Typography
1921} from '@mui/material' ;
2022import { useEffect , useState } from 'react' ;
@@ -24,6 +26,7 @@ import ContinueIcon from '../../assets/continue.svg';
2426import CursorIcon from '../../assets/cursor.svg' ;
2527import GordonIcon from '../../assets/gordon-icon.png' ;
2628import { CATALOG_LAYOUT_SX , DOCKER_MCP_COMMAND } from '../../Constants' ;
29+ import { LinkOffOutlined , LinkOutlined } from '@mui/icons-material' ;
2730
2831// Initialize the Docker Desktop client
2932const client = createDockerDesktopClient ( ) ;
@@ -39,6 +42,16 @@ const iconMap = {
3942 'Continue.dev' : ContinueIcon ,
4043} ;
4144
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+
4255const MCPClientSettings = ( { appProps } : MCPClientSettingsProps ) => {
4356 // Extract all the values we need from appProps
4457 const { mcpClientStates, updateMCPClientStates } = appProps ;
@@ -127,6 +140,7 @@ function ClientSetting({
127140 mcpClientState : any ;
128141 appProps : any ;
129142} ) {
143+
130144 const [ expanded , setExpanded ] = useState ( false ) ;
131145
132146 // Extract all the values we need from appProps
@@ -149,75 +163,68 @@ function ClientSetting({
149163 />
150164 )
151165 }
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 > }
153167 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 ? (
167181 < KeyboardArrowDownIcon fontSize = "small" />
168182 ) : (
169183 < 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 >
182187 }
183188 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 ( ) => {
195194 setButtonsLoading ( {
196195 ...buttonsLoading ,
197- [ name ] : false ,
196+ [ name ] : true ,
198197 } ) ;
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 )
199210 }
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+ ) }
221228 { mcpClientState . exists && ! mcpClientState . configured && (
222229 < Button
223230 sx = { { fontSize : 12 } }
@@ -231,15 +238,23 @@ function ClientSetting({
231238 } finally {
232239 setButtonsLoading ( {
233240 ...buttonsLoading ,
234- [ name ] : false ,
241+ [ name ] : true ,
235242 } ) ;
243+ try {
244+ await connectClient ( name ) ;
245+ } finally {
246+ setButtonsLoading ( {
247+ ...buttonsLoading ,
248+ [ name ] : false ,
249+ } ) ;
250+ }
236251 }
237252 } }
238253 disabled = { buttonsLoading [ name ] }
239254 color = "primary"
240255 size = "small"
241256 >
242- < Stack direction = "row" alignItems = "center" spacing = { 1 } >
257+ < Stack direction = "row" alignItems = "center" spacing = { 1 } sx = { ConnectButtonStyle } >
243258 { ( buttonsLoading [ name ] && (
244259 < >
245260 < Typography sx = { { fontSize : 12 , width : 70 } } >
@@ -255,46 +270,47 @@ function ClientSetting({
255270 </ Stack >
256271 </ Button >
257272 ) }
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 ( ) => {
271280 setButtonsLoading ( {
272281 ...buttonsLoading ,
273- [ name ] : false ,
282+ [ name ] : true ,
274283 } ) ;
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 >
295311 }
296312 />
297- < Collapse in = { expanded } timeout = "auto" unmountOnExit >
313+ < Collapse in = { expanded } timeout = "auto" unmountOnExit >
298314 < CardContent >
299315 < Stack direction = "column" justifyContent = "center" spacing = { 1 } >
300316 < Stack direction = "row" alignItems = "center" spacing = { 1 } >
@@ -345,8 +361,8 @@ function ClientSetting({
345361 ) }
346362 </ List >
347363 </ CardContent >
348- </ Collapse >
349- </ Card >
364+ </ Collapse >
365+ </ Card >
350366 ) ;
351367}
352368
0 commit comments