# MCP Gateway Tests This directory contains unit and integration tests for the Python MCP Gateway. ## Current Flow The production Workbuddy flow is direct Gateway session access: 1. Base creates a Workbuddy config containing a `GWS_xxx` credential. 2. Public Gateway reads the session from Redis. 3. Tool calls use the request-scoped MCP token stored in that Gateway session. 4. Missing or revoked sessions return the device-invalid message. The old authorization-code binding flow is no longer part of the supported runtime. ## Run All Tests ```powershell python -m unittest discover -s tests -p "test_*.py" -v ``` ## Key Test Areas - `test_public_gateway_unit.py`: public tool routing and Gateway session checks. - `test_public_server_integration.py`: HTTP JSON-RPC behavior. - `test_gateway_session_store_unit.py`: Redis Gateway session storage. - `test_request_context.py`: session extraction from headers, bearer token, and cookies. - `test_auth_client.py`: token refresh/revoke only. - `test_gateway_runtime.py`: local runtime tool registration and token refresh.