test: add integration test suite with FastMCP companion server - #6
Merged
Conversation
Adds the 'integration' optional-dependency extra (fastmcp, uvicorn) and registers an 'integration' pytest marker, per issue #2. Unit-test installs are unaffected; integration test modules skip via pytest.importorskip when the extra is absent. Signed-off-by: Jonathan Springer <jps@s390x.com>
Minimal in-tree equivalent of mcp-context-forge's test_reverse_proxy_mcp_server (issue #2): a FastMCP companion server with deterministic echo/add tools, a resource, and a prompt, servable over stdio, SSE, and Streamable HTTP. - test_adapters_integration.py drives a full MCP session (initialize, tools/list, tools/call, resources/list) through each real transport adapter against the live server - test_end_to_end.py bridges the stdio companion server through ReverseProxyClient to a fake in-process WebSocket gateway, verifying registration and a gateway->MCP->gateway tool-call round-trip Signed-off-by: Jonathan Springer <jps@s390x.com>
Runs tests/integration on Python 3.13 with the integration extra; continue-on-error keeps it advisory while the suite proves itself (issue #2). Signed-off-by: Jonathan Springer <jps@s390x.com>
CHANGELOG entry and tests/README section covering the integration extra, how to run the suite, and its skip behavior without fastmcp. Signed-off-by: Jonathan Springer <jps@s390x.com>
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
Implements #2: adds an integration test layer that exercises the reverse proxy against a live MCP server instead of mocks.
The original companion server branch (
cyberfraud-reverse-proxy-support) no longer exists upstream, so this adds the minimal equivalent the issue allows: an in-tree FastMCP server (tests/integration/companion_server.py) with deterministicecho/addtools, a resource, and a prompt, servable over stdio, SSE, and Streamable HTTP.test_adapters_integration.py— parametrized over all three MCP-server-side transports (stdio / SSE / Streamable HTTP), driving a full MCP session (initialize → initialized → tools/list → tools/call → resources/list) through each real adapter against the live server.test_end_to_end.py— full round-trip:ReverseProxyClientbridges the stdio companion server to a fake in-process WebSocket gateway, which accepts registration and drives initialize → tools/call through the proxy.integrationoptional extra (fastmcp,uvicorn) — test modulespytest.importorskip("fastmcp"), so the unit-test job and contributor workflows without the extra are unaffected.continue-on-error: true, Python 3.13) runningpytest tests/integration -q, per the issue's "optional/non-blocking initially" guidance.Closes #2
Test plan
pytest tests/— 128 passed (124 unit + 4 integration)ruff check src tests— cleanmypy src/mcp_reverse_proxy— clean