Skip to content

Commit 1536db2

Browse files
feat: Update session builder method to use set* instead of with*
1 parent 25bec57 commit 1536db2

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

examples/01-discovery-stdio-calculator/server.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@
1919
logger()->info('Starting MCP Stdio Calculator Server...');
2020

2121
$server = Server::make()
22-
->withServerInfo('Stdio Calculator', '1.1.0', 'Basic Calculator over STDIO transport.')
23-
->withContainer(container())
24-
->withLogger(logger())
25-
->withDiscovery(__DIR__, ['.'])
22+
->setServerInfo('Stdio Calculator', '1.1.0', 'Basic Calculator over STDIO transport.')
23+
->setContainer(container())
24+
->setLogger(logger())
25+
->setDiscovery(__DIR__, ['.'])
2626
->build();
2727

2828
$transport = new StdioTransport(logger: logger());

examples/10-simple-http-transport/server.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@
1616
$request = $creator->fromGlobals();
1717

1818
$server = Server::make()
19-
->withServerInfo('HTTP MCP Server', '1.0.0', 'MCP Server over HTTP transport')
20-
->withContainer(container())
21-
->withSession(new FileSessionStore(__DIR__ . '/sessions'))
22-
->withDiscovery(__DIR__, ['.'])
19+
->setServerInfo('HTTP MCP Server', '1.0.0', 'MCP Server over HTTP transport')
20+
->setContainer(container())
21+
->setSession(new FileSessionStore(__DIR__ . '/sessions'))
22+
->setDiscovery(__DIR__, ['.'])
2323
->build();
2424

2525
$transport = new StreamableHttpTransport($request, $psr17Factory, $psr17Factory);

src/Server/ServerBuilder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ public function setContainer(ContainerInterface $container): self
200200
return $this;
201201
}
202202

203-
public function withSession(
203+
public function setSession(
204204
SessionStoreInterface $sessionStore,
205205
SessionFactoryInterface $sessionFactory = new SessionFactory(),
206206
int $ttl = 3600

0 commit comments

Comments
 (0)