50 std::vector<std::string> args,
51 std::map<std::string, std::string> env = {},
80 std::vector<std::string> args,
81 std::map<std::string, std::string> env,
103 void close()
override;
204 std::atomic<bool> cancel_flag_{
false};
206 std::string display_name_;
207 std::string command_;
208 std::vector<std::string> args_;
209 std::map<std::string, std::string> env_;
210 std::string working_dir_;
213 pid_t child_pid_{-1};
217 std::atomic<bool> connected_{
false};
218 std::thread stderr_thread_;
219 std::mutex io_mutex_;
235 bool desynced_ =
false;
243 std::vector<std::string> build_env()
const;
256 const std::vector<std::string>&
env_strs);
291 int drain_orphaned_responses();
303 int poll_until_ready(
305 std::chrono::steady_clock::time_point deadline);
314 bool create_all_pipes(
int (&
fds)[6]);
322 bool open_child_process();
329 void stderr_reader_loop();
336 void terminate_child();
344 static void close_fd(
int& fd);
Stdio transport: fork/exec child, pipe stdin/stdout.
void set_working_dir(std::string dir)
Set the child's working directory, before connect (gh#166).
bool is_interrupted() const override
Whether an interrupt is currently short-circuiting calls.
bool open() override
Spawn child process and open pipes.
bool is_connected() const override
Check if child process is alive.
void interrupt() override
Abort any blocking read and mark transport uncancellable.
std::string send_request(const std::string &request_json, uint32_t timeout_ms=0) override
Send JSON-RPC request via stdin, read response from stdout.
void close() override
Send SIGTERM, reap the child, join the stderr pump, close pipes.
const std::string & display_name() const
Get the sanitized display name used for stderr labeling.
bool request_cancelled() const
Whether THIS request must abort (gh#158, v2.13.0).
~StdioTransport() override
Destructor — ensures child is cleaned up.
void clear_interrupt() override
Release the cancel flag so this transport works again.
Abstract transport for external MCP communication.
Activate model on GPU (WARM → ACTIVE).
@ optional
optional: every escape asks the host's path approver
Abstract transport for external MCP server communication.