RAM2118 commited on
Commit
e07a4f2
·
verified ·
1 Parent(s): 5198ce4

Sprint 8: prefer port 16620 for first instance, fall back to any port if taken

Browse files

NEXT PUSH:
TASK: Fix port 16620 priority regression
FILES CHANGING: Source/Plugin/McpServer.cpp (start() method only)
FILES NOT TOUCHING: all locked files ✅
NEW FILES: none"

Files changed (1) hide show
  1. Source/Plugin/McpServer.cpp +12 -1
Source/Plugin/McpServer.cpp CHANGED
@@ -70,7 +70,18 @@ void McpServer::start()
70
  if (running.load()) return;
71
  serverThread = std::thread([this]() {
72
  running.store(true);
73
- port = server->bind_to_any_port("127.0.0.1");
 
 
 
 
 
 
 
 
 
 
 
74
  server->listen_after_bind();
75
  running.store(false);
76
  });
 
70
  if (running.load()) return;
71
  serverThread = std::thread([this]() {
72
  running.store(true);
73
+
74
+ // Try preferred port 16620 first (so Claude Code config works without changes)
75
+ // If taken (another instance already running), fall back to any available port
76
+ if (server->bind_to_port("127.0.0.1", PluginBridgeConstants::kDefaultMcpPort))
77
+ {
78
+ port = PluginBridgeConstants::kDefaultMcpPort;
79
+ }
80
+ else
81
+ {
82
+ port = server->bind_to_any_port("127.0.0.1");
83
+ }
84
+
85
  server->listen_after_bind();
86
  running.store(false);
87
  });