Skip to content

Commit 3dcd2f7

Browse files
refactor: rename ServerBuilder to Builder (#85)
Remove redundant "Server" prefix since class is already in Server namespace.
1 parent 38441b8 commit 3dcd2f7

File tree

4 files changed

+36
-32
lines changed

4 files changed

+36
-32
lines changed

phpstan-baseline.neon

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -31,79 +31,79 @@ parameters:
3131
path: src/Schema/Result/ReadResourceResult.php
3232

3333
-
34-
message: '#^Method Mcp\\Server\\ServerBuilder\:\:addPrompt\(\) has parameter \$handler with no value type specified in iterable type array\.$#'
34+
message: '#^Method Mcp\\Server\\Builder\:\:addPrompt\(\) has parameter \$handler with no value type specified in iterable type array\.$#'
3535
identifier: missingType.iterableValue
3636
count: 1
37-
path: src/Server/ServerBuilder.php
37+
path: src/Server/Builder.php
3838

3939
-
40-
message: '#^Method Mcp\\Server\\ServerBuilder\:\:addResource\(\) has parameter \$handler with no value type specified in iterable type array\.$#'
40+
message: '#^Method Mcp\\Server\\Builder\:\:addResource\(\) has parameter \$handler with no value type specified in iterable type array\.$#'
4141
identifier: missingType.iterableValue
4242
count: 1
43-
path: src/Server/ServerBuilder.php
43+
path: src/Server/Builder.php
4444

4545
-
46-
message: '#^Method Mcp\\Server\\ServerBuilder\:\:addResourceTemplate\(\) has parameter \$handler with no value type specified in iterable type array\.$#'
46+
message: '#^Method Mcp\\Server\\Builder\:\:addResourceTemplate\(\) has parameter \$handler with no value type specified in iterable type array\.$#'
4747
identifier: missingType.iterableValue
4848
count: 1
49-
path: src/Server/ServerBuilder.php
49+
path: src/Server/Builder.php
5050

5151
-
52-
message: '#^Method Mcp\\Server\\ServerBuilder\:\:addTool\(\) has parameter \$handler with no value type specified in iterable type array\.$#'
52+
message: '#^Method Mcp\\Server\\Builder\:\:addTool\(\) has parameter \$handler with no value type specified in iterable type array\.$#'
5353
identifier: missingType.iterableValue
5454
count: 1
55-
path: src/Server/ServerBuilder.php
55+
path: src/Server/Builder.php
5656

5757
-
58-
message: '#^Method Mcp\\Server\\ServerBuilder\:\:addTool\(\) has parameter \$inputSchema with no value type specified in iterable type array\.$#'
58+
message: '#^Method Mcp\\Server\\Builder\:\:addTool\(\) has parameter \$inputSchema with no value type specified in iterable type array\.$#'
5959
identifier: missingType.iterableValue
6060
count: 1
61-
path: src/Server/ServerBuilder.php
61+
path: src/Server/Builder.php
6262

6363
-
64-
message: '#^Method Mcp\\Server\\ServerBuilder\:\:getCompletionProviders\(\) return type has no value type specified in iterable type array\.$#'
64+
message: '#^Method Mcp\\Server\\Builder\:\:getCompletionProviders\(\) return type has no value type specified in iterable type array\.$#'
6565
identifier: missingType.iterableValue
6666
count: 1
67-
path: src/Server/ServerBuilder.php
67+
path: src/Server/Builder.php
6868

6969
-
70-
message: '#^Method Mcp\\Server\\ServerBuilder\:\:setDiscovery\(\) has parameter \$excludeDirs with no value type specified in iterable type array\.$#'
70+
message: '#^Method Mcp\\Server\\Builder\:\:setDiscovery\(\) has parameter \$excludeDirs with no value type specified in iterable type array\.$#'
7171
identifier: missingType.iterableValue
7272
count: 1
73-
path: src/Server/ServerBuilder.php
73+
path: src/Server/Builder.php
7474

7575
-
76-
message: '#^Method Mcp\\Server\\ServerBuilder\:\:setDiscovery\(\) has parameter \$scanDirs with no value type specified in iterable type array\.$#'
76+
message: '#^Method Mcp\\Server\\Builder\:\:setDiscovery\(\) has parameter \$scanDirs with no value type specified in iterable type array\.$#'
7777
identifier: missingType.iterableValue
7878
count: 1
79-
path: src/Server/ServerBuilder.php
79+
path: src/Server/Builder.php
8080

8181
-
82-
message: '#^Property Mcp\\Server\\ServerBuilder\:\:\$instructions is never read, only written\.$#'
82+
message: '#^Property Mcp\\Server\\Builder\:\:\$instructions is never read, only written\.$#'
8383
identifier: property.onlyWritten
8484
count: 1
85-
path: src/Server/ServerBuilder.php
85+
path: src/Server/Builder.php
8686

8787
-
88-
message: '#^Property Mcp\\Server\\ServerBuilder\:\:\$prompts type has no value type specified in iterable type array\.$#'
88+
message: '#^Property Mcp\\Server\\Builder\:\:\$prompts type has no value type specified in iterable type array\.$#'
8989
identifier: missingType.iterableValue
9090
count: 1
91-
path: src/Server/ServerBuilder.php
91+
path: src/Server/Builder.php
9292

9393
-
94-
message: '#^Property Mcp\\Server\\ServerBuilder\:\:\$resourceTemplates type has no value type specified in iterable type array\.$#'
94+
message: '#^Property Mcp\\Server\\Builder\:\:\$resourceTemplates type has no value type specified in iterable type array\.$#'
9595
identifier: missingType.iterableValue
9696
count: 1
97-
path: src/Server/ServerBuilder.php
97+
path: src/Server/Builder.php
9898

9999
-
100-
message: '#^Property Mcp\\Server\\ServerBuilder\:\:\$resources type has no value type specified in iterable type array\.$#'
100+
message: '#^Property Mcp\\Server\\Builder\:\:\$resources type has no value type specified in iterable type array\.$#'
101101
identifier: missingType.iterableValue
102102
count: 1
103-
path: src/Server/ServerBuilder.php
103+
path: src/Server/Builder.php
104104

105105
-
106-
message: '#^Property Mcp\\Server\\ServerBuilder\:\:\$tools type has no value type specified in iterable type array\.$#'
106+
message: '#^Property Mcp\\Server\\Builder\:\:\$tools type has no value type specified in iterable type array\.$#'
107107
identifier: missingType.iterableValue
108108
count: 1
109-
path: src/Server/ServerBuilder.php
109+
path: src/Server/Builder.php

src/Server.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
namespace Mcp;
1313

1414
use Mcp\JsonRpc\Handler;
15-
use Mcp\Server\ServerBuilder;
15+
use Mcp\Server\Builder;
1616
use Mcp\Server\TransportInterface;
1717
use Psr\Log\LoggerInterface;
1818
use Psr\Log\NullLogger;
@@ -30,9 +30,9 @@ public function __construct(
3030
) {
3131
}
3232

33-
public static function builder(): ServerBuilder
33+
public static function builder(): Builder
3434
{
35-
return new ServerBuilder();
35+
return new Builder();
3636
}
3737

3838
public function connect(TransportInterface $transport): void

src/Server/ServerBuilder.php renamed to src/Server/Builder.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
/**
5353
* @author Kyrian Obikwelu <[email protected]>
5454
*/
55-
final class ServerBuilder
55+
final class Builder
5656
{
5757
private ?Implementation $serverInfo = null;
5858

@@ -108,17 +108,21 @@ final class ServerBuilder
108108
* annotations: Annotations|null}
109109
* > */
110110
private array $resourceTemplates = [];
111+
111112
/** @var array<
112113
* array{handler: array|string|\Closure,
113114
* name: string|null,
114115
* description: string|null}
115116
* > */
116117
private array $prompts = [];
118+
117119
private ?string $discoveryBasePath = null;
120+
118121
/**
119-
* @var array|string[]
122+
* @var string[]
120123
*/
121124
private array $discoveryScanDirs = [];
125+
122126
/**
123127
* @var array|string[]
124128
*/

src/Server/Configuration.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
/**
1818
* Value Object holding core configuration and shared dependencies for the MCP Server instance.
1919
*
20-
* This object is typically assembled by the ServerBuilder and passed to the Server constructor.
20+
* This object is typically assembled by the Builder and passed to the Server constructor.
2121
*
2222
* @author Kyrian Obikwelu <[email protected]>
2323
*/

0 commit comments

Comments
 (0)