
TCP Transport
TcpStream and TcpListener own their sockets. Explicit close is idempotent; cloned handles share a connection; shutdown interrupts a blocking peer thread.

Network
Blocking TCP transport with explicit ownership, bounded wire framing, and a complete dual-protocol MCP control plane — independent of oa::Engine and Vulkan.
Module layout
TCP primitives, bounded wire framing, and a complete JSON-RPC control plane share one explicit ownership contract — with no additional crate dependencies.

TcpStream and TcpListener own their sockets. Explicit close is idempotent; cloned handles share a connection; shutdown interrupts a blocking peer thread.

TcpFramed preserves the OA donor wire format: four-byte LE length header, 16 MiB ceiling, caller-configurable per-reader limit, and buffer reuse.

A complete Rust port of the OA MCP session with full legacy and modern protocol negotiation, a private zero-dependency JSON engine, and no runtime dependencies beyond std.

McpTraining registers live tool handlers so an authorised client can inspect, pause, resume, evaluate, and checkpoint a running training session at safe points.
Contracts · Guarantees
Every socket, frame, and message follows the same OA pattern: ownership is explicit, errors surface immediately, and no hidden path exists between an operation and its result.

Wire Protocol
The OA donor wire format: a four-byte little-endian payload length followed by that many bytes, with a 16 MiB absolute ceiling. Readers may apply a smaller per-reader limit enforced before any payload allocation.
read_message_into reuses a caller-owned buffer for repeated messages — no allocation per round-trip in the steady state.
After a partial read or write, timeout, or rejected peer length, the wrapper closes its stream because the next frame boundary is no longer trustworthy. Invalid caller limits and oversized local payloads fail before I/O reaches the wire.
MCP Control Plane
A stateful, transport-independent Model Context Protocol session. Registration is frozen by the first handled message. handle_message dispatches any JSON-RPC message; run_stdio adds the standard newline-delimited subprocess binding.
Full legacy (2024–2025) and modern (2026-07-28) protocol negotiation, tools/list, tools/call, resources/list, resources/read, server/discover, and ping are handled out of the box.
The private authenticated satellite protocol remains Planned. TCP framing alone provides no peer authentication or remote compute semantics.

For Developers · Network SDK
Register tools, set configuration defaults, and run a stdio MCP server — or use TcpFramed directly for framed byte transport over any TCP connection with the same explicit ownership contract.
1use oa::{McpServer, McpServerConfig, McpTool, McpToolResult};23let mut server = McpServer::new(McpServerConfig {4 name: "my-server".into(),5 version: "1.0.0".into(),6 ..Default::default()7});89let mut tool = McpTool::new("greet", |args| {10 let name = args.string("name")?;11 Ok(McpToolResult::success(format!("Hello, {name}!")))12});13tool.description = "Greet a user by name.".into();14tool.input_schema_json = r#"{"type":"object",15 "properties":{"name":{"type":"string"}},16 "required":["name"]}"#.into();17tool.read_only = true;18tool.destructive = false;19server.add_tool(tool)?;2021server.run_stdio()?;
Oa Library
Follow the same Engine, values, and explicit execution contract into another module.