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

Blocking TCP transport with explicit ownership, bounded wire framing, and support for both MCP protocol versions. The module works independently of oa::Runtime and Vulkan.
TCP primitives, bounded wire framing, and the JSON-RPC control plane share one explicit ownership contract and require no additional crates.

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 JSON parser with no external dependencies, and no runtime dependencies beyond std.

oa::ml::McpTraining registers live tool handlers so an authorised client can inspect, pause, resume, evaluate, and checkpoint a running training session at safe points.
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.

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 buffer provided by the caller, avoiding allocations on each round trip once the buffer has enough capacity.
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.
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 to 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.

Register tools and run an MCP server over stdio in Rust. For framed byte transport over TCP, use TcpFramed with the same explicit ownership contract.
Mcp_server.rs
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()?;
Follow the same runtime and semantic values into another module.