@nekzus/liop/bridge module provides two primary bridging abstractions: LiopMcpBridge for local STDIO process integration (e.g., Claude Desktop, Cursor, Zed) and LiopStreamBridge for remote HTTP/SSE streaming over networks.
LIOP Bridge: Bi-directional translation between MCP JSON-RPC and internal binary envelopes
1. Local STDIO Bridge (LiopMcpBridge)
LiopMcpBridge operates in two distinct modes depending on the source object passed to its constructor:
Mode A: EXPOSE (LIOP Server → MCP Stdio Client)
Exposes a nativeLiopServer as a standard MCP server running over stdio. This allows local desktop clients like Claude Desktop or Cursor to invoke tools while maintaining in-situ WASM execution and ZK-Receipt verification behind the scenes.
server-stdio.ts
Mode B: WRAP (Legacy MCP Server → LIOP Mesh)
Wraps an existing@modelcontextprotocol/sdk McpServer and advertises its capabilities into the decentralized LIOP P2P mesh as an enclave.
wrap-legacy-mcp.ts
Configuration Options (LiopBridgeOptions)
2. Remote HTTP Bridge (LiopStreamBridge)
LiopStreamBridge exposes a LiopServer over the network using the official MCP Streamable HTTP transport powered by Hono. External agents connect via HTTP with Server-Sent Events (SSE) and mandatory Bearer token authentication.
server-http.ts
Hardening & Defense Properties
- Bearer Token Authentication: Enforces
Authorization: Bearer <token>on all/mcpendpoints. IfZERO_TRUST_TOKENis unset in the environment, generates a cryptographically secure UUID token at startup. - Session Eviction: An automated background timer sweeps active sessions every 60 seconds, evicting any session whose inactivity exceeds
sessionTimeoutMs. - Per-IP Concurrency Caps: Restricts concurrent active sessions per source IP address to prevent socket exhaustion and denial-of-service attempts.
Configuration Options (LiopStreamBridgeOptions)
Dual-Era Protocol Handling
Both bridges incorporate automatic era negotiation:- MCP 2026-07-28: Native support for stateless
server/discoverprobes,resultType: "complete"tool listings, and non-polling subscriptions. - MCP 2025-11-25: Automatic metadata pruning (
adaptResponseForLegacyClient) ensures legacy desktop clients receive backward-compatible JSON payloads without syntax rejections.