Skip to main content
Glama

ESIC Max Plugin (esic-max)

A standalone Antigravity plugin and read-only Python MCP server (esic-max-knowledge) over the pre-compiled ESIC QABERT-J SQLite runtime (max_runtime.sqlite) and SHA-256 Content-Addressed Store (local_cas_sources.json / CAS assets/).

Supports two zero-drift deployment modes with identical tool behavior:

  1. Local Windows Stdio Mode (default in mcp_config.json) — queries your local max_runtime.sqlite and local_cas_sources.json directly.

  2. Hosted Oracle VPS Streamable HTTP Mode (Best for Teams / External Users) — host the MCP server once on your Oracle Linux ARM64 VPS behind HTTPS + Bearer auth alongside /opt/max-data/, switch mcp_config.json to deploy/mcp_config.remote.json ("url": "https://<your-domain>/mcp"), and share the plugin repo so anyone can install it with zero local SQLite, Python, or 22 GiB PDFs.


Features

  • 5 Read-Only MCP Tools (esic-max-knowledge):

    • search_esic_rules — Bilingual (English + Hindi/Devanagari) FTS5/BM25 search with lexically gated Method Q routing, deduplicated scenario hints, Method B cross-domain expansion, and Method T supersession resolution.

    • read_document_clauses — Verbatim page-anchored excerpts (<!-- PAGE N OF M -->, <!-- PAGE_BREAK: Page N -->, --- Page N ---, ## Page N) plus bounded decompression of doc_processed_blobs (narrative_clauses_z, table_register_z, authority_matrix_z, forms_checklists_z).

    • check_temporal_chain — Resolves OPERATIVE vs SUPERSEDED currency and TEMP-* epoch pointers through method_t_chains and method_t_doc_status.

    • explore_legal_graph — Surfaces method_b_edges, method_r_antinomies, method_r_permissions, method_e_entities, method_j_precedents (+ K7 A_J), and method_j_sector_reports.

    • extract_pdf_excerpt — Extracts a focused PyMuPDF PDF excerpt from local CAS or VPS /opt/max-data/assets. Returns excerpt_path locally and a time-limited HMAC-signed HTTPS excerpt_url when MAX_PUBLIC_BASE_URL is configured (never raw base64).

  • Zero Internal ID Leakage: Stateless deterministic HMAC doc_ref tokens (item_<16hex>) and recursive payload scrubbing strip all DOC-*, RUL-*, PST-*, TDR-*, REF-*, TEMP-*, PREC-*, and ref_N tokens.

  • Bundled Rules & Skills:

    • rules/AGENTS.md — Enforces Zero-Hallucination Grounding, Method J Lex Superior (Babu Ram + Wambaugh), Zero ID Leakage, and CSMOP discipline.

    • skills/esic-quick-lookup/ — Fast 2–4 tool-call grounded lookup.

    • skills/esic-csmop-audit/ — Full 8-stage legal & administrative audit with 5 Audit Gates and .docx CSMOP Note Sheet export (scripts/export_csmop_docx.py).


Related MCP server: Law7 MCP

Hosted VPS Setup (Teams & Zero-Local-Footprint Sharing)

If you already sync max_runtime.sqlite and assets/ to /opt/max-data/ on your Oracle Linux ARM64 VPS (e.g., via max_telegram_bot/sync_pusher/):

  1. Copy this repo to /opt/esic-max-plugin on the VPS and run the bootstrap script:

    sudo DOMAIN=esic-mcp.yourdomain.com bash /opt/esic-max-plugin/deploy/setup_vps_mcp.sh

    This installs .venv, generates a random MCP_BEARER_TOKEN and MAX_REF_SECRET in /etc/esic-max-mcp/mcp.env, enables deploy/esic-max-mcp.service (read-only access to /opt/max-data), and exposes:

    • POST/GET /mcp — Streamable HTTP MCP endpoint (stateless_http=true, Bearer-protected)

    • GET /health — Health & document count probe

    • GET /excerpts/{expires}/{sig}/{filename}.pdf — Signed temporary PDF excerpt download

  2. Put Caddy (HTTPS + Let's Encrypt) in front of 127.0.0.1:8765: Use deploy/Caddyfile.example (flush_interval -1 preserves Streamable HTTP streaming).

  3. Switch client mcp_config.json for distribution: Replace mcp_config.json with deploy/mcp_config.remote.json:

    {
      "mcpServers": {
        "esic-max-knowledge": {
          "url": "https://esic-mcp.yourdomain.com/mcp",
          "headers": {
            "Authorization": "Bearer <your-team-token>"
          }
        }
      }
    }

    Any user who clones or installs the plugin folder (plugin.json, mcp_config.json, rules/, skills/) into ~/.gemini/config/plugins/esic-max (or .agents/plugins/esic-max) immediately gets the exact same Max query experience with no local database, no Python .venv, and no PDFs.


Local Setup (Windows)

uv sync --extra dev
uv run pytest

Registering the Plugin in Antigravity

Option A — NTFS Directory Junction (no Administrator privileges required on Windows):

New-Item -ItemType Directory -Force "$HOME\.gemini\config\plugins" | Out-Null
New-Item -ItemType Junction -Path "$HOME\.gemini\config\plugins\esic-max" -Target "C:\Users\Mayank Shekhar\Documents\esic-max-plugin"

Option B — Symbolic Link (requires Developer Mode or elevated PowerShell):

New-Item -ItemType Directory -Force "$HOME\.gemini\config\plugins" | Out-Null
New-Item -ItemType SymbolicLink -Path "$HOME\.gemini\config\plugins\esic-max" -Target "C:\Users\Mayank Shekhar\Documents\esic-max-plugin"

mcp_config.json Reference Variants

(a) Local Windows Stdio (Current Default)

{
  "mcpServers": {
    "esic-max-knowledge": {
      "command": "C:\\Users\\Mayank Shekhar\\Documents\\esic-max-plugin\\.venv\\Scripts\\python.exe",
      "args": ["-m", "mcp_server.server"],
      "env": {
        "MAX_RUNTIME_DB": "C:\\Users\\Mayank Shekhar\\Documents\\ESIC_repos\\max_telegram_bot\\dist\\max_runtime.sqlite",
        "MAX_LOCAL_CAS_SOURCES": "C:\\Users\\Mayank Shekhar\\Documents\\ESIC_repos\\max_telegram_bot\\dist\\local_cas_sources.json",
        "MAX_ASSETS_DIR": "",
        "MAX_EXCERPT_OUT_DIR": "C:\\Users\\Mayank Shekhar\\Documents\\esic-max-plugin\\.excerpts"
      }
    }
  }
}

(b) SSH-Tunneled Stdio to Oracle Linux ARM64 VPS

{
  "mcpServers": {
    "esic-max-knowledge": {
      "command": "ssh",
      "args": [
        "-i", "C:\\Users\\Mayank Shekhar\\.ssh\\oracle_vps_key",
        "-T",
        "ubuntu@<ORACLE_VPS_IP>",
        "MAX_RUNTIME_DB=/opt/max-data/max_runtime.sqlite MAX_ASSETS_DIR=/opt/max-data/assets MAX_EXCERPT_OUT_DIR=/tmp/esic-excerpts /opt/esic-max-plugin/.venv/bin/python -m mcp_server.server --transport stdio"
      ]
    }
  }
}

(c) Remote Streamable HTTP (/mcp, NOT legacy /sse)

See deploy/mcp_config.remote.json.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      Provides AI assistants with up-to-date legal documents from official sources, enabling accurate legal information retrieval and analysis.
      23
      AGPL 3.0
    • A
      license
      Not graded
      quality
      C
      maintenance
      Provides agents with unified access to Singapore's legal corpus—statutes, case law, data-protection enforcement, and Hansard—supporting point-in-time queries, provenance tracking, and tools like search, citation resolution, and parliamentary intent.
      MIT
    • A
      license
      Not graded
      quality
      Not graded
      maintenance
      Enables AI assistants and agents to search a legal document collection via hybrid BM25+dense retrieval, read articles with context, and generate full or short citations. It also exposes whole acts as Markdown resources, provides a citation-answering prompt, and supports stdio and streamable HTTP transports.
      MIT