|
cxxmcp 1.1.6
C++ MCP SDK
|
Adapts a transport::ServerTransport to the existing server::Transport API. More...
#include <transport_adapter.hpp>
Public Member Functions | |
| ContractTransportAdapter (transport::ServerTransport &transport) | |
| ContractTransportAdapter (std::unique_ptr< transport::ServerTransport > transport) | |
| ContractTransportAdapter (const ContractTransportAdapter &)=delete | |
| ContractTransportAdapter & | operator= (const ContractTransportAdapter &)=delete |
| ContractTransportAdapter (ContractTransportAdapter &&other) noexcept | |
| ContractTransportAdapter & | operator= (ContractTransportAdapter &&other) noexcept |
| core::Result< core::Unit > | start (RequestHandler handler, NotificationHandler notification_handler={}) override |
| Start accepting inbound messages and dispatch them to handlers. | |
| core::Result< protocol::JsonRpcResponse > | send_request (const protocol::JsonRpcRequest &request) override |
| Send a JSON-RPC request from the server to the connected client. | |
| core::Result< core::Unit > | send_notification (const protocol::JsonRpcNotification ¬ification) override |
| Send a JSON-RPC notification from the server to the client. | |
| std::optional< protocol::ClientCapabilities > | client_capabilities () const override |
| Return capabilities learned from the client's initialize request. | |
| void | stop () noexcept override |
| Request transport shutdown. | |
| std::string_view | name () const noexcept override |
| Human-readable transport name for diagnostics. | |
Public Member Functions inherited from mcp::server::Transport | |
| std::weak_ptr< void > | lifetime_token () const noexcept |
| Weak lifetime token for SessionContext and ClientPeer guards. | |
| virtual core::Result< protocol::JsonRpcResponse > | send_request_to_session (std::string_view session_id, const protocol::JsonRpcRequest &request) |
| Send a JSON-RPC request to a specific logical session. | |
| virtual std::optional< protocol::ClientCapabilities > | client_capabilities_for_session (std::string_view session_id) const |
| Return capabilities learned for a specific logical session. | |
| virtual core::Result< core::Unit > | send_notification_to_session (std::string_view session_id, const protocol::JsonRpcNotification ¬ification) |
| Send a JSON-RPC notification to a specific logical session. | |
| virtual void | wait_until_ready () |
| Blocks until the transport is ready to process messages. | |
Adapts a transport::ServerTransport to the existing server::Transport API.
start() drains inbound messages from the role-generic transport, dispatches requests and notifications through server handlers, and writes request responses back to the transport. send_request() and send_notification() provide the legacy server-side outbound API over the same message contract. send_request() calls must be serialized by the caller.
|
inlineoverridevirtual |
Return capabilities learned from the client's initialize request.
Reimplemented from mcp::server::Transport.
|
inlineoverridevirtualnoexcept |
Human-readable transport name for diagnostics.
Implements mcp::server::Transport.
|
inlineoverridevirtual |
Send a JSON-RPC notification from the server to the client.
| notification | Notification to serialize and deliver. |
Implements mcp::server::Transport.
|
inlineoverridevirtual |
Send a JSON-RPC request from the server to the connected client.
| request | Request to serialize and deliver. |
Reimplemented from mcp::server::Transport.
|
inlineoverridevirtual |
Start accepting inbound messages and dispatch them to handlers.
| handler | Required request handler. |
| notification_handler | Optional notification handler. |
Implements mcp::server::Transport.
|
inlineoverridevirtualnoexcept |
Request transport shutdown.
stop() is best-effort and must not throw. Implementations should unblock any running start() call or pending outbound operation where possible.
Implements mcp::server::Transport.