Skip to main content
Glama

Laya-MLX MCP

laya-mlx を MCP 経由で使う薄いサーバーです。
文章生成はしません。choice / score / noul の typed decision だけ返します。

必要環境: Apple Silicon(macOS arm64)、Python 3.11+

ツール

ツール

内容

laya_status

ロード状態・既定モデル

laya_load

チェックポイントを事前ロード

laya_predict

状態+質問 JSON で判定

既定モデルは aac6fef/laya-multilingual-mlx(日本語向け)。
変更は環境変数 LAYA_MLX_MODEL / LAYA_MLX_DTYPE。

Related MCP server: laya-mcp — on-device typed decisions in ~10ms

Cursor への入れ方

推奨(Homebrew の mlx が入っていても安全): scripts/run-mcp.sh を叩く。

~/.cursor/mcp.json(またはプロジェクトの .cursor/mcp.json)に追加:

{
  "mcpServers": {
    "laya-mlx": {
      "command": "/絶対パス/laya-mlx-mcp/scripts/run-mcp.sh"
    }
  }
}

例: examples/cursor-mcp.json

GitHub クローン後の最短手順:

gh repo clone Blackphi6/laya-mlx-mcp
cd laya-mlx-mcp
uv sync
chmod +x scripts/run-mcp.sh
# mcp.json の command を scripts/run-mcp.sh の絶対パスにする

Cursor を再起動(または MCP を再読込)すると laya_predict などが使えます。
初回の laya_load / laya_predict で Hugging Face から重みを取得します。

ローカル開発

cd laya-mlx-mcp
uv sync --extra dev
uv run pytest -q
uv run laya-mlx-mcp   # stdio MCP(ホストから起動する想定)

手動で判定だけ試す例(laya-mlx-mcp と同じ dylib 修正を通す):

uv run python -c '
from laya_mlx_mcp.dyld_fix import ensure_wheel_mlx_dylib
ensure_wheel_mlx_dylib()
from laya_mlx_mcp.runtime import predict
import json
print(json.dumps(predict(
  "二重請求です。返金してください。",
  {
    "department": {
      "type": "choice",
      "instructions": "どの部署が対応すべきか?",
      "criteria": ["billing", "technical", "sales"],
    },
    "refund": {
      "type": "noul",
      "instructions": "返金を求めているか?",
    },
  },
), ensure_ascii=False, indent=2))
'

Homebrew の mlx が入っていると、pip の mlx wheel と libmlx.dylib が衝突することがあります。MCP のエントリポイントは自動で wheel 側を優先します。

ライセンス・帰属

  • この MCP ラッパー: Apache-2.0

  • 推論本体: mizorewww/laya-mlx(Apache-2.0)

  • 元モデル: Convai Innovations / upstream Laya

Available Tools

3 tools
laya_loadB

チェックポイントを事前ロードする。未指定時は環境変数または既定の multilingual を使う。

Args:
    model: Hugging Face のモデル ID またはローカルパス。例: aac6fef/laya-multilingual-mlx
    dtype: float16(既定)または float32

Inputs: dtype, model. Returns: result

laya_predictA

状態に対して typed decision を実行する。

Args:
    state: 判定対象の文章。JSON オブジェクト/配列の文字列でも可。
    questions_json: 質問定義の JSON オブジェクト文字列。各値は type / instructions
        (choice・score は criteria)を持つ。
    model: 使うチェックポイント。省略時はロード済み、なければ既定モデル。
    dtype: float16 または float32。

Example questions_json:
    {
      "department": {
        "type": "choice",
        "instructions": "どの部署が対応すべきか?",
        "criteria": ["billing", "technical", "sales"]
      },
      "urgency": {
        "type": "score",
        "instructions": "緊急度は?",
        "criteria": ["not urgent", "soon", "critical"]
      },
      "refund": {
        "type": "noul",
        "instructions": "返金を求めているか?"
      }
    }

Inputs: state (required), questions_json (required), dtype, model. Returns: result

laya_statusA

ロード済みモデルと実行環境の状態を返す。

Inputs: no named parameters. Returns: result

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.9/5.0

    Scored across 3 tools

    Disambiguation5/5

    Each tool has a clearly distinct purpose: status reports environment state, load prepares a checkpoint, and predict runs inference. There is no functional overlap between any pair.

    Naming Consistency5/5

    All tools follow a uniform laya_ prefix with a concise verb suffix (status, load, predict), using consistent snake_case throughout. The pattern is predictable and easy to extend.

    Tool Count5/5

    Three tools form a tight, well-scoped set for model serving: check status, load a model, and run predictions. No tool feels extraneous, and the count is sufficient for the domain.

    Completeness4/5

    The core lifecycle of loading and using a model is covered, including a status check for runtime awareness. A minor gap is the lack of an explicit unload or model listing operation, but these are not essential for the stated purpose.

    Maintenance

    ActivitySlowing
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      B
      maintenance
      Provides an MCP interface to the Laya decision model, enabling typed queries (yes/no, multiple choice, score) with preflight token-budget reporting, honest confidence calibration, and structured error handling.
      31 PyPI
      5
      Apache 2.0
    • A
      license
      Not graded
      quality
      C
      maintenance
      Laya-MLX as an MCP server (and plain-HTTP API). It answers typed decisions — choose an option / score a rubric / is this true? — on your own machine (Apple Silicon / MLX), with no cloud and ~10ms after warm-up. Not a chatbot. No token-by-token text, no JSON that can break. One forward pass returns a structured answer you can branch on. Ideal for routing, triage, classification, lead scoring, and g
      MIT