Docs import a namespace that does not exist: Mcp\Server\Capability\Attribute\McpTool
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 1/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 85/100
- Issue 类型
- 文档
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- php
调研方向
更新 docs/get-started/first-server.md 和 README.md 中的导入;先根据 issue 中列出的 v0.9.0 属性命名空间检查现有示例。两个示例都从 Mcp\Capability\Attribute\ 导入属性并与 SDK 保持一致后,即表示完成。建议的 class_alias 是可选的,需要单独进行范围审查。
由索引模型根据 Issue 内容生成。
描述
What's wrong
The getting-started docs and the SDK README both tell you to import the tool attribute from a namespace that does not exist in v0.9.0.
docs/get-started/first-server.md:
use Mcp\Server\Capability\Attribute\McpResource;
use Mcp\Server\Capability\Attribute\McpTool;
README.md shows the same import.
What actually exists
Verified against mcp/sdk v0.9.0:
use Mcp\Capability\Attribute\McpTool; // correct
use Mcp\Capability\Attribute\McpResource; // correct
use Mcp\Capability\Attribute\McpPrompt; // correct
use Mcp\Capability\Attribute\McpResourceTemplate; // correct
$ ls vendor/mcp/sdk/src/Server/Capability
ls: vendor/mcp/sdk/src/Server/Capability: No such file or directory
$ php -r 'require "vendor/autoload.php";
var_dump(class_exists("Mcp\Server\Capability\Attribute\McpTool"));
var_dump(class_exists("Mcp\Capability\Attribute\McpTool"));'
bool(false)
bool(true)
All five attribute classes live under Mcp\Capability\Attribute\. The Server\ segment was dropped at some point, and the docs were not updated with it.
Why it's worth fixing
Copying the quickstart verbatim is a fatal error on the very first file a new user writes. The error points at the use statement, so it reads like a typo the user made rather than an outdated doc, and the natural next step is to go looking for a typo instead of checking the installed version.
Suggested fix
Update the quickstart and README imports. If the flattening is recent, a class_alias shim for one release would let code written against the old docs keep working:
class_alias(\Mcp\Capability\Attribute\McpTool::class, \Mcp\Server\Capability\Attribute\McpTool::class);
Happy to open a PR for the docs if that's easier than doing it yourself.
Found while building a hackathon project against mcp/sdk v0.9.0 / symfony/mcp-bundle v1.0.0-BETA1 on PHP 8.5.8.
- 主要语言
- PHP
- 星标
- 1.7k
- 派生
- 206
- 平均合并
- 1 天 17 小时
- 30 天内合并 PR
- 102
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
modelcontextprotocol/php-sdk 的其他 Issue
-
[Server] Handler type uses bare Closure, hard to decorate RegistryInterface under strict PHPStan未关闭Server
难度 1/5 1 小时以内 新手友好度 78/100
modelcontextprotocol/php-sdk#468 · 3 条评论 ·
维护者通常 1 天内回复
-
enhancement P3
难度 4/5 3-5 天 新手友好度 48/100
modelcontextprotocol/php-sdk#733 · 2 条评论 ·
维护者通常 1 天内回复
-
[Server] Handle notifications/cancelled on the handshake era可能已有人在做 @ump45nose 于 5 天前认领。 未关闭help wanted improves spec compliance Server
难度 4/5 3-5 天 新手友好度 57/100
modelcontextprotocol/php-sdk#732 ·
维护者通常 1 天内回复
-
[Client][Server] Ship extension classes for the two authorization extensions可能已有人在做 @chr-hertel 于 6 天前认领。 未关闭auth Client Server
modelcontextprotocol/php-sdk#721 · 已指派 1 人 ·
维护者通常 1 天内回复
-
[Client] Test cross-app access against a real identity provider可能已有人在做 @chr-hertel 于 6 天前认领。 未关闭auth Client
modelcontextprotocol/php-sdk#720 · 已指派 1 人 ·
维护者通常 1 天内回复
查看 modelcontextprotocol/php-sdk 的全部 Issue
相似的 Issue
-
难度 1/5 1 小时以内 新手友好度 82/100
pluginsGLPI/carbon#396 ·
-
[BUG] Bundle products lose their price in RSS feeds: getPrices() was removed可能已有人在做 @pcvelz 今天认领。 未关闭
难度 1/5 1 小时以内 新手友好度 90/100
OpenMage/magento-lts#5869 ·
维护者通常 2 天内回复
-
难度 1/5 1 小时以内 新手友好度 90/100
OpenGIS/waymark-wp#82 ·
-
bug
难度 2/5 1-3 小时 新手友好度 68/100
维护者通常 1 天内回复
-
claude
难度 2/5 1-3 小时 新手友好度 76/100
sprain/sprainocchio#39 ·
维护者通常 1 天内回复