Skip to content

Commit 2d7856f

Browse files
committed
✨ Adapt MCP protocal to different program language #416
[Specification Details] 1.Conflict resolve.
1 parent 9fc51aa commit 2d7856f

File tree

1 file changed

+31
-22
lines changed

1 file changed

+31
-22
lines changed

frontend/app/[locale]/agents/components/McpConfigModal.tsx

Lines changed: 31 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ import {
2222
Maximize,
2323
Minimize,
2424
RefreshCw,
25-
FileTextOutlined,
26-
ContainerOutlined,
25+
FileText,
26+
Container,
2727
} from "lucide-react";
2828

2929
import { McpConfigModalProps, AgentRefreshEvent } from "@/types/agentConfig";
@@ -93,7 +93,7 @@ export default function McpConfigModal({
9393
// Notify parent component to update tool list
9494
window.dispatchEvent(new CustomEvent("toolsUpdated"));
9595
}
96-
96+
9797
// Refresh agent list to update agent availability status
9898
window.dispatchEvent(
9999
new CustomEvent("refreshAgentList") as AgentRefreshEvent
@@ -166,7 +166,7 @@ export default function McpConfigModal({
166166
// Refresh tools and agents asynchronously after adding server
167167
// This will update MCP tool availability and agent availability status
168168
await refreshToolsAndAgents();
169-
169+
170170
// Show success message after refresh completes to avoid message overlap
171171
message.success(t("mcpService.message.addServerSuccess"));
172172
} else {
@@ -266,7 +266,7 @@ export default function McpConfigModal({
266266
if (result.success) {
267267
message.success(t("mcpConfig.message.healthCheckSuccess"));
268268
await loadServerList();
269-
269+
270270
// Refresh tools and agents asynchronously after health check
271271
// This will update MCP tool availability and agent availability status
272272
refreshToolsAndAgents();
@@ -275,15 +275,15 @@ export default function McpConfigModal({
275275
result.message || t("mcpConfig.message.healthCheckFailed")
276276
);
277277
await loadServerList();
278-
278+
279279
// Refresh tools and agents even if health check failed
280280
// This will update MCP tool availability and agent availability status
281281
refreshToolsAndAgents();
282282
}
283283
} catch (error) {
284284
message.error(t("mcpConfig.message.healthCheckFailed"));
285285
await loadServerList();
286-
286+
287287
// Refresh tools and agents even if health check failed
288288
// This will update MCP tool availability and agent availability status
289289
refreshToolsAndAgents();
@@ -552,17 +552,13 @@ export default function McpConfigModal({
552552
};
553553

554554
// Delete container
555-
const handleDeleteContainer = async (container: any) => {
556-
modal.confirm({
555+
const handleDeleteContainer = async (container: McpContainer) => {
556+
confirm({
557557
title: t("mcpConfig.deleteContainer.confirmTitle"),
558558
content: t("mcpConfig.deleteContainer.confirmContent", {
559559
name: container.name || container.container_id,
560560
}),
561561
okText: t("common.delete", "Delete"),
562-
cancelText: t("common.cancel", "Cancel"),
563-
okType: "danger",
564-
cancelButtonProps: { disabled: updatingTools },
565-
okButtonProps: { disabled: updatingTools, loading: updatingTools },
566562
onOk: async () => {
567563
try {
568564
const result = await deleteMcpContainer(container.container_id);
@@ -574,14 +570,19 @@ export default function McpConfigModal({
574570

575571
// Refresh tools and agents
576572
refreshToolsAndAgents().catch((error) => {
577-
log.error("Failed to refresh tools and agents after container deletion:", error);
573+
log.error(
574+
"Failed to refresh tools and agents after container deletion:",
575+
error
576+
);
578577
});
579578
} else {
580579
message.error(result.message);
580+
// Throw error to prevent modal from closing
581581
throw new Error(result.message);
582582
}
583583
} catch (error) {
584584
message.error(t("mcpConfig.message.deleteContainerFailed"));
585+
// Throw error to prevent modal from closing
585586
throw error;
586587
}
587588
},
@@ -688,8 +689,16 @@ export default function McpConfigModal({
688689
{/* Add containerized MCP server section */}
689690
<Card size="small" style={{ marginBottom: 16 }}>
690691
<Title level={5} style={{ margin: "0 0 12px 0" }}>
691-
<ContainerOutlined style={{ marginRight: 8 }} />
692-
{t("mcpConfig.addContainer.title")}
692+
<span
693+
style={{
694+
display: "inline-flex",
695+
alignItems: "center",
696+
gap: 8,
697+
}}
698+
>
699+
<Container style={{ width: 16, height: 16 }} />
700+
{t("mcpConfig.addContainer.title")}
701+
</span>
693702
</Title>
694703
<Space direction="vertical" style={{ width: "100%" }} size="middle">
695704
<div>
@@ -727,9 +736,9 @@ export default function McpConfigModal({
727736
loading={addingContainer || updatingTools}
728737
icon={
729738
addingContainer || updatingTools ? (
730-
<LoadingOutlined />
739+
<LoaderCircle className="animate-spin" size={16} />
731740
) : (
732-
<PlusOutlined />
741+
<Plus className="size-4" />
733742
)
734743
}
735744
disabled={actionsLocked}
@@ -745,7 +754,7 @@ export default function McpConfigModal({
745754
<Divider style={{ margin: "16px 0" }} />
746755

747756
{/* Server list */}
748-
<div style={{ marginBottom: 24 }}>
757+
<div>
749758
<div
750759
style={{
751760
display: "flex",
@@ -829,7 +838,7 @@ export default function McpConfigModal({
829838
<Space size="small">
830839
<Button
831840
type="link"
832-
icon={<FileTextOutlined />}
841+
icon={<FileText className="size-4" />}
833842
onClick={() => handleViewLogs(record.container_id)}
834843
size="small"
835844
disabled={updatingTools}
@@ -839,7 +848,7 @@ export default function McpConfigModal({
839848
<Button
840849
type="link"
841850
danger
842-
icon={<DeleteOutlined />}
851+
icon={<Trash className="size-4" />}
843852
onClick={() => handleDeleteContainer(record)}
844853
size="small"
845854
disabled={actionsLocked}
@@ -911,7 +920,7 @@ export default function McpConfigModal({
911920
<div style={{ padding: "0 0 16px 0" }}>
912921
{loadingLogs ? (
913922
<div style={{ textAlign: "center", padding: "40px 0" }}>
914-
<LoadingOutlined style={{ fontSize: 24, marginRight: 8 }} />
923+
<LoaderCircle className="animate-spin" size={16} />
915924
<Text>{t("mcpConfig.containerLogs.loading")}</Text>
916925
</div>
917926
) : (

0 commit comments

Comments
 (0)