fix(test): migrate e2e MCP tests from wrapper to FastMCP Client#4421
Merged
fix(test): migrate e2e MCP tests from wrapper to FastMCP Client#4421
Conversation
The mcpgateway.wrapper lacks MCP session management (#4419), causing all post-initialize requests to fail with HTTP 400. Migrate RBAC transport tests to use FastMCP Client which handles sessions properly. - Replace wrapper subprocess helpers with sync wrappers around async FastMCP Client (thread pool bridge for Playwright event loop compat) - Update tool call assertions for check_any_team=True behavior (#3687) - Handle ambiguous resource URIs in protocol e2e test (#4418) - Add E402 to ruff per-file-ignores for tests (pytest.importorskip) Closes #4419 Signed-off-by: Jonathan Springer <jps@s390x.com>
5d40c07 to
3c13bd1
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
mcpgateway.wrappersubprocess to FastMCPClient, fixing all 35 test failures caused by the wrapper's missing session management ([BUG]: mcpgateway.wrapper lacks MCP session management — all post-initialize requests fail with HTTP 400 #4419)check_any_team=Truebehavior from fix(rbac): use check_any_team for API tokens in MCP transports #3687E402to ruff per-file-ignores fortests/(needed forpytest.importorskipguard)Why
The
mcpgateway.wrappersends each JSON-RPC message as an independent HTTP POST without trackingmcp-session-id. After transport hardening (#3344), the gateway strictly requires session IDs for post-initialize requests, breaking all wrapper-based tests.Approach
The FastMCP
Clienthandles MCP session lifecycle internally. Since the RBAC tests use Playwright sync fixtures (which own the event loop), async FastMCP calls are bridged viaconcurrent.futures.ThreadPoolExecutor+asyncio.run.Related Issues