HTTP client sends handler exception messages back to the server
メンテナーはふだん 1 日以内に返信
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 35/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 停滞
- 技術スタック
- ruby
調査の方向性
Read lib/mcp/client/http.rb:1192-1206, comparing the ServerRequestError handling with the unexpected exception path in MCP::Client::HTTP#dispatch_server_request. Check the existing client HTTP tests for server request callbacks and add coverage that confirms unexpected exceptions return a generic message while ServerRequestError retains its explicit message. The issue links open pull request #664, so the work is already under way.
索引モデルが issue の本文から書いたものです。
説明
When a handler registered with on_server_request (for example the on_elicitation callback) raises, MCP::Client::HTTP#dispatch_server_request answers the server with "Internal error handling #{method} request: #{e.message}" (http.rb:1198-1206). Exception messages often contain local details such as file paths, host names or library internals.
The server side stopped sending exception messages to clients in #486, for #485. This is the same problem on the client side. ServerRequestError keeps its explicit message (http.rb:1192-1197), which is correct because the handler chose that text.
Repro
Run from the repository root with bundle exec ruby -I lib repro.rb:
require "mcp"
require "mcp/client/http"
require "webmock"
include WebMock::API
WebMock.enable!
url = "http://localhost:9292/mcp"
reply = nil
stub_request(:post, url).to_return do |request|
body = JSON.parse(request.body)
if body["method"] == "tools/list"
events = [
{ jsonrpc: "2.0", id: "s1", method: "elicitation/create", params: { message: "Name?", requestedSchema: { type: "object", properties: {} } } },
{ jsonrpc: "2.0", id: body["id"], result: { tools: [] } },
]
{ status: 200, headers: { "Content-Type" => "text/event-stream" }, body: events.map { |event| "data: #{event.to_json}\n\n" }.join }
else
reply = body
{ status: 202 }
end
end
transport = MCP::Client::HTTP.new(url: url)
transport.on_server_request("elicitation/create") { |_params| File.read("/etc/example-app/ui.yml") }
transport.send_request(request: { jsonrpc: "2.0", id: "1", method: "tools/list" })
p reply["error"]
Expected: a generic message, for example {"code" => -32603, "message" => "Internal error"}.
Actual:
{"code" => -32603, "message" => "Internal error handling elicitation/create request: No such file or directory @ rb_sysopen - /etc/example-app/ui.yml"}
Suggested fix
Send a fixed message such as "Internal error" (optionally with the method name) for unexpected exceptions, and make the exception available to the application locally, for example through a reporter callback or a log line. Keep the current behavior for ServerRequestError.
- 主要言語
- Ruby
- スター
- 940
- フォーク
- 143
- 平均マージ
- 1日 3時間
- マージ済み PR(30日)
- 47
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
modelcontextprotocol/ruby-sdk のほかの issue
-
Invalid UTF-8 in `MCP-Protocol-Version`, `Mcp-Method` or `Mcp-Name` gives 500 instead of 400対応中かも @atesgoral が今日担当しました。 オープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
modelcontextprotocol/ruby-sdk#663 ·
メンテナーはふだん 1 日以内に返信
-
`Client::Stdio` passes the whole parent environment to the server process対応中かも @atesgoral が今日担当しました。 オープンbug
難易度 4/5 3〜5日 初心者へのやさしさ 55/100
modelcontextprotocol/ruby-sdk#662 ·
メンテナーはふだん 1 日以内に返信
-
Elicitation results are not checked against `requested_schema`, but the docs say they match it対応中かも @atesgoral が今日担当しました。 オープンbug
難易度 3/5 1〜2日 初心者へのやさしさ 35/100
modelcontextprotocol/ruby-sdk#661 ·
メンテナーはふだん 1 日以内に返信
-
`JWTVerifier` answers 500 instead of 401 for a PS256 token when it verifies with an EC key (jwt < 3.3.0)対応中かも @atesgoral が今日担当しました。 オープンbug
難易度 3/5 1〜2日 初心者へのやさしさ 35/100
modelcontextprotocol/ruby-sdk#659 ·
メンテナーはふだん 1 日以内に返信
-
`logging/setLevel` from one session changes the log level of other sessions対応中かも @atesgoral が今日担当しました。 オープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 35/100
modelcontextprotocol/ruby-sdk#658 ·
メンテナーはふだん 1 日以内に返信
modelcontextprotocol/ruby-sdk の issue をすべて見る
似ている issue
-
bug javascript
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
yegor256/netbout.rb#69 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
yegor256/iccq.github.io#161 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
palladius/rails8-app-on-gcp#198 ·
-
bug
難易度 1/5 1時間未満 初心者へのやさしさ 95/100
WikiEducationFoundation/WikiEduDashboard#7258 ·
メンテナーはふだん 1 日以内に返信