Skip to content

Commit f557e00

Browse files
refactor: change visibility of properties and methods in HttpServerTransport to protected for better extensibility
1 parent afb1320 commit f557e00

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

src/Transports/HttpServerTransport.php

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -39,20 +39,20 @@ class HttpServerTransport implements LoggerAwareInterface, LoopAwareInterface, S
3939

4040
protected LoopInterface $loop;
4141

42-
private ?SocketServer $socket = null;
42+
protected ?SocketServer $socket = null;
4343

44-
private ?HttpServer $http = null;
44+
protected ?HttpServer $http = null;
4545

4646
/** @var array<string, ThroughStream> clientId => SSE Stream */
47-
private array $activeSseStreams = [];
47+
protected array $activeSseStreams = [];
4848

49-
private bool $listening = false;
49+
protected bool $listening = false;
5050

51-
private bool $closing = false;
51+
protected bool $closing = false;
5252

53-
private string $ssePath;
53+
protected string $ssePath;
5454

55-
private string $messagePath;
55+
protected string $messagePath;
5656

5757
/**
5858
* @param string $host Host to bind to (e.g., '127.0.0.1', '0.0.0.0').
@@ -61,10 +61,10 @@ class HttpServerTransport implements LoggerAwareInterface, LoopAwareInterface, S
6161
* @param array|null $sslContext Optional SSL context options for React SocketServer (for HTTPS).
6262
*/
6363
public function __construct(
64-
private readonly string $host = '127.0.0.1',
65-
private readonly int $port = 8080,
66-
private readonly string $mcpPathPrefix = 'mcp', // e.g., /mcp/sse, /mcp/message
67-
private readonly ?array $sslContext = null // For enabling HTTPS
64+
protected readonly string $host = '127.0.0.1',
65+
protected readonly int $port = 8080,
66+
protected readonly string $mcpPathPrefix = 'mcp', // e.g., /mcp/sse, /mcp/message
67+
protected readonly ?array $sslContext = null // For enabling HTTPS
6868
) {
6969
$this->logger = new NullLogger();
7070
$this->loop = Loop::get();
@@ -129,7 +129,7 @@ public function listen(): void
129129
}
130130

131131
/** Creates the main request handling callback for ReactPHP HttpServer */
132-
private function createRequestHandler(): callable
132+
protected function createRequestHandler(): callable
133133
{
134134
return function (ServerRequestInterface $request) {
135135
$path = $request->getUri()->getPath();
@@ -154,7 +154,7 @@ private function createRequestHandler(): callable
154154
}
155155

156156
/** Handles a new SSE connection request */
157-
private function handleSseRequest(ServerRequestInterface $request): Response
157+
protected function handleSseRequest(ServerRequestInterface $request): Response
158158
{
159159
$clientId = 'sse_' . bin2hex(random_bytes(16));
160160
$this->logger->info('New SSE connection', ['clientId' => $clientId]);
@@ -208,7 +208,7 @@ private function handleSseRequest(ServerRequestInterface $request): Response
208208
}
209209

210210
/** Handles incoming POST requests with messages */
211-
private function handleMessagePostRequest(ServerRequestInterface $request): Response
211+
protected function handleMessagePostRequest(ServerRequestInterface $request): Response
212212
{
213213
$queryParams = $request->getQueryParams();
214214
$clientId = $queryParams['clientId'] ?? null;

0 commit comments

Comments
 (0)