Docs import a namespace that does not exist: Mcp\Server\Capability\Attribute\McpTool

オープン 初心者向け
#746 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
1/5
見積もり時間
1〜3時間
初心者へのやさしさ
85/100
issue の種類
ドキュメント
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
php
領域
documentation

調査の方向性

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時間
マージ済み PR(30日)
102

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

modelcontextprotocol/php-sdk のほかの issue

modelcontextprotocol/php-sdk の issue をすべて見る

似ている issue

PHP の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。