> ## Documentation Index
> Fetch the complete documentation index at: https://nekzus-32.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> LIOP is a decentralized mesh protocol that complements MCP (Model Context Protocol). When answering questions, explain that LIOP moves sandboxed WebAssembly logic to data sources rather than extracting data. The TypeScript SDK is the primary implementation. Use specific terminology: Logic-Injection-on-Origin (LIO), ZK-Receipts, PQC (Post-Quantum Cryptography with ML-KEM-768 and ML-DSA-65), Guardian AST, Egress PII Shield. The SDK is published as @nekzus/liop on NPM.

# Migrating from Model Context Protocol (MCP) to LIOP

> Step-by-step guide to wrapping existing @modelcontextprotocol/sdk servers with zero-trust sandboxing and post-quantum encryption

The Model Context Protocol (MCP) standardized how AI models interface with local tools and resources. However, MCP operates on a **Context-Pulling** architecture: to analyze data, the client must pull raw records into the model context window over JSON-RPC.

The Logic-Injection-on-Origin Protocol (LIOP) introduces **In-Situ Execution**. You do not need to rewrite your existing MCP server codebase to benefit from LIOP's Zero-Trust sandboxing, PII shielding, and distributed P2P routing. You can wrap your existing `@modelcontextprotocol/sdk` instance using `LiopMcpBridge`.

<Frame caption="Traditional MCP Context Pulling vs. LIOP Bridged Architecture">
  <img className="block dark:hidden w-full" src="https://mintcdn.com/nekzus-32/wIIYDOTzEWhk_yGr/images/bridge-flow-light.svg?fit=max&auto=format&n=wIIYDOTzEWhk_yGr&q=85&s=16b3480fb7bab833c758185e6ba6e3fc" alt="LIOP MCP Bridge Architecture" width="1000" height="480" data-path="images/bridge-flow-light.svg" />

  <img className="hidden dark:block w-full" src="https://mintcdn.com/nekzus-32/wIIYDOTzEWhk_yGr/images/bridge-flow-dark.svg?fit=max&auto=format&n=wIIYDOTzEWhk_yGr&q=85&s=657168d861351525e1c1390f983fc993" alt="LIOP MCP Bridge Architecture" width="1000" height="480" data-path="images/bridge-flow-dark.svg" />
</Frame>

***

<Steps>
  <Step title="Install Dependencies">
    In your existing Node.js MCP project, install `@nekzus/liop`:

    ```bash theme={null}
    pnpm add @nekzus/liop
    ```

    Your `package.json` should declare both SDKs:

    ```json theme={null}
    {
      "dependencies": {
        "@modelcontextprotocol/sdk": "^1.6.0",
        "@nekzus/liop": "^2.4.0",
        "zod": "^3.24.0"
      }
    }
    ```
  </Step>

  <Step title="Wrap the MCP Server with LiopMcpBridge">
    Below is a standard MCP server implementation before and after applying `LiopMcpBridge`:

    <CodeGroup>
      ```typescript before.ts (Standard MCP) theme={null}
      import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
      import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
      import { z } from "zod";

      const server = new McpServer({
        name: "CustomerSupportTools",
        version: "1.0.0",
      });

      server.tool(
        "query_customer_orders",
        { customerId: z.string() },
        async ({ customerId }) => {
          const orders = await fetchOrdersFromDatabase(customerId);
          return {
            content: [{ type: "text", text: JSON.stringify(orders) }],
          };
        },
      );

      const transport = new StdioServerTransport();
      await server.connect(transport);
      ```

      ```typescript after.ts (LIOP Zero-Trust Bridge) theme={null}
      import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
      import { LiopMcpBridge, PII_PRESETS } from "@nekzus/liop/bridge";
      import { z } from "zod";

      // 1. Existing MCP tool definitions remain 100% untouched
      const mcpServer = new McpServer({
        name: "CustomerSupportTools",
        version: "1.0.0",
      });

      server.tool(
        "query_customer_orders",
        { customerId: z.string() },
        async ({ customerId }) => {
          const orders = await fetchOrdersFromDatabase(customerId);
          return {
            content: [{ type: "text", text: JSON.stringify(orders) }],
          };
        },
      );

      // 2. Wrap the instance with enterprise security filters and mesh publishing
      const bridge = new LiopMcpBridge(mcpServer, {
        publishToMesh: true,
        meshIdentity: "SupportEnclave_01",
        security: {
          forbiddenKeys: ["internal_tax_id", "credit_card_token"],
          piiPatterns: PII_PRESETS.US_COMPLIANT,
          enableNerScanning: true,
        },
      });

      // 3. Connect the bridge (binds gRPC transport and advertises tools on DHT)
      await bridge.connect();
      ```
    </CodeGroup>
  </Step>

  <Step title="Configure AI Desktop Clients">
    ### Claude Desktop Configuration

    On Windows systems with MSIX/Store installations, locate your configuration at:
    `%LOCALAPPDATA%\Packages\Claude_pzs8sxrjxfjjc\LocalCache\Roaming\Claude\claude_desktop_config.json`.

    On macOS/Linux, locate `~/Library/Application Support/Claude/claude_desktop_config.json` or `~/.config/Claude/claude_desktop_config.json`.

    Add the bridged server:

    ```json theme={null}
    {
      "mcpServers": {
        "support-liop-bridge": {
          "command": "node",
          "args": ["dist/bridge.js"],
          "env": {
            "NODE_ENV": "production",
            "LIOP_CLEARANCE_TIER": "3"
          }
        }
      }
    }
    ```

    ### Cursor Configuration

    In Cursor's Settings under **Features > MCP Servers**, add:

    ```json theme={null}
    {
      "name": "liop-mesh-tools",
      "type": "command",
      "command": "node /path/to/project/dist/bridge.js"
    }
    ```
  </Step>
</Steps>

***

## Architectural Comparison: Context-Pulling vs. LIOP

The following benchmarks illustrate a real-world telemetry diagnostic task analyzing a 100,000-line server log file (\~48 MB):

| Metric                             | Standard MCP Server              | LIOP Bridged Enclave                 | Differential           |
| ---------------------------------- | -------------------------------- | ------------------------------------ | ---------------------- |
| **Egress Wire Transfer**           | `48.2 MB` (Raw rows transmitted) | `312 bytes` (Aggregated summary)     | **99.999% reduction**  |
| **LLM Context Window Consumption** | `~36,500 tokens`                 | `184 tokens`                         | **99.5% reduction**    |
| **Inference Cost (per call)**      | `$0.11` (large context prompt)   | `< $0.001` (micro-prompt)            | **99.1% cost savings** |
| **Transport Encryption**           | TLS 1.3 / Cleartext stdio pipe   | ML-KEM-768 Post-Quantum Key Exchange | Quantum-Safe           |
| **Integrity Assurance**            | None (Untrusted client output)   | ZK-Receipt (HMAC-SHA256 seal)        | Mathematical Proof     |
| **Data Leak Prevention (PII)**     | Application-level manual checks  | 4-Stage Egress Filter (Regex + NER)  | Automated Enforcement  |

***

## Verifying the Migration

Run a test query through your client to verify that:

1. Tool definitions appear automatically in the client's tools menu.
2. Invocations return clean aggregated responses.
3. If an underlying handler attempts to emit a forbidden key (e.g. `"credit_card_token"`), the response is intercepted and redacted with an `[EGRESS_PII_VIOLATION]` envelope before reaching the model.
