|
cxxmcp 1.1.6
C++ MCP SDK
|
Abstract client transport used by Client to exchange JSON-RPC messages. More...
#include <client.hpp>
Public Member Functions | |
| virtual core::Result< protocol::JsonRpcResponse > | send (const protocol::JsonRpcRequest &request)=0 |
| Sends a JSON-RPC request and waits for the corresponding response. | |
| virtual core::Result< core::Unit > | send_notification (const protocol::JsonRpcNotification ¬ification) |
| Sends a JSON-RPC notification without waiting for a response. | |
| virtual core::Result< core::Unit > | start (TransportRequestHandler request_handler, TransportNotificationHandler notification_handler={}) |
| Starts receiving inbound messages for transports that need an active loop. | |
| virtual void | stop () noexcept |
| Requests transport shutdown. | |
Abstract client transport used by Client to exchange JSON-RPC messages.
Implementations own the wire protocol details. Client calls send() for outbound requests and may call start() lazily before the first operation so transports can register inbound request and notification callbacks.
|
pure virtual |
Sends a JSON-RPC request and waits for the corresponding response.
| request | Fully formed JSON-RPC request. |
Implemented in mcp::client::HttpTransport, mcp::client::ProcessStdioTransport, mcp::client::StdioTransport, and mcp::client::ContractTransportAdapter.
|
virtual |
Sends a JSON-RPC notification without waiting for a response.
| notification | Fully formed JSON-RPC notification. |
Reimplemented in mcp::client::HttpTransport, mcp::client::ProcessStdioTransport, mcp::client::StdioTransport, and mcp::client::ContractTransportAdapter.
|
inlinevirtual |
Starts receiving inbound messages for transports that need an active loop.
| request_handler | Callback used for server-to-client JSON-RPC requests. |
| notification_handler | Callback used for server-to-client notifications. |
Reimplemented in mcp::client::HttpTransport, mcp::client::ProcessStdioTransport, mcp::client::StdioTransport, and mcp::client::ContractTransportAdapter.
|
inlinevirtualnoexcept |
Requests transport shutdown.
stop() is best-effort and must not throw. Request/response-only transports can keep the default no-op implementation.
Reimplemented in mcp::client::HttpTransport, mcp::client::ProcessStdioTransport, and mcp::client::ContractTransportAdapter.