Skip to content

Commit 27ede09

Browse files
fix failure toast
1 parent 49e04f7 commit 27ede09

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

packages/tui/src/component/dialog-mcp.tsx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,14 @@ export function DialogMcp() {
8585
setPendingAdd(name)
8686
sync.set("mcp", { ...sync.data.mcp, [name]: { status: "disabled" } })
8787
dialog.replace(() => <DialogMcp />)
88-
sdk.client.mcp.add({ name, config }).then(() => {
89-
refreshStatus()
90-
toast.show({ variant: "success", message: `MCP "${name}" added` })
88+
sdk.client.mcp.add({ name, config }).then(async () => {
89+
await refreshStatus()
90+
const status = sync.data.mcp[name]
91+
if (status?.status === "failed") {
92+
toast.show({ variant: "error", message: `MCP "${name}" failed to connect` })
93+
} else {
94+
toast.show({ variant: "success", message: `MCP "${name}" added` })
95+
}
9196
}).catch((error) => {
9297
console.error("Failed to add MCP:", error)
9398
toast.show({ variant: "error", message: `Failed to add MCP "${name}"` })

0 commit comments

Comments
 (0)