Repository navigation
fix(cli): refuse a URL that contradicts a positional command or --transport stdio - #2701
Merged
Merged
Conversation
…nsport stdio (#2611) buildConfigFromOptions resolved the target as `positional URL ?? --server-url` and returned on the URL branch, so a positional command next to --server-url was silently dropped, and --transport stdio next to a URL was ignored (or reported as "not specified" when the path gave no hint). Decide the target before the transport and refuse contradictions: - a positional target together with --server-url is an error naming both - --transport stdio with a URL is an error - an unrecognized --transport is an error; /mcp and /sse path sniffing runs only when --transport is absent The CLI README's first remote example no longer claims an SSE default and now runs as written. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: cliffhall <[email protected]>
There was a problem hiding this comment.
🟢 Approval recommended
The implementation matches the linked issue, preserves explicit transport overrides, and includes focused regression coverage.
0 open findings
What changed in this PR
Fixes conflicting CLI target and transport options by rejecting ambiguous combinations.
Changes:
- Validates positional targets, URLs, and transports before path inference.
- Adds regression tests for conflict and override cases.
- Corrects remote-server CLI documentation.
| File | Description |
|---|---|
core/mcp/node/config.ts |
Rejects contradictory target and transport options. |
clients/web/src/test/core/mcp/node/config.test.ts |
Adds regression coverage for validation behavior. |
clients/cli/README.md |
Corrects remote transport guidance and example. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
Member
Author
|
Copilot review loop closed: round 1 was clean (0 inline comments, 0 findings, no suppressed comments), so no further round was requested. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #2611
What changed
buildConfigFromOptions(core/mcp/node/config.ts) resolved the URL aspositional URL ?? --server-urland returned from the URL branch, so the other flags were never checked. It now picks the target before the transport and refuses contradictory flags instead of letting one silently win:node ./server.js --server-url https://example.com/mcpCannot combine a positional target (node) with --server-url (https://example.com/mcp). Pass one or the other.https://a/mcp --server-url https://b/mcp--transport stdio --server-url https://example.com/mcp/mcpstdio transport cannot be used with a URL (…)--transport stdio --server-url https://example.com/foo--transport <unknown>with a URL (reachable via--web, which doesn't validate the flag)Invalid transport type: …The
/mcp//ssepath sniffing now runs only when--transportis absent. This lives in core, so the TUI,--web, mcpdo andservers/addpick up the same refusals.clients/cli/README.md: the first remote example claimed "default is SSE" and failed as written. It now uses a/mcpURL with--method tools/listand says plainly that there is no default transport.Tests
Six new cases in
clients/web/src/test/core/mcp/node/config.test.ts: each refusal, plus an explicit--transport sseoverriding a/mcppath.npm run local:gateis green.🤖 Generated with Claude Code