Skip to content

Commit e34db06

Browse files
author
colinmcneil
committed
Add secret expectations
1 parent ec64bab commit e34db06

File tree

2 files changed

+62
-47
lines changed

2 files changed

+62
-47
lines changed

src/extension/ui/src/components/PromptCard.tsx

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,12 @@ import { Card, CardActions, CardContent, CardMedia, Typography } from "@mui/mate
44
import { Ref } from "../Refs";
55
import { useState } from "react";
66
import { trackEvent } from "../Usage";
7-
import { Article, AttachFile, Build } from "@mui/icons-material";
7+
import { Article, AttachFile, Build, LockRounded } from "@mui/icons-material";
88

99
export interface CatalogItem {
1010
description?: string;
1111
icon?: string;
12+
secrets?: { name: string }[];
1213
ref: string;
1314
prompts: number;
1415
resources: object[];
@@ -60,7 +61,18 @@ export function CatalogItemCard({ openUrl, item, canRegister, registered, regist
6061
<Build />
6162
</Badge>
6263
</Tooltip>
63-
64+
{item.secrets?.length && (
65+
<Tooltip title={<Stack sx={{ pr: 1 }} direction="column" spacing={1}>
66+
<Typography sx={{ fontWeight: 'bold' }}>Expected secrets:</Typography>
67+
{item.secrets.map(secret => (
68+
<Typography key={secret.name}>{secret.name}</Typography>
69+
))}
70+
</Stack>}>
71+
<Badge badgeContent={item.secrets?.length || "0"} color="warning">
72+
<LockRounded />
73+
</Badge>
74+
</Tooltip>
75+
)}
6476
</Stack>
6577
<Button
6678
size="small"

src/extension/ui/src/components/Settings.tsx

Lines changed: 48 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ import {
2727
ContentCopy,
2828
LinkOff,
2929
LinkRounded,
30-
SaveOutlined
30+
SaveOutlined,
31+
InfoOutlined
3132
} from '@mui/icons-material';
3233
import { DOCKER_MCP_CONFIG, MCPClient } from '../Constants';
3334
import { client } from '../App';
@@ -80,50 +81,52 @@ const Settings = ({ settings, setSettings, mcpClientStates, onUpdate }: { onUpda
8081
<List>
8182
{Object.entries(mcpClientStates).map(([name, mcpClientState]) => (
8283
<ListItem key={name} secondaryAction={
83-
<>
84-
{mcpClientState.exists && mcpClientState.configured &&
85-
<Button onClick={async () => {
86-
setButtonsLoading({ ...buttonsLoading, [name]: true });
87-
await mcpClientState.disconnect(client)
88-
await onUpdate();
89-
setButtonsLoading({ ...buttonsLoading, [name]: false });
90-
}} disabled={buttonsLoading[name]} color="warning" variant="outlined" size="small">
91-
<Stack direction="row" alignItems="center" spacing={1}>
92-
<Typography>Disconnect</Typography>
93-
<LinkOff />
94-
{buttonsLoading[name] && <CircularProgress size={16} />}
95-
</Stack>
96-
</Button>
97-
}
98-
{mcpClientState.exists && !mcpClientState.configured &&
99-
<Button onClick={async () => {
100-
setButtonsLoading({ ...buttonsLoading, [name]: true });
101-
await mcpClientState.connect(client)
102-
await onUpdate();
103-
setButtonsLoading({ ...buttonsLoading, [name]: false });
104-
}} disabled={buttonsLoading[name]} color="primary" variant="outlined" size="small">
105-
<Stack direction="row" alignItems="center" spacing={1}>
106-
<Typography>Connect</Typography>
107-
<LinkRounded />
108-
{buttonsLoading[name] && <CircularProgress size={16} />}
109-
</Stack>
110-
</Button>
111-
}
112-
{!mcpClientState.exists &&
113-
<Button color="error" variant="outlined" size="small" onClick={async () => {
114-
setButtonsLoading({ ...buttonsLoading, [name]: true });
115-
await mcpClientState.connect(client)
116-
await onUpdate();
117-
setButtonsLoading({ ...buttonsLoading, [name]: false });
118-
}}>
119-
<Stack direction="row" alignItems="center" spacing={1}>
120-
<SaveOutlined />
121-
<Typography>Write Config</Typography>
122-
{buttonsLoading[name] && <CircularProgress size={16} />}
123-
</Stack>
124-
</Button>
125-
}
126-
</>
84+
<Tooltip title="You need to restart Claude Desktop after changing the connection.">
85+
<span>
86+
{mcpClientState.exists && mcpClientState.configured &&
87+
<Button onClick={async () => {
88+
setButtonsLoading({ ...buttonsLoading, [name]: true });
89+
await mcpClientState.disconnect(client)
90+
await onUpdate();
91+
setButtonsLoading({ ...buttonsLoading, [name]: false });
92+
}} disabled={buttonsLoading[name]} color="warning" variant="outlined" size="small">
93+
<Stack direction="row" alignItems="center" spacing={1}>
94+
<Typography>Disconnect</Typography>
95+
<LinkOff />
96+
{buttonsLoading[name] && <CircularProgress size={16} />}
97+
</Stack>
98+
</Button>
99+
}
100+
{mcpClientState.exists && !mcpClientState.configured &&
101+
<Button onClick={async () => {
102+
setButtonsLoading({ ...buttonsLoading, [name]: true });
103+
await mcpClientState.connect(client)
104+
await onUpdate();
105+
setButtonsLoading({ ...buttonsLoading, [name]: false });
106+
}} disabled={buttonsLoading[name]} color="primary" variant="outlined" size="small">
107+
<Stack direction="row" alignItems="center" spacing={1}>
108+
<Typography>Connect</Typography>
109+
<LinkRounded />
110+
{buttonsLoading[name] && <CircularProgress size={16} />}
111+
</Stack>
112+
</Button>
113+
}
114+
{!mcpClientState.exists &&
115+
<Button color="error" variant="outlined" size="small" onClick={async () => {
116+
setButtonsLoading({ ...buttonsLoading, [name]: true });
117+
await mcpClientState.connect(client)
118+
await onUpdate();
119+
setButtonsLoading({ ...buttonsLoading, [name]: false });
120+
}}>
121+
<Stack direction="row" alignItems="center" spacing={1}>
122+
<SaveOutlined />
123+
<Typography>Write Config</Typography>
124+
{buttonsLoading[name] && <CircularProgress size={16} />}
125+
</Stack>
126+
</Button>
127+
}
128+
</span>
129+
</Tooltip>
127130
}>
128131
<ListItemText
129132
primary={

0 commit comments

Comments
 (0)