Upgrade mcp/sdk to ^0.5, add symfony/finder and symfony/filesystem#6
Merged
Conversation
- Require mcp/sdk ^0.5 (BC breaks: symfony/finder now optional, Tool/Prompt attribute signatures changed with new title parameter) - Require symfony/finder explicitly (was a transitive dep in 0.4, dropped in 0.5) - Require symfony/filesystem for cross-platform path utilities - Fix ServerBuilder::withPluginTools() scan dir path computation using Filesystem::makePathRelative() instead of fragile str_replace(ROOT, ...) approach which broke when the plugin lives outside ROOT (e.g. test_app setup) - Replace RecursiveDirectoryIterator in Repository::getMarkdownFiles() with Finder - Replace manual mkdir/rmdir patterns with Filesystem::mkdir() and Filesystem::remove()
v8.0 requires PHP 8.4+; widen to v7.0||v8.0 to cover PHP 8.2 as declared in the plugin php requirement
There was a problem hiding this comment.
Pull request overview
This pull request upgrades the MCP PHP SDK to ^0.5 and adapts the plugin to the SDK’s breaking changes by switching to Symfony’s filesystem/path and file-finding utilities for more robust cross-platform behavior.
Changes:
- Bump
mcp/sdkto^0.5and add explicitsymfony/finder+symfony/filesystemdependencies. - Update tool discovery path handling in
ServerBuilder::withPluginTools()to useFilesystem::makePathRelative()instead ofstr_replace()-based path chopping. - Replace manual recursive markdown discovery and manual mkdir/rmdir logic with Symfony Finder/Filesystem in documentation components and tests.
Reviewed changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| composer.json | Upgrades mcp/sdk and adds Symfony filesystem/finder dependencies. |
| src/Builder/ServerBuilder.php | Uses Filesystem::makePathRelative() to compute scan directories robustly. |
| src/Documentation/DocumentSearchService.php | Uses Filesystem::mkdir() for cache DB directory creation. |
| src/Documentation/Git/Repository.php | Uses Filesystem::mkdir() and Symfony Finder for markdown discovery. |
| src/Prompts/QualityAssurancePrompt.php | Makes in_array() checks strict (true as 3rd arg). |
| tests/TestCase/Builder/ServerBuilderTest.php | Updates expectations to match new relative-path computation approach. |
| tests/TestCase/Documentation/Git/RepositoryTest.php | Uses Symfony Filesystem for test directory setup/cleanup. |
| tests/TestCase/Prompts/TinkerWorkshopPromptTest.php | Removes redundant local @var annotations in prompt tests. |
| tests/TestCase/Prompts/TestingAssistantPromptTest.php | Removes redundant local @var annotations in prompt tests. |
| tests/TestCase/Prompts/PerformanceAnalyzerPromptTest.php | Removes redundant local @var annotations in prompt tests. |
| tests/TestCase/Prompts/OrmQueryHelperPromptTest.php | Removes redundant local @var annotations in prompt tests. |
| tests/TestCase/Prompts/MigrationGuidePromptTest.php | Removes redundant local @var annotations in prompt tests. |
| tests/TestCase/Prompts/FeatureBuilderPromptTest.php | Removes redundant local @var annotations in prompt tests. |
| tests/TestCase/Prompts/DocumentationExpertPromptTest.php | Removes redundant local @var annotations in prompt tests. |
| tests/TestCase/Prompts/DebugHelperPromptTest.php | Removes redundant local @var annotations in prompt tests. |
| tests/TestCase/Prompts/DatabaseExplorerPromptTest.php | Removes redundant local @var annotations in prompt tests. |
| tests/TestCase/Prompts/CodeReviewerPromptTest.php | Removes redundant local @var annotations in prompt tests. |
Comments suppressed due to low confidence (1)
src/Documentation/Git/Repository.php:65
Filesystem::mkdir()throws Symfony filesystem exceptions (e.g.IOExceptionInterface) rather thanRuntimeException. The method docblock promises@throws RuntimeException, so either update the docblock to reflect the new exception type(s) or catch/wrap the filesystem exception to keep the public contract consistent.
* @throws \RuntimeException If clone fails
*/
public function clone(): void
{
if ($this->exists()) {
return; // Already cloned
}
// Ensure parent directory exists
(new Filesystem())->mkdir(dirname($this->path));
// Delegate to git adapter
$this->gitAdapter->clone($this->url, $this->branch, $this->path);
}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Restores graceful handling of unreadable subdirectories during indexing. Previously an UnexpectedValueException catch returned partial results; Finder throws by default without this flag.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Upgrades
mcp/sdkfrom^0.4to^0.5and resolves the breaking changes introduced in that release.Changes
Dependencies (
composer.json)mcp/sdkto^0.5symfony/finderas an explicit dependency — it was a transitive dep via the SDK in 0.4 but was made optional in 0.5symfony/filesystemfor cross-platform path utilitiesServerBuilder::withPluginTools()str_replace(ROOT, '', $pluginSrcPath)to compute a relative scan directory path, which broke silently when the plugin lives outsideROOT(e.g. installed via Composer into a project whereROOT≠ plugin parent). Replaced withFilesystem::makePathRelative()which correctly computes the relative path in all cases including Windows.Repository::getMarkdownFiles()RecursiveDirectoryIterator/RecursiveIteratorIteratorwithsymfony/finder'sFinder, removing manual path-prefix and separator normalisation logic.Repository::clone()/DocumentSearchService::__construct()is_dir+mkdir+ explicitRuntimeExceptionthrow withFilesystem::mkdir(), which handles recursive creation and throws on failure itself.