Laya Typed Decisions

io.github.PerryLink由 GitHub 账号 PerryLink 发布v0.1.5更新于 Oct 24, 2026

Typed noul / choice / score judgments from a local Laya model, with token-budget preflight.

已验证STDIO仅桌面开发者工具AI 与机器学习

概览

AI 生成的概览

本地 MCP 服务器,调用 Laya PyTorch 模型做是/否、选择与评分三类判断,并提供 token 预算预检与诚实的置信度说明。

可以做什么
  • 向本地 Laya 模型提出类型化判断:是/否(noul)、多选(choice)与数值评分(score)
  • 在提问前运行预检,报告输入会被截断的部分
  • 返回指明具体问题的结构化错误,并提供会承认降级到 CPU 的健康状态接口
  • 通过本机 HTTP sidecar 让模型只加载一次,而不是每个会话都加载
  • 把服务器注册到常见 agent 工具,并检查已安装内容与 GPU 是否真正可用
适用场景
当你希望助手从本地 Laya 模型获得小型、类型化的判断,而不是调用云端大模型,并且想知道输入是否被截断、置信度是否可靠时使用。适合试验,不适合用于对准确性有要求的决策。
运行要求
以 stdio 方式在本地运行。npm 包只是启动器:还需要安装 laya-mcp[mcp] 的 Python 环境,以及 PyTorch(约 2 GB)和模型检查点(约 650 MB)。启动器必须找到可用的 Python 解释器,可设置 LAYA_MCP_PYTHON 或激活虚拟环境(会读取 VIRTUAL_ENV,仍兼容 LAYACORE_PYTHON)。仅支持桌面端。
安装前请注意
0.1.5 版仍在开发中,1.0 之前接口可能变动。README 说明基础检查点在类型化判断上接近随机水平,score 是最弱的原语,confidence 并不等于准确率,因此不应把结果用于重要决策。启动器不会替你安装 Python 依赖。

安装

在 SourceWeft 中

  1. 打开 控制台中的 Laya Typed Decisions,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

laya-mcp

MCP server for Laya typed decisions — noul (yes/no), choice, score — wrapped so it survives contact with a server.

English · 简体中文 · Español · Português · हिन्दी

bash
npx -y laya-mcp --help

Registered as io.github.PerryLink/laya-mcp in the official MCP Registry.

This npm package is a launcher, not an implementation. Laya is a PyTorch model, so the server itself is Python. Installing this package gets you the Node entry point and nothing else; you also need the Python side:

bash
pip install "laya-mcp[mcp]"

npx laya-mcp finds that interpreter, hands stdio to it, and passes the MCP stream through untouched. It does not install anything for you — fetching torch (~2 GB) and a checkpoint (~650 MB) as a side effect of running a command is not something a launcher should do.

If it cannot find your Python

On Windows, python on PATH is often the Microsoft Store execution alias, which is a stub: it cannot import anything, and it sits ahead of your real interpreter. The launcher therefore reports what it tried rather than claiming the package is missing. Point it at the right interpreter either way:

bash
# name it outrightset LAYA_MCP_PYTHON=C:\path\to\python.exe        # Windowsexport LAYA_MCP_PYTHON=/path/to/python           # macOS, Linux
# or just activate the virtualenv you installed into — VIRTUAL_ENV is honoured

LAYACORE_PYTHON is still read. 0.1.0 and 0.1.1 printed that name in the error message, and a launcher that stopped honouring the variable its own previous version told you to set would be worse than one carrying the alias.

Status: 0.1.5, work in progress. The Python core is implemented and covered by CI. The launcher itself is covered by ten checks over interpreter discovery, which is where it has been wrong before. Interfaces may move before 1.0.


Why it exists

Laya truncates things silently and reports none of it:

  • It cuts the state from the end. A long document loses its tail — for a contract or an email thread, often where the answer was — and the model answers about the surviving prefix at full confidence.
  • It shortens options until labels are indistinguishable. Options share a fixed per-question token budget; past a point every label gets ~4 tokens. This is the documented cause of its collapse on high-cardinality choices.
  • Its confidence is not accuracy. It is a normalised entropy, low whenever probability is spread out even when the top option is right, and high on a confident wrong answer.
  • It demotes itself to CPU on a CUDA OOM, permanently, with no flag set — roughly 10-15x slower, and nothing in the response says so.

This package adds a preflight that reports what would be cut, structured errors that name the offending question, an honest confidence contract, and a health surface that admits a demotion.

Usage

bash
laya-mcp serve      # warm HTTP sidecar on 127.0.0.1:8787 (loads the model once)laya-mcp mcp        # MCP over stdiolaya-mcp doctor     # what is installed, and whether the GPU really workslaya-mcp install    # register with whichever agent harness you have

install handles the fact that there is no portable way to register an MCP server: Claude Code (mcpServers), Codex ([mcp_servers.<name>]), opencode (mcp, with an array command), OpenClaw (mcp.servers) and Hermes (mcp_servers) each get the right shape written to the right file, merged and backed up rather than overwritten. pi has no native MCP support and is reported as unsupported.

Prefer serve plus --sidecar over hosting the model in each stdio process: a harness spawns one server per session, and loading a 650 MB checkpoint per session is the main reason a Python-backed MCP server feels slow.

Honest limits

Upstream's own numbers, repeated because an integration that implies otherwise is lying to you: the base checkpoints are near chance zero-shot on typed decisions (0.362 against a 0.461 majority-class baseline); score is the weakest primitive (35% vs 70% in independent measurement); raw calibration error is 0.466 before temperature fitting; and one fixture run answered "A" on 46 of 50 multiple-choice items.

Calibration makes a probability honest; it cannot make a model right.

Licence

Apache-2.0. Laya is Apache-2.0 by Convai Innovations. This is an independent integration, not affiliated with or endorsed by that project.

来源:README.md,提交 6525f30

工具

0
SourceWeft 尚未在沙箱中启动过该软件包,因此其工具未知。

版本历史

3
  1. v0.1.5最新Sep 22, 2026
  2. v0.1.4Sep 22, 2026
  3. v0.1.3Sep 21, 2026

评分

已满足适用检查项的 50%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分

    请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。

  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分