Use this file to discover all available pages before exploring further.
The Logic-Injection-on-Origin Protocol (LIOP) provides the @nekzus/liop, designed as a powerful yet highly familiar SDK. If you have previously built servers for MCP, transitioning to LIOP architecture is almost effortless.In this guide, we’ll build a basic LIOP Server that exposes a tool, and a Client that invokes it.
Under the hood, LIOP is compiling your logic to WebAssembly and injecting it via P2P. However, the SDK abstracts this entirely, letting you focus on writing pure business logic.
A LIOP Server acts as a Data Node. It connects to the mesh and listens for incoming injected logic from remote agents. It exposes secure tools and resources.Create a file named server.ts:
server.ts
import { LiopServer } from '@nekzus/liop';import { z } from 'zod';// Initialize the Server with identityconst server = new LiopServer({ name: "MyLocalDataNode", version: "1.0.0"});// Expose a tool. // Note: In LIOP, the async logic provided here is dynamically converted // into an isolated Capability for incoming WASM Agents.server.tool( "query_database", "Analyzes giant tables exactly at the origin. Pass a SQL-like string.", { query: z.string() }, async ({ query }) => { console.log(`[Server] Executing Logic-Injection-on-Origin for query: ${query}`); // Imagine processing 5GB of local data here. // Only the final result leaves the server. return { content: [{ type: "text", text: `Processed query results for: ${query}` }] }; });// Start the server and announce it to the Kademlia DHT Meshasync function main() { await server.connect(); console.log("LIOP Server is listening on the Mesh...");}main().catch(console.error);
A LIOP Client acts as the Intelligence. It discovers servers on the mesh and injects compiled logic into them.Create a file named client.ts:
client.ts
import { LiopClient } from '@nekzus/liop';async function main() { // Initialize the Client (TLS options are optional for local development) const client = new LiopClient(); // Connect to the mesh await client.connect(); console.log("Joined LIOP Protocol..."); // Discover the server's tools and invoke logic try { // Invoke the tool using a CallToolRequest const result = await client.callTool({ name: "query_database", arguments: { query: "SELECT * FROM massive_table WHERE anomaly = true" } }); console.log("Received verified result:"); console.log(result.content[0].text); } catch (err) { console.error("Agent execution failed:", err); }}main().catch(console.error);
Now that you’ve run your first Mesh execution, dive deeper into the core architecture to understand how to leverage advanced capabilities like Continuous Watchdogs and Zero-Knowledge Proofs.
Core Architecture
Learn how the Data Layer and Transport Layer synergize in LIOP.