Skip to content

fix: enable dynamic MCP server start/stop without app restart#55

Merged
Mouseww merged 1 commit intoMouseww:mainfrom
52sanmao:fix/mcp-server-dynamic-start
May 4, 2026
Merged

fix: enable dynamic MCP server start/stop without app restart#55
Mouseww merged 1 commit intoMouseww:mainfrom
52sanmao:fix/mcp-server-dynamic-start

Conversation

@52sanmao
Copy link
Copy Markdown
Contributor

@52sanmao 52sanmao commented May 3, 2026

Summary

  • mcp-server:saveConfig handler now dynamically starts/stops the MCP server after saving config, instead of requiring a full app restart
  • Follows the same pattern already used by the MITM proxy saveConfig handler
  • Updated UI toast message to remove "重启应用后生效" since changes now take effect immediately

Problem

When users enable the MCP Server toggle and click "保存 MCP Server 设置", the config is saved to disk but the server doesn't actually start. The UI shows "已停止" even though enabled: true. Users must restart the entire app for the server to start. (See #54)

Root Cause

The mcp-server:saveConfig IPC handler only called saveMCPServerConfig(config) without invoking initMCPServer(). The MCP server was only initialized once at app startup (app.whenReady).

Fix

Added dynamic start/stop logic to saveConfig handler (matching the existing MITM proxy pattern):

if (config.enabled && !isMCPServerRunning()) {
  await initMCPServer(...);
} else if (!config.enabled && isMCPServerRunning()) {
  await stopMCPServer();
}

Closes #54

The `mcp-server:saveConfig` handler only wrote config to disk without
starting/stopping the MCP server, requiring a full app restart. Now it
dynamically starts or stops the server after saving, matching the
existing MITM proxy saveConfig pattern.

Fixes Mouseww#54

Co-Authored-By: Craft Agent <agents-noreply@craft.do>
@Mouseww Mouseww merged commit 29f9694 into Mouseww:main May 4, 2026
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.

mcp未能打开

2 participants