|
cxxmcp 1.1.6
C++ MCP SDK
|
Client transport that exchanges MCP JSON-RPC messages over HTTP. More...
#include <http_transport.hpp>
Public Member Functions | |
| HttpTransport (HttpTransportOptions options) | |
| Creates an HTTP transport from endpoint options. | |
| core::Result< protocol::JsonRpcResponse > | send (const protocol::JsonRpcRequest &request) override |
| Sends one JSON-RPC request to the HTTP endpoint. | |
| core::Result< core::Unit > | send_notification (const protocol::JsonRpcNotification ¬ification) override |
| Sends a JSON-RPC notification to the HTTP endpoint. | |
| core::Result< core::Unit > | start (TransportRequestHandler request_handler, TransportNotificationHandler notification_handler={}) override |
| Starts receive-side handling for server-initiated messages. | |
| void | stop () noexcept override |
| Stops background receive activity and releases transport resources. | |
| void | set_negotiated_protocol_version (std::string version) |
| Updates the negotiated protocol version for subsequent requests. | |
Client transport that exchanges MCP JSON-RPC messages over HTTP.
The transport implements Client::Transport and can be used directly with Client(std::unique_ptr<Transport>) or indirectly through Client factory helpers.
|
explicit |
Creates an HTTP transport from endpoint options.
| options | Host, port, path, headers, and timeout configuration. |
|
overridevirtual |
Sends one JSON-RPC request to the HTTP endpoint.
Implements mcp::client::Transport.
|
overridevirtual |
Sends a JSON-RPC notification to the HTTP endpoint.
Reimplemented from mcp::client::Transport.
| void mcp::client::HttpTransport::set_negotiated_protocol_version | ( | std::string | version | ) |
Updates the negotiated protocol version for subsequent requests.
Called after version negotiation to ensure headers reflect the agreed version.
|
overridevirtual |
Starts receive-side handling for server-initiated messages.
| request_handler | Handler for inbound server requests. |
| notification_handler | Handler for inbound server notifications. |
Reimplemented from mcp::client::Transport.
|
overridevirtualnoexcept |
Stops background receive activity and releases transport resources.
Reimplemented from mcp::client::Transport.