|
cxxmcp 1.3.0
C++ MCP SDK
|
Adapts an existing server::Transport to transport::ServerTransport. More...
#include <transport_adapter.hpp>
Public Member Functions | |
| TransportContractAdapter (mcp::server::Transport &transport) | |
| TransportContractAdapter (std::unique_ptr< mcp::server::Transport > transport) | |
| TransportContractAdapter (const TransportContractAdapter &)=delete | |
| TransportContractAdapter & | operator= (const TransportContractAdapter &)=delete |
| TransportContractAdapter (TransportContractAdapter &&other) noexcept | |
| TransportContractAdapter & | operator= (TransportContractAdapter &&other) noexcept |
| std::string_view | name () const noexcept override |
| Human-readable transport name for diagnostics. | |
| core::Result< core::Unit > | send (TxMessage message) override |
| core::Result< std::optional< RxMessage > > | receive () override |
| Receives the next JSON-RPC message from the peer. | |
| void | publish_subscription_notification (std::string_view method, protocol::Json params) override |
| Publishes a notification to active subscription listen streams. | |
| core::Result< core::Unit > | close () override |
| Closes the transport and unblocks receive() where possible. | |
Public Member Functions inherited from mcp::transport::Transport< Role > | |
| virtual protocol::Json | diagnostics () const |
| Structured implementation diagnostics. | |
| virtual core::Result< core::Unit > | send (TxMessage message)=0 |
| Sends one JSON-RPC message to the peer. | |
| virtual core::Result< std::optional< RxMessage > > | receive_response (const protocol::RequestId &id) |
| Waits for the response to one specific outbound request. | |
| virtual void | wait_until_ready () |
| Blocks until the transport is ready to process messages. | |
Additional Inherited Members | |
Public Types inherited from mcp::transport::Transport< Role > | |
| using | TxMessage = typename MessageTraits< Role >::TxMessage |
| using | RxMessage = typename MessageTraits< Role >::RxMessage |
Adapts an existing server::Transport to transport::ServerTransport.
Outbound request responses are queued for receive(). Inbound client messages still belong to the concrete transport's start() callback model and are not synthesized by this adapter. This compatibility adapter is not internally synchronized; callers must serialize send(), receive(), and close() access unless the wrapped transport and caller add their own synchronization.
|
inlineoverridevirtual |
Closes the transport and unblocks receive() where possible.
Implements mcp::transport::Transport< Role >.
|
inlineoverridevirtualnoexcept |
Human-readable transport name for diagnostics.
Implements mcp::transport::Transport< Role >.
|
inlineoverridevirtual |
Publishes a notification to active subscription listen streams.
Transports that serve SEP-2575 stateless subscription channels override this to deliver the notification to matching subscribers. The default is a no-op.
Reimplemented from mcp::transport::Transport< Role >.
|
inlineoverridevirtual |
Receives the next JSON-RPC message from the peer.
receive() is the sequential inbound side. A successful std::nullopt return is an orderly end-of-stream signal, not a parse or transport error.
Implements mcp::transport::Transport< Role >.