fix(mcp): accept environment-based endpoints without exposing resolved URLs - #919
Open
breedx wants to merge 2 commits into
Open
fix(mcp): accept environment-based endpoints without exposing resolved URLs#919breedx wants to merge 2 commits into
breedx wants to merge 2 commits into
Conversation
Contributor
Author
|
This fix remains independently reviewable, but full CI hits the existing quoted-tilde completion assertion already addressed separately in #916. I reproduced that exact failure on unpatched
Once the separate completion correction lands, this topic can be requalified on the updated base without widening its scope. |
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.
MCP endpoint templates can fail validation even when their environment variables resolve to valid HTTP URLs. Validate the resolved value so these configurations work, without including the resolved endpoint in validation errors or replacing the stored template.
Problem
Startup expands environment variables, but registry validation checks the unexpanded URL. A configuration such as
${MCP_BASE}/mcpis rejected before startup even whenMCP_BASEcontains a valid HTTP(S) base URL.Change
No connector lifecycle or schema changes; this patch is independent of other pending MCP fixes. It does not change configuration file reading/writing policy (#802 addresses separate configuration I/O).
Validation
Base:
1d25d696; Linux / Python 3.13.13 with the unchanged upstream lock. Tests use disposable HOME/XDG, no inherited credentials and blocked socket connect/DNS/bind.python -m pytest -q -o addopts= tests/mcp/test_expanded_url_validation.py tests/mcp/test_registry_comprehensive.py tests/mcp/test_registry_coverage.py tests/mcp/test_registry_sync_drops_unconfigured.py: 82 passed.python -m pytest -q -o addopts= tests/mcp: 487 passed, 6 skipped, no warnings. The skips cover explicitly unimplemented MCP search.Compatibility and limits
No dependency or package-version changes. This retains the existing HTTP(S) scheme-prefix policy; it is not full URL validation, SSRF protection, authorization, or a guarantee that unresolved variables elsewhere in an otherwise prefixed URL will be rejected. Environment changes between validation and startup remain possible. No live-connector qualification is claimed.
The base currently fails the unrelated tilde-completion assertion corrected separately in #916. This PR neither incorporates that change nor claims the full upstream suite is green.