Skip to content

test: add integration test suite with FastMCP companion server - #6

Merged
jonpspri merged 4 commits into
mainfrom
test/integration-test-suite
Aug 13, 2026
Merged

test: add integration test suite with FastMCP companion server#6
jonpspri merged 4 commits into
mainfrom
test/integration-test-suite

Conversation

@jonpspri

Copy link
Copy Markdown
Collaborator

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 deterministic echo/add tools, 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: ReverseProxyClient bridges the stdio companion server to a fake in-process WebSocket gateway, which accepts registration and drives initialize → tools/call through the proxy.
  • integration optional extra (fastmcp, uvicorn) — test modules pytest.importorskip("fastmcp"), so the unit-test job and contributor workflows without the extra are unaffected.
  • Non-blocking CI job (continue-on-error: true, Python 3.13) running pytest 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 — clean
  • mypy src/mcp_reverse_proxy — clean
  • CI: unit jobs unaffected (integration modules skip without the extra); new integration job runs advisory

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>
@jonpspri
jonpspri merged commit e612d34 into main Aug 13, 2026
7 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.

[TESTING]: Add integration tests using companion test MCP server

1 participant