@@ -27,7 +27,7 @@ class LoopMcpServerStartCommand extends Command
2727    public  function  handle (McpHandler $ mcpHandlerint 
2828    {
2929        if  ($ this option ('debug ' )) {
30-             $ this info ('Starting Laravel Loop MCP server (STDIO transport) ' );
30+             $ this debug ('Starting Laravel Loop MCP server (STDIO transport) ' );
3131        }
3232
3333        if  ($ this option ('user-id ' )) {
@@ -43,7 +43,7 @@ public function handle(McpHandler $mcpHandler): int
4343            Auth::login ($ user
4444
4545            if  ($ this option ('debug ' )) {
46-                 $ this info (sprintf ('Authenticated with user ID %s ' , $ this option ('user-id ' )));
46+                 $ this debug (sprintf ('Authenticated with user ID %s ' , $ this option ('user-id ' )));
4747            }
4848        }
4949
@@ -53,13 +53,13 @@ public function handle(McpHandler $mcpHandler): int
5353
5454        $ stdinon ('data ' , function  ($ datause  ($ stdout$ mcpHandler
5555            if  ($ this option ('debug ' )) {
56-                 $ this comment ('Received data:  ' .$ data
56+                 $ this debug ('Received data:  ' .$ data
5757            }
5858
5959            foreach  (explode ("\n" , trim ($ dataas  $ line
6060                if  (! json_validate ($ line
6161                    if  ($ this option ('debug ' )) {
62-                         $ this comment ('Invalid line:  ' .$ line
62+                         $ this debug ('Invalid line:  ' .$ line
6363                    }
6464
6565                    continue ;
@@ -70,14 +70,14 @@ public function handle(McpHandler $mcpHandler): int
7070                    $ response$ mcpHandlerhandle ($ message
7171
7272                    if  ($ this option ('debug ' )) {
73-                         $ this comment ('Response:  ' .json_encode ($ response
73+                         $ this debug ('Response:  ' .json_encode ($ response
7474                    }
7575
7676                    if  (isset ($ message'id ' ])) {
7777                        $ stdoutwrite (json_encode ($ responsePHP_EOL );
7878                    }
79-                 } catch  (Exception $ e
80-                     $ this error ('Error processing message:  ' .$ egetMessage ());
79+                 } catch  (\ Throwable $ e
80+                     $ this debug ('Error processing message:  ' .$ egetMessage ());
8181
8282                    $ response$ mcpHandlerformatErrorResponse (
8383                        $ message'id ' ] ?? '' ,
@@ -92,7 +92,7 @@ public function handle(McpHandler $mcpHandler): int
9292        });
9393
9494        if  ($ this option ('debug ' )) {
95-             $ this info ('Laravel Loop MCP server running. Press Ctrl+C or send SIGTERM to stop. ' );
95+             $ this debug ('Laravel Loop MCP server running. Press Ctrl+C or send SIGTERM to stop. ' );
9696        }
9797
9898        // Add signal handlers if pcntl is available 
@@ -101,7 +101,7 @@ public function handle(McpHandler $mcpHandler): int
101101                info ('Received signal:  ' .$ signal'. Shutting down... ' );
102102
103103                if  ($ this option ('debug ' )) {
104-                     $ this info ('Received signal:  ' .$ signal'. Shutting down... ' );
104+                     $ this debug ('Received signal:  ' .$ signal'. Shutting down... ' );
105105                }
106106
107107                $ loopstop ();
@@ -130,4 +130,9 @@ public function handle(McpHandler $mcpHandler): int
130130
131131        return  Command::SUCCESS ;
132132    }
133+ 
134+     protected  function  debug ($ message
135+     {
136+         $ this getOutput ()->getOutput ()->getErrorOutput ()->writeln ($ message
137+     }
133138}
0 commit comments