Skip to content

fix(mcp): reject non-object JSON-RPC payloads - #41

Open
Coding-Dev-Tools wants to merge 1 commit into
masterfrom
cleanup/local-20260925
Open

Coding-Dev-Tools wants to merge 1 commit into
masterfrom
cleanup/local-20260925

Conversation

@Coding-Dev-Tools

Copy link
Copy Markdown
Owner

Summary

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>
@github-actions

Copy link
Copy Markdown

🤖 Automated Code Review

✅ Ruff Lint — No issues

⚠️ Ruff Format — Formatting needed

unformatted: File would be reformatted
   --> README.md:220:1
    |
219 |
220 +
221 | @click.group()
--------------------------------------------------------------------------------
225 |
226 +
227 | @my_cli.command()
--------------------------------------------------------------------------------
236 |
237 +
238 | if __name__ == "__main__":
--------------------------------------------------------------------------------
276 |
277 +
278 | @click.group()
--------------------------------------------------------------------------------
282 |
283 +
284 | @cli.command()
--------------------------------------------------------------------------------
290 |
291 +
292 | # Run as MCP server
--------------------------------------------------------------------------------
377 |
378 +
379 | @app.command()

✅ Secret Detection — Clean

✅ Large Files — Within limits

📊 Diff Stats — 4 file(s) changed

 click_to_mcp/http_server.py            |   8 ++
 click_to_mcp/server.py                 |  11 +++
 click_to_mcp/streamable_http.py        |   7 ++
 tests/test_invalid_request_payloads.py | 139 +++++++++++++++++++++++++++++++++
 4 files changed, 165 insertions(+)

Verdict: ⚠️ Warnings — Lint/format issues found. Recommend fixing before merge.

Automated by Coding-Dev-Tools/.github reusable workflow.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 25, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-25T09:51:13.254318Z b6a65fa PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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):

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant