Realm
OA Network transport and MCP control plane

Transport and control.
No runtime required.

One module. Four layers of the stack.

TCP primitives, bounded wire framing, and a complete JSON-RPC control plane share one explicit ownership contract — with no additional crate dependencies.

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 zero-dependency JSON engine, and no runtime dependencies beyond std.

A layered city connected by cables and elevated links

ML Training Surface

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.

01

CPU-independent transport

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

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.
03

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.
04

Dual-protocol MCP negotiation

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

Zero-dependency JSON engine

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

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 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.

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–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, 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};
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 Engine, values, and explicit execution contract into another module.