fix: MCP server on Task.Run + start after 10th frame

- Changed from Thread to Task.Run for MCP server
- Start delay: 10 frames (was 3) — let scene fully initialize first
- Kestrel on ThreadPool instead of dedicated thread
This commit is contained in:
emil28092005
2026-06-18 22:11:24 +03:00
parent 5312625920
commit f8504cd44c
+3 -3
View File
@@ -81,12 +81,12 @@ class Program
#if !RELEASE_AOT #if !RELEASE_AOT
frameCount++; frameCount++;
if (mcpPort > 0 && !mcpStarted && frameCount > 3) if (mcpPort > 0 && !mcpStarted && frameCount > 10)
{ {
mcpStarted = true; mcpStarted = true;
var port = mcpPort; var port = mcpPort;
var q = queue; var q = queue;
new Thread(() => Task.Run(() =>
{ {
try try
{ {
@@ -98,7 +98,7 @@ class Program
{ {
Console.WriteLine($"[App] MCP server error: {ex.Message}"); Console.WriteLine($"[App] MCP server error: {ex.Message}");
} }
}) { IsBackground = true }.Start(); });
} }
#endif #endif