Skip to content

fix: gate ClientSessionGroup lists on capabilities#2954

Closed
fengjikui wants to merge 1 commit into
modelcontextprotocol:mainfrom
fengjikui:codex/session-group-capability-gates
Closed

fix: gate ClientSessionGroup lists on capabilities#2954
fengjikui wants to merge 1 commit into
modelcontextprotocol:mainfrom
fengjikui:codex/session-group-capability-gates

Conversation

@fengjikui

Copy link
Copy Markdown

Summary

  • make ClientSessionGroup consult the negotiated server capabilities before listing prompts, resources, or tools
  • preserve the existing MCPError warning fallback when a server advertises a capability but the list call still fails
  • add a regression test for a tools-only server so unadvertised prompts/resources are not queried

Fixes #2689.

Validation

  • uv run pytest tests/client/test_session_group.py::test_client_session_group_skips_unadvertised_capabilities -q
  • env -u ALL_PROXY -u all_proxy -u HTTP_PROXY -u http_proxy -u HTTPS_PROXY -u https_proxy uv run pytest tests/client/test_session_group.py -q
  • uv run ruff check src/mcp/client/session_group.py tests/client/test_session_group.py
  • uv run ruff format --check src/mcp/client/session_group.py tests/client/test_session_group.py
  • uv run pyright src/mcp/client/session_group.py tests/client/test_session_group.py
  • one-off tools-only in-memory server repro passes without prompt/resource warnings

Note: the full test_session_group.py run needs proxy env vars unset locally because this shell has ALL_PROXY=socks5://127.0.0.1:7890 and the test constructs an httpx.AsyncClient; with the proxy removed, the file passes.

@maxisbey maxisbey closed this Jun 23, 2026
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.

ClientSessionGroup attempts to use capabilities that were not advertised

2 participants