Skip to main content

ugs-mcp

PyPI version CI License: MIT Python 3.11+

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

pip install ugs-mcp

From source

git clone https://github.com/zackpeters93/ugs-mcp.git
cd ugs-mcp
pip install -e .

Claude Code setup

claude mcp add ugs-cnc ugs-mcp

Or from source (without pip install):

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:

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

Or from source:

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

Configuration

Environment variables (all optional):

Variable Default Description
UGS_HOST localhost UGS Pendant host
UGS_PORT 8080 UGS Pendant port
MACROS_DIR ugs_mcp/macros/ Directory for saved G-code macros
RAPID_SPEED_MM_MIN 5000 Rapid 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.

Category Tools
Connection ugs_connect, ugs_disconnect, ugs_troubleshoot_connection
Status ugs_get_status, ugs_get_job_status
Job ugs_run_file, ugs_pause_job, ugs_cancel_job
Motion ugs_jog, ugs_home, ugs_return_to_zero, ugs_set_work_zero
G-code gcode_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.

Metadata

Release files for ugs-mcp 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ugs-mcp 0.1.1
File Size Uploaded Provenance
ugs_mcp-0.1.1.tar.gz 53.2 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for ugs-mcp 0.1.1
File Interpreter ABI Platform
ugs_mcp-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 86.3 kB

Release files / ugs_mcp-0.1.1.tar.gz

Download URL ugs_mcp-0.1.1.tar.gz
Size 53.2 kB
Tags Source
SHA-256 checksum
How to use checksums
6b0493a74caecc19e8f9916a5c86a17e0b0230b01dd0fdef7a7243759126b0bc
BLAKE2b-256 checksum
How to use checksums
5730d00f2046d02af50deca0a27f1df18c279f5857ac915b9a494f254b5bedea
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.15

Release files / ugs_mcp-0.1.1-py3-none-any.whl

Download URL ugs_mcp-0.1.1-py3-none-any.whl
Size 33.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cea23e0e57c09419e34241c2a776d799bbf78acd22cb347bf16da1e68dfabf4c
BLAKE2b-256 checksum
How to use checksums
2e01152a0cdf5183b240996c95a56cb8e76afc8e8645809e8bfc833c0f703177
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.15

Security for ugs-mcp 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page