LiopHybridGateway
LiopHybridGateway multiplexes HTTP/1.1 and HTTP/2 (gRPC) over a single TCP port and delegates MCP requests through LiopMcpRouter.
LiopMcpRouter & Dual-Era Compliance
LiopMcpRouter is the request dispatcher used by the gateway and CLI agents. It provides Dual-Era MCP Protocol Compliance:
- Modern MCP v2 Era (2026-07-28): Supports stateless routing, non-polling resource updates via
subscriptions/listen, dynamic resource template discovery (resources/templates/list), SEP-2243 header routing, and deterministically sorted results (SEP-2549). - Legacy MCP Era (2025-11-25): Automatically negotiates handshake capabilities and strips unsupported fields via
adaptResponseForLegacyClient()for legacy MCP clients (Claude Desktop, Cursor). - In-Situ Dispatch: Routes calls to local tool definitions or discovers remote data providers across the Kademlia DHT mesh.
- ZK Verification: Automatically verifies HMAC-SHA256 ZK-Receipt commitments on incoming remote responses before returning results to the LLM.
HTTP/1.1 gRPC-Web Framing Adapter
For edge networks, web browsers, and environments where native HTTP/2 gRPC framing is restricted by corporate firewalls or reverse proxies,LiopHybridGateway integrates an automatic gRPC-Web framing adapter:
- Emulates gRPC 5-byte length-prefixed binary frames (
[flags (1B)][length (4B BE)][payload]) over standard HTTP/1.1 POST streams. - Encodes gRPC status trailers in HTTP response headers (
grpc-status,grpc-message).
Observability & Health Probes
LiopHybridGateway natively serves standard Kubernetes and Prometheus endpoints:
Graceful Draining
When terminating nodes in production clusters:LiopStreamBridge
LiopStreamBridge exposes a LiopServer over Streamable HTTP transport with session isolation.
Border LIO Gateway (BLG) & Perimeter Defense
In production topologies with multi-tier security domains, the Border LIO Gateway (blg) acts as the protocol boundary between external untrusted networks and Tier 1 sovereign enclaves:
Gateway Responsibilities
- OAuth 2.1 Token Verification: Asserts Bearer tokens signed by Nexus OIDC before proxying JSON-RPC requests to internal services.
- Swarm Key Bridge: Possesses the private 256-bit PSK required to communicate directly with Tier 1 enclaves (
The Bank,The Vault) across the isolatedpnetsubnet. - Defense-in-Depth Inspection: Runs preflight validation on AST logic payloads before dispatching to destination enclaves.
Sliding-Window Rate Limiter (InMemoryRateLimiter)
To defend edge gateways, MCP endpoints, and worker pools against Denial of Service (DoS) attacks and brute-force token enumeration, the SDK provides a high-throughput, zero-dependency InMemoryRateLimiter.
It strictly adheres to OWASP API Security Top 10 (API4:2023 - Unrestricted Resource Consumption) by enforcing per-client sliding-window quotas.
RateLimiter API Reference
Security Notes
LiopStreamBridgesupports Zero-Trust bearer enforcement viaZERO_TRUST_TOKEN.- Sessions are isolated and evicted when idle to reduce long-lived attack surfaces.
- Gateway/router components preserve full MCP JSON-RPC compatibility while maintaining mesh-native routing behavior.
- The Border LIO Gateway caches RFC 6749 credentials in-memory with automatic refresh 30 seconds prior to expiration, eliminating transient 401 Unauthorized errors during high-frequency batch executions.
- For semantic perimeter filtering, see Gateway Interceptor.