Realm
OA Network transport and MCP control plane

Transport and control.
No GPU runtime required.

One module. Four layers of the stack.

TCP primitives, bounded wire framing, and the JSON-RPC control plane share one explicit ownership contract and require no additional crates.

An interconnected city of homes and network infrastructure

TCP Transport

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

Network equipment and cabling in a data center

Wire Framing

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

A cascading field of data and control signals

MCP Control Plane

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.

A layered city connected by cables and elevated links

ML Training Surface

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.

Explicit ownership at every boundary.

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.

CPU independent transport

oa::net owns blocking TCP independently of oa::Runtime and Vulkan. No GPU runtime is required to use the transport or the MCP control plane.

Explicit socket ownership

Dropping a TcpStream or TcpListener releases its handle without waiting. Shutdown can interrupt another thread's blocking I/O through a cloned handle.

Bounded wire framing

TcpFramed enforces the four byte LE donor wire format with a 16 MiB absolute ceiling. A partial read, write, timeout, or rejected peer length closes the stream immediately.

Dual protocol MCP negotiation

Legacy (2024 to 2025) sessions use initialize/notifications/initialized. Modern (2026-07-28) sessions carry _meta on every request. The two paths are mutually exclusive per session.

JSON parser with no external dependencies

A private recursive descent parser and serializer is embedded in net/mcp.rs. It enforces nesting depth, node count, duplicate rejection, and full UTF-8 validation without pulling in any external crate.

Transport independent McpServer

handle_message dispatches one JSON-RPC message. run_stdio binds the standard newline delimited subprocess loop. Custom transports compose handle_message directly.
Layered city infrastructure connected by cables and elevated links

TcpFramed

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.

McpServer

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.

Interconnected homes and network infrastructure extending to the horizon

One surface. TCP and MCP.

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};
2
3let mut server = McpServer::new(McpServerConfig {
4 name: "my-server".into(),
5 version: "1.0.0".into(),
6 ..Default::default()
7});
8
9let 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)?;
20
21server.run_stdio()?;

One library. Across the stack.

Follow the same runtime and semantic values into another module.