Remove explicit server initialization calls from Java MCP server examples

Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com>
This commit is contained in:
Christian Tzolov 2025-02-26 19:14:21 +01:00 • committed by Christian Tzolov
commit 5625d93f2a

View file

@ -31,9 +31,6 @@ McpSyncServer syncServer = McpServer.sync(transport)
.build())
.build();
// Initialize the server
syncServer.initialize();
// Register tools, resources, and prompts
syncServer.addTool(syncToolRegistration);
syncServer.addResource(syncResourceRegistration);
@ -64,11 +61,6 @@ McpAsyncServer asyncServer = McpServer.async(transport)
.build())
.build();
// Initialize the server
asyncServer.initialize()
.doOnSuccess(v -> logger.info("Server initialized"))
.subscribe();
// Register tools, resources, and prompts
asyncServer.addTool(asyncToolRegistration)
.doOnSuccess(v -> logger.info("Tool registered"))