Kick off the SDK based on Symfony's MCP SDK
This commit is contained in:
parent
0044ffb365
commit
ee0dffe369
1 changed files with 3924 additions and 0 deletions
45
src/Server/RequestHandler/InitializeHandler.php
Normal file
45
src/Server/RequestHandler/InitializeHandler.php
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the official PHP MCP SDK.
|
||||
*
|
||||
* A collaboration between Symfony and the PHP Foundation.
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Mcp\Server\RequestHandler;
|
||||
|
||||
use Mcp\Message\Request;
|
||||
use Mcp\Message\Response;
|
||||
|
||||
/**
|
||||
* @author Christopher Hertel <mail@christopher-hertel.de>
|
||||
*/
|
||||
final class InitializeHandler extends BaseRequestHandler
|
||||
{
|
||||
public function __construct(
|
||||
private readonly string $name = 'app',
|
||||
private readonly string $version = 'dev',
|
||||
) {
|
||||
}
|
||||
|
||||
public function createResponse(Request $message): Response
|
||||
{
|
||||
return new Response($message->id, [
|
||||
'protocolVersion' => '2025-03-26',
|
||||
'capabilities' => [
|
||||
'prompts' => ['listChanged' => false],
|
||||
'tools' => ['listChanged' => false],
|
||||
'resources' => ['listChanged' => false, 'subscribe' => false],
|
||||
],
|
||||
'serverInfo' => ['name' => $this->name, 'version' => $this->version],
|
||||
]);
|
||||
}
|
||||
|
||||
protected function supportedMethod(): string
|
||||
{
|
||||
return 'initialize';
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue