mcp-for-maya

v0.8.0
io.github.Xxx91n/mcp-for-maya Checked 4 days ago Published 20 days ago

Spatial awareness for AI agents in Autodesk Maya: scene checks, checkpoints, captures (Beta)

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

scene_snapshot Scene Snapshot

Get a complete spatial overview of the current Maya scene. Returns a structured description of ALL objects with positions, sizes, and types. Call this once at the start of each task to see the whole scene before changing it. Sizes are world-axis bounding boxes. Each shape's own box is transformed once, so a rotated parent no longer widens a size layer by layer; geometry that does not fill its own box (an L-shape, a character mesh) can still read up to one axis-alignment too wide. The first line ends with MODIFIED=y or MODIFIED=n. y means the scene has changes that were never saved; n means…

ParameterTypeDescription
detailstringDetail level - "compact" (fast), "standard" (+materials/mesh stats), "full" (+vertices).
formatstringOutput format - "cos" (CoS: short one-line-per-object text, compact) or "json" (full JSON).
session_keyMaya session key (auto-selected if only one session).

scene_inspect Scene Inspect

Deep inspection of a specific object or zone. Returns detailed properties including transform, BBox, material, mesh stats, and optionally nearby objects with distances. Object positions, box corners, sizes, neighbor distances and zone centers/boxes are in the scene's current linear unit (cm, m or mm). JSON object results name that unit. Centimetre output keeps its previous shape; non-centimetre zone results and the CoS view add the unit. An object's BBox is the node's own box, without its ancestors' transforms. The zone branch reports world-axis boxes built from each shape's own box transfo…

ParameterTypeDescription
target *stringObject name or zone name to inspect.
formatstringOutput format - "cos" or "json".
include_neighborsbooleanWhether to include nearby objects (default True).
session_keyMaya session key.

scene_measure Scene Measure

Measure the spatial relationship between two objects. Call this in the compute step (the second of ICEV's four steps), to turn a spatial question into a number before you execute a change: size a clearance before moving something, prove two objects interpenetrate before you separate them, or get the axis detail behind an overlap that scene_validate reported. Read-only and idempotent: it queries world-space bounding boxes and never modifies the scene, so no checkpoint file is written. Requires an active Maya session. Every mode measures world-space AABBs, not the mesh surface and not the obj…

ParameterTypeDescription
obj_a *stringFirst object name.
obj_b *stringSecond object name.
formatstringOutput format - "cos" or "json".
modestringWhat the returned number means — see the list above.
session_keyMaya session key.

scene_assert Scene Assert

Verify scene state matches expected values. Use this after modifications to confirm the scene is in the desired state. This is the check step (the last of ICEV's four steps). bbox_min/bbox_max compare world-axis boxes built from each shape's own box, transformed once: a rotated parent no longer widens them layer by layer, but geometry that does not fill its own box (an L-shape, a character mesh) can still read up to one axis-alignment too wide. Boundary: Disambiguated from scene_validate (checks relational spatial constraints across zones rather than exact expected values for named objects)…

ParameterTypeDescription
expectations *stringJSON string defining expected state. Format: {"obj_name": {"position": [x,y,z], "bbox_max": [x,y,z], ...}} Supported properties: position, bbox_max, bbox_min, exists, material. Position and bbox value…
formatstringOutput format - "cos" or "json".
session_keyMaya session key.

scene_validate Scene Validate

Validate scene against spatial constraints. Checks the scene for constraint violations like minimum clearance, object limits, overlaps, and height requirements. This is a read-only check without auto_fix mutations (it cannot modify or repair objects; for automated fixes, see scene_plan with auto_fix=True). Because it is non-destructive, it needs no undo or rollback checkpoint. Requires an active Maya session. Boundary: Disambiguated from scene_review (a full check of scene quality across 11 checks) and scene_assert (verifies specific numeric values or object existence).

ParameterTypeDescription
rules *stringJSON string with constraint rules. Format: [{"type": "min_clearance", "zone": "entrance", "value": 180}, {"type": "max_objects", "value": 5000}, {"type": "no_overlap", "objects": ["wall_a", "shelf_b…
formatstringOutput format - "cos" or "json".
session_keyMaya session key.

scene_checkpoint Scene Checkpoint

Save the current scene to a `.ma` file on disk under checkpoints/. Boundary: Disambiguated from scene_checkpoint_list (list the checkpoint files already written) and scene_rollback (open one and point the scene at it) — scene_checkpoint is the save half. Writes a self-contained .ma into a checkpoints/ directory next to the scene file. A scene that was never saved to disk needs an explicit name, and its temporary checkpoint goes under the Maya workspace — returned with original_file_status="no_original_file" and scene_rebound_to=null. Same-name checkpoints are rejected unless overwrite=Tr…

ParameterTypeDescription
nameCheckpoint name (^[A-Za-z0-9_-]+$). Required when the scene was never saved to disk.
overwritebooleanReplace a same-name checkpoint, preserving the old file.
session_keyMaya session key.

scene_rollback Scene Rollback

Open a checkpoint file and point the scene at its original path (S2). Boundary: Disambiguated from scene_checkpoint (save a checkpoint from the current scene) and scene_checkpoint_list (list the ones already written) — scene_rollback is the read-back half. Before opening, the current scene is saved to a file first (auto_before_rollback); if that fails, the read-back aborts — pass discard_current_state=True to escape (the result reports safety_snapshot="skipped_by_user"). The scene points back only when it has a file path at read-back time; otherwise it stays on the checkpoint path (S1) a…

ParameterTypeDescription
filename *stringCheckpoint filename from scene_checkpoint_list (cp_*.ma or prev_*.ma).
discard_current_statebooleanEscape hatch — proceed even if saving the current scene fails.
session_keyMaya session key.

scene_checkpoint_list Scene Checkpoint List

List all saved checkpoints for the current scene state. Boundary: Disambiguated from scene_checkpoint (save a new checkpoint) and scene_rollback (open one and point the scene at it) — scene_checkpoint_list only reads what is already on disk. Saved scenes list <scene_dir>/checkpoints; a scene never saved to disk lists the workspace checkpoints instead (adhoc flag per entry).

ParameterTypeDescription
session_keyMaya session key.

camera_create Camera Create

Create a camera positioned for a specific shot type. Boundary: Disambiguated from camera_orbit (animates a turntable around a point over many frames) — camera_create frames one static shot and adds no animation. Supports the 8 built-in shot types: extreme_wide, wide, medium, close, extreme_close, over_shoulder, bird_eye, low_angle.

ParameterTypeDescription
target *stringTarget object name to look at.
azimuthnumberHorizontal angle in degrees (default 30).
elevationnumberVertical angle in degrees (default 15).
namestringCamera name.
session_keyMaya session key.
shot_typestringShot type (default "medium").

camera_orbit Camera Orbit

Create an orbiting camera with turntable animation around a point. Side effects: creates a new camera and animation curves in the scene and marks the scene dirty. Not idempotent — each call adds another camera. Requires an active Maya session. Boundary: Disambiguated from camera_create (static shot-type framing; use camera_orbit only when an animated orbit is needed).

ParameterTypeDescription
center *stringOrbit center as a JSON string "[x, y, z]".
framesintegerNumber of frames for one full orbit.
namestringCamera name.
radiusnumberOrbit radius in scene units.
session_keyMaya session key.

scene_aesthetics Scene Aesthetics

Score the scene's look on 5 design dimensions. Scores the scene's look across 5 design dimensions: 1. Color Theory: 60-30-10 rule, temperature balance, harmony type, saturation variety, contrast 2. Spatial Composition: golden ratio proportions, rule-of-thirds alignment, visual weight balance 3. Proportion & Scale: human ergonomic reference, size hierarchy (hero/secondary/tertiary) 4. Lighting Quality: layer composition (key/fill/rim/accent), color temperature consistency 5. Visual Flow: sight line clarity, circulation paths, visual rhythm patterns Returns an overall score (0-100) with grade…

ParameterTypeDescription
formatstringOutput format - "json" (default) or "cos" (a short score summary: the overall score, each dimension's score, and the suggestions).
session_keyMaya session key.

scene_review Scene Review

Check a whole scene - all the aspects worth checking after operations. Runs spatial integrity, overlap detection, zone coverage, aesthetics, constraint validation, orphan detection, naming, componentization, conflicts, lighting quality, and scene organization. Returns a score (0-100) and detailed issue list. Checks you add in the Maya session with `_mcp_scene.register_validator(...)` (call it through execute_code) are reported in a separate "custom" section - `validators` per rule, `score`/`max_score` in weight points, `issues` for what did not pass. The built-in score is unchanged and the s…

ParameterTypeDescription
checksstringComma-separated check names or "all". Options: spatial, overlaps, zones, aesthetics, constraints, orphans, naming, components, conflicts, lighting, organization
formatstringOutput format - "json" or "cos".
session_keyMaya session key.

scene_plan Scene Plan

Plan a scene layout: organization checks plus layout suggestions. Checks the scene and produces an actionable plan: - Organization check: finds orphan meshes, empty groups, default names - Zone analysis: coverage and spatial balance across zones - Layout suggestions: spacing, overlap, and clustering detection - Conflict prevention: predicts near-miss collisions - Action plan: prioritized step-by-step execution guide With recommend_assets=True, also recommends Poly Haven models across the built-in scene zones (entrance, display, furniture, lighting; shell, ip_core, and path are skipped with n…

ParameterTypeDescription
auto_fixbooleanIf True, auto-fix safe issues (remove empty groups, reparent orphans).
formatstringOutput format - "json" (default) or "cos".
objectivestringNatural language goal description. e.g., "set up entrance area with display window and clear circulation"
recommend_assetsbooleanIf True, attach advisory Poly Haven model recommendations across the mapped built-in zones (entrance, display, furniture, lighting; shell/ip_core/path skipped) to the plan. This reaches the Poly Haven…
session_keyMaya session key.

scene_viewport_snapshot Scene Viewport Snapshot

Capture the active viewport as an image (WYSIWYG). Boundary: Disambiguated from scene_render_preview (playblast a frame from a chosen camera with the HUD suppressed) — scene_viewport_snapshot captures the panel exactly as the artist sees it, HUD included. GUI sessions only - headless (mayapy/batch/native-channel) sessions get a structured gui_session_required error. The capture is what the artist sees: viewport HUD, selection highlights and ornaments included. That is a feature - the agent verifies exactly what the user is looking at. A cmds.refresh(force=True) runs first so the frame is…

ParameterTypeDescription
formatstring"jpeg" (default, small) or "png". png recommended for wireframe/line-art review.
max_sizeintegerLongest-side pixel cap for the returned image (default 800 - keeps base64 well under client image token limits).
qualityintegerJPEG quality 1-100 (ignored for png).
session_keyMaya session key.

scene_render_preview Scene Render Preview

Single-frame playblast preview from a camera (clean, no HUD). Boundary: Disambiguated from scene_viewport_snapshot (capture the panel as the artist sees it, HUD and selection highlights included) — scene_render_preview renders a chosen camera with the HUD suppressed. GUI sessions only - headless sessions get a structured gui_session_required error. Side-effect disclosures (read_only_hint is honest): 1. Switching the panel camera via the modelPanel camera flag is instantaneous, visible, and NOT undoable in Maya. 2. Everything is put back: the panel camera is restored on every path -…

ParameterTypeDescription
cameraCamera to look through (default: the panel's current camera).
formatstring"jpeg" (default) or "png". png recommended for wireframe/line-art review.
heightintegerFrame height (default 360). Same /4 rule.
max_sizeintegerLongest-side cap for the returned image.
qualityintegerJPEG quality 1-100.
session_keyMaya session key.
widthintegerFrame width in pixels (default 640). Rounded UP to a multiple of 4 server-side (playblast constraint); the actual size may also be clamped by the viewport - trust the returned metadata, not the reques…

asset_import Asset Import

Import a Poly Haven CC0 model into Maya (find ids via asset_search). Boundary: Disambiguated from asset_search (host-side id and metadata lookup that touches no Maya session) — asset_import is the mutating half and needs a live session to import into. Pipeline: host downloads FBX + textures from the Poly Haven whitelist (https-only, size caps, per-file md5 verify) into the platformdirs cache -> Maya imports the local FBX (explicit meters unit handling) -> texture maps auto-wire by PH naming convention (diff/albedo -> color sRGB; rough/metal -> Raw single-channel; nor_gl -> bump2d normal) -…

ParameterTypeDescription
asset_id *stringPoly Haven asset id (case-sensitive, e.g. 'Camera_01').
allow_high_polycountbooleanOverride the polycount guard (the override is written to the call record).
forcebooleanRe-import even when GRP_asset_<id> already exists.
max_polycountintegerFace-count guard (default 100000); imports over the limit are deleted and rejected.
resolutionstringTexture tier '1k' (default), '2k', '4k', '8k'.
session_keyMaya session key.

scene_export Scene Export

Export the Maya scene (or named objects) to a local file. Writes through cmds.file with prompt=False forced (a modal dialog would hang the command channel). Formats: fbx, obj, usd (Alembic is not supported - its AbcExport API is not a cmds.file surface). The selection set is restored after every objects= export and the scene's modified flag is untouched. destructive_hint is False but note: overwrite=True permanently replaces the target file - that path is not recoverable.

ParameterTypeDescription
path *stringTarget file path on the Maya host. Normalized and auto-parented (missing directories are created). An existing file is rejected unless overwrite=True.
format"fbx", "obj", or "usd". Optional when the path carries a recognizable extension; a missing extension is appended for an explicit format, and a conflicting extension+format pair is an error, never a gu…
objectsNode names to export. None (default) exports the whole scene via exportAll; a list is pre-validated (any missing name aborts - no partial export) and drives exportSelected.
overwritebooleanReplace an existing target file (default False).
session_keyMaya session key.

scene_describe Scene Describe

API-level self-description of ONE node (not spatial). Boundary: scene_inspect answers WHERE an object is (position, bbox, neighbors); scene_nodes discovers candidate node names; scene_describe answers WHAT the node is at the API level - exact node type, per-attribute metadata, and connection wiring - so you can compose accurate execute_code/setAttr/connectAttr calls against real names.

ParameterTypeDescription
node *stringNode name (short name or long DAG path).
attrsAttribute names to describe; None (default) lists every attribute listAttr reports UP TO the response budget (limit) - over-budget output is truncated and disclosed via attrs_truncated + total_count,…
include_connectionsbooleanReturn connection wiring {src_plug, dst_plug, direction} (default True); the same budget applies (connections_truncated + total_connections; no cursor in v1 - narrow and re-query).
include_valuesbooleanAlso return value + soft_min/soft_max per attr (default False). Reading a value can trigger DG evaluation inside Maya - still read-only, but the eval may cost time on heavy graphs.
limitintegerMax items returned per face (attrs and connections). Soft default 200; a caller may relax explicitly to the hard cap 1000 - bounds response size only, not the per-attribute query cost.
session_keyMaya session key (auto-selected if one session).

scene_nodes Scene Nodes

Bounded enumeration of scene nodes - including non-DAG nodes. Boundary: scene_snapshot is the low-resolution spatial overview you call once per workflow; scene_nodes is the name-discovery complement for the API layer - it lists nodes a spatial view never shows (materials, shadingEngines, tool nodes) and pages honestly: has_more/next_cursor tell you when the list was cut (for attribute schema and connection inspection, call scene_describe).

ParameterTypeDescription
cursorOpaque page token from a previous call's next_cursor; valid while the scene is unchanged.
dag_onlybooleanOnly DAG nodes (transforms/shapes); False includes dependency nodes such as materials and utility nodes.
include_type_countsbooleanAlso return per-type counts over the full match set (not just the page).
inheritedbooleanSee type.
limitintegerPage size (default 50, hard-capped at 100).
patternMaya glob pattern on names (e.g. "GEO_*").
session_keyMaya session key (auto-selected if one session).
typeNode type filter. With inherited=True (default) derived types match too (ls type= semantics, e.g. type="light" matches spotLight/directionalLight); inherited=False pins the exact type.

list_sessions List Sessions

List all active Maya sessions. Boundary: Disambiguated from add_session (register a host:port by hand) and maya_setup_guide (diagnose an empty result) — list_sessions only reports what is already connected. Returns a list of session information including: - session_key: Session key used to interact with tools and resources - host: Session host address - port: Session port number - pid: Maya process ID - user: Logged-in user - maya_version: Maya version string - scene_name: Current scene filename - scene_path: Full path to current scene Note: To detect new or removed sessions, clients shou…

maya_setup_guide Maya Setup Guide

Maya connection setup guide and diagnostics. Boundary: Disambiguated from list_sessions (read the current session set) and add_session (attach a host:port you already know) — maya_setup_guide diagnoses and repairs the connection itself. Use this tool when list_sessions returns empty or when setting up Maya MCP for the first time. Provides platform-aware diagnostics, auto-installation of userSetup.py, and step-by-step fallback instructions.

ParameterTypeDescription
actionstringWhat to do: - "diagnose": Run connection diagnostics and return status - "install": Merge the managed block into userSetup.py. Existing files without the block require a second call with confirm=T…
confirmbooleanRequired to write into an existing userSetup.py that has no mcp-for-maya managed block (first install call is dry-run).
dry_runbooleanPreview the install: return the proposed block without writing anything.
portintegerMaya command port number (default: 7001)
remove_empty_filebooleanOn uninstall, delete the file when it only contained the managed block.
target_versionSpecific Maya version (e.g., "2024"). If None, targets all detected versions.

write_module Write Module

Create a virtual in-memory Python module in an active Maya session. Injects reusable Python functions into the target Maya session's sys.modules. Modules are virtual and in-memory: they do not persist across Maya restarts, and existing modules are protected unless overwrite=True is explicitly set. Requires an active Maya session. Under safe_mode (MAYA_MCP_SAFE_MODE, opt-in, default off) this code payload passes the same deny-by-default allowlist as execute_code: non-allowlisted imports, denied builtin names (any reference, not just calls), __builtins__ references, dunder attribute access, an…

ParameterTypeDescription
code *stringPython source code for the module.
name *stringModule name. Can be a dotted path (e.g., 'mypackage.utils') in which case parent packages are created automatically.
overwritebooleanIf True, overwrite and replace existing module. If False, raise error if module already exists.
session_keyMaya session key (optional if only one active session exists).

execute_code Execute Code

Execute arbitrary Python code in an active Maya session. Runs arbitrary code with full session privileges of the connected Maya process. Execution is irreversible and cannot be undone (modifications do not register an automatic undo chunk). The return value shape is governed by the result_type envelope parameter. Requires an established Maya session (discoverable via list_sessions). Under safe_mode (MAYA_MCP_SAFE_MODE, opt-in, default off) the code payload passes a deny-by-default allowlist checked on the parsed code before dispatch: imports outside the v1 roots (maya/math/json/re/collection…

ParameterTypeDescription
code *stringPython code to execute in Maya.
result_typestringReturn envelope handling for the execution result: - "NONE": Execute statements, don't capture result (returns None) - "JSON": Evaluate expression, JSON-encode result - "RAW": Evaluate expression, ret…
session_keyMaya session key (optional if only one session exists).

add_session Add Session

Manually add a Maya session at a specific host and port. Boundary: Disambiguated from list_sessions (report the sessions the SessionManager already discovered) and maya_setup_guide (diagnose and repair a connection) — add_session registers a host:port you already know. Use this when auto-discovery doesn't find your Maya session, or to connect to a Maya instance on a specific port.

ParameterTypeDescription
hoststringThe session host (default: "127.0.0.1")
portintegerThe session port number (default: 7001)