@@ -65,7 +65,7 @@ public function __construct(
6565 private readonly string $ mcpPathPrefix = 'mcp ' , // e.g., /mcp/sse, /mcp/message
6666 private readonly ?array $ sslContext = null // For enabling HTTPS
6767 ) {
68- $ this ->logger = new NullLogger () ;
68+ $ this ->logger = new NullLogger ;
6969 $ this ->loop = Loop::get ();
7070 $ this ->ssePath = '/ ' .trim ($ mcpPathPrefix , '/ ' ).'/sse ' ;
7171 $ this ->messagePath = '/ ' .trim ($ mcpPathPrefix , '/ ' ).'/message ' ;
@@ -109,7 +109,7 @@ public function listen(): void
109109 $ this ->http ->listen ($ this ->socket );
110110
111111 $ this ->socket ->on ('error ' , function (Throwable $ error ) {
112- $ this ->logger ->error ('HttpTransport: Socket server error. ' , ['error ' => $ error ->getMessage ()]);
112+ $ this ->logger ->error ('Socket server error. ' , ['error ' => $ error ->getMessage ()]);
113113 $ this ->emit ('error ' , [new TransportException ("Socket server error: {$ error ->getMessage ()}" , 0 , $ error )]);
114114 $ this ->close ();
115115 });
@@ -159,7 +159,7 @@ private function handleSseRequest(ServerRequestInterface $request): Response
159159 $ clientId = 'sse_ ' .bin2hex (random_bytes (16 ));
160160 $ this ->logger ->info ('New SSE connection ' , ['clientId ' => $ clientId ]);
161161
162- $ sseStream = new ThroughStream () ;
162+ $ sseStream = new ThroughStream ;
163163
164164 $ sseStream ->on ('close ' , function () use ($ clientId ) {
165165 $ this ->logger ->info ('SSE stream closed ' , ['clientId ' => $ clientId ]);
@@ -216,13 +216,13 @@ private function handleMessagePostRequest(ServerRequestInterface $request): Resp
216216 $ clientId = $ queryParams ['clientId ' ] ?? null ;
217217
218218 if (! $ clientId || ! is_string ($ clientId )) {
219- $ this ->logger ->warning ('HttpTransport: Received POST without valid clientId query parameter. ' );
219+ $ this ->logger ->warning ('Received POST without valid clientId query parameter. ' );
220220
221221 return new Response (400 , ['Content-Type ' => 'text/plain ' ], 'Missing or invalid clientId query parameter ' );
222222 }
223223
224224 if (! isset ($ this ->activeSseStreams [$ clientId ])) {
225- $ this ->logger ->warning ('HttpTransport: Received POST for unknown or disconnected clientId. ' , ['clientId ' => $ clientId ]);
225+ $ this ->logger ->warning ('Received POST for unknown or disconnected clientId. ' , ['clientId ' => $ clientId ]);
226226
227227 return new Response (404 , ['Content-Type ' => 'text/plain ' ], 'Client ID not found or disconnected ' );
228228 }
@@ -234,7 +234,7 @@ private function handleMessagePostRequest(ServerRequestInterface $request): Resp
234234 $ body = $ request ->getBody ()->getContents ();
235235
236236 if (empty ($ body )) {
237- $ this ->logger ->warning ('HttpTransport: Received empty POST body ' , ['clientId ' => $ clientId ]);
237+ $ this ->logger ->warning ('Received empty POST body ' , ['clientId ' => $ clientId ]);
238238
239239 return new Response (400 , ['Content-Type ' => 'text/plain ' ], 'Empty request body ' );
240240 }
@@ -265,16 +265,15 @@ public function sendToClientAsync(string $clientId, string $rawFramedMessage): P
265265 return \React \Promise \resolve (null );
266266 }
267267
268- $ deferred = new Deferred () ;
268+ $ deferred = new Deferred ;
269269 $ written = $ this ->sendSseEvent ($ stream , 'message ' , $ jsonData );
270270
271271 if ($ written ) {
272- $ this ->logger ->debug ('HttpTransport: Message sent via SSE. ' , ['clientId ' => $ clientId , 'data ' => $ jsonData ]);
273272 $ deferred ->resolve (null );
274273 } else {
275- $ this ->logger ->debug ('HttpTransport: SSE stream buffer full, waiting for drain. ' , ['clientId ' => $ clientId ]);
274+ $ this ->logger ->debug ('SSE stream buffer full, waiting for drain. ' , ['clientId ' => $ clientId ]);
276275 $ stream ->once ('drain ' , function () use ($ deferred , $ clientId ) {
277- $ this ->logger ->debug ('HttpTransport: SSE stream drained. ' , ['clientId ' => $ clientId ]);
276+ $ this ->logger ->debug ('SSE stream drained. ' , ['clientId ' => $ clientId ]);
278277 $ deferred ->resolve (null );
279278 });
280279 // Add a timeout?
@@ -316,7 +315,7 @@ public function close(): void
316315 }
317316 $ this ->closing = true ;
318317 $ this ->listening = false ;
319- $ this ->logger ->info ('HttpTransport: Closing... ' );
318+ $ this ->logger ->info ('Closing transport ... ' );
320319
321320 if ($ this ->socket ) {
322321 $ this ->socket ->close ();
@@ -326,7 +325,7 @@ public function close(): void
326325 $ activeStreams = $ this ->activeSseStreams ;
327326 $ this ->activeSseStreams = [];
328327 foreach ($ activeStreams as $ clientId => $ stream ) {
329- $ this ->logger ->debug ('HttpTransport: Closing active SSE stream ' , ['clientId ' => $ clientId ]);
328+ $ this ->logger ->debug ('Closing active SSE stream ' , ['clientId ' => $ clientId ]);
330329 unset($ this ->activeSseStreams [$ clientId ]);
331330 $ stream ->close ();
332331 }
0 commit comments