Auto-set server.transport in Transport#initialize
## Motivation and Context Transport subclasses (StreamableHTTPTransport, StdioTransport) already receive the server in their constructor, but users must manually call `server.transport = transport` after creating a transport instance. This is boilerplate that can be eliminated by setting the connection automatically in `Transport#initialize`. ## How Has This Been Tested? All existing tests pass. Redundant `server.transport = transport` lines were removed from tests, examples, README.md, and conformance server. ## Breaking Changes None. Existing code that manually sets `server.transport = transport` continues to work (idempotent assignment).
This commit is contained in:
parent
2822e00b62
commit
de38804ed7
1 changed files with 10 additions and 36 deletions
|
|
@ -7,6 +7,7 @@ module MCP
|
|||
# Initialize the transport with the server instance
|
||||
def initialize(server)
|
||||
@server = server
|
||||
server.transport = self
|
||||
end
|
||||
|
||||
# Send a response to the client
|
||||
|
|
|
|||
Loading…
Reference in a new issue