code wiki / (root) / nx_mcp_stdio_http_t174.nx

nx_mcp_stdio_http_t174.nx

buildroot/runtime/nx_mcp_stdio_http_t174.nx

22206 B403 linesdepth 21pulls 149 transitivereach 0 importersview sourcekind tooltopic mcp
docsdependenciesstructsconstsfunctions

about

MCP stdio to sovereign HTTPS. The server remains the authority for discovery and capability checks. Each request runs in a child so the current TLS allocator cannot accumulate across a long session. FAILURE SEMANTICS (lane conn, 2026-09-11). A per-request failure -- a child that exits non-zero, the SIGALRM deadline, a non-2xx HTTP status, an over-budget response, a response-id mismatch, or a TLS/transport failure -- produces a JSON-RPC 2.0 error response for THAT request id on the protocol fd, and the connector KEEPS SERVING every other request. Two mechanisms, one shape: * the request CHILD self-reports soft failures (it knows the http status / byte limit) by writing a correlated error to its own pipe and exiting 0, so the parent forwards it like any response; * the PARENT (mp_recover_pump) turns a child that died WITHOUT self-reporting -- a crash, or the SIGALRM deadline killing it -- into a correlated error from that slot's pending id and continues. An oversized OR malformed request line is consumed to its newline and answered with -32600 for its id when the id is readable from the retained prefix; otherwise a stderr diagnostic. Notifications (no id) never get a response. Only broken stdin/stdout, poll failure, or allocation failure ends the process. Protocol-fd isolation (stdout dup'd away to stderr for library chatter, the real protocol pipe held on a private fd) and response-id correlation are preserved. No magic numbers: every code/limit is named.

dependencies 5 imports · 0 importers

nx_mcp_transport.nx nx_mcp_route.nx nx_request_pool.nx nx_mcp_control.nx nx_mcp_pending_http_t174.nx nx_mcp_stdio_http_t174.nx

imports: nx_mcp_transport.nxnx_mcp_route.nxnx_request_pool.nxnx_mcp_control.nxnx_mcp_pending_http_t174.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main mr_equal mr_len ms_number mr_config mr_len ↻ mr_equal ↻ mc_puts rp_new nx_ra_new sys_mmap nxa_die sys_write sys_exit nxa_lock_take nxa_lock_addr sys_write ↻ nxa_lock_give nxa_lock_addr ↻ nxa_report_overrun sys_write ↻ nxa_dump_printable sys_write ↻ nxa_dump_sizes sys_write ↻ sys_munmap nx_ra_set_budget nx_ra_kind_is_valid nx_ra_set_max_share nx_ra_kind_is_valid ↻ mp_recover_pump rp_pump rp_pump_timeout rp_worker rp_write rp_release rp_worker ↻ nx_ra_release _ra_alloc_at mp_sweep

structs

55struct NxMcpErr { code: i64, stage: *u8, cause: *u8, measured: i64, next: *u8, http_data:*u8, http_n:i64 }

consts

23const MS_F_DUPFD_CLOEXEC: i64 = 1030
24const MS_FIRST_PRIVATE_FD: i64 = 3
25const MS_STDIN: i64 = 0
26const MS_STDOUT: i64 = 1
27const MS_STDERR: i64 = 2
32const MS_OK: i64 = 0
33const MS_DUP: i64 = 0 - 1
34const MS_FATAL: i64 = 10
38const MSE_CODE_TRANSPORT: i64 = 0 - 32001
39const MSE_CODE_HTTPSTATUS: i64 = 0 - 32002
40const MSE_CODE_PARSE: i64 = 0 - 32003
41const MSE_CODE_BODY: i64 = 0 - 32004
42const MSE_CODE_RESPSIZE: i64 = 0 - 32005
43const MSE_CODE_IDENTITY: i64 = 0 - 32006
44const MSE_CODE_TRUSTSTORE: i64 = 0 - 32007
45const MSE_CODE_CREDENTIAL: i64 = 0 - 32008
46const MSE_CODE_URL: i64 = 0 - 32009
47const MSE_CODE_ROUTE: i64 = 0 - 32010
48const MSE_CODE_PROTOWRITE: i64 = 0 - 32011
49const MSO_CODE_DUP: i64 = 0 - 32013
50const MSO_CODE_INVALID: i64 = 0 - 32600

functions

57func ms_number(s: *u8) -> i64
called by 1: main
72func ms_has_id(src: *u8, n: i64) -> i64
called by 1: ms_exchange
106func ms_exchange(base: *u8, capfile: *u8, body: *u8, body_n: i64, response_cap: i64, protocol_fd: i64, timeout_secs: i64, err: *NxMcpErr) -> i64
213func ms_request(base: *u8, capfile: *u8, body: *u8, body_n: i64, response_cap: i64, protocol_fd: i64, timeout_secs: i64, argc: i64, argv: *i64, route_first: i64, pool: *NxRequestPool, pending: *u8, control: *NxMcpControl) -> i64
248func ms_drain(pool: *NxRequestPool, pending: *u8, protocol_fd: i64, timeout_secs: i64) -> i64
called by 1: main calls 1: mp_recover_pump
255func main(argc: i64, argv: *i64) -> i64