mcp-server-gcodeclean
MCP server for G-code syntax validation and cleaning using GCodeClean. Validates G-code against NIST RS274 standards with bundled binaries for all platforms.
Installation
From PyPI (Recommended)
# Using uvx (recommended for MCP servers)
uvx mcp-server-gcodeclean
# Using pip
pip install mcp-server-gcodeclean
From Source
git clone https://github.com/ivan-loh/mcp-server-gcodeclean.git
cd mcp-server-gcodeclean
uv sync
Requirements:
- Python 3.10+
- uv (for development)
- Claude Desktop
Configuration
Add to Claude Desktop config:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json
Using uvx (PyPI installation)
{
"mcpServers": {
"gcodeclean": {
"command": "uvx",
"args": ["mcp-server-gcodeclean"]
}
}
}
Using local installation
{
"mcpServers": {
"gcodeclean": {
"command": "uv",
"args": [
"--directory",
"/absolute/path/to/mcp-server-gcodeclean",
"run",
"mcp-server-gcodeclean"
]
}
}
}
Optional: Override bundled binary with custom path:
{
"mcpServers": {
"gcodeclean": {
"command": "uv",
"args": ["--directory", "/path/to/mcp-server-gcodeclean", "run", "mcp-server-gcodeclean"],
"env": {
"GCODECLEAN_PATH": "/path/to/custom/GCC"
}
}
}
}
Tools
validate_gcode_syntax
Validates and cleans G-code programs.
Parameters:
gcode_content(string, required): G-code to validatetolerance(float, optional, default: 0.01): Clipping tolerance in mmminimise(string, optional, default: "soft"): Token removal strategysoft: Remove F/Z codes only (10-20% reduction)medium: Remove all except IJK+spaces (30-50% reduction)hard: Maximum compression (50-70% reduction)
annotate(boolean, optional, default: false): Add explanatory comments
Response:
{
"status": "PASSED",
"passed": true,
"cleaned_gcode": "...",
"statistics": {
"original_lines": 100,
"output_lines": 85,
"reduction_percent": 25.0
},
"error": null
}
Status values: PASSED, FAILED, ERROR, TIMEOUT
Limits: 10MB max file size, 30 second timeout
get_gcodeclean_version
Verifies GCodeClean installation and returns diagnostic information.
Response:
{
"status": "SUCCESS",
"binary_path": "/path/to/GCC",
"platform": {
"os": "Darwin",
"architecture": "arm64"
},
"version_output": "1.4.2",
"exit_code": 0
}
Platform Support
Bundled binaries included for:
- Linux x64
- Linux ARM/aarch64
- macOS Intel (x64)
- macOS Apple Silicon (arm64)
- Windows x64
Total size: ~70MB. No .NET runtime required.
Development
Project Structure
mcp-server-gcodeclean/
├── src/mcp_server_gcodeclean/
│ └── server.py # Main implementation
├── resources/gcodeclean/
│ ├── version.json # Version metadata
│ └── 1.4.2/ # Platform binaries
├── tests/ # Test suite (42+ tests)
├── pyproject.toml
└── README.md
Running Tests
uv run python tests/test_server.py # Unit tests
uv run python tests/test_defaults_and_overrides.py # Comprehensive tests
Running Server
uv run mcp-server-gcodeclean
Troubleshooting
Binary not found:
ls -la resources/gcodeclean/1.4.2/
uv run python -c "from mcp_server_gcodeclean.server import get_gcodeclean_path; print(get_gcodeclean_path())"
Permission denied:
chmod +x resources/gcodeclean/1.4.2/*/GCC*
File too large: Split G-code into sections under 10MB
Validation timeout: File is very complex. Try validating in smaller sections or increase tolerance value.
Binary Selection Priority
GCODECLEAN_PATHenvironment variable (custom override)- Bundled binary for current platform (auto-detected)
- System PATH (
GCCcommand)
License
AGPL-3.0. This project bundles GCodeClean binaries (AGPL-3.0).
Full license: resources/gcodeclean/1.4.2/LICENSE
References
Metadata
Release files for mcp-server-gcodeclean 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| mcp_server_gcodeclean-0.2.0.tar.gz | 44.8 MB | Without provenance | Details for mcp_server_gcodeclean-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| mcp_server_gcodeclean-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for mcp_server_gcodeclean-0.2.0-py3-none-any.whl |
Total release size: 75.0 MB
Release files / mcp_server_gcodeclean-0.2.0.tar.gz
| Download URL | mcp_server_gcodeclean-0.2.0.tar.gz |
|---|---|
| Size | 44.8 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
59d5e8c8e9d1b9869c400bdb1a7d6b88c7ae75f5c8d3ff9c28eff3f6e4ad711d
|
|
BLAKE2b-256 checksum How to use checksums |
5a979621d6e60f4c2883b70752686db81411513ed929cbd6707f86ab22d84f04
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.0
|
Release files / mcp_server_gcodeclean-0.2.0-py3-none-any.whl
| Download URL | mcp_server_gcodeclean-0.2.0-py3-none-any.whl |
|---|---|
| Size | 30.2 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1cb321c5d5e7a63f2dc9e60b0512e1c08197a5820cca83e2ff82f065ef9f00ae
|
|
BLAKE2b-256 checksum How to use checksums |
3f15f622922fdf89f302ea14c731d1d3f7d33e0e2391132804bfc5c3747ff521
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.0
|
Security for mcp-server-gcodeclean 0.2.0
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.