You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
UriTemplate.match() misparses {;var} when following literal begins with '=' #3852
UriTemplate.match() breaks match(expand(variables)) == variables when a {;var} path-style parameter expression (ifemp = True, RFC 6570 §3.2.7) is immediately followed by a literal that begins with "=" (for example "{;a}=end{+rest}" or "/api{;mode}=fast{/id}").
In src/mcp/shared/uri_template.py (_scan_prefix), the atom.ifemp check runs:
Checking uri.startswith(nxt.text, pos) unconditionally before uri[pos] == "=" handles the empty-value case (a == "" -> ";a=end/x"), except when a equals the stem of nxt.text (a == "end" -> expand() emits ";a=end=end/x"). At pos right after ";a", uri[pos:] is "=end=end/x", which also starts with nxt.text ("=end"). _scan_prefix prematurely treats a as "" and leaves the second "=end" to be absorbed by a downstream greedy variable {+rest} (or fails suffix matching when no greedy variable follows).
I'd like to take this issue and ask to be assigned.
UriTemplate.match() currently misparses {;var} when the following literal starts with =, because the empty-value check in _scan_prefix can treat that literal as an empty path-style value. I plan to fix that check in src/mcp/shared/uri_template.py and add tests so match(expand(variables)) == variables holds for this case (including examples like {;a}=end{+rest}).
Please assign this issue to me. Once it is assigned, I will open a PR with Fixes #3852, as described in the contributing guide (external PRs are reviewed when assigned or labeled help wanted).
Activity
ZYZ666-RGB commentedon Nov 13, 2026
I'd like to take this issue and ask to be assigned.
UriTemplate.match()currently misparses{;var}when the following literal starts with=, because the empty-value check in_scan_prefixcan treat that literal as an empty path-style value. I plan to fix that check insrc/mcp/shared/uri_template.pyand add tests somatch(expand(variables)) == variablesholds for this case (including examples like{;a}=end{+rest}).Please assign this issue to me. Once it is assigned, I will open a PR with
Fixes #3852, as described in the contributing guide (external PRs are reviewed when assigned or labeled help wanted).