Mcp Laya

io.github.dockndevai由 GitHub 帳號 dockndevai 發布v0.1.1更新於 Oct 24, 2026

Safe-by-default MCP for Laya: fast, local, typed decisions (classify/score/yes-no), 100+ langs.

概覽

AI 產生的概覽

在本機執行的 Laya 決策模型 MCP 伺服器,讓助理離線快速完成分類、評分與是/否判斷等型別化決策。

可以做什麼
  • 把文字或 JSON 狀態分類到數個類別之一,並附上機率與校準後的信心值
  • 依序位量表為狀態評分,例如急迫程度
  • 回答是/否/未知問題,用於控制流程分支
  • 一次呼叫回答多個型別化問題,或使用 triage、email、moderation、guard 等預設決策集
  • 偵測文字的書寫系統與語言,並查看將由哪個檢查點作答、可用模型、裝置與離線狀態
適用情境
適合需要便宜、可重複的路由判斷,例如工單該歸哪個團隊、是否急件、是否為退款請求,而不必耗掉一次緩慢的 LLM 往返。也適合多語言分類,以及用是/否結果控制流程。
執行需求
需要 Python 3.10+ 並在本機安裝 mcp-laya 套件(pipx 或 pip),會一併安裝 torch。模型檢查點需連網並設定 LAYA_ALLOW_DOWNLOAD=true 一次性從 Hugging Face 下載,之後可完全離線執行。選用設定包括 LAYA_DEFAULT_MODEL、LAYA_DEVICE、LAYA_MODELS 與 LAYA_MIN_CONFIDENCE。僅限桌面端,使用 stdio 傳輸。
安裝前請注意
首次下載檢查點會向 Hugging Face 發出請求,預設關閉,需明確開啟 LAYA_ALLOW_DOWNLOAD。伺服器會讀取傳入的狀態,工單、郵件或 JSON 可能含敏感資料;建議保持 LAYA_REDACT_STATE 開啟,避免輸入進入稽核日誌,並用 LAYA_MODELS 限定可載入的檢查點。低信心答案只有在設定 LAYA_MIN_CONFIDENCE 時才會被標記。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 Mcp Laya,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

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

bash
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:

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

Then run the server offline.

Configure

json
{  "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":

jsonc
// 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

bash
python -m venv .venv && . .venv/bin/activatepip install -e ".[dev]"ruff check src tests && mypy src && pytest      # the policy tests need no modelpython -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

來源:README.md,提交 07721a9

工具

0
SourceWeft 尚未在沙箱中啟動過該軟體包,因此其工具未知。

版本歷史

1
  1. v0.1.1最新Sep 24, 2026

評分

已滿足適用檢查項的 50%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分

    請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。

  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分