Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -570,12 +570,6 @@ parameters:
count: 1
path: src/Server/ServerBuilder.php

-
message: '#^Method Mcp\\Server\\ServerBuilder\:\:registerManualElements\(\) is unused\.$#'
identifier: method.unused
count: 1
path: src/Server/ServerBuilder.php

-
message: '#^Method Mcp\\Server\\ServerBuilder\:\:withDiscovery\(\) has parameter \$excludeDirs with no value type specified in iterable type array\.$#'
identifier: missingType.iterableValue
Expand Down
5 changes: 4 additions & 1 deletion src/Server/ServerBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
use Psr\Container\ContainerInterface;
use Psr\EventDispatcher\EventDispatcherInterface;
use Psr\Log\LoggerInterface;
use Psr\Log\NullLogger;
use Psr\SimpleCache\CacheInterface;

/**
Expand Down Expand Up @@ -218,6 +219,8 @@ public function build(): Server
$container = $this->container ?? new Container();
$registry = new Registry(new ReferenceHandler($container), $this->eventDispatcher, $this->logger);

$this->registerManualElements($registry, $this->logger);

if (null !== $this->discoveryBasePath) {
$discovery = new Discoverer($registry, $this->logger);
$discovery->discover($this->discoveryBasePath, $this->discoveryScanDirs, $this->discoveryExcludeDirs);
Expand All @@ -233,7 +236,7 @@ public function build(): Server
* Helper to perform the actual registration based on stored data.
* Moved into the builder.
*/
private function registerManualElements(Registry $registry, LoggerInterface $logger): void
private function registerManualElements(Registry $registry, LoggerInterface $logger = new NullLogger()): void
{
if (empty($this->manualTools) && empty($this->manualResources) && empty($this->manualResourceTemplates) && empty($this->manualPrompts)) {
return;
Expand Down