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
Maintainer thường phản hồi trong vòng 2 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 55/100
Hướng nghiên cứu
Bắt đầu từ ánh xạ endpoint MapMcp("/mcp/environments/{environmentId}/servers/{serverName}") được thể hiện trong Startup.cs và action Invoke của controller. Tái hiện POST với InitializeRequest chưa đầy đủ, sau đó theo dõi quá trình xác thực request và xử lý lỗi để xác định 500 được tạo ra ở đâu. Hoàn tất khi ClientInfo.Version bị thiếu được báo cáo thông qua response 400 hoặc lỗi JSON-RPC có cấu trúc.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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:
- 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(); }
- Ngôn ngữ chính
- C#
- Star
- 4.5k
- Fork
- 814
- Merge trung bình
- 9 ngày 19 giờ
- Pull request đã merge (30 ngày)
- 4
Chuẩn bị môi trường
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của modelcontextprotocol/csharp-sdk
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
modelcontextprotocol/csharp-sdk#1867 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
modelcontextprotocol/csharp-sdk#1840 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
modelcontextprotocol/csharp-sdk#1836 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
enhancement needs confirmation
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 64/100
modelcontextprotocol/csharp-sdk#678 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
-
enhancement needs confirmation P3 ready for work
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
modelcontextprotocol/csharp-sdk#515 · 6 bình luận · 3 reaction ·
Maintainer thường phản hồi trong vòng 2 ngày
Tất cả issue của modelcontextprotocol/csharp-sdk
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
microsoft/onnxruntime-genai#2633 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
python triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
microsoft/semantic-kernel#14491 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
area:jobads-cv FE mvp P3
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
klasolsson81/jobbliggaren#1878 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug help wanted
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
pnp/pnpcore#1878 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
SubtitleEdit/subtitleedit#15331 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày