laya-mcp
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@laya-mcpRun a choice query: classify this ticket as billing, technical, or account."
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
laya-mcp
Laya is a fast, non-autoregressive
"System 1" decision model: it answers typed questions — noul (yes/no),
choice, score — over a piece of state and returns probabilities, in a single
forward pass. It is genuinely good, and it is a research artifact.
This is the part that makes it survive contact with a server.
pip install 'laya-mcp[mcp]'
laya-mcp serve # loads the model once, keeps it warm on 127.0.0.1:8787
laya-mcp install # registers it with whichever agent harness you haveStatus: 0.1.0, work in progress. The core is implemented and its pure logic is covered by 64 checks, but it has not yet been exercised end-to-end against a live harness in CI. Interfaces may move before 1.0.
The problem this solves
Laya truncates things silently, and the omissions are the kind you only notice after acting on a wrong answer.
It cuts the state, from the end, and says nothing. build_sequence gives the
state whatever room is left after the options and slices it st[:room]. A long
document loses its tail — which for a contract, a log or an email thread is often
where the answer was — and the model then answers about the surviving prefix at
full confidence. Nothing in the response marks it.
It shortens options until labels are indistinguishable. Options share a fixed
head_max_len budget (192 tokens on the English checkpoint, 256 on the others).
Past a point every label gets ~4 tokens. This is the documented cause of the
Banking77 collapse (0.425 against Jev's 0.870), and again, nothing reports it.
Its validation is one check. An unknown type is a bare KeyError from
QTYPES[q["t"]]; a missing criteria is a bare KeyError too. They are
indistinguishable from a bug in the model, and neither names the question at
fault.
Its confidence is not accuracy. It is 1 - H(p)/log(k) for choice and
score and max(p, 1-p) for noul. A normalised entropy is low when
probability is spread out even when the top option is right, and high on a
confident wrong answer — the English checkpoint scores 0.000 accuracy on Khmer at
0.952 confidence. A threshold on it does not mean what it looks like.
And it demotes itself to CPU in silence. On a CUDA OOM it moves the model to CPU in fp32, in place, permanently, printing to stdout. No flag is set anywhere. A process that hits this once keeps answering, roughly 10–15x slower, and nothing in the response admits it.
So this package adds what is missing: a preflight that says what would be cut, structured errors naming the question, an honest confidence contract, and a health surface that reports a demotion.
Related MCP server: jev-mcp
What it does
Warm sidecar | One |
Token-budget preflight |
|
Structured errors | Every Laya failure becomes a code, an HTTP status, the offending question id, and a hint. |
Honest confidence |
|
Calibration store | Fit a temperature per |
Device honesty | Reports a silent CPU demotion, and |
Serialised inference | A lock, by default. Laya is not thread-safe: |
Restartable |
|
One installer, five harnesses
There is no portable way to register an MCP server. Measured against real installed harnesses, they disagree on the file, the format, and the key:
harness | config | format | key |
Claude Code |
| JSON |
|
Codex |
| TOML |
|
opencode |
| JSON |
|
OpenClaw |
| JSON |
|
Hermes |
| YAML |
|
laya-mcp install detects which are present and writes the right shape to each.
Every writer merges rather than replaces, backs the file up first, and refuses to
touch a file it cannot parse — ~/.claude.json is a large shared file holding
history and per-project state, and clobbering it to install a decision model
would be a catastrophic trade.
Two honest limitations:
opencode differs from everyone three more times inside its own entry:
commandis a single array holding the executable and its arguments, the environment key isenvironment, notenv, and the toggle isenabled. Settingdisabled: truethere is silently ignored.piis not supported. Not an oversight:pihas no native MCP support. Its settings reference contains no MCP key, and its own upstream request for MCP is titled "Add MCP extension example" — inpi, MCP is an extension you build. There is no config file an installer can write.installdetects it and says so.
install points the harness at python -m laya_mcp mcp rather than at the
laya-mcp console script, deliberately: on Windows a console script is a .cmd
shim and the MCP SDK spawns with shell: false, which cannot execute it.
Tools
tool | what it answers |
| A batch of typed questions over one state. The general one. |
| One yes/no question. Returns |
| One multiple-choice question. Returns the label and the distribution. |
| One ordered-scale question. |
| "Will this fit, and what will be cut?" — no forward pass. |
Every description says what the tool is not for. A decision model asked to write prose produces nothing useful, and an agent that does not know that will keep trying.
HTTP
laya-mcp serve --model english --port 8787
curl -s localhost:8787/health
curl -s localhost:8787/ask -H 'content-type: application/json' -d '{
"state": {"subject": "Duplicate charge", "body": "Billed twice. Refund or we cancel."},
"questions": {
"churn": {"type": "noul", "instructions": "Does the user threaten to cancel?"},
"team": {"type": "choice", "instructions": "Which team?",
"criteria": {"billing": "invoices, refunds", "tech": "bugs, outages"}}
}
}'GET /health, GET /capabilities, GET /version, POST /ask,
DELETE /model. Loopback only by default; binding elsewhere warns loudly, because
there is no authentication.
Configuration worth knowing
flag | why |
| Raised at startup, this is the fix for high-cardinality |
| The total budget. Raising it is the fix for a truncated state. |
| Raise only if you know Laya is not sharing device state. The default of 1 is correctness, not caution. |
| Point |
What this does not fix
Upstream's own numbers are worth repeating, because an integration layer that implies otherwise is lying to you.
The base checkpoints are near chance zero-shot on typed decisions — 0.362 for English against a 0.461 majority-class baseline. Guessing the most common answer beats the model.
scoreis the weakest primitive. Independently measured at 35% against Jev's 70% on a five-level ordinal task.Calibration needs labelled data. Raw ECE is 0.466 for English and 0.314 for multilingual, improving to 0.081 and 0.106 after fitting. A temperature cannot be invented; this package will not pretend to.
Position bias is real. One published fixture run answered "A" on 46 of 50 multiple-choice items.
Accuracy falls off above ~20 options, per the author.
Calibration makes a probability honest; it cannot make a model right. If the accuracy is not there for your task, fit on your own domain or do not deploy it.
Verify
python tests/smoke_pure.py # 66 checks: validation, planning, calibration, errors
python tests/install_harnesses.py # 35 checks: every harness dialect, in a temp dir
python tests/mcp_protocol.py # 25 checks: a real MCP handshake and real tool calls
laya-mcp doctor # what is installed, and what the GPU can really do126 checks, and each suite covers a layer the others cannot reach.
smoke_pure.py needs no torch, model, network or harness config. install_harnesses.py
redirects every harness into a temporary directory, because ~/.claude.json is a
large shared file holding history and per-project state and a test that clobbered
it would be a worse bug than any it could catch.
mcp_protocol.py is the one that matters most and the one that was missing
longest. It spawns the server exactly as a harness does
(python -m laya_mcp mcp), performs the real initialize handshake with the
official SDK, lists tools, and calls them through the sidecar to the model. Two
real defects escaped the other suites and were caught only here: FastMCP in
mcp 1.30 takes no version argument, so the server failed to start at all; and
the token-budget warning was written into the DSH plugin's tool description but
never into this server's, so a client using MCP could not have known that an
oversized state is cut from the end.
The harness dialects were additionally verified by letting the harnesses parse
the files this tool writes: codex mcp list --json and openclaw mcp list --json
both report the registered server with the correct stdio transport. For the other
three the format is verified but harness acceptance is not, which is stated rather
than implied — pi has no MCP support at all, and this machine's Hermes runtime is
incomplete.
Licence
Apache-2.0. Laya is Apache-2.0, by Convai Innovations. This is an independent integration and is not affiliated with or endorsed by that project.
This server cannot be deployed
Maintenance
Related MCP Connectors
A paid remote MCP for Pydantic AI structured output, built to return verdicts, receipts, usage logs,
Hosted MCP server for LLM cost estimation, model comparison, and budget-aware routing.
A paid remote MCP for ZeroLang, built to return verdicts, receipts, usage logs, and audit-ready JSON
Paid remote MCP for LLM security scans, jailbreak checks, analytics, checkout, and readiness.
Related MCP Servers
- AlicenseNot gradedqualityBmaintenanceEnables LLM agents to route responses as accept, verify, or ask-a-human based on token logprobs, and provides an MCP server for delegating generation to local models with confidence bands.MIT
- AlicenseAqualityBmaintenanceEnables typed, calibrated judgment calls through classify, score, check, and batched ask tools, each returning full probability distributions for programmatic decisions.5220 npm4MIT
- AlicenseAqualityCmaintenanceProvides agents with fast, typed, calibrated decision tools for classification, scoring, yes/no checks, and gating risky tool calls.5MIT
- AlicenseNot gradedqualityBmaintenanceEnables MCP hosts to query Jev's typed decision model—yes/no, choice, and score—with calibrated probabilities, while defaulting to an offline mock and disclosing all egress unless explicitly enabled.Apache 2.0