feat(mcp): advertise the MCP Apps extension when a resource serves an app

未关闭
#8,832 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 2 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
52/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
活跃
技术栈
php
领域
api, backend

调研方向

Start by reading the MCP bundle Loader and the referenced McpAppPass::extensionAlreadyEnabled() logic, then check how the SDK defines McpApps::MIME_TYPE and McpApps::URI_SCHEME. Trace how registered resources and tools expose those values and how server capabilities are built. Done means app resources or tool metadata enable the extension once per server, including when #[AsMcpApp] is also used.

由索引模型根据 Issue 内容生成。

描述

When an McpResource serves an MCP App (mimeType: 'text/html;profile=mcp-app', ui:// uri) or an McpTool points to one through meta: ['ui' => ['resourceUri' => 'ui://...']], the server should advertise the io.modelcontextprotocol/ui extension in its capabilities. Today we don't, so every app ends up with its own compiler pass:

$container->getDefinition('mcp.server.garage.builder')
    ->addMethodCall('enableExtension', [new Definition(McpApps::class)]);

The bundle already does this for #[AsMcpApp] (Symfony\AI\McpBundle\DependencyInjection\McpAppPass, see extensionAlreadyEnabled()), and since 2026-07-28 extensions are negotiated through capabilities.extensions, so a host that doesn't see it may not render the app at all.

I think the Loader (or a compiler pass in the bundle integration) could check the operations it registers and call enableExtension(new McpApps()) once per server when one of them is an app, reusing McpApps::MIME_TYPE / McpApps::URI_SCHEME from the sdk. We'd also need to not enable it twice when #[AsMcpApp] is used next to API Platform resources.

Thoughts?

主要语言
PHP
星标
2.6k
派生
988
平均合并
4 天 16 小时
30 天内合并 PR
118

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

api-platform/core 的其他 Issue

查看 api-platform/core 的全部 Issue

相似的 Issue

更多 PHP Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。