Ugs Mcp

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

CNC machine control via Universal G-code Sender. Jog, home, run files with hardware safety tokens.

概览

AI 生成的概览

通过 Universal G-code Sender 控制 CNC 机床:点动、回零、运行文件和宏,并检查 G-code,运动需令牌确认。

可以做什么
通过 UGS Pendant REST API 将助手连接到 CNC 机床。连接类工具用于连接或断开 UGS,并排查串口问题;状态类工具读取机床状态、位置、进给率和主轴转速。运动类工具可点动各轴、回零、返回工件零点、设置工件零点,以及运行 G-code 文件或已保存的宏。G-code 检查器可将 G-code 翻译成英文、做安全检查、估算加工时间并列出刀具。
适用场景
当你想让助手操作或检查一台已运行 UGS 并启用 Pendant 插件的 GRBL 机床时使用,例如点动、回零、运行任务或在切削前检查 G-code。没有连接机床和 UGS 环境时没有用处。
运行要求
本地 Python 3.11+ 进程,从 PyPI 或源码安装。需要 Universal GCode Sender 2.x 并启用 UGS Pendant 插件,且可通过配置的主机和端口访问。可选环境变量:UGS_HOST、UGS_PORT、MACROS_DIR、RAPID_SPEED_MM_MIN。未声明账号或 API 密钥。
安装前请注意
该服务器会驱动真实机械,可能损坏设备、毁坏工件,甚至造成人身伤亡。运动命令需要两步确认令牌,必须由用户读回,但运行文件、宏、回零和设置零点仍会改变机床状态。使用前请阅读安全文档,并确认急停按钮的位置。

安装

在 SourceWeft 中

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

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

其他 MCP 客户端

参照 仓库 中的启动说明。

README

ugs-mcp

[PyPI version] [CI] [License: MIT] [Python 3.11+] [ugs-mcp MCP server]

MCP server for controlling CNC machines via Universal GCode Sender.

Lets Claude (or any MCP-compatible AI assistant) connect to a CNC machine, inspect G-code, and issue motion commands — all through the UGS Pendant REST API.


⚠️ STOP. READ THIS FIRST.

This software controls machines that can damage equipment, destroy parts, and injure or kill people.

CNC machines move fast and don't know where your hands are. Before you use this:

If you skim the safety docs and something goes wrong, that's on you. We warned you.


What it does

  • Connection tools — Connect/disconnect UGS to your CNC, troubleshoot serial port issues
  • Status tools — Read machine state, position, feed rate, spindle speed
  • Motion tools (token-protected) — Jog axes, home, return to work zero, run G-code files and macros
  • G-code inspector — Translate G-code to English, safety check, cycle time estimate, tool list

Every motion command uses a two-step token protocol: Claude generates a token, shows it to you, and the machine only moves when you read the token back. Claude cannot bypass this — tokens are generated and validated server-side.


Requirements

  • Universal GCode Sender 2.x (winder.github.io/ugs_website)
  • UGS Pendant plugin installed and active (Tools → Plugins → Installed)
  • Pendant running at http://localhost:8080 (default)
  • Python 3.11+

Installation

Via pip

bash
pip install ugs-mcp

From source

bash
git clone https://github.com/zackpeters93/ugs-mcp.gitcd ugs-mcppip install -e .

Claude Code setup

bash
claude mcp add ugs-cnc ugs-mcp

Or from source (without pip install):

bash
claude mcp add ugs-cnc /path/to/ugs-mcp/ugs_mcp/run_server.sh

Claude Desktop setup

In ~/Library/Application Support/Claude/claude_desktop_config.json:

json
{  "mcpServers": {    "ugs-cnc": {      "command": "ugs-mcp"    }  }}

Or from source:

json
{  "mcpServers": {    "ugs-cnc": {      "command": "/opt/homebrew/opt/[email protected]/libexec/bin/python3",      "args": ["-m", "ugs_mcp.server"],      "cwd": "/path/to/ugs-mcp"    }  }}

Configuration

Environment variables (all optional):

VariableDefaultDescription
UGS_HOSTlocalhostUGS Pendant host
UGS_PORT8080UGS Pendant port
MACROS_DIRugs_mcp/macros/Directory for saved G-code macros
RAPID_SPEED_MM_MIN5000Rapid speed used in return-to-zero

Copy .env.example to .env to customize.


The token system

Every motion tool uses a mandatory two-step confirmation:

Step 1 — Call the tool without a token. Claude shows you a preview (axis, distance, resulting position, safety warnings) and a token like [A3F8B2C1].

Step 2 — Read the preview. If you agree, tell Claude the token. Claude calls the tool again with confirmation_token="A3F8B2C1". The machine moves.

Tokens are generated server-side via uuid4(), expire in 2 minutes, and are single-use. Claude cannot predict, fabricate, or reuse them. The only way movement happens is if you type the token back.


Tools

See USER_GUIDE.md for the full tool reference with parameters, examples, and typical workflows.

CategoryTools
Connectionugs_connect, ugs_disconnect, ugs_troubleshoot_connection
Statusugs_get_status, ugs_get_job_status
Jobugs_run_file, ugs_pause_job, ugs_cancel_job
Motionugs_jog, ugs_home, ugs_return_to_zero, ugs_set_work_zero
G-codegcode_safety_check, gcode_estimate_time, gcode_translate, gcode_list_tools, gcode_save_macro, gcode_list_macros, gcode_run_macro

Tested with

  • SainSmart Genmitsu 3018 Pro (GRBL)
  • UGS 2.x with Pendant plugin
  • macOS / Python 3.11

Likely works with any GRBL-based machine. TinyG/FluidNC/Smoothieware untested.


License

MIT — see LICENSE.

No warranty. No liability. Read SAFETY.md.

来源:README.md,提交 ec3f442

工具

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

版本历史

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

评分

已满足适用检查项的 50%

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

  • 近 30 天内可连通25 分

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

  • 已声明认证方式10 分

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

  • 已列出工具15 分

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

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