mcpField
M
mcp-laya

mcp-laya

Local
github.com/dockndevaiAI & Agents0Updated 3w ago

About mcp-laya

mcp-laya wraps Laya’s local decision engine as an MCP server for agents that classify, score, or check text and other state. It returns typed results with confidence instead of generated text, and supports offline inference.

Key features

  1. 01Classify, score, and answer yes/no
  2. 02Handle multiple typed questions in one pass
  3. 03Use presets for triage and moderation
  4. 04Detect text language and script
  5. 05Route requests across available checkpoints
  6. 06Run offline inference with confidence scores

Use cases

  1. 01Route support tickets to a department
  2. 02Assess urgency in emails or tickets
  3. 03Check whether a request meets a workflow condition
  4. 04Triage or moderate submitted content

MCP support

The MCP server exposes typed decision tools such as decide, classify, score, check, and triage, along with language detection and model information tools. Inference runs locally and returns structured decisions rather than generated text.

Configuration

Local server config is the same for every client. Copy it into your client’s MCP config file.

mcp.json · Universal config
{
"mcpServers": {
"dockndevai-mcp-laya": {
"command": "uvx",
"args": [
"mcp-laya"
],
"env": {
"LAYA_DEFAULT_MODEL": "<LAYA_DEFAULT_MODEL>",
"LAYA_MODELS": "<LAYA_MODELS>",
"LAYA_ALLOW_DOWNLOAD": "<LAYA_ALLOW_DOWNLOAD>",
"LAYA_MIN_CONFIDENCE": "<LAYA_MIN_CONFIDENCE>",
"LAYA_DEVICE": "<LAYA_DEVICE>"
}
}
}
}
Run commanduvx mcp-laya
Environment variables to set
LAYA_DEFAULT_MODELCheckpoint to use: auto (Router picks) | english | multilingual | typed-decisions.
LAYA_MODELSComma-separated allowlist of checkpoints that may load. Empty = all.
LAYA_ALLOW_DOWNLOADAllow the one-time Hugging Face checkpoint download. Off by default (offline).
LAYA_MIN_CONFIDENCEFlag answers below this calibrated confidence (0 = never flag).
LAYA_DEVICEInference device: auto | cpu | cuda.

Local servers need a runtime on your machine (e.g. Node.js 18+). Config file locations differ by client; see your client’s docs.

Packages
pypimcp-laya0.1.1

Tools

No tool list yet

Local servers expose tools only once running on your machine, and the maintainer has not provided a tool list.

Details

From the project README

mcp-laya

PyPI CI licence

A safe-by-default Model Context Protocol server for Laya — a fast, non-autoregressive System-1 decision engine. It gives an agent a thinking primitive: typed decisions — classify, score, yes/no — over any state (text, an email, a ticket, a JSON object), in a single local forward pass (~33 ms), across 100+ languages, with no text generation — nothing to parse and nothing to hallucinate, and a calibrated confidence on every answer.

Instead of burning a slow, costly LLM round-trip on "which team should handle this? is it urgent? is this a refund request?", the agent calls a typed tool that answers locally, in milliseconds, offline. It's the safest server in the suite — laya only reads a state and returns a decision; it changes nothing.

Part of the dockndevai MCP server suite — one governance model across all of them. (This is the first Python server in the suite; the rest are Node/TS.)

What it gives an agent

ToolFor
decideanswer several typed questions (choice/score/noul) in one pass — the full engine
classifyassign the single best category (one choice)
scorerate on an ordinal scale, e.g. urgency (one score)
checka yes/no/unknown gate for control flow (one noul)
triagea ready-made decision set via a laya preset (triage / email / moderation / guard)
detect_languagescript + language of a text (sub-ms, no model)
explain_routingwhich checkpoint would answer, without running inference
list_modelsthe checkpoints available, default, device, offline status

Three checkpoints, auto-routed per request: english (ModernBERT-large), multilingual (mmBERT, 100+ languages), typed-decisions.

Install

pipx install mcp-laya      # or: pip install mcp-laya

Python 3.10+. laya pulls in torch; the model checkpoints download once from Hugging Face (see below), after which it runs fully offline.

First run: fetch the model once

Downloads are off by default (nothing leaves your machine at runtime). Pre-fetch the checkpoints one time with network access:

LAYA_ALLOW_DOWNLOAD=true python -c "import laya; laya.Router(preload=True)"

Then run the server offline.

Configure

{
  "mcpServers": {
    "laya": {
      "command": "mcp-laya",
      "env": { "LAYA_DEFAULT_MODEL": "auto" }
    }
  }
}

See docs/CLIENTS.md for Claude Code / Cursor / Codex / VS Code / Windsurf, and .env.example for every variable.

Example

Ask your agent to "use laya to classify this ticket's department and whether it's a churn risk":

// classify(state, criteria={billing, technical, sales, other})
{ "choice": "billing", "confidence": 0.95, "probabilities": { "billing": 0.95, ... } }
// check(state, "Does the user threaten to cancel?")
{ "answer": "yes", "probability_yes": 0.91, "confidence": 0.91 }

Safe by default

laya is read-only inference, so the guardrails (in src/mcp_laya/security.py) are about privacy and resource control, not write-gating:

  • Offline by default — the model runs locally; nothing is sent anywhere. The one exception, the first-time checkpoint download, is disabled unless LAYA_ALLOW_DOWNLOAD=true.
  • Model allowlist — LAYA_MODELS pins which checkpoints may load.
  • Input caps — LAYA_MAX_INPUT_CHARS / LAYA_MAX_QUESTIONS bound each request.
  • Confidence honesty — LAYA_MIN_CONFIDENCE flags (never silently trusts) low-confidence answers; every answer already carries a calibrated confidence.
  • Log privacy — LAYA_REDACT_STATE keeps the input text out of the JSON audit log by default.

There's a bundled skill, laya-decisions, teaching an agent when to offload a decision to laya and how to phrase typed questions. See also SECURITY.md.

Developing

python -m venv .venv && . .venv/bin/activate
pip install -e ".[dev]"
ruff check src tests && mypy src && pytest      # the policy tests need no model
python -m mcp_laya                              # run the server (stdio)

Credits

Built on laya by Convai Innovations (Apache-2.0). This server wraps that library; all model work is theirs. See NOTICE.

Licence

MIT

Comments

Markdown supported

New to MCP?

From what the protocol is to installing your first server, these answers cover most first questions.

An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.