Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Passing a malformed body throws a 500 error instead of 400. Very hard to figure out what is incorrect in the request being issued by the caller

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

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

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
55/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
静か
技術スタック
csharp
領域
api, backend

調査の方向性

Startup.cs に示されている MapMcp("/mcp/environments/{environmentId}/servers/{serverName}") のエンドポイントマッピングと、コントローラーの Invoke アクションから始めます。不完全な InitializeRequest を使って POST を再現し、その後リクエストの検証とエラーハンドリングを追跡して、500 がどこで生成されるかを特定します。ClientInfo.Version の欠落が 400 レスポンスまたは構造化された JSON-RPC エラーとして報告されれば完了です。

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

説明

bug help wanted needs confirmation P3

Description
When sending an InitializeRequest to the MCP C# SDK server with a malformed or incomplete request body (e.g., missing required fields like clientInfo.Version, the server responds with a 500 Internal Server Error.
This behavior is problematic because:

  • A 500 error implies a server-side failure, not a client-side input issue.
  • According to MCP protocol expectations, the server should return a 400 Bad Request or a structured JSON-RPC error response indicating what was wrong with the request.

Steps to reproduce the behavior:

  1. Issue a POST mcp call with this request body:

{ "jsonrpc": "2.0", "id": "7", "method": "initialize", "params": { "protocolVersion": "2025-06-18", "clientInfo": { "name": "Insomnia" } } }

Expected behavior
A 400 error should be returned telling the user that the ClientInfo.Version property is missing

Additional Context
Our controllers are mapped like this in our Startup.cs file:

app.UseEndpoints(endpoints => { endpoints.MapControllers(); endpoints.MapMcp("/mcp/environments/{environmentId}/servers/{serverName}"); });
and controller is defined like this:

[HttpGet] [HttpPost] [HttpDelete] [Route("mcp/environments/{environmentId}/servers/{serverName}")] public IActionResult Invoke() { return this.Ok(); }

主要言語
C#
スター
4.5k
フォーク
814
平均マージ
9日 19時間
マージ済み PR(30日)
4

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

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

はじめの一歩

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

modelcontextprotocol/csharp-sdk のほかの issue

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

似ている issue

C# の issue をもっと見る

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

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