From a62a0f711fd17919703523419cc873e41a680877 Mon Sep 17 00:00:00 2001 From: agent-qv Date: Mon, 19 Oct 2026 13:16:21 +0200 Subject: [PATCH] Call setServerInfo() on the server builder config/services.yaml redefines mcp.server.builder as iTopBuilder with its own list of calls. The bundle's definition of that service starts with setServerInfo(mcp.app, mcp.version, mcp.description, mcp.icons, mcp.website_url); the redefinition left that call out, so it was never made. initialize then answered with the SDK defaults, "app" and "dev", whatever config/packages/mcp.yaml says, and the configured description, icon and website URL were never sent. Clients name the server after serverInfo.name (VS Code prefixes every tool with it), so two iTop MCP servers configured in the same client could not be told apart. iTopBuilder::setServerInfo() already exists and forwards to the SDK builder: this only adds the missing call. ServerInfoTest posts a real initialize to /_mcp and checks the reported name and version against the configuration. --- config/services.yaml | 1 + tests/phpunit/ServerInfoTest.php | 40 ++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 tests/phpunit/ServerInfoTest.php diff --git a/config/services.yaml b/config/services.yaml index 3f7bca4..a5ce6e8 100644 --- a/config/services.yaml +++ b/config/services.yaml @@ -50,6 +50,7 @@ services: # you CAN still use autowiring: we just want to show what it looks like without autowire: true calls: + - setServerInfo: ['%mcp.app%', '%mcp.version%', '%mcp.description%', '%mcp.icons%', '%mcp.website_url%'] - setPaginationLimit: ['%mcp.pagination_limit%'] - setInstructions: ['%mcp.instructions%'] - setEventDispatcher: ['@event_dispatcher'] diff --git a/tests/phpunit/ServerInfoTest.php b/tests/phpunit/ServerInfoTest.php new file mode 100644 index 0000000..e044db0 --- /dev/null +++ b/tests/phpunit/ServerInfoTest.php @@ -0,0 +1,40 @@ +request('POST', '/_mcp', [], [], [ + 'CONTENT_TYPE' => 'application/json', + 'HTTP_ACCEPT' => 'application/json, text/event-stream', + ], json_encode([ + 'jsonrpc' => '2.0', + 'id' => 1, + 'method' => 'initialize', + 'params' => [ + 'protocolVersion' => '2025-06-18', + 'capabilities' => new \stdClass(), + 'clientInfo' => ['name' => 'phpunit', 'version' => '1.0'], + ], + ])); + + $this->assertResponseIsSuccessful(); + $response = json_decode($client->getResponse()->getContent(), true); + + $this->assertSame($container->getParameter('mcp.app'), $response['result']['serverInfo']['name']); + $this->assertSame($container->getParameter('mcp.version'), $response['result']['serverInfo']['version']); + $this->assertNotSame('app', $response['result']['serverInfo']['name']); + } +}