Skip to content

Commit 4c2415b

Browse files
committed
Make NotificationPublisher optional
1 parent f226b2b commit 4c2415b

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

src/Capability/Registry.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ class Registry
6060
private array $resourceTemplates = [];
6161

6262
public function __construct(
63-
private readonly NotificationPublisher $notificationPublisher,
63+
private readonly NotificationPublisher $notificationPublisher = new NotificationPublisher(),
6464
private readonly ReferenceHandler $referenceHandler = new ReferenceHandler(),
6565
private readonly LoggerInterface $logger = new NullLogger(),
6666
) {

tests/Capability/Discovery/DiscoveryTest.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
use Mcp\Capability\Registry\ResourceReference;
2020
use Mcp\Capability\Registry\ResourceTemplateReference;
2121
use Mcp\Capability\Registry\ToolReference;
22-
use Mcp\Server\NotificationPublisher;
2322
use Mcp\Tests\Capability\Attribute\CompletionProviderFixture;
2423
use Mcp\Tests\Capability\Discovery\Fixtures\DiscoverableToolHandler;
2524
use Mcp\Tests\Capability\Discovery\Fixtures\InvocablePromptFixture;
@@ -35,7 +34,7 @@ class DiscoveryTest extends TestCase
3534

3635
protected function setUp(): void
3736
{
38-
$this->registry = new Registry(new NotificationPublisher());
37+
$this->registry = new Registry();
3938
$this->discoverer = new Discoverer($this->registry);
4039
}
4140

0 commit comments

Comments
 (0)