Skip to main content
Glama
Mastercam MCP Server

Mastercam MCP Server

by FunSize77

Server Configuration

Describes the environment variables required to run the server.

NameRequiredDescriptionDefault
MCAM_MCP_PIDNoPin the server to one Mastercam process (mastercam_mcp_<pid>). select_mastercam does the same at runtime.
MASTERCAM_EXENoFull path to Mastercam.exe if it is not in the standard location.auto
MCAM_MCP_PIPENoBase pipe name (must match the add-in).mastercam_mcp
MCAM_MCP_TOOLSNoTools to expose: all, core, or groups / tool names separated by commas. Also available as --tools.all
MCAM_MCP_TIMEOUTNoDefault seconds per bridge call (long tools such as post/regenerate use more).120
MCAM_MCP_ALLOWED_DIRSNoSemicolon-separated folders. When set, every path read or written must be inside one of them.
MCAM_MCP_ALLOW_SCRIPTSNoSet to 1 to expose execute_csharp (arbitrary C# inside Mastercam). Also available as --allow-scripts. The add-in accepts it only when Mastercam also runs with it set.off
MCAM_MCP_NC_EXTENSIONSNoExtra file extensions read_nc_file / check_nc_file may read (semicolon-separated), if your post writes an unusual one.

Instructions

Guidance the server publishes about itself, which clients place ahead of the tool catalog so the model reads it before choosing anything.

Tools for driving Mastercam (CAD/CAM) on this Windows PC. The Mastercam window is in front of the user: work like a careful CAM programmer and report what you changed. Call knowledge (no arguments) once before programming a part: it is the master guide, and its topics (workflow, toolpaths, chaining, linking, holes, planes, posting, gotchas, csharp, troubleshooting) hold measured facts.

Typical workflow

  1. mastercam_status (launch_mastercam if it is not running). If several Mastercam windows are open, status lists them: select_mastercam the one the user means before changing anything.

  2. open_file the part (.sldprt/.step/.x_t/.mcam ...), then get_part_info + screenshot to understand it. get_state shows the active groups and planes. create_geometry draws missing wireframe; create_plane sets up fixture faces with their work offsets; create_toolpath_group starts a new setup.

  3. Make sure there is a machine group (list_machine_groups / create_machine_group) and stock (set_stock).

  4. Add toolpaths: import_operations from an operation library (list_library_operations shows what is in it), or build them: create_tool, then create_facing / create_contour / create_pocket (chain by entity ids from list_geometry, or by level and depth), create_drill / create_circle_mill (pre-drilled holes) / create_helix_bore (holes and counterbores from solid), with holes by entity, position or bolt_circle. Tune anything with get_operation_parameters / set_operation_parameters. execute_csharp (when enabled) covers whatever the structured tools do not.

  5. regenerate_operations; fix anything left dirty. Check get_cycle_time.

  6. save_file (.mcam), post_process (.nc), check_nc_file (with the machine's travel and the stock top), generate_setup_sheet (setup + run sheet HTML). read_nc_file to look at the code. run_job does steps 2-6 in one call for template / operation-library driven programming.

Rules

  • All paths are absolute Windows paths. Never overwrite the user's files unless asked: save to a new name.

  • Toolpaths from automation must be verified (simulation / review) before they run on a machine. Say so.

  • Units follow the open file (get_part_info.units). Feeds/speeds are in those units.

  • Mastercam pop-ups raised during a call are answered automatically and returned as mastercam_messages (or appended to the error). Read them: "Toolpath regeneration failed" means the operation exists but has no toolpath.

  • A post_process result with dirty_operations means those operations posted no motion: fix them and post again.

  • post_errors: true means the post processor reported errors (e.g. a plane the machine cannot reach). The NC file exists but must not be run: find out why first.

Capabilities

Features and capabilities supported by this server

Protocol revision2025-11-25

CapabilityDetails
tools
{
  "listChanged": false
}
prompts
{
  "listChanged": false
}
resources
{
  "subscribe": false,
  "listChanged": false
}

Tools

Functions exposed to the LLM to take actions

NameDescription
mastercam_statusA

Start here. Is Mastercam running and is the MCP Bridge add-in answering? Returns versions, open file, units and, when several Mastercam windows are open, each instance so you can select_mastercam the right one. Before programming a part, read the knowledge tool's master guide (call knowledge with no arguments).

select_mastercamA

Send all following commands to one specific Mastercam window (when several are open).

launch_mastercamA

Start Mastercam (if it is not running) and wait for the MCP Bridge add-in to answer.

open_fileA

Open a part in Mastercam (unsaved changes in the current file are discarded unless merge=true).

new_fileA

Start a new empty part. Unsaved changes in the current file are discarded.

save_fileA

Save the current file (Save As when path is given; existing files are kept unless overwrite=true).

export_fileA

Export the part's geometry to a CAD file (e.g. STEP for a customer or a fixture designer). The open .mcam stays the current file.

screenshotA

Capture Mastercam's graphics window as an image.

get_part_infoB

Open file, units, geometry counts by type, bounding box, levels, machine groups and operation counts.

get_extentsB

Bounding box of all geometry: min, max and size as [x, y, z].

list_levelsB

Levels (layers) with names, entity counts and visibility.

list_geometryB

List geometry entities (ids, type, level; arc centers/radii, line endpoints, point positions).

get_stateA

What Mastercam is set to now: file, units, active machine/toolpath group, WCS / tool / construction planes (with work offsets), active level, selection count, operation and dirty-operation counts. Check it before creating geometry or operations: new operations go into the active group and take the current tool plane. The knowledge tool explains planes, chaining, linking and posting with measured facts.

create_geometryA

Create wireframe (all or nothing). Returns the new entity ids per shape, ready for chain={"entity_ids": [...]} or drilling by entity_ids. Rectangles are lines (and corner arcs) in a closed loop.

delete_geometryA

Delete entities from the open part (never files). Operations chained to them keep their old toolpath until regenerated: regenerate_operations and check them afterwards.

set_levelA

Create, name, activate or show/hide a level.

list_planesB

Planes in the part (origin, X/Y/Z axes in world, work offset) and which is the current WCS / tool / construction plane.

create_planeA

Create a work/tool plane, e.g. a fixture face with its own work offset. On a horizontal machine B0 is usually base front, B90 right, B180 back, B270 left: check against the machine before posting.

update_planeA

Move, renumber or rename a plane you created (system planes can only get a work offset).

set_planesB

Set the current WCS / tool plane / construction plane. New operations take the tool plane; the WCS decides which coordinates are posted.

list_machine_groupsB

Machine groups with machine definition, NC output folder, and toolpath groups.

create_machine_groupB

Create a machine group (this selects the machine, control definition and post processor).

set_output_folderC

Set where a machine group's NC files are written.

set_stockA

Define the mill stock of a machine group (bounding box of all solids / all entities, or an explicit box).

list_operationsC

Operations in the Toolpaths Manager: id, name, type, tool, spindle/feeds, dirty/locked status.

list_toolsB

Tools defined in the current part (number, name, type, diameter, corner radius, lengths, offsets).

list_library_operationsB

List the operations and toolpath groups stored in an operation library / other Mastercam file.

list_library_toolsB

List the tools in a tool library or another Mastercam file.

import_operationsB

Import toolpath operations (with their tools and parameters) into the active machine group.

update_operationB

Change an operation's name, spindle speed, feeds or H/D offset numbers (then it is regenerated).

create_toolpath_groupA

Create a toolpath group (e.g. one per setup or fixture side) and make it active: new operations go there.

set_active_groupA

Make a toolpath group active (ids from list_machine_groups): new operations are added to it.

move_operationsB

Reorder operations (they keep their order among themselves). Returns the new order.

copy_operationsA

Duplicate operations with their geometry; the copies are regenerated. Returns new_ids.

operation_statsB

Per operation: toolpath extents (min/max in WCS and world, so deepest Z and XY reach) and cycle time.

delete_operationsC

Delete operations by id.

regenerate_operationsA

Recalculate toolpaths. Returns regenerated ids, per-operation errors, and anything still dirty.

get_cycle_timeB

Estimated machining time per operation and in total (seconds).

create_toolA

Create a tool in the open part (units follow the part). Its rpm/feeds become the default for toolpaths that use it.

create_contourB

Create and regenerate a 2D contour toolpath in the active machine group. Closed chains run clockwise, so comp_side left cuts outside and right cuts inside. Lead in/out arcs and lines are sized to the tool.

create_pocketB

Create and regenerate a 2D pocket (closed chains; chains inside others are islands).

create_facingB

Create and regenerate a facing toolpath over the chained boundary (usually the part outline).

create_drillB

Create and regenerate a drill/peck/tap/bore toolpath. Give entity_ids, arc_diameter, positions and/or bolt_circle.

create_circle_millA

Circle mill round holes at the given centers (best for pre-drilled holes; it plunges at the center). For counterbores or holes cut from solid use create_helix_bore.

create_helix_boreB

Helix bore counterbores / round holes from solid with an end mill (helix down, then a finish circle).

get_operation_parametersB

All parameter groups of an operation with current values (names usable in set_operation_parameters).

set_operation_parametersA

Change any operation parameters by path, then regenerate the operation.

post_processB

Post-process toolpaths to G-code with the machine group's post. Regenerates dirty operations first.

generate_setup_sheetB

Write a printable HTML setup sheet + operator run sheet (operations, tools, offsets, times, part image).

run_native_setup_sheetC

Run Mastercam's own setup-sheet report (configured template) without its dialog.

read_nc_fileA

Read (part of) a posted NC program or other text output to verify it.

knowledgeA

How to program Mastercam well with these tools: the master guide (default), one topic, or a search across all guides. Built from behaviour measured on Mastercam 2027.

check_nc_fileA

Review posted G-code before it runs: F0 feeds, cutting with the spindle off, H/D numbers that do not match the tool, rapids into the stock zone, moves outside the machine travel, missing program end; plus each tool's Z range, feeds and speeds and the program extents. A review aid, not a simulation.

run_jobA

One-shot CAD-to-CAM: open part (optionally into a template), machine group, stock, import operations, regenerate, save .mcam, post .nc and write the setup/run sheet. Returns every artifact path and a step log.

Prompts

Interactive templates invoked by user choice

NameDescription
program_partStep-by-step instructions for programming a part end to end.

Resources

Contextual data attached and managed by the client

NameDescription

No resources

TDQS

B3.2/5.0

Scored across 54 tools

Disambiguation4/5

Despite 54 tools, most have a clearly distinct resource+action target, and the descriptions actively disambiguate the risky pairs (create_circle_mill vs create_helix_bore, generate_setup_sheet vs run_native_setup_sheet, list_tools vs list_library_tools). There is residual overlap among the several 'what is the current state' tools (mastercam_status, get_state, get_part_info, list_operations) and between run_job and the individual step tools, but an agent can still choose correctly from the text.

Naming Consistency4/5

The dominant convention is snake_case verb_noun (create_contour, set_planes, list_geometry, delete_operations), applied across nearly the whole surface. Minor deviations exist: bare nouns (knowledge, screenshot, operation_stats), noun-first names (mastercam_status), and 'new_file' where create_* would be expected, plus launch_mastercam/select_mastercam placing the server name in different positions.

Tool Count2/5

54 tools is well past the point where an agent can reason about the surface at once, even though the CAD-to-CAM domain is genuinely broad and most tools are non-redundant. The set is sensibly grouped into lifecycle areas, but it would benefit from consolidation (e.g. run_job-style wrappers for common sequences).

Completeness4/5

Coverage is strong across the domain: session/file management, geometry, levels, planes, tools, toolpath operations, machine groups, stock, posting, NC verification, setup sheets and a one-shot job runner. Gaps remain around geometry modification/transforms (only create and delete), tool editing/library import, and machine-group removal, but these are workaroundable.

Maintenance

ActivityMaintained
ResponsivenessNo recent community issues