modelcontextprotocol / modelcontextprotocol/python-sdk

Specifying capabilities w/ FastMCP Server

オープン
#1,126 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る

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

  • #1043 @gspencergoog による — マージされずにクローズ
enhancement needs decision P2 v2
主要言語
Python
スター
24.3k
フォーク
4k
平均マージ
1日 1時間
マージ済み PR(30日)
31

説明

Question

I noticed that the FastMCP server does not have the options to manually specify the capabilities of the server, however it is possible to do so with the low-level server.

My current workaround to advertise the capabilities is like so:

mcp = FastMCP("test-server")

# Manually set notification options
lowlevel_server: Server = mcp._mcp_server
lowlevel_server.notification_options.resources_changed = True
lowlevel_server.notification_options.tools_changed = True

# Now, we override the mcp.run()
async def main():
    async with stdio_server() as (r, w):
        init_opts = lowlevel_server.create_initialization_options(
            lowlevel_server.notification_options,
            {}
        )
        await lowlevel_server.run(r, w, init_opts)

if __name__ == "__main__":
    anyio.run(main)

Is there any other way to specify the capabilities of the FastMCP server? Is there a reason not to?

Thanks!

Additional Context

No response

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

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

調査の方向性

まず、レポートに示されている FastMCP のエントリポイントと、Server の低レベルメソッドである notification_options、create_initialization_options、run を読みます。現在 FastMCP の初期化がどのように capabilities を公開しているかを確認し、mcp.run() をオーバーライドせずにそれらの capabilities を指定できることを「done」と定義します。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
python
領域
api
issue の種類
機能追加
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

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

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