fix(mcp): reject non-object JSON-RPC payloads - #41
Coding-Dev-Tools wants to merge 1 commit into
Conversation
Keep stdio, HTTP+SSE, and Streamable HTTP servers alive when payloads are scalars, arrays, or null, and add recovery, mixed-batch, and no-dispatch regressions. Co-authored-by: CommandCodeBot <noreply@commandcode.ai>
🤖 Automated Code Review✅ Ruff Lint — No issues
|
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b6a65fa5de
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
|
||
| # Support both single message and batch (array) | ||
| messages = msg if isinstance(msg, list) else [msg] | ||
| if any(not isinstance(m, dict) for m in messages): |
There was a problem hiding this comment.
Process valid entries in mixed JSON-RPC batches
When a batch contains both valid requests and a non-object element, this preflight rejects the entire batch before processing any valid entry. JSON-RPC batch semantics require each entry to be handled independently, with an -32600 response for each malformed entry, so a valid ping or tools/call included in the same batch is currently discarded. Validate inside the loop and append an error response with a null ID for only the invalid element.
Useful? React with 👍 / 👎.
Summary