laya-mcp
by YerikZ
README.md
# laya-mcp
An [MCP](https://modelcontextprotocol.io) server that exposes [Laya](https://github.com/NandhaKishorM/laya) — a 33ms non-autoregressive decision model — as tools for coding agents such as [Claude Code](https://claude.com/claude-code).
Laya answers typed questions (`choice` / `score` / `noul`) about a piece of text in a single forward pass, with calibrated confidence. This server wraps Laya's built-in workflow presets so an agent can call into it mid-task instead of shelling out to a Python script.
## Tools
| Tool | Purpose |
|---|---|
| `classify_request(request)` | Difficulty, domain (`code`, `math_or_logic`, `writing`, ...), tool need, sensitivity — useful for routing a task to a lighter or heavier model. |
| `guard_check(text)` | Screen text (fetched web content, file, tool output) for jailbreak attempts, prompt injection, embedded secrets/PII, and harm severity before acting on it. |
| `moderate_content(text)` | Toxicity, harassment, threats, spam, rule-violation severity. |
| `triage_ticket(message)` | Support-ticket triage: intent, urgency, frustration, refund request, churn risk. |
| `evaluate(state, questions)` | Run an arbitrary typed-question schema against any state — the generic escape hatch. See Laya's [decision primitives](https://github.com/NandhaKishorM/laya#decision-primitives). |
## Setup
```bash
git clone https://github.com/<you>/laya-mcp.git
cd laya-mcp
python3 -m venv .venv
.venv/bin/pip install -r requirements.txt
```
First call downloads the Laya checkpoint from Hugging Face (~300–400MB) and caches it under `~/.cache/huggingface`.
## Wire into Claude Code
```bash
claude mcp add laya -s user -- $(pwd)/.venv/bin/python $(pwd)/server.py
```
`-s user` registers it for every Claude Code session on this machine. Use `-s project` to scope it to the current project instead.
## Wire into other MCP clients
Any stdio-based MCP client works the same way — point it at `<venv>/bin/python <path>/server.py`. For example, in `~/.codex/config.toml`:
```toml
[mcp_servers.laya]
command = "/path/to/laya-mcp/.venv/bin/python"
args = ["/path/to/laya-mcp/server.py"]
```
## Configuration
- `LAYA_PRELOAD=1` — preload all Laya checkpoints into memory at server startup instead of loading lazily on first request (trades startup latency for consistent per-call latency).
## Notes
- Laya's `laya` checkpoint emits a `RuntimeWarning` about temperature calibration for `choice` questions with 11+ options — an upstream calibration quirk in the checkpoint, not this wrapper. None of the built-in presets hit that bucket count.
- This project only wraps Laya's Python SDK; it does not modify or vendor Laya itself.
## License
MIT — see [LICENSE](LICENSE). Laya itself is licensed separately (Apache 2.0); see [NandhaKishorM/laya](https://github.com/NandhaKishorM/laya).
This server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessNo issues