cxxmcp 1.1.6
C++ MCP SDK
Loading...
Searching...
No Matches
mcp::client::ProcessStdioTransport Class Referencefinal

Client transport that owns a child process and exchanges JSON-RPC over stdio. More...

#include <process_stdio_transport.hpp>

Inheritance diagram for mcp::client::ProcessStdioTransport:
mcp::client::Transport

Public Member Functions

 ProcessStdioTransport (ProcessStdioTransportOptions options)
 Creates a child-process stdio transport.
 
 ProcessStdioTransport (const ProcessStdioTransport &)=delete
 
ProcessStdioTransportoperator= (const ProcessStdioTransport &)=delete
 
core::Result< protocol::JsonRpcResponsesend (const protocol::JsonRpcRequest &request) override
 Sends one JSON-RPC request to the child process and waits for a response.
 
core::Result< core::Unitsend_notification (const protocol::JsonRpcNotification &notification) override
 Sends one JSON-RPC notification to the child process.
 
core::Result< core::Unitstart (TransportRequestHandler request_handler, TransportNotificationHandler notification_handler={}) override
 Starts the child process and receive loop when needed.
 
void stop () noexcept override
 Stops the child process and receive loop.
 

Detailed Description

Client transport that owns a child process and exchanges JSON-RPC over stdio.

The transport is move-only through unique ownership by Client. It starts the child process on demand and routes server-initiated requests and notifications through callbacks registered with start().

Constructor & Destructor Documentation

◆ ProcessStdioTransport()

mcp::client::ProcessStdioTransport::ProcessStdioTransport ( ProcessStdioTransportOptions  options)
explicit

Creates a child-process stdio transport.

Parameters
optionsCommand, arguments, working directory, and environment.

Member Function Documentation

◆ send()

core::Result< protocol::JsonRpcResponse > mcp::client::ProcessStdioTransport::send ( const protocol::JsonRpcRequest request)
overridevirtual

Sends one JSON-RPC request to the child process and waits for a response.

Implements mcp::client::Transport.

◆ send_notification()

core::Result< core::Unit > mcp::client::ProcessStdioTransport::send_notification ( const protocol::JsonRpcNotification notification)
overridevirtual

Sends one JSON-RPC notification to the child process.

Reimplemented from mcp::client::Transport.

◆ start()

core::Result< core::Unit > mcp::client::ProcessStdioTransport::start ( TransportRequestHandler  request_handler,
TransportNotificationHandler  notification_handler = {} 
)
overridevirtual

Starts the child process and receive loop when needed.

Parameters
request_handlerHandler for server-to-client requests.
notification_handlerHandler for server-to-client notifications.

Reimplemented from mcp::client::Transport.

◆ stop()

void mcp::client::ProcessStdioTransport::stop ( )
overridevirtualnoexcept

Stops the child process and receive loop.

Reimplemented from mcp::client::Transport.


The documentation for this class was generated from the following file: