Skip to content

Conversation

@camilleislasse
Copy link
Contributor

@camilleislasse camilleislasse commented Nov 13, 2025

Q A
Bug fix? no
New feature? yes
Docs? no
Issues Fix #529
License MIT

Description

This PR adds a Web Profiler integration for the MCP Bundle that displays MCP server capabilities (tools, prompts, resources, resource templates) in the Symfony debug toolbar and profiler panel.

Features

  • ProfilingLoader to capture Registry reference during server build
  • DataCollector to collect and display MCP capabilities

Note: This implementation depends on the loader pattern. If MCP SDK PR #146 (direct Registry injection via DI) is merged, this approach may need adjustment.

Capture d’écran 2025-11-13 à 20 10 00

@carsonbot carsonbot added Feature New feature MCP Bundle Issues & PRs about the MCP SDK integration bundle Status: Needs Review labels Nov 13, 2025
Copy link
Member

@chr-hertel chr-hertel left a comment

Choose a reason for hiding this comment

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

Thanks, this looks great already, but let's please switch to a TraceableRegistry once modelcontextprotocol/php-sdk#150 gets merged - makes sense?

@OskarStark
Copy link
Contributor

Would love to see some infos around the MCP Profiler and the screenshot in the documentation

Copy link
Member

@chr-hertel chr-hertel left a comment

Choose a reason for hiding this comment

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

We should be able to use/decorate the Registry directly now and skip the ProfilingLoader, right?

Copy link
Member

@chr-hertel chr-hertel left a comment

Choose a reason for hiding this comment

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

Looks good & works with the demo - one last thing about the service registration tho 👍

Thanks already!

Comment on lines 27 to 31
->set('ai.mcp.registry.inner', Registry::class)
->args([service('event_dispatcher'), service('monolog.logger.mcp')])

->set('ai.mcp.registry', TraceableRegistry::class)
->args([service('ai.mcp.registry.inner')])
Copy link
Member

Choose a reason for hiding this comment

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

let's shift that into McpBundle, make it conditional, drop the ai. prefix in favor of just mcp. and use the decoration feature of the container:

if ($container->getParameter('kernel.debug')) {
    $traceableRegistry = (new Definition('mcp.traceable_registry'))
        ->setClass(TraceableRegistry::class)
        ->setArguments([new Reference('.inner')])
        ->setDecoratedService('mcp.registry');
    $container->setDefinition('mcp.traceable_registry', $traceableRegistry);
}

Copy link
Member

@chr-hertel chr-hertel left a comment

Choose a reason for hiding this comment

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

Thanks for kicking this off - we can build up on this now with more features :)

@chr-hertel
Copy link
Member

Thank you @camilleislasse.

@chr-hertel chr-hertel merged commit ae670c0 into symfony:main Dec 7, 2025
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Feature New feature MCP Bundle Issues & PRs about the MCP SDK integration bundle Status: Reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[MCP Bundle] Implement Profiler Panel & Toolbar

4 participants