Repository navigation
Expand file tree
/
Copy pathConfiguration.php
More file actions
59 lines (53 loc) · 1.98 KB
/
Copy pathConfiguration.php
File metadata and controls
59 lines (53 loc) · 1.98 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<?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;
use Mcp\Schema\Enum\ProtocolVersion;
use Mcp\Schema\Implementation;
use Mcp\Schema\ServerCapabilities;
/**
* Value Object holding core configuration and shared dependencies for the MCP Server instance.
*
* This object is typically assembled by the Builder and passed to the Server constructor.
*
* @author Kyrian Obikwelu <koshnawaza@gmail.com>
*/
class Configuration
{
/**
* @param Implementation $serverInfo info about this MCP server application
* @param ServerCapabilities $capabilities capabilities of this MCP server application
* @param int $paginationLimit maximum number of items to return for list methods
* @param string|null $instructions instructions describing how to use the server and its features
*/
public function __construct(
public readonly Implementation $serverInfo,
public readonly ServerCapabilities $capabilities,
public readonly int $paginationLimit = 50,
public readonly ?string $instructions = null,
public readonly ?ProtocolVersion $protocolVersion = null,
) {
}
/**
* Versions this server is willing to negotiate over `initialize`.
*
* A configured version pins the handshake to exactly that revision. Modern
* revisions are never offered here: they have no `initialize` at all, so a
* client negotiating one could not use the connection.
*
* @return non-empty-list<ProtocolVersion>
*/
public function handshakeVersions(): array
{
if (null !== $this->protocolVersion && !$this->protocolVersion->isModern()) {
return [$this->protocolVersion];
}
return ProtocolVersion::handshakeVersions();
}
}