P13-T3: Implement multi-client transport and JSON-RPC multiplexing#65
Merged
Conversation
…ltiplexing (PASS)
…or Python 3.9 compatibility
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.
Description
Implements P13-T3: full
UnixSocketServerinsrc/mcpbridge_wrapper/broker/transport.py, replacing the P13-T1 stub. The server accepts concurrent Unix domain socket connections from MCP clients and multiplexes their JSON-RPC traffic through the single upstreamxcrun mcpbridgesubprocess owned byBrokerDaemon.Key changes:
transport.py— fullUnixSocketServerimplementation: client accept loop, per-session handlers, request ID remapping (session_id << 20 | original_id), upstream write, response routing, notification broadcast, graceful shutdown with-32001drain, and queue TTL enforcement during reconnection.daemon.py— integratesUnixSocketServeras an optionaltransportparameter; starts/stops transport instart()/stop(); routes upstream stdout lines throughtransport.route_upstream_response().test_broker_transport.py— 32 new tests covering concurrent clients, ID remapping, error isolation, reconnect TTL, graceful stop.test_broker_stubs.py— replacedNotImplementedErrorassertions with instantiation tests (stubs now live).Validation report:
SPECS/ARCHIVE/P13-T3_Implement_multi-client_transport_and_JSON-RPC_multiplexing/P13-T3_Validation_Report.mdType of Change
Quality Gates
Before submitting, ensure all quality gates pass:
Or run individually:
make test- All tests pass with ≥90% coverage (550 passed, 5 skipped; 93.6% coverage)make lint- No linting errors (ruff check src/— all checks passed)make format- Code is properly formattedmake typecheck- Type checking passes (mypy src/— no issues in 18 files)make doccheck- Documentation is synced with DocC (if docs changed)Documentation Sync
Testing
test_broker_transport.py)xcrun mcpbridgerequires Xcode 26.3+)Checklist