13#include <unordered_map>
18namespace mcp::client {
26 std::vector<std::string>
args;
32 std::unordered_map<std::string, std::string>
env;
37 std::chrono::seconds(30);
74 void stop() noexcept override;
80 std::unique_ptr<Impl> impl_;
Client transport that owns a child process and exchanges JSON-RPC over stdio.
Definition process_stdio_transport.hpp:46
ProcessStdioTransport(ProcessStdioTransportOptions options)
Creates a child-process stdio transport.
core::Result< protocol::JsonRpcResponse > send(const protocol::JsonRpcRequest &request) override
Sends one JSON-RPC request to the child process and waits for a response.
core::Result< core::Unit > start(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.
core::Result< core::Unit > send_notification(const protocol::JsonRpcNotification ¬ification) override
Sends one JSON-RPC notification to the child process.
Abstract client transport used by Client to exchange JSON-RPC messages.
Definition client.hpp:83
Core client compatibility API and transport interface for MCP clients.
std::function< core::Result< core::Unit >(const protocol::JsonRpcNotification &)> TransportNotificationHandler
Handles JSON-RPC notifications sent by the server to this client.
Definition client.hpp:75
std::function< core::Result< protocol::JsonRpcResponse >(const protocol::JsonRpcRequest &)> TransportRequestHandler
Handles JSON-RPC requests sent by the server to this client.
Definition client.hpp:68
tl::expected< T, Error > Result
Alias for the SDK result type.
Definition result.hpp:64
Configuration for a child-process stdio transport.
Definition process_stdio_transport.hpp:21
std::string cwd
Optional working directory for the child process.
Definition process_stdio_transport.hpp:29
std::optional< std::chrono::milliseconds > request_timeout
Optional maximum time to wait for a JSON-RPC response from the child.
Definition process_stdio_transport.hpp:36
std::vector< std::string > args
Command-line arguments passed to the executable.
Definition process_stdio_transport.hpp:26
std::string command
Executable to launch.
Definition process_stdio_transport.hpp:23
std::unordered_map< std::string, std::string > env
Extra environment variables for the child process.
Definition process_stdio_transport.hpp:32
JSON-RPC notification envelope for one-way MCP messages.
Definition types.hpp:137
JSON-RPC request envelope carrying an MCP method invocation.
Definition types.hpp:99