Fix MCP server startup for Claude Code compatibility

- Suppress stderr output (Claude Code rejects servers with stderr)
- Make SyncEngine.start() non-blocking (blocking sync caused 15s+ timeout)
- Skip Content-Length header lines gracefully (NDJSON transport)
- Silently ignore malformed JSON lines instead of sending error responses
This commit is contained in:
Viktor Barzin 2026-03-14 16:05:35 +00:00
parent be9e6352c3
commit a52afe050d
No known key found for this signature in database
GPG key ID: 0EB088298288D958
2 changed files with 8 additions and 18 deletions

View file

@ -87,14 +87,7 @@ class SyncEngine:
return self._last_sync_success
def start(self) -> None:
"""Run initial sync (blocking), then start background thread."""
try:
self._sync_once()
self._last_sync_success = True
except Exception:
logger.warning("Initial sync failed, starting in offline mode")
self._last_sync_success = False
"""Start background sync thread (non-blocking)."""
self._thread = threading.Thread(target=self._sync_loop, daemon=True)
self._thread.start()