Skip to content

Conversation

@tadasant
Copy link
Member

@tadasant tadasant commented Jan 21, 2026

Authored by Claude Code Opus 4.5, steered/reviewed by me.

Summary

  • Updated the URL regex pattern in StreamableHttpTransport and SseTransport to allow template variables like {baseUrl} as an alternative to requiring the https:// prefix
  • This enables more flexible URL configuration in the remotes section of server.json

Changes

  • Modified the url field pattern from ^https?://[^\s]+$ to ^(https?://[^\s]+|\{[a-zA-Z_][a-zA-Z0-9_]*\}[^\s]*)$
  • Updated both openapi.yaml and the derived server.schema.json
  • Added clarifying documentation that URL must start with http://, https://, or a template variable

Regex breakdown

^(https?://[^\s]+|\{[a-zA-Z_][a-zA-Z0-9_]*\}[^\s]*)$
Part Meaning
^ Start of string
( Begin alternation group
https?://[^\s]+ http:// or https:// followed by non-whitespace
| OR
\{[a-zA-Z_][a-zA-Z0-9_]*\} Template variable: { + valid identifier + }
[^\s]* Optional path/query after template variable
) End alternation group
$ End of string

Test cases

Should match ✓

  • https://api.example.com/mcp
  • http://localhost:8080/sse
  • https://example.com/path?query=value
  • {baseUrl}
  • {baseUrl}/mcp
  • {server_url}/api/v1
  • {API_ENDPOINT}

Should NOT match ✗

  • ftp://example.com — wrong protocol
  • example.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

Agent Orchestrator and others added 2 commits January 21, 2026 02:59
The URL pattern for StreamableHttpTransport and SseTransport now accepts
template variables like {baseUrl} as an alternative to requiring the
https:// prefix. This enables more flexible URL configuration in remotes.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Added explicit documentation that the url field must start with
http://, https://, or a template variable (e.g., {baseUrl}).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@tadasant tadasant force-pushed the allow-template-variable-in-url branch 2 times, most recently from 3b74111 to 713be29 Compare January 23, 2026 01:34
Adds a test suite that extracts regex patterns from the JSON schema and
validates them against test cases. Tests cover:
- Transport URL pattern (http/https or template variables like {baseUrl})
- Icon sizes pattern (WxH format or "any")
- Server name pattern (namespace/name format)
- File SHA-256 pattern (64 hex chars)

Includes helper functions for cleaner schema traversal and pattern testing.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@tadasant tadasant force-pushed the allow-template-variable-in-url branch from 713be29 to 1a99275 Compare January 23, 2026 01:37
@tadasant tadasant marked this pull request as ready for review January 23, 2026 01:45
@tadasant tadasant requested a review from a team January 23, 2026 01:45
@tadasant
Copy link
Member Author

cc @BobDickinson

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@BobDickinson
Copy link
Contributor

I like it

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.

3 participants