Skip to content

Commit aa9f222

Browse files
committed
fix(mcp): support mcp/sdk 0.6
mcp/sdk 0.6 renames Mcp\Schema\Resource to ResourceDefinition and drops the $isManual argument from RegistryInterface::registerTool() and registerResource(). symfony/mcp-bundle now requires ^0.6, so composer resolves 0.6 and PHPStan fails on the old API. Bump the constraint to ^0.6 and adapt the registry loader.
1 parent 573df71 commit aa9f222

4 files changed

Lines changed: 4 additions & 9 deletions

File tree

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@
142142
"jangregor/phpstan-prophecy": "^2.1.11",
143143
"justinrainbow/json-schema": "^6.5.2",
144144
"laravel/framework": "^11.0 || ^12.0 || ^13.0",
145-
"mcp/sdk": ">=0.4 <1.0",
145+
"mcp/sdk": "^0.6",
146146
"orchestra/testbench": "^10.9 || ^11.0",
147147
"phpspec/prophecy-phpunit": "^2.2",
148148
"phpstan/extension-installer": "^1.1",

src/Mcp/Capability/Registry/Loader.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
use Mcp\Capability\Registry\Loader\LoaderInterface;
2424
use Mcp\Capability\RegistryInterface;
2525
use Mcp\Schema\Annotations;
26-
use Mcp\Schema\Resource;
26+
use Mcp\Schema\ResourceDefinition;
2727
use Mcp\Schema\Tool;
2828
use Mcp\Schema\ToolAnnotations;
2929

@@ -72,13 +72,12 @@ public function load(RegistryInterface $registry): void
7272
outputSchema: $outputSchema,
7373
),
7474
self::HANDLER,
75-
true,
7675
);
7776
}
7877

7978
if ($mcp instanceof McpResource) {
8079
$registry->registerResource(
81-
new Resource(
80+
new ResourceDefinition(
8281
uri: $mcp->getUri(),
8382
name: $mcp->getName(),
8483
description: $mcp->getDescription(),
@@ -89,7 +88,6 @@ public function load(RegistryInterface $registry): void
8988
meta: $mcp->getMeta()
9089
),
9190
self::HANDLER,
92-
true,
9391
);
9492
}
9593
}

src/Mcp/Tests/Capability/Registry/LoaderTest.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ class: \stdClass::class,
7171
return true;
7272
}),
7373
Loader::HANDLER,
74-
true,
7574
);
7675

7776
$loader = new Loader($nameCollectionFactory, $metadataCollectionFactory, $schemaFactory);
@@ -114,7 +113,6 @@ class: \stdClass::class,
114113
return true;
115114
}),
116115
Loader::HANDLER,
117-
true,
118116
);
119117

120118
$loader = new Loader($nameCollectionFactory, $metadataCollectionFactory, $schemaFactory);
@@ -154,7 +152,6 @@ class: \stdClass::class,
154152
return true;
155153
}),
156154
Loader::HANDLER,
157-
true,
158155
);
159156

160157
$loader = new Loader($nameCollectionFactory, $metadataCollectionFactory, $schemaFactory);

src/Mcp/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
"php": ">=8.2",
3131
"api-platform/metadata": "^4.3",
3232
"api-platform/json-schema": "^4.3",
33-
"mcp/sdk": ">=0.4 <1.0",
33+
"mcp/sdk": "^0.6",
3434
"symfony/object-mapper": "^7.4 || ^8.0",
3535
"symfony/polyfill-php85": "^1.32"
3636
},

0 commit comments

Comments
 (0)