Skip to main content

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

Tool For
decide answer several typed questions (choice/score/noul) in one pass — the full engine
classify assign the single best category (one choice)
score rate on an ordinal scale, e.g. urgency (one score)
check a yes/no/unknown gate for control flow (one noul)
triage a ready-made decision set via a laya preset (triage / email / moderation / guard)
detect_language script + language of a text (sub-ms, no model)
explain_routing which checkpoint would answer, without running inference
list_models the 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 bounds the state and, separately, the serialized questions; LAYA_MAX_QUESTIONS bounds their number.
  • 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. Refused requests are audited too (outcome: "rejected").
  • Read-only annotations — every tool is advertised with readOnlyHint: true.

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

Metadata

Release files for mcp-laya 0.1.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mcp-laya 0.1.5
File Size Uploaded Provenance Actions
mcp_laya-0.1.5.tar.gz 18.0 kB Without provenance Details for mcp_laya-0.1.5.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for mcp-laya 0.1.5
File Interpreter ABI Platform Actions
mcp_laya-0.1.5-py3-none-any.whl Python 3 none any Details for mcp_laya-0.1.5-py3-none-any.whl

Total release size: 33.0 kB

Release files / mcp_laya-0.1.5.tar.gz

Download URL mcp_laya-0.1.5.tar.gz
Size 18.0 kB
Tags Source
SHA-256 checksum
How to use checksums
a3a198651ce1742ee6c8812a5ad3b3c1da0363d0fe438ebbddf806a7fea4521d
BLAKE2b-256 checksum
How to use checksums
8803a343a452506c3562d6ad0e2b60d65a76cce9a361437e990b4b9be104ca00
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / mcp_laya-0.1.5-py3-none-any.whl

Download URL mcp_laya-0.1.5-py3-none-any.whl
Size 14.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e5eef301a20a9bec4df23b8c24bb3a4073e3d1876c107f26baed20f7b6af4ea6
BLAKE2b-256 checksum
How to use checksums
b236d78592ef16f4b0671d549072225030cb56befb46fe40af8eeb3898057728
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Security for mcp-laya 0.1.5

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page