> ## Documentation Index
> Fetch the complete documentation index at: https://docs.lexera.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Run a Free Statutory Compliance Audit With Lexera

> Submit a contract anonymously to lexera_local_statutory_audit via SSE, get a rapid compliance check against local statutory laws without authentication or wallet holds.

Lexera's `lexera_local_statutory_audit` is a public, unauthenticated tool designed for the anonymous PLG funnel. You can check any contract or legal document against local statutory laws in seconds, with no API key and no wallet hold required. This guide walks you through opening an SSE stream, capturing the session ID, dispatching the audit request, and reading the compliance result.

## Prerequisites

* No API key is required for this tool.
* All requests must use HTTPS. Plain HTTP will fail.
* A contract or legal document as raw text.

## Steps

<Steps>
  <Step title="Open the SSE stream">
    Start by opening a persistent Server-Sent Events connection to Lexera's MCP server. This connection will stream back both the session endpoint and the eventual tool result.

    ```js theme={null}
    const response = await fetch("https://lexera.dev/mcp-server/sse", {
      headers: { "Authorization": "Bearer lex_82bea57b8c3fd39f..." }
    });

    const reader = response.body.getReader();
    const decoder = new TextDecoder();

    while (true) {
      const { value, done } = await reader.read();
      if (done) break;

      const text = decoder.decode(value);
      if (text.includes("event: endpoint")) {
        const match = text.match(/data: (\/mcp-server\/messages\?sessionId=[\w-]+)/);
        const sessionUrl = `https://lexera.dev${match[1]}`;
        // Proceed to dispatch tool...
      }
    }
    ```

    <Note>
      Although the example above includes a Bearer token, `lexera_local_statutory_audit` is unauthenticated. You may omit the `Authorization` header entirely for this tool.
    </Note>
  </Step>

  <Step title="Capture the session URL">
    The server streams an `endpoint` event containing the session path. Extract the `sessionId` and build the full POST URL:

    ```text theme={null}
    https://lexera.dev/mcp-server/messages?sessionId=<uuid>
    ```

    Store this URL. Every subsequent JSON-RPC dispatch for this session must POST to it.
  </Step>

  <Step title="Dispatch the statutory audit">
    POST a JSON-RPC 2.0 payload to your session URL with the document text and target jurisdiction.

    <CodeGroup>
      ```js theme={null}
      const auditPayload = {
        jsonrpc: "2.0",
        id: 1,
        method: "tools/call",
        params: {
          name: "lexera_local_statutory_audit",
          arguments: {
            document_text: "Vendor contract with uncapped liability clause...",
            target_jurisdiction: "UAE"
          }
        }
      };

      await fetch(sessionUrl, {
        method: "POST",
        headers: { "Content-Type": "application/json" },
        body: JSON.stringify(auditPayload)
      });
      ```

      ```bash theme={null}
      curl -X POST "https://lexera.dev/mcp-server/messages?sessionId=<uuid>" \
        -H "Content-Type: application/json" \
        -d '{
          "jsonrpc": "2.0",
          "id": 1,
          "method": "tools/call",
          "params": {
            "name": "lexera_local_statutory_audit",
            "arguments": {
              "document_text": "Vendor contract with uncapped liability clause...",
              "target_jurisdiction": "UAE"
            }
          }
        }'
      ```
    </CodeGroup>

    The server responds with `HTTP 202 Accepted`. The audit result streams back over the open SSE connection.
  </Step>

  <Step title="Read the result over SSE">
    Continue reading from the SSE stream opened in Step 1. The compliance result arrives as a JSON-RPC response. Inspect the payload for statutory flags, warnings, or a clean pass.
  </Step>
</Steps>

<Note>
  No wallet hold is required for `lexera_local_statutory_audit`. This tool is free and part of Lexera's anonymous PLG funnel.
</Note>

## Next steps

* For full parameter details, see the [lexera\_local\_statutory\_audit reference](/tools/lexera-local-statutory-audit).
* When you are ready to route a document to a human attorney, follow the [Route to a Specialist guide](/guides/route-to-specialist).
