Skip to content

feat(settings): 新增 MCP 服务器启用/禁用开关#2351

Open
LaiyanB wants to merge 1 commit into
esengine:v1from
LaiyanB:new-feature
Open

feat(settings): 新增 MCP 服务器启用/禁用开关#2351
LaiyanB wants to merge 1 commit into
esengine:v1from
LaiyanB:new-feature

Conversation

@LaiyanB
Copy link
Copy Markdown

@LaiyanB LaiyanB commented May 30, 2026

背景

目前启用或禁用 MCP 服务器需要手动编辑配置文件或使用斜杠命令,且需要重启应用才能生效。Desktop 设置界面中没有可视化的开关来管理 MCP 服务器状态。

变更内容

在设置 → MCP 页面中,为每个 MCP 服务器卡片添加了图形化 Toggle 开关,用户可以单击切换启用/禁用状态,变更立即生效,无需重启应用。

实现方式

  • 前端:在 McpServerCard 组件中添加滑动开关,ON 为绿色,OFF 为灰色
  • 后端:新增 mcp_specs_toggle RPC 命令,持久化配置并实时连接/断开

修改文件

 desktop/src/protocol.ts            |  1 +
 desktop/src/App.tsx                |  5 ++
 desktop/src/ui/settings.tsx        |  6 ++
 desktop/src/ui/mcp-server-card.tsx | 18 ++++
 desktop/src/styles.css             | 57 +++++
 desktop/src/i18n/en.ts             |  2 +
 desktop/src/i18n/zh-CN.ts          |  2 +
 src/cli/commands/desktop.ts        | 43 ++++
 8 files changed, 134 insertions(+)

测试

  • TypeScript 类型检查通过
  • 生产构建通过
  • Toggle 开关 UI 正常显示并可切换

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant