Repository navigation
fix(cli): reject MCP URLs without a hostname - #1072
Open
austinchennn wants to merge 1 commit into
Open
austinchennn wants to merge 1 commit into
austinchennn wants to merge 1 commit into
Conversation
Author
|
@evalstate, could you please approve the first-contributor Pull Request Checks workflow and review the hostname validation fix when you have a chance? Current head: |
3 of 5 tasks
This branch has not been deployed
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.
The MCP URL parser accepts authorities containing only a port or userinfo even though they have no hostname. For example,
https://:443/mcpandhttps://user@/mcpcurrently return an empty server name; passing them through the URL-list/configuration path creates an empty server key instead of reporting the documented input error.Validate
parsed_url.hostnameat the existing CLI boundary rather thannetloc. Keep the same missing-hostname error and preserve valid userinfo, explicit ports, IPv6, transport detection and default MCP paths. This is not a new DNS, connectivity or comprehensive hostname-syntax policy.The regressions exercise the public single-URL and list-to-config paths plus valid-authority controls. They use normal package imports without network calls.
Validation on macOS / Python 3.13 with the project's frozen uv dev environment:
uv run scripts/format.py --check: 1987 files formatted.uv run scripts/lint.py: passed.uv run --frozen scripts/typecheck.py: passed.git diff --check: passed.The full test suite, live MCP connections and model calls were not run. Please review whether the existing hostname-validation contract should cover these malformed authorities as proposed.
Fixes #1071
AI assistance: Codex investigated, implemented and ran the reported checks autonomously with the account owner's authorization. The account owner has not personally reviewed or tested the code.
Required contributor question: “You're given a calfskin wallet for your birthday. How would you feel about using it?”
As the AI assistant preparing this PR, I do not experience feelings or use wallets; I cannot represent the account owner's personal preference.