feat(schema): allow template variables in transport URL field #910
+137
−9
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.
Authored by Claude Code Opus 4.5, steered/reviewed by me.
Summary
StreamableHttpTransportandSseTransportto allow template variables like{baseUrl}as an alternative to requiring thehttps://prefixremotessection of server.jsonChanges
urlfield pattern from^https?://[^\s]+$to^(https?://[^\s]+|\{[a-zA-Z_][a-zA-Z0-9_]*\}[^\s]*)$openapi.yamland the derivedserver.schema.jsonhttp://,https://, or a template variableRegex breakdown
^(https?://[^\s]+http://orhttps://followed by non-whitespace|\{[a-zA-Z_][a-zA-Z0-9_]*\}{+ valid identifier +}[^\s]*)$Test cases
Should match ✓
https://api.example.com/mcphttp://localhost:8080/ssehttps://example.com/path?query=value{baseUrl}{baseUrl}/mcp{server_url}/api/v1{API_ENDPOINT}Should NOT match ✗
ftp://example.com— wrong protocolexample.com— missing protocol or variable/relative/path— relative paths not allowed{invalid-name}/path— hyphens not valid in variable names{123invalid}— variables can't start with numbers