modelcontextprotocol / modelcontextprotocol/php-sdk

[Client] Implement SSE reconnect with Last-Event-ID

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

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

Client enhancement improves spec compliance
主要言語
PHP
スター
1.6k
フォーク
173
平均マージ
2日 49分
マージ済み PR(30日)
23

説明

Context

Per the MCP Streamable HTTP transport spec, when an SSE stream disconnects the client SHOULD reconnect using Last-Event-ID to resume the stream without losing notifications. src/Client/Transport/HttpTransport.php::processSSEStream currently abandons the stream on EOF.

Scope

  • Track the most recent id: line per active stream.
  • On unexpected EOF (stream still expected open — pending request unresolved, or session active), reconnect with:
    • GET <endpoint> + Accept: text/event-stream
    • Mcp-Session-Id header
    • Last-Event-ID: <id> header
  • Configurable retry policy: backoff (1s, 2s, 4s, capped at 10s) + max attempts (default 5).
  • Respect retry: SSE field when present.

Conformance scenarios unblocked

sse-retry.

Dependencies

Independent — can run in parallel with auth work.

Acceptance

  • Unit tests for ID tracking + reconnect with Last-Event-ID.
  • Conformance: sse-retry passes.

cc @soyuka

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

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

はじめの一歩

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

調査の方向性

src/Client/Transport/HttpTransport.php::processSSEStream から始め、既存の SSE 解析とストリーム状態の処理を追跡します。イベント ID の追跡と再接続についてユニットテストのカバレッジを追加し、その後 sse-retry 適合シナリオを実行します。再接続が Last-Event-ID を使用して再開され、retry ポリシーが守られれば完了です。

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

評価

技術スタック
php
領域
api, networking
issue の種類
機能追加
難易度
4/5
見積もり時間
3〜5日
活発さ
静か
明瞭さ
明確に書かれている
初心者へのやさしさ
66/100

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

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