Skip to content

fix(mcp): multiplex opaque resource URIs - #2538

Merged
stevenctl merged 1 commit into
agentgateway:mainfrom
piyushbag:fix/mcp-resource-uri-opaque
Jul 17, 2026
Merged

stevenctl merged 1 commit into
agentgateway:mainfrom
piyushbag:fix/mcp-resource-uri-opaque

Conversation

@piyushbag

Copy link
Copy Markdown
Contributor

Summary

  • Expand MCP resource URI multiplexing to any RFC 3986 absolute URI (scheme present), not only hierarchical scheme://… forms.
  • Opaque URIs such as memo:insights are now rewritten as service+memo:insights and round-trip through the existing first-+ parse path.
  • Hierarchical URIs (http://…, svn+ssh://…) keep the same service+<uri> encoding.

Test plan

  • cargo test -p agentgateway --lib uri_scheme_prefix
  • cargo test -p agentgateway --lib resource_uri_
  • CI on this PR

Fixes #2340

@piyushbag
piyushbag requested a review from a team as a code owner July 15, 2026 13:09
@piyushbag
piyushbag force-pushed the fix/mcp-resource-uri-opaque branch from 693ed77 to 9d1a972 Compare July 15, 2026 13:09
@stevenctl

Copy link
Copy Markdown
Collaborator

This mostly looks good to me, but currently conflicts with the ui:// changes I made in #2475 which requires the ui:// scheme stays on the lefthand side of our federation target.

Expand resource URI rewriting beyond scheme:// so RFC 3986 opaque forms
like memo:insights round-trip through service+ prefix multiplexing.

Fixes agentgateway#2340

Signed-off-by: Piyush Jagadish Bag <[email protected]>
@piyushbag
piyushbag force-pushed the fix/mcp-resource-uri-opaque branch from 9d1a972 to 8939f5b Compare July 17, 2026 13:57
@piyushbag

Copy link
Copy Markdown
Contributor Author

Rebased onto current main and reconciled with the Apps ui:// left-hand federation from #2475.

resource_uri now:

  1. Keeps ui:// on the left via apps::encode_ui_uri (ui://svc+…)
  2. Multiplexes all other absolute URIs (hierarchical + opaque) as svc+<uri>

Added a unit assertion that ui://weather/dashboard.html becomes ui://svc+weather/dashboard.html, not svc+ui://….

Local: cargo test -p agentgateway --lib -- uri_scheme_prefix resource_uri_multiplexes test_parse_resource_uri_ui

@stevenctl
stevenctl merged commit 2f641af into agentgateway:main Jul 17, 2026
10 checks passed
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.

MCP: better URI handling semantics

2 participants