Skip to main content
Glama

mcp-mlx-launcher

一个旨在 Apple Silicon (Mac) 环境中自主管理、启动和关闭本地 mlx-lm 实例的 MCP (Model Context Protocol) 服务器。

该工具使 AI 智能体(如 Cline、Claude Desktop 等)能够按需启动本地 LLM 服务器、检查其状态、准备环境,并在不再需要时优雅地关闭它们,从而节省系统资源。

功能特性

  • 系统环境检查:验证系统内存和架构(Apple Silicon)以确保就绪。

  • 模型搜索与下载:在 Hugging Face 上搜索可用的 MLX 模型,并在启动前将其下载到本地缓存。

  • 启动与管理本地 LLM:在后台启动、停止和重启带有任何受支持模型的 mlx-lm 服务器。

  • 状态检查:验证特定端口当前是否处于活动和监听状态。

  • Apple Silicon 优化:专为管理基于 MLX 的本地模型而构建。

  • 自动清理:当 MCP 服务器断开连接或关闭时,自动清理并关闭所有受管理的 LLM 进程,防止资源泄漏。

Related MCP server: Local AI MCP

先决条件

  • macOS (Apple Silicon M1/M2/M3/M4)

  • Python 3.10 或更高版本

  • 环境中已安装 mlx-lm (pip install mlx-lm)

安装

# Clone the repository
git clone [https://github.com/YOUR_USERNAME/mcp-mlx-launcher.git](https://github.com/YOUR_USERNAME/mcp-mlx-launcher.git)
cd mcp-mlx-launcher

# Install dependencies
pip install -e .

使用方法 (MCP 配置)

要将此服务器与您的 MCP 客户端(例如 Claude Desktop 或 Cline)配合使用,请将以下内容添加到您的 MCP 配置文件中:

{
  "mcpServers": {
    "mcp-mlx-launcher": {
      "command": "python",
      "args": [
        "-m",
        "mcp_mlx_launcher.server"
      ]
    }
  }
}

可用工具

连接后,MCP 服务器为 AI 智能体提供以下工具:

  1. check_system_environment():诊断当前系统环境,返回可用统一内存 (GB) 和架构详细信息。

  2. check_llm_status(port: int):如果服务器当前在指定端口上运行,则返回 true。

  3. list_running_servers():检索当前在后台运行的所有本地 LLM 服务器(端口和模型)的列表。

  4. search_mlx_models(search_query: str = "", limit: int = 10):在 Hugging Face 上搜索可用的 MLX 格式模型,并列出其详细信息(如下载次数和模型 ID)。

  5. download_model(model_name: str):从 Hugging Face 预下载指定的 MLX 模型并将其缓存在本地。适用于在启动前准备大型模型。

  6. launch_llm_server(model_name: str, port: int, memory_requirement_gb: float = 4.0):在后台启动 mlx_lm.server 实例。包含可选的内存需求检查,以防止内存不足错误。

  7. restart_llm_server(port: int, model_name: str = None, memory_requirement_gb: float = 4.0):优雅地停止给定端口上运行的服务器并重启它。如果省略 model_name,它将使用当前加载的模型重启。

  8. shutdown_llm_server(port: int):优雅地终止给定端口上运行的 LLM 服务器。

Available Tools

8 tools
check_llm_statusB

指定されたポートでサーバーがリッスンしているか(稼働中か)を確認します。

Inputs: port (required).

check_system_environmentA

現在のシステム環境(Apple Siliconか、空きメモリが何GBあるかなど)を診断します。

Inputs: no named parameters.

download_modelA

Hugging Faceから指定されたMLXモデルを事前にダウンロードし、ローカルにキャッシュします。大きなモデルの起動前の準備に利用します。

Inputs: model_name (required).

launch_llm_serverB

mlx_lm.server をサブプロセスとしてバックグラウンドで起動します。空きメモリが少ない場合は起動が拒否されます。

Inputs: model_name (required), port (required), memory_requirement_gb.

list_running_serversA

現在バックグラウンドで稼働しているすべてのローカルLLMサーバー(ポート番号とモデル名)の一覧を取得します。

Inputs: no named parameters.

restart_llm_serverB

指定されたポートで稼働しているサーバーを一度停止し、再起動します。モデルの切り替えなどにも使用できます。

Inputs: port (required), model_name, memory_requirement_gb.

search_mlx_modelsC

Hugging Faceからダウンロード可能なMLXフォーマットのLLMモデルを検索・リストアップします。

Inputs: search_query, limit.

shutdown_llm_serverA

指定されたポートで稼働しているローカル LLM サーバープロセスを安全に終了させます。

Inputs: port (required).

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    A3.7/5.0

    Scored across 8 tools

    Disambiguation5/5

    Each tool targets a distinct operation: system check, model download, server launch, list, restart, search, shutdown, and status check. No two tools have overlapping purposes.

    Naming Consistency5/5

    All tool names follow a consistent verb_noun pattern in snake_case (e.g., check_llm_status, launch_llm_server, shutdown_llm_server). No mixing of conventions.

    Tool Count5/5

    8 tools is well-scoped for an LLM server launcher covering environment check, model management, and server lifecycle. Neither too few nor too many.

    Completeness4/5

    Covers the full lifecycle: system check, model search/download, launch, list, restart, shutdown. Minor gap in lacking detailed server logs or configuration updates, but core operations are complete.

    Maintenance

    ActivityInactive
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      B
      maintenance
      Unified MCP server for managing local model runtimes (Ollama, LM Studio, etc.), enabling provider-agnostic discovery, lifecycle management, hardware-fit checks, and delegated inference.
      22
      104 npm
      Creative Commons Attribution Non Commercial No Derivatives 4.0 International
    • A
      license
      Not graded
      quality
      D
      maintenance
      Text-to-speech MCP server using the Kokoro-82M model accelerated with MLX on Apple Silicon, enabling local Claude and Codex clients to speak text aloud and convert text to audio.
      4
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      MCP server that enables local Apple on-device Foundation Model access via any MCP client, supporting text generation, structured output, and multi-turn chat on macOS.
      2
      MIT