Skip to main content
Glama
eliamarlaw-dotcom

legalix-engineering

README.md
# Legalix Engineering & Tender MCP Service

An ultra-fast, production-ready **Model Context Protocol (MCP)** server connecting LLMs (ChatGPT, Claude, Cursor, and custom autonomous agents) to Israeli civil engineering databases, the Interministerial General Specification (**"הספר הכחול"** — all 48 chapters), **Dekel pricing benchmarks (2026)**, and the **Tender Arbitrage & Unbalanced Bidding Engine**.

---

## 🌟 Key Features

1. **⚡ Sub-Millisecond In-Memory Search:** Indexed access to all 48 Blue Book chapters, 4,761 pages of measurement rules, and 2026 pricing benchmarks.
2. **🏗️ 12 Engineering Consultant Disciplines:** Deep retrieval for Structural (ת"י 466), Geotechnical (ת"י 940), Electrical, Plumbing (ת"י 1205), HVAC, Fire Safety, Acoustics (ת"י 1004), Accessibility (ת"י 1918), Green Building (ת"י 5281), and Infrastructure.
3. **📊 Enterprise Excel BOQ Parser:** Automatic extraction and cleaning of multi-sheet Israeli construction tenders (`.xlsx`, `.xlsm`, `.xls`, `.csv`), filtering out subtotal and summary rows.
4. **💰 Tender Arbitrage Engine (Unbalanced Bidding):** Mathematical cross-referencing between tender quantities and actual CAD Takeoff measurements to optimize profit and win probability.
5. **🔌 Dual Protocol:** Supports both **Stdio MCP** (native for Claude Desktop / ChatGPT Desktop / Cursor) and **HTTP/REST Gateway** (for Web Custom GPTs).

---

## 🚀 Quickstart & MCP Configuration

### 1. Claude Desktop / ChatGPT Desktop / Cursor (Stdio MCP)

Add the following to your MCP settings file (`claude_desktop_config.json` or ChatGPT Developer Settings):

```json
{
  "mcpServers": {
    "legalix-engineering": {
      "command": "python3",
      "args": [
        "/path/to/legalix-engineering-mcp-repo/legalix_engineering_mcp_server.py"
      ]
    }
  }
}
```

### 2. HTTP / REST Gateway (For Web Clients & Cloudflare Tunnels)

Start the HTTP service on port `8090`:
```bash
python3 legalix_engineering_mcp_http_bridge.py
```
- Healthcheck: `GET http://localhost:8090/health`
- Tool Definitions: `GET http://localhost:8090/tools`
- RPC Executions: `POST http://localhost:8090/`

---

## 🛠️ Available MCP Operations

| Operation Name | Description | Key Parameters |
| :--- | :--- | :--- |
| `search_blue_book` | Searches measurement rules and technical specs across 48 Blue Book chapters | `query`, `chapter_code`, `max_results` |
| `get_dekel_price` | Retrieves updated 2026 unit prices, 8-digit codes, and market ranges | `item_code_or_keyword` |
| `search_engineering_discipline` | Searches technical standards across 12 engineering domains (Structure, Geo, Electrical, HVAC, etc.) | `discipline`, `query`, `max_results` |
| `parse_boq_excel` | Parses, filters, and mathematically audits construction tender Excel files | `excel_file_path` |
| `run_tender_arbitrage` | Runs Unbalanced Bidding optimization between tender BOQ and CAD takeoff | `excel_file_path`, `cad_takeoff_json` |

*Detailed schemas and payload examples are documented in [`docs/OPERATIONS_AND_TOOLS.md`](docs/OPERATIONS_AND_TOOLS.md).*

---

## 📚 Documentation Index

- [Detailed Operations & Tools Reference](docs/OPERATIONS_AND_TOOLS.md)
- [MCP Client Integration Guide (Desktop & Cloud)](docs/MCP_INTEGRATION_GUIDE.md)
- [Unbalanced Bidding & Arbitrage Methodology](docs/UNBALANCED_BIDDING_STRATEGY.md)

---

## 📦 Requirements

- Python 3.9+
- `openpyxl`
- `xlrd`

Install dependencies:
```bash
pip install -r requirements.txt
```