Skip to content

Upgrade mcp/sdk to ^0.5, add symfony/finder and symfony/filesystem#6

Merged
josbeir merged 3 commits into
mainfrom
upgrade-mcp-sdk-0.5
May 23, 2026
Merged

Upgrade mcp/sdk to ^0.5, add symfony/finder and symfony/filesystem#6
josbeir merged 3 commits into
mainfrom
upgrade-mcp-sdk-0.5

Conversation

@josbeir

@josbeir josbeir commented May 23, 2026

Copy link
Copy Markdown
Owner

Upgrades mcp/sdk from ^0.4 to ^0.5 and resolves the breaking changes introduced in that release.

Changes

Dependencies (composer.json)

  • Bump mcp/sdk to ^0.5
  • Add symfony/finder as an explicit dependency — it was a transitive dep via the SDK in 0.4 but was made optional in 0.5
  • Add symfony/filesystem for cross-platform path utilities

ServerBuilder::withPluginTools()

  • The previous implementation used str_replace(ROOT, '', $pluginSrcPath) to compute a relative scan directory path, which broke silently when the plugin lives outside ROOT (e.g. installed via Composer into a project where ROOT ≠ plugin parent). Replaced with Filesystem::makePathRelative() which correctly computes the relative path in all cases including Windows.

Repository::getMarkdownFiles()

  • Replaced RecursiveDirectoryIterator / RecursiveIteratorIterator with symfony/finder's Finder, removing manual path-prefix and separator normalisation logic.

Repository::clone() / DocumentSearchService::__construct()

  • Replaced manual is_dir + mkdir + explicit RuntimeException throw with Filesystem::mkdir(), which handles recursive creation and throws on failure itself.

- 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()
Copilot AI review requested due to automatic review settings May 23, 2026 09:37
v8.0 requires PHP 8.4+; widen to v7.0||v8.0 to cover PHP 8.2 as declared in the plugin php requirement

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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/sdk to ^0.5 and add explicit symfony/finder + symfony/filesystem dependencies.
  • Update tool discovery path handling in ServerBuilder::withPluginTools() to use Filesystem::makePathRelative() instead of str_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 than RuntimeException. 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.

Comment thread src/Builder/ServerBuilder.php
Comment thread tests/TestCase/Builder/ServerBuilderTest.php
Comment thread tests/TestCase/Builder/ServerBuilderTest.php
Comment thread tests/TestCase/Builder/ServerBuilderTest.php
Comment thread src/Documentation/Git/Repository.php
Comment thread src/Documentation/Git/Repository.php
Comment thread src/Documentation/DocumentSearchService.php
Comment thread tests/TestCase/Documentation/Git/RepositoryTest.php
Restores graceful handling of unreadable subdirectories during indexing.
Previously an UnexpectedValueException catch returned partial results;
Finder throws by default without this flag.
@josbeir
josbeir merged commit aad22d8 into main May 23, 2026
7 checks passed
@josbeir
josbeir deleted the upgrade-mcp-sdk-0.5 branch May 23, 2026 09:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants