Skip to content

fix: forward host client capabilities to the upstream server - #451

Open
moaadb wants to merge 1 commit into
aws:mainfrom
moaadb:fix/forward-client-capabilities
Open

moaadb wants to merge 1 commit into
aws:mainfrom
moaadb:fix/forward-client-capabilities

Conversation

@moaadb

@moaadb moaadb commented Oct 30, 2026

Copy link
Copy Markdown

Closes #450

Summary

Closes #450

Changes

The proxy dropped the capabilities the host declared, so the upstream server only saw the proxy's own defaults. This change forwards the host's extensions (for example the MCP Apps io.modelcontextprotocol/ui entry) and experimental capabilities in the upstream initialize.

  • context.py: adds set_client_capabilities / get_client_capabilities, alongside the existing clientInfo pair.
  • initialize_middleware.py: stores the host's capabilities when the host's initialize arrives, next to set_client_info. sigv4_helper.py: adds _forward_client_capabilities_hook, a request hook modeled on _inject_metadata_hook. It only changes initialize bodies, merging in extensions and experimental. It runs right before _sign_request_hook, so the signature covers the modified body. sampling, elicitation and roots stay as the proxy declares them, because the proxy is what answers those server-to-client requests. Profile-switcher clients use the same create_sigv4_client, so they forward capabilities too.
  • server.py: InitializeMiddleware is now inserted at the front of the middleware list, through a new add_initialize_middleware helper. FastMCP's ProxyInitializeMiddleware opens the upstream session, so the capabilities have to be stored before it runs. The fix depends on that order, and a unit test checks it.

User experience

Before: an upstream server received only {"sampling": {}, "elicitation": {...}, "roots": {...}}, even when the host declared MCP Apps support. Servers that only return MCP App UI to UI-capable hosts treated every host behind the proxy as text-only.

After: the upstream initialize also includes the host's extensions and experimental capabilities, so MCP App UIs render through the proxy. Nothing changes for hosts that declare no extensions or experimental capabilities.

Checklist

If your change doesn't seem to apply, please leave them unchecked.

  • I have reviewed the contributing guidelines
  • I have performed a self-review of this change
  • Changes have been tested
  • Changes are documented

Is this a breaking change? (Y/N)

  • Yes
  • No

Please add details about how this change was tested.

  • Did integration tests succeed?
    uv run pytest -m integ: 25 passed, 1 skipped (the library-client test, which needs an AgentCore endpoint that verifies SigV4).
  • If the feature is a new use case, is it necessary to add a new integration test case?

Acknowledgment

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@moaadb
moaadb force-pushed the fix/forward-client-capabilities branch from fc7c845 to 0b192de Compare October 30, 2026 19:58
@moaadb
moaadb marked this pull request as ready for review October 30, 2026 20:00
@moaadb
moaadb requested a review from a team as a code owner October 30, 2026 20:00

This branch has not been deployed

No deployments
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.

Host client capabilities (e.g. MCP Apps extensions) are not forwarded to the upstream server

1 participant