API Reference¶
This is the generated Python API reference for Maya MCP.
Use it when you are working directly against the Python package. If you are integrating through MCP, start with Getting Started and Tool Guide first.
Typed Result Models¶
Tool functions return plain dictionaries at runtime, but high-use tools expose
TypedDict result models in their public Python annotations. These models
describe the same keys documented in the tool contracts; they do not change
MCP JSON response shapes or error conventions.
Nodes¶
| Model | Backing tools |
|---|---|
maya_mcp.tools.nodes.NodesListOutput |
nodes.list |
maya_mcp.tools.nodes.NodesCreateOutput |
nodes.create |
maya_mcp.tools.nodes.NodesInfoOutput |
nodes.info |
maya_mcp.tools.nodes.NodesDeleteOutput |
nodes.delete |
maya_mcp.tools.nodes.NodesRenameOutput |
nodes.rename |
maya_mcp.tools.nodes.NodesParentOutput |
nodes.parent |
maya_mcp.tools.nodes.NodesDuplicateOutput |
nodes.duplicate |
Attributes¶
| Model | Backing tools |
|---|---|
maya_mcp.tools.attributes.AttributesGetOutput |
attributes.get |
maya_mcp.tools.attributes.AttributesSetOutput |
attributes.set |
Selection¶
| Model | Backing tools |
|---|---|
maya_mcp.tools.selection.SelectionOutput |
selection.get, selection.set, selection.clear |
maya_mcp.tools.selection.SelectionWithErrorsOutput |
selection.set_components |
maya_mcp.tools.selection.SelectionComponentsOutput |
selection.get_components |
maya_mcp.tools.selection.SelectionConvertComponentsOutput |
selection.convert_components |
Mesh¶
| Model | Backing tools |
|---|---|
maya_mcp.tools.mesh.MeshInfoOutput |
mesh.info |
maya_mcp.tools.mesh.MeshVerticesOutput |
mesh.vertices |
maya_mcp.tools.mesh.MeshEvaluateOutput |
mesh.evaluate |
Connections¶
| Model | Backing tools |
|---|---|
maya_mcp.tools.connections.ConnectionEntry |
connections.list |
maya_mcp.tools.connections.ConnectionsListOutput |
connections.list |
maya_mcp.tools.connections.ConnectionAttributeInfo |
connections.get |
maya_mcp.tools.connections.ConnectionsGetOutput |
connections.get |
maya_mcp.tools.connections.ConnectionsConnectOutput |
connections.connect |
maya_mcp.tools.connections.ConnectionPair |
connections.disconnect |
maya_mcp.tools.connections.ConnectionsDisconnectOutput |
connections.disconnect |
maya_mcp.tools.connections.ConnectionHistoryEntry |
connections.history |
maya_mcp.tools.connections.ConnectionsHistoryOutput |
connections.history |
Viewport¶
| Model | Backing tools |
|---|---|
maya_mcp.tools.viewport.ViewportCaptureOutput |
viewport.capture |
Modeling¶
| Model | Backing tools |
|---|---|
maya_mcp.tools.modeling.ModelingCreatePolygonPrimitiveOutput |
modeling.create_polygon_primitive |
maya_mcp.tools.modeling.ModelingExtrudeFacesOutput |
modeling.extrude_faces |
maya_mcp.tools.modeling.ModelingBooleanOutput |
modeling.boolean |
maya_mcp.tools.modeling.ModelingCombineOutput |
modeling.combine |
maya_mcp.tools.modeling.ModelingSeparateOutput |
modeling.separate |
maya_mcp.tools.modeling.ModelingMergeVerticesOutput |
modeling.merge_vertices |
maya_mcp.tools.modeling.ModelingBevelOutput |
modeling.bevel |
maya_mcp.tools.modeling.ModelingBridgeOutput |
modeling.bridge |
maya_mcp.tools.modeling.ModelingInsertEdgeLoopOutput |
modeling.insert_edge_loop |
maya_mcp.tools.modeling.ModelingDeleteFacesOutput |
modeling.delete_faces |
maya_mcp.tools.modeling.ModelingMoveComponentsOutput |
modeling.move_components |
maya_mcp.tools.modeling.ModelingFreezeTransformsOutput |
modeling.freeze_transforms |
maya_mcp.tools.modeling.ModelingDeleteHistoryOutput |
modeling.delete_history |
maya_mcp.tools.modeling.ModelingCenterPivotOutput |
modeling.center_pivot |
maya_mcp.tools.modeling.ModelingSetPivotOutput |
modeling.set_pivot |
Shading¶
| Model | Backing tools |
|---|---|
maya_mcp.tools.shading.ShadingCreateMaterialOutput |
shading.create_material |
maya_mcp.tools.shading.ShadingAssignMaterialOutput |
shading.assign_material |
maya_mcp.tools.shading.ShadingSetMaterialColorOutput |
shading.set_material_color |
Curves¶
| Model | Backing tools |
|---|---|
maya_mcp.tools.curve.CurveInfoOutput |
curve.info |
maya_mcp.tools.curve.CurveCvsOutput |
curve.cvs |
Skinning¶
| Model | Backing tools |
|---|---|
maya_mcp.tools.skin.SkinBindOutput |
skin.bind |
maya_mcp.tools.skin.SkinUnbindOutput |
skin.unbind |
maya_mcp.tools.skin.SkinInfluenceEntry |
skin.influences |
maya_mcp.tools.skin.SkinInfluencesOutput |
skin.influences |
maya_mcp.tools.skin.SkinWeightEntry |
skin.weights.get |
maya_mcp.tools.skin.SkinWeightsGetOutput |
skin.weights.get |
maya_mcp.tools.skin.SkinWeightsSetOutput |
skin.weights.set |
maya_mcp.tools.skin.SkinCopyWeightsOutput |
skin.copy_weights |
Animation¶
| Model | Backing tools |
|---|---|
maya_mcp.tools.animation.AnimationSetTimeOutput |
animation.set_time |
maya_mcp.tools.animation.AnimationGetTimeRangeOutput |
animation.get_time_range |
maya_mcp.tools.animation.AnimationSetTimeRangeOutput |
animation.set_time_range |
maya_mcp.tools.animation.AnimationSetKeyframeOutput |
animation.set_keyframe |
maya_mcp.tools.animation.KeyframeEntry |
animation.get_keyframes |
maya_mcp.tools.animation.AnimationGetKeyframesOutput |
animation.get_keyframes |
maya_mcp.tools.animation.AnimationDeleteKeyframesOutput |
animation.delete_keyframes |
Scripts¶
| Model | Backing tools |
|---|---|
maya_mcp.tools.scripts.ScriptListEntry |
script.list |
maya_mcp.tools.scripts.ScriptListOutput |
script.list |
maya_mcp.tools.scripts.ScriptExecuteOutput |
script.execute |
maya_mcp.tools.scripts.ScriptRunOutput |
script.run |
Package¶
maya_mcp
¶
Maya MCP Server.
A Model Context Protocol (MCP) server for controlling Autodesk Maya via its commandPort socket interface.
This package provides
- MCP tools for interacting with Maya (scene, nodes, selection, etc.)
- A transport layer for Maya commandPort communication
- Typed error handling and resilience features
Example
Run the MCP server::
python -m maya_mcp.server
Or import and use programmatically::
from maya_mcp.server import mcp
mcp.run()
Note
This package does NOT import any Maya modules directly. All communication with Maya happens via TCP socket to Maya's commandPort.
MayaCommandError
dataclass
¶
MayaCommandError(message: str, details: dict[str, Any] = dict(), command: str = '', maya_error: str = '')
Bases: MayaMCPError
Raised when a Maya command fails to execute.
This error indicates that the command was sent to Maya but failed during execution. The command syntax may be invalid, or the operation may have failed for other reasons.
| ATTRIBUTE | DESCRIPTION |
|---|---|
message |
Human-readable error description.
TYPE:
|
command |
The command that failed (may be truncated for security).
TYPE:
|
maya_error |
The error message returned by Maya.
TYPE:
|
MayaMCPError
dataclass
¶
Bases: Exception
Base exception for all Maya MCP errors.
All errors raised by Maya MCP inherit from this class, making it easy to catch all Maya MCP-related exceptions with a single handler.
| ATTRIBUTE | DESCRIPTION |
|---|---|
message |
Human-readable error description.
TYPE:
|
details |
Additional context as key-value pairs.
TYPE:
|
MayaTimeoutError
dataclass
¶
MayaTimeoutError(message: str, details: dict[str, Any] = dict(), timeout_seconds: float = 0.0, operation: str = '')
Bases: MayaMCPError
Raised when a Maya operation times out.
This error indicates that a command was sent to Maya but no response was received within the configured timeout period.
| ATTRIBUTE | DESCRIPTION |
|---|---|
message |
Human-readable error description.
TYPE:
|
timeout_seconds |
The timeout value that was exceeded.
TYPE:
|
operation |
Description of the operation that timed out.
TYPE:
|
MayaUnavailableError
dataclass
¶
MayaUnavailableError(message: str, details: dict[str, Any] = dict(), host: str = 'localhost', port: int = 7001, attempts: int = 0, last_error: str | None = None)
Bases: MayaMCPError
Raised when Maya cannot be reached via commandPort.
This error indicates that the MCP server cannot establish a connection to Maya's commandPort. This typically happens when:
- Maya is not running
- commandPort is not open in Maya
- Network/socket issues
| ATTRIBUTE | DESCRIPTION |
|---|---|
message |
Human-readable error description.
TYPE:
|
host |
Target host that was attempted.
TYPE:
|
port |
Target port that was attempted.
TYPE:
|
attempts |
Number of connection attempts made.
TYPE:
|
last_error |
The last underlying error message, if any.
TYPE:
|
ConnectionStatus
¶
Bases: Enum
Connection status for Maya commandPort.
| ATTRIBUTE | DESCRIPTION |
|---|---|
OK |
Connected and responsive.
|
OFFLINE |
Not connected, no active connection attempts.
|
RECONNECTING |
Attempting to establish/re-establish connection.
|
Server¶
server
¶
Maya MCP Server entrypoint.
This module creates and configures the FastMCP server instance, registers all tools, and provides the main entry point.
Example
Run the server::
python -m maya_mcp.server
Or use the CLI::
maya-mcp
Or import and use programmatically::
from maya_mcp.server import mcp
mcp.run()
Errors¶
errors
¶
Typed error classes for Maya MCP.
This module defines the error hierarchy used throughout Maya MCP. All errors inherit from MayaMCPError, making it easy to catch all Maya MCP-related exceptions.
Example
Handling Maya errors::
from maya_mcp.errors import MayaUnavailableError, MayaCommandError
try:
result = client.execute("cmds.ls()")
except MayaUnavailableError as e:
print(f"Maya not available: {e.message}")
except MayaCommandError as e:
print(f"Command failed: {e.message}")
MayaMCPError
dataclass
¶
Bases: Exception
Base exception for all Maya MCP errors.
All errors raised by Maya MCP inherit from this class, making it easy to catch all Maya MCP-related exceptions with a single handler.
| ATTRIBUTE | DESCRIPTION |
|---|---|
message |
Human-readable error description.
TYPE:
|
details |
Additional context as key-value pairs.
TYPE:
|
MayaUnavailableError
dataclass
¶
MayaUnavailableError(message: str, details: dict[str, Any] = dict(), host: str = 'localhost', port: int = 7001, attempts: int = 0, last_error: str | None = None)
Bases: MayaMCPError
Raised when Maya cannot be reached via commandPort.
This error indicates that the MCP server cannot establish a connection to Maya's commandPort. This typically happens when:
- Maya is not running
- commandPort is not open in Maya
- Network/socket issues
| ATTRIBUTE | DESCRIPTION |
|---|---|
message |
Human-readable error description.
TYPE:
|
host |
Target host that was attempted.
TYPE:
|
port |
Target port that was attempted.
TYPE:
|
attempts |
Number of connection attempts made.
TYPE:
|
last_error |
The last underlying error message, if any.
TYPE:
|
MayaCommandError
dataclass
¶
MayaCommandError(message: str, details: dict[str, Any] = dict(), command: str = '', maya_error: str = '')
Bases: MayaMCPError
Raised when a Maya command fails to execute.
This error indicates that the command was sent to Maya but failed during execution. The command syntax may be invalid, or the operation may have failed for other reasons.
| ATTRIBUTE | DESCRIPTION |
|---|---|
message |
Human-readable error description.
TYPE:
|
command |
The command that failed (may be truncated for security).
TYPE:
|
maya_error |
The error message returned by Maya.
TYPE:
|
MayaTimeoutError
dataclass
¶
MayaTimeoutError(message: str, details: dict[str, Any] = dict(), timeout_seconds: float = 0.0, operation: str = '')
Bases: MayaMCPError
Raised when a Maya operation times out.
This error indicates that a command was sent to Maya but no response was received within the configured timeout period.
| ATTRIBUTE | DESCRIPTION |
|---|---|
message |
Human-readable error description.
TYPE:
|
timeout_seconds |
The timeout value that was exceeded.
TYPE:
|
operation |
Description of the operation that timed out.
TYPE:
|
ValidationError
dataclass
¶
ValidationError(message: str, details: dict[str, Any] = dict(), field_name: str = '', value: str = '', constraint: str = '')
Bases: MayaMCPError
Raised when input validation fails.
This error indicates that the input parameters to a tool or function did not pass validation.
| ATTRIBUTE | DESCRIPTION |
|---|---|
message |
Human-readable error description.
TYPE:
|
field |
The name of the field that failed validation.
TYPE:
|
value |
The invalid value (sanitized for security).
TYPE:
|
constraint |
Description of the violated constraint.
TYPE:
|
Types¶
types
¶
Type definitions for Maya MCP.
This module contains all shared type definitions used throughout Maya MCP, including enums, dataclasses, and type aliases.
These types are designed to be stable and form the public API contract that MCP clients can rely on.
ConnectionStatus
¶
Bases: Enum
Connection status for Maya commandPort.
| ATTRIBUTE | DESCRIPTION |
|---|---|
OK |
Connected and responsive.
|
OFFLINE |
Not connected, no active connection attempts.
|
RECONNECTING |
Attempting to establish/re-establish connection.
|
ConnectionConfig
dataclass
¶
ConnectionConfig(host: str = 'localhost', port: int = 7001, connect_timeout: float = 5.0, command_timeout: float = 30.0, max_retries: int = 3, retry_base_delay: float = 0.5)
Configuration for Maya commandPort connection.
| ATTRIBUTE | DESCRIPTION |
|---|---|
host |
Target host (localhost only in v0).
TYPE:
|
port |
Target port number.
TYPE:
|
connect_timeout |
Connection timeout in seconds.
TYPE:
|
command_timeout |
Command execution timeout in seconds.
TYPE:
|
max_retries |
Maximum number of connection retry attempts.
TYPE:
|
retry_base_delay |
Base delay for exponential backoff (seconds).
TYPE:
|
HealthCheckResult
dataclass
¶
HealthCheckResult(status: Literal['ok', 'offline', 'reconnecting'], last_error: str | None, last_contact: str | None, host: str, port: int)
Result of a health check operation.
| ATTRIBUTE | DESCRIPTION |
|---|---|
status |
Current connection status.
TYPE:
|
last_error |
Last error message, if any.
TYPE:
|
last_contact |
Timestamp of last successful contact with Maya.
TYPE:
|
host |
Current target host.
TYPE:
|
port |
Current target port.
TYPE:
|
ConnectResult
dataclass
¶
Result of a connection attempt.
| ATTRIBUTE | DESCRIPTION |
|---|---|
connected |
Whether connection was successful.
TYPE:
|
host |
Target host.
TYPE:
|
port |
Target port.
TYPE:
|
error |
Error message if connection failed.
TYPE:
|
DisconnectResult
dataclass
¶
Result of a disconnect operation.
| ATTRIBUTE | DESCRIPTION |
|---|---|
disconnected |
Whether disconnect was successful.
TYPE:
|
was_connected |
Whether was connected before disconnect.
TYPE:
|
SceneInfo
dataclass
¶
SceneInfo(file_path: str | None, modified: bool, fps: float, frame_range: tuple[float, float], up_axis: Literal['y', 'z'])
Information about the current Maya scene.
| ATTRIBUTE | DESCRIPTION |
|---|---|
file_path |
Path to the current scene file, or None if untitled.
TYPE:
|
modified |
Whether the scene has unsaved changes.
TYPE:
|
fps |
Frames per second.
TYPE:
|
frame_range |
Tuple of (start_frame, end_frame).
TYPE:
|
up_axis |
Scene up axis ('y' or 'z').
TYPE:
|
NodeListResult
dataclass
¶
Result of a node listing operation.
| ATTRIBUTE | DESCRIPTION |
|---|---|
nodes |
List of node names.
TYPE:
|
count |
Number of nodes in the list.
TYPE:
|
SelectionResult
dataclass
¶
Result of a selection query or modification.
| ATTRIBUTE | DESCRIPTION |
|---|---|
selection |
List of selected node names.
TYPE:
|
count |
Number of selected items.
TYPE:
|
ClientState
dataclass
¶
ClientState(status: ConnectionStatus = OFFLINE, last_error: str | None = None, last_contact: datetime | None = None, config: ConnectionConfig = ConnectionConfig())
Internal state of the CommandPort client.
| ATTRIBUTE | DESCRIPTION |
|---|---|
status |
Current connection status.
TYPE:
|
last_error |
Last error encountered.
TYPE:
|
last_contact |
Timestamp of last successful Maya contact.
TYPE:
|
config |
Current connection configuration.
TYPE:
|
Transport¶
transport
¶
Transport layer for Maya MCP.
This package provides the communication layer between Maya MCP and Maya's commandPort socket interface.
CommandPortClient
¶
CommandPortClient(host: str = 'localhost', port: int = 7001, connect_timeout: float = 5.0, command_timeout: float = 30.0, max_retries: int = 3, retry_base_delay: float = 0.5)
Client for communicating with Maya via commandPort.
This client manages socket connections to Maya's commandPort, handles timeouts and retries, and translates errors to typed exceptions.
The client is designed for Level 1 resilience
- Detects when Maya is unavailable
- Returns typed errors
- Automatically reconnects on next call when Maya restarts
| ATTRIBUTE | DESCRIPTION |
|---|---|
config |
Connection configuration.
|
state |
Current client state.
|
Example
Basic usage::
client = CommandPortClient(host="localhost", port=7001)
try:
client.connect()
result = client.execute("cmds.ls()")
print(result)
finally:
client.disconnect()
With custom timeouts::
client = CommandPortClient(
connect_timeout=10.0,
command_timeout=60.0,
max_retries=5,
)
Initialize the CommandPortClient.
| PARAMETER | DESCRIPTION |
|---|---|
host
|
Target host. Only "localhost" or "127.0.0.1" are supported.
TYPE:
|
port
|
Target port number (1-65535).
TYPE:
|
connect_timeout
|
Connection timeout in seconds.
TYPE:
|
command_timeout
|
Command execution timeout in seconds.
TYPE:
|
max_retries
|
Maximum number of connection retry attempts.
TYPE:
|
retry_base_delay
|
Base delay for exponential backoff (seconds).
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If configuration is invalid. |
Source code in src/maya_mcp/transport/commandport.py
connect
¶
Establish connection to Maya commandPort.
Attempts to connect to Maya's commandPort with retry logic. Uses exponential backoff between retry attempts.
| RETURNS | DESCRIPTION |
|---|---|
bool
|
True if connection was successful. |
| RAISES | DESCRIPTION |
|---|---|
MayaUnavailableError
|
If connection fails after all retries. |
Example
client = CommandPortClient() if client.connect(): ... print("Connected to Maya")
Source code in src/maya_mcp/transport/commandport.py
235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 | |
disconnect
¶
Close the connection to Maya.
| RETURNS | DESCRIPTION |
|---|---|
bool
|
True if disconnection was successful, False if wasn't connected. |
Example
client.disconnect() True
Source code in src/maya_mcp/transport/commandport.py
execute
¶
Execute a Python command in Maya and return the result.
Sends a command to Maya via commandPort and waits for the response. Automatically connects if not already connected. If the connection drops during the send phase, reconnects and retries once.
| PARAMETER | DESCRIPTION |
|---|---|
command
|
Python code to execute in Maya.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
str
|
Command output as string. |
| RAISES | DESCRIPTION |
|---|---|
MayaUnavailableError
|
Cannot connect to Maya. |
MayaCommandError
|
Command execution failed. |
MayaTimeoutError
|
Command timed out. |
Example
result = client.execute("cmds.ls(selection=True)") print(result) ['pCube1', 'pSphere1']
Source code in src/maya_mcp/transport/commandport.py
is_connected
¶
Check if currently connected to Maya.
| RETURNS | DESCRIPTION |
|---|---|
bool
|
True if socket is connected. |
Example
if client.is_connected(): ... print("Connected")
Source code in src/maya_mcp/transport/commandport.py
get_status
¶
get_status() -> ConnectionStatus
Get the current connection status.
| RETURNS | DESCRIPTION |
|---|---|
ConnectionStatus
|
Current ConnectionStatus enum value. |
Example
status = client.get_status() if status == ConnectionStatus.OK: ... print("Connected and healthy")
Source code in src/maya_mcp/transport/commandport.py
get_health
¶
get_health() -> HealthCheckResult
Get detailed health information.
| RETURNS | DESCRIPTION |
|---|---|
HealthCheckResult
|
HealthCheckResult with current connection health details. |
Example
health = client.get_health() print(f"Status: {health.status}")
Source code in src/maya_mcp/transport/commandport.py
reconfigure
¶
Update connection configuration.
Disconnects if currently connected and updates the configuration.
| PARAMETER | DESCRIPTION |
|---|---|
host
|
New target host (optional).
TYPE:
|
port
|
New target port (optional).
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If new configuration is invalid. |
Example
client.reconfigure(port=7002)
Source code in src/maya_mcp/transport/commandport.py
get_client
¶
get_client() -> CommandPortClient
Get the global CommandPortClient instance.
Returns a singleton CommandPortClient instance, creating it if necessary. This is the recommended way to get a client for use in MCP tools.
| RETURNS | DESCRIPTION |
|---|---|
CommandPortClient
|
The global CommandPortClient instance. |
Example
client = get_client() client.execute("cmds.ls()")
Source code in src/maya_mcp/transport/commandport.py
commandport
¶
Maya commandPort client.
This module provides the CommandPortClient class for communicating with Maya via its commandPort socket interface.
The client handles
- TCP socket connection management
- Command encoding (UTF-8)
- Response parsing
- Timeout enforcement
- Retry with exponential backoff
- Error translation to typed exceptions
Example
Basic usage::
from maya_mcp.transport import CommandPortClient
client = CommandPortClient()
client.connect()
result = client.execute("cmds.ls(selection=True)")
client.disconnect()
Note
This module does NOT import any Maya modules. All communication happens via TCP socket.
CommandPortClient
¶
CommandPortClient(host: str = 'localhost', port: int = 7001, connect_timeout: float = 5.0, command_timeout: float = 30.0, max_retries: int = 3, retry_base_delay: float = 0.5)
Client for communicating with Maya via commandPort.
This client manages socket connections to Maya's commandPort, handles timeouts and retries, and translates errors to typed exceptions.
The client is designed for Level 1 resilience
- Detects when Maya is unavailable
- Returns typed errors
- Automatically reconnects on next call when Maya restarts
| ATTRIBUTE | DESCRIPTION |
|---|---|
config |
Connection configuration.
|
state |
Current client state.
|
Example
Basic usage::
client = CommandPortClient(host="localhost", port=7001)
try:
client.connect()
result = client.execute("cmds.ls()")
print(result)
finally:
client.disconnect()
With custom timeouts::
client = CommandPortClient(
connect_timeout=10.0,
command_timeout=60.0,
max_retries=5,
)
Initialize the CommandPortClient.
| PARAMETER | DESCRIPTION |
|---|---|
host
|
Target host. Only "localhost" or "127.0.0.1" are supported.
TYPE:
|
port
|
Target port number (1-65535).
TYPE:
|
connect_timeout
|
Connection timeout in seconds.
TYPE:
|
command_timeout
|
Command execution timeout in seconds.
TYPE:
|
max_retries
|
Maximum number of connection retry attempts.
TYPE:
|
retry_base_delay
|
Base delay for exponential backoff (seconds).
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If configuration is invalid. |
Source code in src/maya_mcp/transport/commandport.py
connect
¶
Establish connection to Maya commandPort.
Attempts to connect to Maya's commandPort with retry logic. Uses exponential backoff between retry attempts.
| RETURNS | DESCRIPTION |
|---|---|
bool
|
True if connection was successful. |
| RAISES | DESCRIPTION |
|---|---|
MayaUnavailableError
|
If connection fails after all retries. |
Example
client = CommandPortClient() if client.connect(): ... print("Connected to Maya")
Source code in src/maya_mcp/transport/commandport.py
235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 | |
disconnect
¶
Close the connection to Maya.
| RETURNS | DESCRIPTION |
|---|---|
bool
|
True if disconnection was successful, False if wasn't connected. |
Example
client.disconnect() True
Source code in src/maya_mcp/transport/commandport.py
execute
¶
Execute a Python command in Maya and return the result.
Sends a command to Maya via commandPort and waits for the response. Automatically connects if not already connected. If the connection drops during the send phase, reconnects and retries once.
| PARAMETER | DESCRIPTION |
|---|---|
command
|
Python code to execute in Maya.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
str
|
Command output as string. |
| RAISES | DESCRIPTION |
|---|---|
MayaUnavailableError
|
Cannot connect to Maya. |
MayaCommandError
|
Command execution failed. |
MayaTimeoutError
|
Command timed out. |
Example
result = client.execute("cmds.ls(selection=True)") print(result) ['pCube1', 'pSphere1']
Source code in src/maya_mcp/transport/commandport.py
is_connected
¶
Check if currently connected to Maya.
| RETURNS | DESCRIPTION |
|---|---|
bool
|
True if socket is connected. |
Example
if client.is_connected(): ... print("Connected")
Source code in src/maya_mcp/transport/commandport.py
get_status
¶
get_status() -> ConnectionStatus
Get the current connection status.
| RETURNS | DESCRIPTION |
|---|---|
ConnectionStatus
|
Current ConnectionStatus enum value. |
Example
status = client.get_status() if status == ConnectionStatus.OK: ... print("Connected and healthy")
Source code in src/maya_mcp/transport/commandport.py
get_health
¶
get_health() -> HealthCheckResult
Get detailed health information.
| RETURNS | DESCRIPTION |
|---|---|
HealthCheckResult
|
HealthCheckResult with current connection health details. |
Example
health = client.get_health() print(f"Status: {health.status}")
Source code in src/maya_mcp/transport/commandport.py
reconfigure
¶
Update connection configuration.
Disconnects if currently connected and updates the configuration.
| PARAMETER | DESCRIPTION |
|---|---|
host
|
New target host (optional).
TYPE:
|
port
|
New target port (optional).
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If new configuration is invalid. |
Example
client.reconfigure(port=7002)
Source code in src/maya_mcp/transport/commandport.py
get_client
¶
get_client() -> CommandPortClient
Get the global CommandPortClient instance.
Returns a singleton CommandPortClient instance, creating it if necessary. This is the recommended way to get a client for use in MCP tools.
| RETURNS | DESCRIPTION |
|---|---|
CommandPortClient
|
The global CommandPortClient instance. |
Example
client = get_client() client.execute("cmds.ls()")
Source code in src/maya_mcp/transport/commandport.py
Tool Modules¶
Health¶
health
¶
Health check tool for Maya MCP.
This module provides the health.check tool for monitoring the connection status between Maya MCP and Maya.
HealthCheckOutput
¶
Bases: TypedDict
Return payload for the health.check tool.
health_check
¶
health_check() -> HealthCheckOutput
Check the health status of the Maya connection.
Returns current connection status, last error (if any), last successful contact timestamp, and connection configuration.
| RETURNS | DESCRIPTION |
|---|---|
HealthCheckOutput
|
Dictionary with health check results: - status: "ok" | "offline" | "reconnecting" - last_error: Last error message or None - last_contact: ISO8601 timestamp or None - host: Current target host - port: Current target port |
Example
result = health_check() print(result["status"]) 'ok'
Source code in src/maya_mcp/tools/health.py
Connection¶
connection
¶
Connection management tools for Maya MCP.
This module provides tools for manually controlling the connection to Maya's commandPort. These are optional debugging controls.
MayaConnectOutput
¶
Bases: TypedDict
Return payload for the maya.connect tool.
MayaDisconnectOutput
¶
Bases: TypedDict
Return payload for the maya.disconnect tool.
maya_connect
¶
maya_connect(host: str = 'localhost', port: int = 7001, source_type: Literal['python', 'mel'] = 'python') -> MayaConnectOutput
Establish a connection to Maya's commandPort.
Attempts to connect to Maya at the specified host and port. This is primarily for debugging and explicit connection control.
| PARAMETER | DESCRIPTION |
|---|---|
host
|
Target host. Only "localhost" or "127.0.0.1" are supported.
TYPE:
|
port
|
Target port number (1-65535).
TYPE:
|
source_type
|
Command interpreter type. Currently only "python" is actually used; "mel" is accepted for compatibility.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
MayaConnectOutput
|
Dictionary with connection result: - connected: Whether connection succeeded - host: Target host - port: Target port - error: Error message if connection failed, else None |
Example
result = maya_connect(port=7001) if result["connected"]: ... print("Connected!")
Source code in src/maya_mcp/tools/connection.py
maya_disconnect
¶
maya_disconnect() -> MayaDisconnectOutput
Close the connection to Maya.
Disconnects from Maya's commandPort and moves the client state to offline.
| RETURNS | DESCRIPTION |
|---|---|
MayaDisconnectOutput
|
Dictionary with disconnect result: - disconnected: Whether disconnect was performed - was_connected: Whether was connected before |
Example
result = maya_disconnect() print(f"Was connected: {result['was_connected']}")
Source code in src/maya_mcp/tools/connection.py
Scene¶
scene
¶
Scene tools for Maya MCP.
This module provides tools for querying and manipulating Maya scenes.
SceneInfoOutput
¶
Bases: TypedDict
Return payload for the scene.info tool.
SceneNewOutput
¶
Bases: TypedDict
Return payload for the scene.new tool.
SceneOpenOutput
¶
Bases: TypedDict
Return payload for the scene.open tool.
SceneUndoOutput
¶
Bases: TypedDict
Return payload for the scene.undo tool.
SceneRedoOutput
¶
Bases: TypedDict
Return payload for the scene.redo tool.
SceneSaveOutput
¶
Bases: TypedDict
Return payload for the scene.save tool.
SceneSaveAsOutput
¶
Bases: TypedDict
Return payload for the scene.save_as tool.
SceneImportOutput
¶
Bases: _GuardedOutput
Return payload for the scene.import tool.
SceneExportOutput
¶
Bases: TypedDict
Return payload for the scene.export tool.
scene_info
¶
scene_info() -> SceneInfoOutput
Get information about the current Maya scene.
Returns information about the currently open scene including file path, modification status, frame rate, and frame range.
| RETURNS | DESCRIPTION |
|---|---|
SceneInfoOutput
|
Dictionary with scene information: - file_path: Current scene file path, or None if untitled - modified: Whether scene has unsaved changes - fps: Frames per second - frame_range: [start_frame, end_frame] - up_axis: "y" or "z" |
| RAISES | DESCRIPTION |
|---|---|
MayaUnavailableError
|
If not connected to Maya. |
MayaCommandError
|
If Maya command execution fails. |
Example
info = scene_info() print(f"Scene: {info['file_path']}")
Source code in src/maya_mcp/tools/scene.py
scene_undo
¶
scene_undo() -> SceneUndoOutput
Undo the last operation in Maya.
Critical for LLM error recovery - allows reverting mistakes made during automated operations.
| RETURNS | DESCRIPTION |
|---|---|
SceneUndoOutput
|
Dictionary with undo result: - success: Whether undo succeeded - undone: Description of the undone action, or None - can_undo: Whether more undo operations are available - can_redo: Whether redo is now available |
| RAISES | DESCRIPTION |
|---|---|
MayaUnavailableError
|
If not connected to Maya. |
MayaCommandError
|
If Maya command execution fails. |
Example
result = scene_undo() if result['success']: ... print(f"Undone: {result['undone']}")
Source code in src/maya_mcp/tools/scene.py
scene_new
¶
scene_new(force: bool = False) -> SceneNewOutput
Create a new, empty Maya scene.
Checks whether the current scene has unsaved changes before proceeding.
When force is False (default) and the scene has been modified, the
operation is rejected with an actionable error message instead of
discarding work. When force is True, unsaved changes are discarded
and a new scene is created unconditionally.
Important: This tool never triggers Maya's interactive "Save changes?"
dialog, which would block the commandPort indefinitely. Instead it
pre-checks the modification state and always passes force=True to the
underlying cmds.file(new=True, force=True) call.
| PARAMETER | DESCRIPTION |
|---|---|
force
|
If True, discard unsaved changes and create a new scene. If False (default), refuse when the scene has unsaved changes.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
SceneNewOutput
|
Dictionary with scene_new result: - success: Whether the new scene was created - previous_file: File path of the previous scene (or None) - was_modified: Whether the previous scene had unsaved changes - error: Error message if the operation was refused, or None |
| RAISES | DESCRIPTION |
|---|---|
MayaUnavailableError
|
If not connected to Maya. |
MayaCommandError
|
If Maya command execution fails. |
Example
result = scene_new() if not result['success']: ... print(result['error']) # "Scene has unsaved changes..." result = scene_new(force=True) assert result['success']
Source code in src/maya_mcp/tools/scene.py
scene_open
¶
scene_open(file_path: str, force: bool = False) -> SceneOpenOutput
Open a Maya scene file.
Loads the specified scene file into Maya. Checks whether the current scene
has unsaved changes before proceeding. When force is False (default)
and the scene has been modified, the operation is rejected with an
actionable error message. When force is True, unsaved changes are
discarded and the file is opened unconditionally.
Important: This tool never triggers Maya's interactive "Save changes?"
dialog, which would block the commandPort indefinitely. Instead it
pre-checks the modification state and always passes force=True to the
underlying cmds.file(path, open=True, force=True) call.
The file path is validated before being sent to Maya:
- Must not be empty
- Must not contain shell metacharacters (``;|&$``` etc.)
- Must end with a supported Maya file extension (
.ma,.mb) - The file must exist on disk (verified inside Maya)
| PARAMETER | DESCRIPTION |
|---|---|
file_path
|
Absolute or relative path to the Maya scene file to open.
Supported extensions:
TYPE:
|
force
|
If True, discard unsaved changes and open the file. If False (default), refuse when the current scene has unsaved changes.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
SceneOpenOutput
|
Dictionary with scene_open result: - success: Whether the file was opened - file_path: The opened file path (as reported by Maya), or None - previous_file: File path of the previous scene, or None - was_modified: Whether the previous scene had unsaved changes - error: Error message if the operation was refused, or None |
| RAISES | DESCRIPTION |
|---|---|
ValidationError
|
If the file path is invalid or contains dangerous characters. |
MayaUnavailableError
|
If not connected to Maya. |
MayaCommandError
|
If Maya command execution fails. |
Example
result = scene_open("/path/to/scene.ma") if not result['success']: ... print(result['error']) # "Scene has unsaved changes..." result = scene_open("/path/to/scene.ma", force=True) assert result['success']
Source code in src/maya_mcp/tools/scene.py
393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 | |
scene_redo
¶
scene_redo() -> SceneRedoOutput
Redo the last undone operation in Maya.
Allows re-applying an operation that was previously undone.
| RETURNS | DESCRIPTION |
|---|---|
SceneRedoOutput
|
Dictionary with redo result: - success: Whether redo succeeded - redone: Description of the redone action, or None - can_undo: Whether undo is now available - can_redo: Whether more redo operations are available |
| RAISES | DESCRIPTION |
|---|---|
MayaUnavailableError
|
If not connected to Maya. |
MayaCommandError
|
If Maya command execution fails. |
Example
result = scene_redo() if result['success']: ... print(f"Redone: {result['redone']}")
Source code in src/maya_mcp/tools/scene.py
scene_save
¶
scene_save() -> SceneSaveOutput
Save the current Maya scene.
Saves the currently open scene file. If the scene is untitled (never saved),
the operation is rejected with an error instructing to use scene.save_as.
| RETURNS | DESCRIPTION |
|---|---|
SceneSaveOutput
|
Dictionary with save result: - success: Whether the scene was saved - file_path: The saved file path (or None if failed) - error: Error message if the operation failed, or None |
| RAISES | DESCRIPTION |
|---|---|
MayaUnavailableError
|
If not connected to Maya. |
MayaCommandError
|
If Maya command execution fails. |
Example
result = scene_save() if result['success']: ... print(f"Saved: {result['file_path']}")
Source code in src/maya_mcp/tools/scene.py
scene_save_as
¶
scene_save_as(file_path: str) -> SceneSaveAsOutput
Save the current scene to a new file path.
Renames the current scene and saves it to the specified path.
If the file extension is .ma, it saves as Maya ASCII.
If the file extension is .mb, it saves as Maya Binary.
The file path is validated before being sent to Maya:
- Must not be empty
- Must not contain shell metacharacters
- Must end with a supported Maya file extension (.ma, .mb)
| PARAMETER | DESCRIPTION |
|---|---|
file_path
|
Absolute or relative path to save the scene to.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
SceneSaveAsOutput
|
Dictionary with save result: - success: Whether the scene was saved - file_path: The new file path (or None if failed) - error: Error message if the operation failed, or None |
| RAISES | DESCRIPTION |
|---|---|
ValidationError
|
If the file path is invalid. |
MayaUnavailableError
|
If not connected to Maya. |
MayaCommandError
|
If Maya command execution fails. |
Example
result = scene_save_as("/path/to/new_scene.ma") if result['success']: ... print(f"Saved as: {result['file_path']}")
Source code in src/maya_mcp/tools/scene.py
scene_import
¶
scene_import(file_path: str, namespace: str | None = None, force: bool = False) -> SceneImportOutput
Import a file into the current Maya scene.
Imports geometry, animation, or other scene data from an external file. Supports multiple formats including Maya scenes, OBJ, FBX, Alembic, and USD.
The file path is validated before being sent to Maya: - Must not be empty - Must not contain shell metacharacters (``;|&$``` etc.) - Must end with a supported extension - The file must exist on disk (verified inside Maya)
Token Protection: Returns only top-level parent transforms of imported nodes, not all descendants. This prevents token budget explosion when importing complex assets.
| PARAMETER | DESCRIPTION |
|---|---|
file_path
|
Absolute or relative path to the file to import.
Supported extensions:
TYPE:
|
namespace
|
Namespace behavior:
-
TYPE:
|
force
|
If True, replace existing namespace contents. If False (default), merge with existing namespace.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
SceneImportOutput
|
Dictionary with import result: - success: Whether the file was imported - file_path: The imported file path - nodes: List of top-level parent transforms created by import - count: Number of top-level nodes returned - error: Error message if the operation failed, or None |
| RAISES | DESCRIPTION |
|---|---|
ValidationError
|
If the file path is invalid or contains dangerous characters. |
MayaUnavailableError
|
If not connected to Maya. |
MayaCommandError
|
If Maya command execution fails. |
Example
result = scene_import("/assets/character.fbx", namespace="char") if result['success']: ... print(f"Imported {result['count']} top-level nodes")
Source code in src/maya_mcp/tools/scene.py
734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 | |
scene_export
¶
scene_export(file_path: str, export_mode: str = 'selected', animation: bool = False) -> SceneExportOutput
Export scene content to a file.
Exports the current selection or the entire scene to an external file format. Supports multiple formats including Maya scenes, OBJ, FBX, Alembic, and USD.
The file path is validated before being sent to Maya: - Must not be empty - Must not contain shell metacharacters (``;|&$``` etc.) - Must end with a supported extension
| PARAMETER | DESCRIPTION |
|---|---|
file_path
|
Absolute or relative path for the exported file.
Supported extensions:
TYPE:
|
export_mode
|
What to export:
-
TYPE:
|
animation
|
If True, include animation data in export (FBX only). If False (default), export static geometry only.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
SceneExportOutput
|
Dictionary with export result: - success: Whether the file was exported - file_path: The exported file path - nodes_exported: Number of nodes exported (approximate) - error: Error message if the operation failed, or None |
| RAISES | DESCRIPTION |
|---|---|
ValidationError
|
If the file path is invalid or contains dangerous characters, or if export_mode is invalid. |
MayaUnavailableError
|
If not connected to Maya. |
MayaCommandError
|
If Maya command execution fails. |
Example
result = scene_export("/output/asset.fbx", animation=True) if result['success']: ... print(f"Exported to: {result['file_path']}")
Source code in src/maya_mcp/tools/scene.py
862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 | |
Nodes¶
nodes
¶
Node tools for Maya MCP.
This module provides tools for listing, creating, deleting, and querying comprehensive information about Maya nodes.
NodesListOutput
¶
Bases: _GuardedOutput
Return payload for the nodes.list tool.
NodesCreateOutput
¶
Bases: TypedDict
Return payload for the nodes.create tool.
NodesInfoOutput
¶
Bases: TypedDict
Return payload for the nodes.info tool.
Category-specific fields are present only for the requested info category.
NodesDeleteOutput
¶
Bases: TypedDict
Return payload for the nodes.delete tool.
NodesRenameOutput
¶
Bases: TypedDict
Return payload for the nodes.rename tool.
NodesParentOutput
¶
Bases: TypedDict
Return payload for the nodes.parent tool.
NodesDuplicateOutput
¶
Bases: TypedDict
Return payload for the nodes.duplicate tool.
nodes_list
¶
nodes_list(node_type: str | None = None, pattern: str = '*', long_names: bool = False, limit: int | None = DEFAULT_NODE_LIMIT) -> NodesListOutput
List nodes in the Maya scene.
Returns a list of nodes, optionally filtered by type and/or name pattern.
| PARAMETER | DESCRIPTION |
|---|---|
node_type
|
Filter by node type (e.g., "transform", "mesh", "camera"). If None, returns all nodes.
TYPE:
|
pattern
|
Name pattern filter. Supports wildcards ( and ?). Default is "" (all names).
TYPE:
|
long_names
|
If True, return full DAG paths. If False, return short names.
TYPE:
|
limit
|
Maximum number of nodes to return. Default is 500. Set to None or 0 for unlimited (use with caution in large scenes). When truncated, response includes 'truncated' and 'total_count'.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
NodesListOutput
|
Dictionary with node list: - nodes: List of node names - count: Number of nodes returned - truncated: True if results were truncated (only if limit hit) - total_count: Total nodes matching before limit (only if truncated) |
| RAISES | DESCRIPTION |
|---|---|
MayaUnavailableError
|
If not connected to Maya. |
MayaCommandError
|
If Maya command execution fails. |
ValueError
|
If pattern contains invalid characters. |
Example
result = nodes_list(node_type="mesh") print(f"Found {result['count']} meshes") for node in result['nodes']: ... print(node)
Source code in src/maya_mcp/tools/nodes.py
124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 | |
nodes_create
¶
nodes_create(node_type: str, name: str | None = None, parent: str | None = None, attributes: dict[str, Any] | None = None) -> NodesCreateOutput
Create a new node in Maya.
Creates a node of the specified type with optional name, parent, and initial attribute values.
| PARAMETER | DESCRIPTION |
|---|---|
node_type
|
Type of node to create (e.g., "transform", "locator", "joint").
TYPE:
|
name
|
Desired node name. Maya may modify for uniqueness.
TYPE:
|
parent
|
Parent node to parent under.
TYPE:
|
attributes
|
Initial attribute values to set after creation.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
NodesCreateOutput
|
Dictionary with creation result: - node: Name of the created node - node_type: Type of node created - parent: Parent node (if parented), or None - attributes_set: List of attributes successfully set - attribute_errors: Map of attribute to error message, or None |
| RAISES | DESCRIPTION |
|---|---|
MayaUnavailableError
|
If not connected to Maya. |
MayaCommandError
|
If Maya command execution fails. |
ValueError
|
If node_type, name, or parent contains invalid characters. |
Example
result = nodes_create("transform", name="myGroup") print(f"Created: {result['node']}")
Source code in src/maya_mcp/tools/nodes.py
221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 | |
nodes_info
¶
nodes_info(node: str, info_category: str = 'summary') -> NodesInfoOutput
Get comprehensive information about a Maya node in a single call.
Consolidates what would otherwise require multiple attributes.get and nodes.list calls into one tool invocation, reducing LLM tool-call chaining.
| PARAMETER | DESCRIPTION |
|---|---|
node
|
Name of the node to query.
TYPE:
|
info_category
|
Category of information to retrieve: - "summary" (default): node type, parent, children count, exists - "transform": translate, rotate, scale, visibility - "hierarchy": parent (full path), children list, full path - "attributes": all keyable attributes with current values - "shape": shape node(s) under transform, shape type, connections - "all": everything combined (parent = short name from summary, parent_full_path = full DAG path from hierarchy)
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
NodesInfoOutput
|
Dictionary with node information. Contents depend on info_category: - node: The queried node name - info_category: The category requested - exists: Whether the node exists - (category-specific fields) - errors: Error details if any queries failed, or None |
| RAISES | DESCRIPTION |
|---|---|
MayaUnavailableError
|
If not connected to Maya. |
MayaCommandError
|
If Maya command execution fails. |
ValueError
|
If node name or info_category is invalid. |
Example
result = nodes_info("pCube1", info_category="transform") print(f"Position: {result['translate']}")
Source code in src/maya_mcp/tools/nodes.py
nodes_delete
¶
nodes_delete(nodes: list[str], hierarchy: bool = False) -> NodesDeleteOutput
Delete one or more nodes from the Maya scene.
| PARAMETER | DESCRIPTION |
|---|---|
nodes
|
List of node names to delete.
TYPE:
|
hierarchy
|
If True, delete entire hierarchy below each node.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
NodesDeleteOutput
|
Dictionary with deletion result: - deleted: List of nodes successfully deleted - count: Number of nodes deleted - errors: Map of node name to error message, or None |
| RAISES | DESCRIPTION |
|---|---|
MayaUnavailableError
|
If not connected to Maya. |
MayaCommandError
|
If Maya command execution fails. |
ValueError
|
If node names contain invalid characters. |
Example
result = nodes_delete(["pCube1", "pSphere1"]) print(f"Deleted {result['count']} nodes")
Source code in src/maya_mcp/tools/nodes.py
570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 | |
nodes_rename
¶
nodes_rename(mapping: dict[str, str]) -> NodesRenameOutput
Rename one or more nodes in the Maya scene.
| PARAMETER | DESCRIPTION |
|---|---|
mapping
|
Dictionary mapping current node names to new names.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
NodesRenameOutput
|
Dictionary with rename result: - renamed: Map of original name to actual new name - errors: Map of original name to error message, or None |
| RAISES | DESCRIPTION |
|---|---|
MayaUnavailableError
|
If not connected to Maya. |
MayaCommandError
|
If Maya command execution fails. |
ValueError
|
If node names contain invalid characters. |
Example
result = nodes_rename({"pCube1": "myCube"}) print(f"Renamed to: {result['renamed']['pCube1']}")
Source code in src/maya_mcp/tools/nodes.py
nodes_parent
¶
nodes_parent(nodes: list[str], parent: str | None = None, relative: bool = False) -> NodesParentOutput
Reparent one or more nodes in the Maya hierarchy.
| PARAMETER | DESCRIPTION |
|---|---|
nodes
|
List of nodes to reparent.
TYPE:
|
parent
|
New parent node. If None, unparent (parent to world).
TYPE:
|
relative
|
Preserve existing local transformations.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
NodesParentOutput
|
Dictionary with reparent result: - parented: List of nodes successfully reparented - count: Number of nodes reparented - errors: Map of node name to error message, or None |
| RAISES | DESCRIPTION |
|---|---|
MayaUnavailableError
|
If not connected to Maya. |
MayaCommandError
|
If Maya command execution fails. |
ValueError
|
If node names contain invalid characters. |
Source code in src/maya_mcp/tools/nodes.py
722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 | |
nodes_duplicate
¶
nodes_duplicate(nodes: list[str], name: str | None = None, input_connections: bool = False, upstream_nodes: bool = False, parent_only: bool = False) -> NodesDuplicateOutput
Duplicate one or more nodes.
| PARAMETER | DESCRIPTION |
|---|---|
nodes
|
List of nodes to duplicate.
TYPE:
|
name
|
Name for the new node (only valid when duplicating single node).
TYPE:
|
input_connections
|
Duplicate input connections.
TYPE:
|
upstream_nodes
|
Duplicate upstream nodes.
TYPE:
|
parent_only
|
Duplicate only the specified node, not its children.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
NodesDuplicateOutput
|
Dictionary with duplication result: - duplicated: Map of original name to new name - count: Number of nodes duplicated - errors: Map of original name to error message, or None |
Source code in src/maya_mcp/tools/nodes.py
818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 | |
Attributes¶
attributes
¶
Attribute tools for Maya MCP.
This module provides tools for getting and setting node attributes in Maya. Supports batch operations to reduce tool call chaining.
AttributesGetOutput
¶
Bases: TypedDict
Return payload for the attributes.get tool.
AttributesSetOutput
¶
Bases: TypedDict
Return payload for the attributes.set tool.
attributes_get
¶
attributes_get(node: str, attributes: list[str]) -> AttributesGetOutput
Get one or more attribute values from a Maya node.
Supports batch attribute queries to reduce tool call chaining. Returns partial results if some attributes fail.
| PARAMETER | DESCRIPTION |
|---|---|
node
|
The node name to query.
TYPE:
|
attributes
|
List of attribute names to get (e.g., ["translateX", "visibility"]).
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
AttributesGetOutput
|
Dictionary with attribute values: - node: Node name queried - attributes: Map of attribute name to value - count: Number of attributes successfully retrieved - errors: Map of attribute name to error message (if any failed), or None |
| RAISES | DESCRIPTION |
|---|---|
MayaUnavailableError
|
If not connected to Maya. |
MayaCommandError
|
If Maya command execution fails completely. |
ValueError
|
If node or attribute names are invalid. |
Example
result = attributes_get("pCube1", ["translateX", "translateY", "visibility"]) print(f"translateX = {result['attributes']['translateX']}")
Source code in src/maya_mcp/tools/attributes.py
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 | |
attributes_set
¶
attributes_set(node: str, attributes: dict[str, Any]) -> AttributesSetOutput
Set one or more attribute values on a Maya node.
Supports batch attribute setting to reduce tool call chaining. Returns partial results if some attributes fail.
| PARAMETER | DESCRIPTION |
|---|---|
node
|
The node name to modify.
TYPE:
|
attributes
|
Map of attribute name to value.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
AttributesSetOutput
|
Dictionary with set results: - node: Node name modified - set: List of attributes successfully set - count: Number of attributes successfully set - errors: Map of attribute name to error message (if any failed), or None |
| RAISES | DESCRIPTION |
|---|---|
MayaUnavailableError
|
If not connected to Maya. |
MayaCommandError
|
If Maya command execution fails completely. |
ValueError
|
If node or attribute names are invalid. |
Example
result = attributes_set("pCube1", {"translateX": 10.0, "visibility": False}) print(f"Set {result['count']} attributes")
Source code in src/maya_mcp/tools/attributes.py
134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 | |
Selection¶
selection
¶
Selection tools for Maya MCP.
This module provides tools for querying and modifying the Maya selection, including component-level selection (vertices, edges, faces).
SelectionOutput
¶
Bases: TypedDict
Return payload for node selection state tools.
SelectionWithErrorsOutput
¶
Bases: SelectionOutput, _GuardedOutput
Return payload for selection operations that may partially fail.
SelectionComponentsOutput
¶
Bases: _GuardedOutput
Return payload for the selection.get_components tool.
SelectionConvertComponentsOutput
¶
selection_get
¶
selection_get() -> SelectionOutput
Get the current selection in Maya.
Returns the list of currently selected nodes.
| RETURNS | DESCRIPTION |
|---|---|
SelectionOutput
|
Dictionary with selection: - selection: List of selected node names - count: Number of selected items |
| RAISES | DESCRIPTION |
|---|---|
MayaUnavailableError
|
If not connected to Maya. |
MayaCommandError
|
If Maya command execution fails. |
Example
result = selection_get() if result['count'] > 0: ... print(f"Selected: {result['selection']}")
Source code in src/maya_mcp/tools/selection.py
selection_set_components
¶
selection_set_components(components: list[str], add: bool = False, deselect: bool = False) -> SelectionWithErrorsOutput
Select mesh components (vertices, edges, or faces).
Selects components specified by Maya component notation (e.g., "pCube1.vtx[0:10]", "pSphere1.e[5]", "pPlane1.f[0:99]").
| PARAMETER | DESCRIPTION |
|---|---|
components
|
List of component specifications in Maya notation. Examples: - "pCube1.vtx[0]" - single vertex - "pCube1.vtx[0:10]" - vertex range - "pCube1.e[5]" - single edge - "pCube1.f[0:99]" - face range
TYPE:
|
add
|
If True, add to existing selection instead of replacing.
TYPE:
|
deselect
|
If True, remove from selection instead of adding.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
SelectionWithErrorsOutput
|
Dictionary with selection result: - selection: List of currently selected components - count: Number of selected components - errors: Map of component to error message, or None |
| RAISES | DESCRIPTION |
|---|---|
MayaUnavailableError
|
If not connected to Maya. |
MayaCommandError
|
If Maya command execution fails. |
ValueError
|
If components list is empty or contains invalid specifications. |
Example
result = selection_set_components(["pCube1.vtx[0:7]"]) print(f"Selected {result['count']} vertices")
Source code in src/maya_mcp/tools/selection.py
108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 | |
selection_get_components
¶
selection_get_components() -> SelectionComponentsOutput
Get the currently selected mesh components.
Returns the selected components grouped by type (vertex, edge, face) with their indices.
| RETURNS | DESCRIPTION |
|---|---|
SelectionComponentsOutput
|
Dictionary with component selection: - selection: List of all selected components (flattened) - vertices: List of selected vertex specifications - edges: List of selected edge specifications - faces: List of selected face specifications - vertex_count: Number of selected vertices - edge_count: Number of selected edges - face_count: Number of selected faces - total_count: Total number of selected components - has_components: True if any components are selected |
| RAISES | DESCRIPTION |
|---|---|
MayaUnavailableError
|
If not connected to Maya. |
MayaCommandError
|
If Maya command execution fails. |
Example
result = selection_get_components() print(f"Selected {result['vertex_count']} vertices") for v in result['vertices']: ... print(v)
Source code in src/maya_mcp/tools/selection.py
selection_convert_components
¶
selection_convert_components(to_type: Literal['vertex', 'edge', 'face'], nodes: list[str] | None = None) -> SelectionConvertComponentsOutput
Convert the current selection to a different component type.
Converts selected components (or specified nodes) to vertices, edges, or faces.
| PARAMETER | DESCRIPTION |
|---|---|
to_type
|
Target component type: "vertex", "edge", or "face".
TYPE:
|
nodes
|
Optional list of nodes to convert selection on. If None, uses current selection.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
SelectionConvertComponentsOutput
|
Dictionary with converted selection: - selection: List of converted components - to_type: The target component type - count: Number of converted components - errors: Error details if any, or None |
| RAISES | DESCRIPTION |
|---|---|
MayaUnavailableError
|
If not connected to Maya. |
MayaCommandError
|
If Maya command execution fails. |
ValueError
|
If to_type is invalid or nodes contain invalid names. |
Example
Convert edge selection to faces¶
result = selection_convert_components("face") print(f"Now have {result['count']} faces selected")
Source code in src/maya_mcp/tools/selection.py
285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 | |
selection_clear
¶
selection_clear() -> SelectionOutput
Clear the Maya selection.
Deselects all currently selected nodes.
| RETURNS | DESCRIPTION |
|---|---|
SelectionOutput
|
Dictionary with empty selection state: - selection: Empty list - count: 0 |
| RAISES | DESCRIPTION |
|---|---|
MayaUnavailableError
|
If not connected to Maya. |
MayaCommandError
|
If Maya command execution fails. |
Example
result = selection_clear() print(f"Selection cleared: {result['count']} items")
Source code in src/maya_mcp/tools/selection.py
selection_set
¶
selection_set(nodes: list[str], add: bool = False, deselect: bool = False) -> SelectionOutput
Set the Maya selection.
Modifies the current selection by selecting, adding to, or removing from the selection.
| PARAMETER | DESCRIPTION |
|---|---|
nodes
|
List of node names to operate on.
TYPE:
|
add
|
If True, add to existing selection instead of replacing.
TYPE:
|
deselect
|
If True, remove from selection instead of adding.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
SelectionOutput
|
Dictionary with new selection state: - selection: List of selected node names after operation - count: Number of selected items |
| RAISES | DESCRIPTION |
|---|---|
MayaUnavailableError
|
If not connected to Maya. |
MayaCommandError
|
If Maya command execution fails. |
ValueError
|
If nodes list is empty or contains invalid names. |
Example
Replace selection¶
result = selection_set(["pCube1", "pSphere1"])
Add to selection¶
result = selection_set(["pCone1"], add=True)
Remove from selection¶
result = selection_set(["pCube1"], deselect=True)
Source code in src/maya_mcp/tools/selection.py
434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 | |
Connections¶
connections
¶
Connection tools for Maya MCP.
This module provides tools for querying and managing node connections in Maya's dependency graph, including construction/deformation history.
ConnectionEntry
¶
Bases: TypedDict
A single dependency-graph connection.
ConnectionsListOutput
¶
Bases: _GuardedOutput
Return payload for the connections.list tool.
ConnectionAttributeInfo
¶
Bases: TypedDict
Connection details for a single attribute.
ConnectionsGetOutput
¶
Bases: TypedDict
Return payload for the connections.get tool.
ConnectionsConnectOutput
¶
Bases: TypedDict
Return payload for the connections.connect tool.
ConnectionPair
¶
Bases: TypedDict
A disconnected source/destination pair.
ConnectionsDisconnectOutput
¶
Bases: TypedDict
Return payload for the connections.disconnect tool.
ConnectionHistoryEntry
¶
Bases: TypedDict
A single history node discovered during traversal.
ConnectionsHistoryOutput
¶
Bases: _GuardedOutput
Return payload for the connections.history tool.
connections_list
¶
connections_list(node: str, direction: Literal['incoming', 'outgoing', 'both'] = 'both', connections_type: str | None = None, limit: int | None = DEFAULT_CONNECTIONS_LIMIT) -> ConnectionsListOutput
List connections on a Maya node.
| PARAMETER | DESCRIPTION |
|---|---|
node
|
Node name to query connections for.
TYPE:
|
direction
|
Filter by connection direction: - "incoming": Only connections where data flows INTO this node - "outgoing": Only connections where data flows FROM this node - "both" (default): All connections
TYPE:
|
connections_type
|
Filter by connection type (e.g., "animCurve", "shader"). If None, returns all connection types.
TYPE:
|
limit
|
Maximum number of connections to return. Default 500. Set to 0 or None for unlimited.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
ConnectionsListOutput
|
Dictionary with: - node: The queried node name - connections: List of connection info dicts - count: Number of connections returned - truncated: True if results were truncated (only if limit hit) - total_count: Total connections before limit (only if truncated) |
| RAISES | DESCRIPTION |
|---|---|
MayaUnavailableError
|
If not connected to Maya. |
MayaCommandError
|
If Maya command execution fails. |
ValueError
|
If node name is invalid. |
Example
result = connections_list("pCube1", direction="incoming") for conn in result["connections"]: ... print(f"{conn['source']} -> {conn['destination']}")
Source code in src/maya_mcp/tools/connections.py
117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 | |
connections_get
¶
connections_get(node: str, attributes: list[str] | None = None) -> ConnectionsGetOutput
Get detailed connection information for specific attributes.
Returns connection details for each specified attribute, including connected plugs, connection types, and lock status.
| PARAMETER | DESCRIPTION |
|---|---|
node
|
Node name to query.
TYPE:
|
attributes
|
List of attribute names to check for connections. If None, checks all connectable attributes.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
ConnectionsGetOutput
|
Dictionary with: - node: The queried node name - attributes: Dict mapping attribute name to connection info - count: Number of attributes with connections - errors: Map of attribute to error message, or None |
| RAISES | DESCRIPTION |
|---|---|
MayaUnavailableError
|
If not connected to Maya. |
MayaCommandError
|
If Maya command execution fails. |
ValueError
|
If node name is invalid. |
Example
result = connections_get("pCube1", ["translateX", "visibility"]) if result["attributes"]["translateX"]["connected"]: ... print(f"translateX is connected to: {{result['attributes']['translateX']['connections']}}")
Source code in src/maya_mcp/tools/connections.py
259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 | |
connections_connect
¶
connections_connect(source: str, destination: str, force: bool = False) -> ConnectionsConnectOutput
Connect two attributes in Maya.
Creates a connection from the source attribute to the destination attribute. Implements the disconnect-before-reconnect safety pattern when force=True.
| PARAMETER | DESCRIPTION |
|---|---|
source
|
Source plug in "node.attribute" format.
TYPE:
|
destination
|
Destination plug in "node.attribute" format.
TYPE:
|
force
|
If True, disconnect any existing connection to the destination before creating the new connection. If False (default), the operation fails if destination is already connected.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
ConnectionsConnectOutput
|
Dictionary with: - connected: True if connection was created - source: The source plug - destination: The destination plug - disconnected: List of plugs that were disconnected (if force=True) - error: Error message if failed, or None |
| RAISES | DESCRIPTION |
|---|---|
MayaUnavailableError
|
If not connected to Maya. |
MayaCommandError
|
If Maya command execution fails. |
ValueError
|
If plug names are invalid. |
Example
result = connections_connect("ramp1.outColor", "lambert1.color", force=True) print(f"Connected: {{result['connected']}}")
Source code in src/maya_mcp/tools/connections.py
386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 | |
connections_disconnect
¶
connections_disconnect(source: str | None = None, destination: str | None = None) -> ConnectionsDisconnectOutput
Disconnect attributes in Maya.
If both source and destination are provided, disconnects that specific connection. If only source is provided, disconnects all outgoing connections from that plug. If only destination is provided, disconnects all incoming connections to that plug.
| PARAMETER | DESCRIPTION |
|---|---|
source
|
Source plug in "node.attribute" format. If None, uses destination only.
TYPE:
|
destination
|
Destination plug in "node.attribute" format. If None, uses source only.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
ConnectionsDisconnectOutput
|
Dictionary with: - disconnected: List of disconnected connection pairs [source, destination] - count: Number of connections disconnected - error: Error message if failed, or None |
| RAISES | DESCRIPTION |
|---|---|
MayaUnavailableError
|
If not connected to Maya. |
MayaCommandError
|
If Maya command execution fails. |
ValueError
|
If plug names are invalid or neither source nor destination provided. |
Example
Disconnect specific connection¶
result = connections_disconnect("ramp1.outColor", "lambert1.color")
Disconnect all incoming connections to an attribute¶
result = connections_disconnect(destination="pCube1.translateX")
Source code in src/maya_mcp/tools/connections.py
504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 | |
connections_history
¶
connections_history(node: str, direction: Literal['input', 'output', 'both'] = 'input', depth: int = 10, limit: int | None = DEFAULT_CONNECTIONS_LIMIT) -> ConnectionsHistoryOutput
List construction/deformation history on a node.
Traverses the dependency graph to find upstream (input) or downstream (output) history nodes such as deformers, construction history, shaders, etc.
| PARAMETER | DESCRIPTION |
|---|---|
node
|
Node name to query history for.
TYPE:
|
direction
|
Direction to traverse: - "input" (default): Upstream history (construction/deformation inputs) - "output": Downstream history (what this node affects) - "both": Both directions
TYPE:
|
depth
|
Maximum depth to traverse. Default 10.
TYPE:
|
limit
|
Maximum number of history nodes to return. Default 500.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
ConnectionsHistoryOutput
|
Dictionary with: - node: The queried node name - history: List of history node info dicts with name, type, depth, direction - count: Number of history nodes returned - truncated: True if results were truncated - total_count: Total history nodes before limit |
| RAISES | DESCRIPTION |
|---|---|
MayaUnavailableError
|
If not connected to Maya. |
MayaCommandError
|
If Maya command execution fails. |
ValueError
|
If node name is invalid. |
Example
result = connections_history("pCubeShape1", direction="input") for hist in result["history"]: ... print(f"{{hist['type']}}: {{hist['name']}} (depth {{hist['depth']}})")
Source code in src/maya_mcp/tools/connections.py
634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 | |
Mesh¶
mesh
¶
Mesh tools for Maya MCP.
This module provides tools for querying mesh geometry and topology analysis.
MeshInfoOutput
¶
Bases: TypedDict
Return payload for the mesh.info tool.
MeshVerticesOutput
¶
Bases: _GuardedOutput
Return payload for the mesh.vertices tool.
MeshEvaluateOutput
¶
Bases: _GuardedOutput
Return payload for the mesh.evaluate tool.
Check-specific component fields are present only when requested.
mesh_info
¶
mesh_info(node: str) -> MeshInfoOutput
Get mesh statistics for a polygon mesh.
Returns vertex count, face count, edge count, bounding box, and UV set information.
| PARAMETER | DESCRIPTION |
|---|---|
node
|
Name of the mesh node (transform or shape).
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
MeshInfoOutput
|
Dictionary with mesh statistics: - node: The queried node name - exists: Whether the node exists - is_mesh: Whether the node is a mesh - vertex_count: Number of vertices - face_count: Number of faces - edge_count: Number of edges - uv_count: Number of UVs - has_uvs: Whether the mesh has UVs - uv_sets: List of UV set names - bounding_box: [min_x, min_y, min_z, max_x, max_y, max_z] - errors: Error details if any queries failed, or None |
| RAISES | DESCRIPTION |
|---|---|
MayaUnavailableError
|
If not connected to Maya. |
MayaCommandError
|
If Maya command execution fails. |
ValueError
|
If node name contains invalid characters. |
Example
result = mesh_info("pCube1") print(f"Vertices: {result['vertex_count']}, Faces: {result['face_count']}")
Source code in src/maya_mcp/tools/mesh.py
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 | |
mesh_vertices
¶
mesh_vertices(node: str, offset: int = 0, limit: int | None = DEFAULT_VERTEX_LIMIT) -> MeshVerticesOutput
Query vertex positions from a mesh with pagination.
Returns vertex positions as [x, y, z] tuples. Use offset/limit pagination for large meshes to avoid token budget issues.
| PARAMETER | DESCRIPTION |
|---|---|
node
|
Name of the mesh node (transform or shape).
TYPE:
|
offset
|
Starting vertex index (0-based).
TYPE:
|
limit
|
Maximum number of vertices to return. Default 1000. Use 0 for unlimited (use with caution).
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
MeshVerticesOutput
|
Dictionary with vertex data: - node: The queried node name - exists: Whether the node exists - is_mesh: Whether the node is a mesh - vertex_count: Total number of vertices in mesh - vertices: List of [x, y, z] position arrays - offset: The offset used - count: Number of vertices returned - truncated: True if results were truncated (only if limit hit) - errors: Error details if any, or None |
| RAISES | DESCRIPTION |
|---|---|
MayaUnavailableError
|
If not connected to Maya. |
MayaCommandError
|
If Maya command execution fails. |
ValueError
|
If node name contains invalid characters or offset is negative. |
Example
result = mesh_vertices("pCube1", offset=0, limit=100) for i, v in enumerate(result['vertices']): ... print(f"v{result['offset'] + i}: {v}")
Source code in src/maya_mcp/tools/mesh.py
180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 | |
mesh_evaluate
¶
mesh_evaluate(node: str, checks: list[Literal['non_manifold', 'lamina', 'holes', 'border']] | None = None, limit: int | None = DEFAULT_TOPOLOGY_LIMIT) -> MeshEvaluateOutput
Analyze mesh topology for issues.
Performs topology analysis to find non-manifold edges, lamina faces, holes, and border edges. Returns lists of problematic components.
| PARAMETER | DESCRIPTION |
|---|---|
node
|
Name of the mesh node (transform or shape).
TYPE:
|
checks
|
List of checks to perform. Options: - "non_manifold": Find non-manifold edges - "lamina": Find lamina faces (faces sharing all edges) - "holes": Find faces with holes - "border": Find border edges If None, performs all checks.
TYPE:
|
limit
|
Maximum number of components to return per check. Default 500. Use 0 for unlimited.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
MeshEvaluateOutput
|
Dictionary with topology analysis: - node: The queried node name - exists: Whether the node exists - is_mesh: Whether the node is a mesh - non_manifold_edges: List of non-manifold edge names (if checked) - non_manifold_count: Count of non-manifold edges - lamina_faces: List of lamina face names (if checked) - lamina_count: Count of lamina faces - holes: List of faces with holes (if checked) - hole_count: Count of faces with holes - border_edges: List of border edge names (if checked) - border_count: Count of border edges - is_clean: True if mesh has no topology issues - errors: Error details if any, or None |
| RAISES | DESCRIPTION |
|---|---|
MayaUnavailableError
|
If not connected to Maya. |
MayaCommandError
|
If Maya command execution fails. |
ValueError
|
If node name contains invalid characters. |
Example
result = mesh_evaluate("pCube1", checks=["non_manifold", "holes"]) if not result['is_clean']: ... print(f"Found {result['non_manifold_count']} non-manifold edges")
Source code in src/maya_mcp/tools/mesh.py
299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 | |
Viewport¶
viewport
¶
Viewport capture tools for Maya MCP.
This module provides a read-only viewport capture tool that uses Maya playblast to write a temporary image file and returns it as inline MCP image content.
ViewportCaptureOutput
¶
Bases: TypedDict
Structured metadata returned alongside viewport image content.
viewport_capture
¶
viewport_capture(format: ViewportFormat = 'jpeg', width: int = 1024, height: int = 576, quality: int = 85, offscreen: bool = False, show_ornaments: bool = True, panel: str | None = None, frame: float | None = None) -> Image
Capture the Maya viewport as an inline MCP image.
Source code in src/maya_mcp/tools/viewport.py
Modeling¶
modeling
¶
Polygon modeling tools for Maya MCP.
This module provides tools for creating polygon primitives, extruding, booleans, combining/separating meshes, beveling, bridging, edge loops, component manipulation, and cleanup operations.
ModelingCreatePolygonPrimitiveOutput
¶
Bases: TypedDict
Return payload for the modeling.create_polygon_primitive tool.
ModelingExtrudeFacesOutput
¶
Bases: TypedDict
Return payload for the modeling.extrude_faces tool.
ModelingBooleanOutput
¶
Bases: TypedDict
Return payload for the modeling.boolean tool.
ModelingCombineOutput
¶
Bases: TypedDict
Return payload for the modeling.combine tool.
ModelingSeparateOutput
¶
Bases: _GuardedOutput
Return payload for the modeling.separate tool.
ModelingMergeVerticesOutput
¶
Bases: TypedDict
Return payload for the modeling.merge_vertices tool.
ModelingDeleteHistoryOutput
¶
Bases: _GuardedOutput
Return payload for the modeling.delete_history tool.
ModelingFreezeTransformsOutput
¶
Bases: TypedDict
Return payload for the modeling.freeze_transforms tool.
ModelingCenterPivotOutput
¶
Bases: TypedDict
Return payload for the modeling.center_pivot tool.
ModelingSetPivotOutput
¶
Bases: TypedDict
Return payload for the modeling.set_pivot tool.
ModelingMoveComponentsOutput
¶
Bases: TypedDict
Return payload for the modeling.move_components tool.
ModelingBevelOutput
¶
Bases: TypedDict
Return payload for the modeling.bevel tool.
ModelingBridgeOutput
¶
Bases: TypedDict
Return payload for the modeling.bridge tool.
ModelingInsertEdgeLoopOutput
¶
Bases: TypedDict
Return payload for the modeling.insert_edge_loop tool.
ModelingDeleteFacesOutput
¶
Bases: TypedDict
Return payload for the modeling.delete_faces tool.
modeling_create_polygon_primitive
¶
modeling_create_polygon_primitive(primitive_type: Literal['cube', 'sphere', 'cylinder', 'cone', 'torus', 'plane'], name: str | None = None, width: float = 1.0, height: float = 1.0, depth: float = 1.0, radius: float = 0.5, subdivisions_width: int | None = None, subdivisions_height: int | None = None, subdivisions_depth: int | None = None, subdivisions_axis: int | None = None, axis: Literal['x', 'y', 'z'] = 'y') -> ModelingCreatePolygonPrimitiveOutput
Create a polygon primitive.
| PARAMETER | DESCRIPTION |
|---|---|
primitive_type
|
Type of primitive to create.
TYPE:
|
name
|
Optional name for the transform node.
TYPE:
|
width
|
Width of the primitive (cube/plane).
TYPE:
|
height
|
Height of the primitive (cube/cylinder/cone).
TYPE:
|
depth
|
Depth of the primitive (cube).
TYPE:
|
radius
|
Radius of the primitive (sphere/cylinder/cone/torus).
TYPE:
|
subdivisions_width
|
Width subdivisions.
TYPE:
|
subdivisions_height
|
Height subdivisions.
TYPE:
|
subdivisions_depth
|
Depth subdivisions.
TYPE:
|
subdivisions_axis
|
Axis subdivisions (sphere/cylinder/cone/torus).
TYPE:
|
axis
|
Up axis for the primitive.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
ModelingCreatePolygonPrimitiveOutput
|
Dictionary with transform, shape, constructor, primitive_type, |
ModelingCreatePolygonPrimitiveOutput
|
vertex_count, face_count, and errors. |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If primitive_type or axis is invalid, or name contains invalid characters. |
Source code in src/maya_mcp/tools/modeling.py
177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 | |
modeling_extrude_faces
¶
modeling_extrude_faces(faces: list[str], local_translate_z: float | None = None, local_translate_x: float | None = None, local_translate_y: float | None = None, offset: float | None = None, divisions: int = 1, keep_faces_together: bool = True) -> ModelingExtrudeFacesOutput
Extrude polygon faces.
| PARAMETER | DESCRIPTION |
|---|---|
faces
|
Component strings for faces to extrude (e.g., ['pCube1.f[0]']).
TYPE:
|
local_translate_z
|
Local Z translation (thickness/extrusion amount).
TYPE:
|
local_translate_x
|
Local X translation.
TYPE:
|
local_translate_y
|
Local Y translation.
TYPE:
|
offset
|
Offset amount for the extrusion.
TYPE:
|
divisions
|
Number of divisions for the extrusion.
TYPE:
|
keep_faces_together
|
Keep faces together during extrusion.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
ModelingExtrudeFacesOutput
|
Dictionary with node, faces_extruded, new_face_count, and errors. |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If faces list is empty or contains invalid characters. |
Source code in src/maya_mcp/tools/modeling.py
326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 | |
modeling_boolean
¶
modeling_boolean(mesh_a: str, mesh_b: str, operation: Literal['union', 'difference', 'intersection'] = 'union') -> ModelingBooleanOutput
Perform a boolean operation on two meshes.
| PARAMETER | DESCRIPTION |
|---|---|
mesh_a
|
First mesh (the base mesh).
TYPE:
|
mesh_b
|
Second mesh (the operand).
TYPE:
|
operation
|
Boolean operation type.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
ModelingBooleanOutput
|
Dictionary with result_mesh, operation, vertex_count, |
ModelingBooleanOutput
|
face_count, and errors. |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If mesh names contain invalid characters or operation is invalid. |
Source code in src/maya_mcp/tools/modeling.py
modeling_combine
¶
modeling_combine(meshes: list[str], name: str | None = None) -> ModelingCombineOutput
Combine multiple meshes into one.
| PARAMETER | DESCRIPTION |
|---|---|
meshes
|
List of mesh names to combine (minimum 2).
TYPE:
|
name
|
Optional name for the combined mesh.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
ModelingCombineOutput
|
Dictionary with result_mesh, source_meshes, vertex_count, |
ModelingCombineOutput
|
face_count, and errors. |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If meshes list has fewer than 2 entries or names contain invalid characters. |
Source code in src/maya_mcp/tools/modeling.py
modeling_separate
¶
modeling_separate(mesh: str) -> ModelingSeparateOutput
Separate a combined mesh into individual meshes.
| PARAMETER | DESCRIPTION |
|---|---|
mesh
|
Name of the mesh to separate.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
ModelingSeparateOutput
|
Dictionary with source_mesh, result_meshes, count, and errors. |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If mesh name contains invalid characters. |
Source code in src/maya_mcp/tools/modeling.py
modeling_merge_vertices
¶
modeling_merge_vertices(mesh: str, threshold: float = 0.001, vertices: list[str] | None = None) -> ModelingMergeVerticesOutput
Merge vertices on a mesh within a distance threshold.
| PARAMETER | DESCRIPTION |
|---|---|
mesh
|
Name of the mesh.
TYPE:
|
threshold
|
Distance threshold for merging (default 0.001).
TYPE:
|
vertices
|
Optional list of specific vertex components to merge. If None, merges all vertices on the mesh within threshold.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
ModelingMergeVerticesOutput
|
Dictionary with mesh, vertices_merged, vertex_count_before, |
ModelingMergeVerticesOutput
|
vertex_count_after, and errors. |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If mesh name or vertex components contain invalid characters. |
Source code in src/maya_mcp/tools/modeling.py
modeling_delete_history
¶
modeling_delete_history(nodes: list[str] | None = None, all_nodes: bool = False) -> ModelingDeleteHistoryOutput
Delete construction history from nodes.
| PARAMETER | DESCRIPTION |
|---|---|
nodes
|
List of node names to delete history from.
TYPE:
|
all_nodes
|
If True, delete history from all nodes in the scene. If True, the nodes parameter is ignored.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
ModelingDeleteHistoryOutput
|
Dictionary with cleaned list, count, and errors. |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If neither nodes nor all_nodes is specified, or node names contain invalid characters. |
Source code in src/maya_mcp/tools/modeling.py
modeling_freeze_transforms
¶
modeling_freeze_transforms(nodes: list[str], translate: bool = True, rotate: bool = True, scale: bool = True) -> ModelingFreezeTransformsOutput
Freeze (reset) transforms on nodes.
Applies the current transform values as the identity and resets the transform channels to zero/one.
| PARAMETER | DESCRIPTION |
|---|---|
nodes
|
List of node names to freeze.
TYPE:
|
translate
|
Freeze translation (default True).
TYPE:
|
rotate
|
Freeze rotation (default True).
TYPE:
|
scale
|
Freeze scale (default True).
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
ModelingFreezeTransformsOutput
|
Dictionary with frozen list, count, and errors. |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If nodes list is empty or names contain invalid characters. |
Source code in src/maya_mcp/tools/modeling.py
modeling_center_pivot
¶
modeling_center_pivot(nodes: list[str]) -> ModelingCenterPivotOutput
Center the pivot point on nodes.
| PARAMETER | DESCRIPTION |
|---|---|
nodes
|
List of node names to center pivots on.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
ModelingCenterPivotOutput
|
Dictionary with centered list, count, pivot_positions, and errors. |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If nodes list is empty or names contain invalid characters. |
Source code in src/maya_mcp/tools/modeling.py
modeling_set_pivot
¶
modeling_set_pivot(node: str, position: list[float], world_space: bool = True) -> ModelingSetPivotOutput
Set the pivot point of a node to an explicit position.
| PARAMETER | DESCRIPTION |
|---|---|
node
|
Node name to set pivot on.
TYPE:
|
position
|
[x, y, z] position for the pivot.
TYPE:
|
world_space
|
If True, position is in world space (default True).
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
ModelingSetPivotOutput
|
Dictionary with node, pivot, world_space, and errors. |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If node name contains invalid characters or position is not a list of 3 floats. |
Source code in src/maya_mcp/tools/modeling.py
modeling_move_components
¶
modeling_move_components(components: list[str], translate: list[float] | None = None, absolute: list[float] | None = None, world_space: bool = True) -> ModelingMoveComponentsOutput
Move mesh components (vertices, edges, faces).
Exactly one of translate (relative) or absolute must be provided.
| PARAMETER | DESCRIPTION |
|---|---|
components
|
Component strings (e.g., ['pCube1.vtx[0:3]']).
TYPE:
|
translate
|
Relative [x, y, z] translation.
TYPE:
|
absolute
|
Absolute [x, y, z] position.
TYPE:
|
world_space
|
Use world space coordinates (default True).
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
ModelingMoveComponentsOutput
|
Dictionary with components_moved, translate or absolute, |
ModelingMoveComponentsOutput
|
world_space, and errors. |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If components are empty, both or neither of translate/absolute provided, or values are invalid. |
Source code in src/maya_mcp/tools/modeling.py
947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 | |
modeling_bevel
¶
modeling_bevel(components: list[str], offset: float = 0.5, segments: int = 1, fraction: float = 0.5) -> ModelingBevelOutput
Bevel edges or vertices.
| PARAMETER | DESCRIPTION |
|---|---|
components
|
Edge or vertex component strings to bevel.
TYPE:
|
offset
|
Bevel offset distance (default 0.5).
TYPE:
|
segments
|
Number of bevel segments (default 1).
TYPE:
|
fraction
|
Bevel fraction (default 0.5).
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
ModelingBevelOutput
|
Dictionary with node, components_beveled, new_vertex_count, |
ModelingBevelOutput
|
new_face_count, and errors. |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If components list is empty or contains invalid characters. |
Source code in src/maya_mcp/tools/modeling.py
1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 | |
modeling_bridge
¶
modeling_bridge(edge_loops: list[str], divisions: int = 0, twist: int = 0, taper: float = 1.0) -> ModelingBridgeOutput
Bridge between edge loops.
| PARAMETER | DESCRIPTION |
|---|---|
edge_loops
|
Edge component strings for the edge loops to bridge.
TYPE:
|
divisions
|
Number of divisions in the bridge (default 0).
TYPE:
|
twist
|
Twist amount (default 0).
TYPE:
|
taper
|
Taper amount (default 1.0).
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
ModelingBridgeOutput
|
Dictionary with node, new_face_count, and errors. |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If edge_loops list is empty or contains invalid characters. |
Source code in src/maya_mcp/tools/modeling.py
1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 | |
modeling_insert_edge_loop
¶
modeling_insert_edge_loop(edge: str, divisions: int = 1, weight: float = 0.5) -> ModelingInsertEdgeLoopOutput
Insert an edge loop at the specified edge.
| PARAMETER | DESCRIPTION |
|---|---|
edge
|
Single edge component (e.g., 'pCube1.e[4]').
TYPE:
|
divisions
|
Number of edge loops to insert (default 1).
TYPE:
|
weight
|
Position weight along the edge (0-1, default 0.5).
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
ModelingInsertEdgeLoopOutput
|
Dictionary with node, edge, new_edge_count, |
ModelingInsertEdgeLoopOutput
|
new_vertex_count, and errors. |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If edge contains invalid characters. |
Source code in src/maya_mcp/tools/modeling.py
modeling_delete_faces
¶
modeling_delete_faces(faces: list[str]) -> ModelingDeleteFacesOutput
Delete polygon faces from a mesh.
| PARAMETER | DESCRIPTION |
|---|---|
faces
|
Component strings for faces to delete (e.g., ['pCube1.f[0]']).
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
ModelingDeleteFacesOutput
|
Dictionary with faces_deleted, mesh, remaining_face_count, and errors. |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If faces list is empty or contains invalid characters. |
Source code in src/maya_mcp/tools/modeling.py
Shading¶
shading
¶
Shading and material tools for Maya MCP.
This module provides tools for creating materials, assigning them to meshes or face components, and setting material attributes.
ShadingCreateMaterialOutput
¶
Bases: TypedDict
Return payload for the shading.create_material tool.
ShadingAssignMaterialOutput
¶
Bases: TypedDict
Return payload for the shading.assign_material tool.
ShadingSetMaterialColorOutput
¶
Bases: TypedDict
Return payload for the shading.set_material_color tool.
shading_create_material
¶
shading_create_material(material_type: Literal['lambert', 'blinn', 'phong', 'standardSurface'] = 'lambert', name: str | None = None, color: list[float] | None = None) -> ShadingCreateMaterialOutput
Create a new material with an associated shading group.
| PARAMETER | DESCRIPTION |
|---|---|
material_type
|
Type of material shader to create.
TYPE:
|
name
|
Optional name for the material node.
TYPE:
|
color
|
Optional [r, g, b] color values (0-1 range).
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
ShadingCreateMaterialOutput
|
Dictionary with material, shading_group, material_type, and errors. |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If material_type is invalid, name contains invalid characters, or color is not a list of 3 floats. |
Source code in src/maya_mcp/tools/shading.py
shading_assign_material
¶
shading_assign_material(targets: list[str], material: str) -> ShadingAssignMaterialOutput
Assign a material to meshes or face components.
Resolves the material's shading group automatically. Accepts both material names and shading group names.
| PARAMETER | DESCRIPTION |
|---|---|
targets
|
List of mesh names or face component strings to assign to.
TYPE:
|
material
|
Name of the material (or shading group) to assign.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
ShadingAssignMaterialOutput
|
Dictionary with assigned list, material, shading_group, and errors. |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If targets list is empty or material name contains invalid characters. |
Source code in src/maya_mcp/tools/shading.py
129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 | |
shading_set_material_color
¶
shading_set_material_color(material: str, color: list[float], attribute: str = 'color') -> ShadingSetMaterialColorOutput
Set a color attribute on a material.
| PARAMETER | DESCRIPTION |
|---|---|
material
|
Name of the material node.
TYPE:
|
color
|
[r, g, b] color values (0-1 range).
TYPE:
|
attribute
|
Color attribute name (default "color"). Common values: - "color": Diffuse color (lambert/blinn/phong) - "baseColor": Base color (standardSurface) - "transparency": Transparency color - "incandescence": Incandescence color
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
ShadingSetMaterialColorOutput
|
Dictionary with material, attribute, color, and errors. |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If material name contains invalid characters or color is not a list of 3 floats. |
Source code in src/maya_mcp/tools/shading.py
Skinning¶
skin
¶
Skinning tools for Maya MCP.
This module provides tools for skin binding, weight management, and weight transfer for character rigging workflows.
SkinBindOutput
¶
Bases: TypedDict
Return payload for the skin.bind tool.
SkinUnbindOutput
¶
Bases: TypedDict
Return payload for the skin.unbind tool.
SkinInfluenceEntry
¶
Bases: TypedDict
Influence entry returned by skin.influences.
SkinInfluencesOutput
¶
Bases: TypedDict
Return payload for the skin.influences tool.
SkinWeightEntry
¶
Bases: TypedDict
Per-component weights returned by skin.weights.get.
SkinWeightsGetOutput
¶
Bases: _GuardedOutput
Return payload for the skin.weights.get tool.
SkinWeightsSetOutput
¶
Bases: TypedDict
Return payload for the skin.weights.set tool.
SkinCopyWeightsOutput
¶
Bases: TypedDict
Return payload for the skin.copy_weights tool.
skin_bind
¶
skin_bind(mesh: str, joints: list[str], max_influences: int = 4, bind_method: Literal['closestDistance', 'heatMap', 'geodesicVoxel'] = 'closestDistance') -> SkinBindOutput
Bind a mesh to a skeleton using a skin cluster.
Creates a skinCluster binding the mesh to the specified joints with the given binding options.
| PARAMETER | DESCRIPTION |
|---|---|
mesh
|
Name of the mesh to bind.
TYPE:
|
joints
|
List of joint names to use as influences.
TYPE:
|
max_influences
|
Maximum number of influences per vertex (default 4).
TYPE:
|
bind_method
|
Binding algorithm to use. Options: - "closestDistance": Closest distance (default) - "heatMap": Heat map based - "geodesicVoxel": Geodesic voxel
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
SkinBindOutput
|
Dictionary with binding result: - mesh: The mesh that was bound - skin_cluster: Name of the created skinCluster - influences: List of influence joint names - influence_count: Number of influences - errors: Error details if any, or None |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If mesh or joint names contain invalid characters, or if joints list is empty. |
Source code in src/maya_mcp/tools/skin.py
116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 | |
skin_unbind
¶
skin_unbind(mesh: str) -> SkinUnbindOutput
Unbind (detach) a skin cluster from a mesh.
Finds the skinCluster on the mesh and unbinds it, removing the skin deformation.
| PARAMETER | DESCRIPTION |
|---|---|
mesh
|
Name of the mesh to unbind.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
SkinUnbindOutput
|
Dictionary with unbind result: - mesh: The mesh that was unbound - unbound: Whether unbinding succeeded - skin_cluster: Name of the removed skinCluster - errors: Error details if any, or None |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If mesh name contains invalid characters. |
Source code in src/maya_mcp/tools/skin.py
skin_influences
¶
skin_influences(skin_cluster: str) -> SkinInfluencesOutput
List influences on a skin cluster.
Returns the list of joints/transforms influencing the skin cluster, along with their index mapping.
| PARAMETER | DESCRIPTION |
|---|---|
skin_cluster
|
Name of the skinCluster node.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
SkinInfluencesOutput
|
Dictionary with influence data: - skin_cluster: The queried skinCluster name - influences: List of dicts with name and index - count: Number of influences - errors: Error details if any, or None |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If skin_cluster name contains invalid characters. |
Source code in src/maya_mcp/tools/skin.py
skin_weights_get
¶
skin_weights_get(skin_cluster: str, offset: int = 0, limit: int | None = DEFAULT_WEIGHT_LIMIT) -> SkinWeightsGetOutput
Get skin weights with pagination.
Returns per-vertex weight data for the specified range of vertices. Uses offset/limit pagination because skin weight data can be very large (4-15MB for production meshes).
| PARAMETER | DESCRIPTION |
|---|---|
skin_cluster
|
Name of the skinCluster node.
TYPE:
|
offset
|
Starting vertex index (0-based).
TYPE:
|
limit
|
Maximum number of vertices to return. Default 100. Use 0 for unlimited (use with caution on large meshes).
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
SkinWeightsGetOutput
|
Dictionary with weight data: - skin_cluster: The queried skinCluster name - mesh: The bound mesh name - vertex_count: Total number of vertices - influence_count: Number of influences - influences: List of influence names - vertices: List of vertex weight entries - offset: The offset used - count: Number of vertices returned - truncated: True if more vertices remain - errors: Error details if any, or None |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If skin_cluster name contains invalid characters or offset is negative. |
Source code in src/maya_mcp/tools/skin.py
339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 | |
skin_weights_set
¶
skin_weights_set(skin_cluster: str, weights: list[dict[str, Any]], normalize: bool = True) -> SkinWeightsSetOutput
Set skin weights on vertices.
Sets per-vertex skin weights on the specified skin cluster. Each entry in the weights list specifies a vertex_id and a weights dict mapping joint names to weight values.
| PARAMETER | DESCRIPTION |
|---|---|
skin_cluster
|
Name of the skinCluster node.
TYPE:
|
weights
|
List of weight entries, each a dict with: - vertex_id (int): Vertex index - weights (dict): Map of joint name to weight value
TYPE:
|
normalize
|
Whether to normalize weights after setting (default True).
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
SkinWeightsSetOutput
|
Dictionary with set result: - skin_cluster: The skinCluster name - set_count: Number of vertices updated - errors: Error details if any, or None |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If skin_cluster name contains invalid characters, weights list is empty, or too many entries. |
Source code in src/maya_mcp/tools/skin.py
477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 | |
skin_copy_weights
¶
skin_copy_weights(source_mesh: str, target_mesh: str, surface_association: Literal['closestPoint', 'closestComponent', 'rayCast'] = 'closestPoint', influence_association: Literal['closestJoint', 'closestBone', 'oneToOne', 'name', 'label'] = 'closestJoint') -> SkinCopyWeightsOutput
Copy skin weights from one mesh to another.
Transfers skin weights between two meshes using surface and influence association methods.
| PARAMETER | DESCRIPTION |
|---|---|
source_mesh
|
Name of the source mesh (must have a skinCluster).
TYPE:
|
target_mesh
|
Name of the target mesh (must have a skinCluster).
TYPE:
|
surface_association
|
Method for matching surface points. Options: - "closestPoint": Closest point on surface (default) - "closestComponent": Closest component - "rayCast": Ray casting
TYPE:
|
influence_association
|
Method for matching influences. Options: - "closestJoint": Closest joint (default) - "closestBone": Closest bone - "oneToOne": One to one mapping - "name": Match by name - "label": Match by label
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
SkinCopyWeightsOutput
|
Dictionary with copy result: - source_mesh: The source mesh name - target_mesh: The target mesh name - source_skin_cluster: Source skinCluster name - target_skin_cluster: Target skinCluster name - success: Whether the copy succeeded - errors: Error details if any, or None |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If mesh names contain invalid characters. |
Source code in src/maya_mcp/tools/skin.py
590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 | |
Animation¶
animation
¶
Animation tools for Maya MCP.
This module provides tools for keyframing, timeline control, and playback range management for animation workflows.
AnimationSetTimeOutput
¶
Bases: TypedDict
Return payload for the animation.set_time tool.
AnimationGetTimeRangeOutput
¶
Bases: TypedDict
Return payload for the animation.get_time_range tool.
AnimationSetTimeRangeOutput
¶
Bases: TypedDict
Return payload for the animation.set_time_range tool.
AnimationSetKeyframeOutput
¶
Bases: TypedDict
Return payload for the animation.set_keyframe tool.
KeyframeEntry
¶
Bases: TypedDict
A single animation keyframe.
AnimationGetKeyframesOutput
¶
Bases: _GuardedOutput
Return payload for the animation.get_keyframes tool.
AnimationDeleteKeyframesOutput
¶
Bases: TypedDict
Return payload for the animation.delete_keyframes tool.
animation_set_time
¶
animation_set_time(time: float, update: bool = True) -> AnimationSetTimeOutput
Set the current time (go to a specific frame).
| PARAMETER | DESCRIPTION |
|---|---|
time
|
The frame number to set as current time.
TYPE:
|
update
|
Whether to update the viewport (default True).
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
AnimationSetTimeOutput
|
Dictionary with time result: - time: The time that was set - errors: Error details if any, or None |
Source code in src/maya_mcp/tools/animation.py
animation_get_time_range
¶
animation_get_time_range() -> AnimationGetTimeRangeOutput
Get playback range, animation range, and current time.
| RETURNS | DESCRIPTION |
|---|---|
AnimationGetTimeRangeOutput
|
Dictionary with time range data: - current_time: Current frame - min_time: Playback start time - max_time: Playback end time - animation_start: Animation range start - animation_end: Animation range end - fps: Current FPS setting - errors: Error details if any, or None |
Source code in src/maya_mcp/tools/animation.py
animation_set_time_range
¶
animation_set_time_range(min_time: float, max_time: float, animation_start: float | None = None, animation_end: float | None = None) -> AnimationSetTimeRangeOutput
Set the playback and animation range.
| PARAMETER | DESCRIPTION |
|---|---|
min_time
|
Playback start time.
TYPE:
|
max_time
|
Playback end time.
TYPE:
|
animation_start
|
Animation range start (defaults to min_time).
TYPE:
|
animation_end
|
Animation range end (defaults to max_time).
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
AnimationSetTimeRangeOutput
|
Dictionary with range result: - min_time: The playback start time that was set - max_time: The playback end time that was set - animation_start: The animation start that was set - animation_end: The animation end that was set - errors: Error details if any, or None |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If min_time >= max_time, animation_start > min_time, or animation_end < max_time. |
Source code in src/maya_mcp/tools/animation.py
211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 | |
animation_set_keyframe
¶
animation_set_keyframe(node: str, attributes: list[str] | None = None, time: float | None = None, value: float | None = None, in_tangent_type: TangentType = 'auto', out_tangent_type: TangentType = 'auto') -> AnimationSetKeyframeOutput
Set keyframe on attribute(s) at current or specified time.
| PARAMETER | DESCRIPTION |
|---|---|
node
|
Name of the node to keyframe.
TYPE:
|
attributes
|
List of attribute names to keyframe (None = all keyable).
TYPE:
|
time
|
Time/frame to set the keyframe at (None = current time).
TYPE:
|
value
|
Value to set (None = current value).
TYPE:
|
in_tangent_type
|
In-tangent type. Options: auto, linear, flat, step, stepnext, spline, clamped, plateau, fast, slow.
TYPE:
|
out_tangent_type
|
Out-tangent type. Same options as in_tangent_type.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
AnimationSetKeyframeOutput
|
Dictionary with keyframe result: - node: The node that was keyed - attributes: List of attributes that were keyed - time: The time the keyframe was set at - keyframe_count: Number of keyframes set - errors: Error details if any, or None |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If node name or attribute names contain invalid characters, or tangent types are invalid. |
Source code in src/maya_mcp/tools/animation.py
293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 | |
animation_get_keyframes
¶
animation_get_keyframes(node: str, attributes: list[str] | None = None, time_range_start: float | None = None, time_range_end: float | None = None) -> AnimationGetKeyframesOutput
Query keyframes for attribute(s) on a node within optional time range.
| PARAMETER | DESCRIPTION |
|---|---|
node
|
Name of the node to query.
TYPE:
|
attributes
|
List of attribute names to query (None = all animated).
TYPE:
|
time_range_start
|
Start of time range to query (None = all time).
TYPE:
|
time_range_end
|
End of time range to query (None = all time).
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
AnimationGetKeyframesOutput
|
Dictionary with keyframe data: - node: The queried node name - keyframes: Dict mapping attribute names to lists of {time, value} entries - attribute_count: Number of attributes with keyframes - total_keyframe_count: Total number of keyframes found - errors: Error details if any, or None |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If node name or attribute names contain invalid characters, or time_range_start/time_range_end are not both provided or both None. |
Source code in src/maya_mcp/tools/animation.py
508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 | |
animation_delete_keyframes
¶
animation_delete_keyframes(node: str, attributes: list[str] | None = None, time_range_start: float | None = None, time_range_end: float | None = None) -> AnimationDeleteKeyframesOutput
Delete keyframes in a time range for attribute(s).
| PARAMETER | DESCRIPTION |
|---|---|
node
|
Name of the node to delete keyframes from.
TYPE:
|
attributes
|
List of attribute names (None = all animated attributes).
TYPE:
|
time_range_start
|
Start of time range (None = all time).
TYPE:
|
time_range_end
|
End of time range (None = all time).
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
AnimationDeleteKeyframesOutput
|
Dictionary with delete result: - node: The node that was modified - deleted_count: Number of keyframes deleted - attributes: Attributes that were affected - time_range: The time range used (or "all") - errors: Error details if any, or None |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If node name or attribute names contain invalid characters, or time_range_start/time_range_end are not both provided or both None. |
Source code in src/maya_mcp/tools/animation.py
609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 | |
Curves¶
curve
¶
Curve tools for Maya MCP.
This module provides tools for querying NURBS curve geometry.
CurveInfoOutput
¶
Bases: TypedDict
Return payload for the curve.info tool.
CurveCvsOutput
¶
Bases: _GuardedOutput
Return payload for the curve.cvs tool.
curve_info
¶
curve_info(node: str) -> CurveInfoOutput
Get information about a NURBS curve.
Returns degree, spans, form, CV count, knots, length, and bounding box.
| PARAMETER | DESCRIPTION |
|---|---|
node
|
Name of the curve node (transform or shape).
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
CurveInfoOutput
|
Dictionary with curve information: - node: The queried node name - exists: Whether the node exists - is_curve: Whether the node is a nurbsCurve - degree: Curve degree - spans: Number of spans - form: Curve form (open, closed, periodic) - cv_count: Number of CVs - knots: List of knot values - length: Arc length of the curve - bounding_box: [min_x, min_y, min_z, max_x, max_y, max_z] - errors: Error details if any, or None |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If node name contains invalid characters. |
Source code in src/maya_mcp/tools/curve.py
curve_cvs
¶
curve_cvs(node: str, offset: int = 0, limit: int | None = DEFAULT_CV_LIMIT) -> CurveCvsOutput
Query CV positions from a NURBS curve with pagination.
Returns CV positions as [x, y, z] arrays in world space.
| PARAMETER | DESCRIPTION |
|---|---|
node
|
Name of the curve node (transform or shape).
TYPE:
|
offset
|
Starting CV index (0-based).
TYPE:
|
limit
|
Maximum number of CVs to return. Default 1000. Use 0 for unlimited.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
CurveCvsOutput
|
Dictionary with CV data: - node: The queried node name - exists: Whether the node exists - is_curve: Whether the node is a nurbsCurve - cv_count: Total number of CVs - cvs: List of [x, y, z] position arrays - offset: The offset used - count: Number of CVs returned - truncated: True if more CVs remain - errors: Error details if any, or None |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If node name contains invalid characters or offset is negative. |
Source code in src/maya_mcp/tools/curve.py
142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 | |
Scripts¶
scripts
¶
Script execution tools for Maya MCP.
This module provides tools for listing, executing, and running scripts in Maya with a three-tier trust model: - Tier 1 (script.list): Read-only listing of scripts from allowed dirs - Tier 2 (script.execute): Execute validated .py files from allowed dirs - Tier 3 (script.run): Execute raw Python/MEL code (requires opt-in)
ScriptListEntry
¶
Bases: TypedDict
A discovered script file.
ScriptListOutput
¶
Bases: _GuardedOutput
Return payload for the script.list tool.
ScriptExecuteOutput
¶
Bases: TypedDict
Return payload for the script.execute tool.
ScriptRunOutput
¶
Bases: TypedDict
Return payload for the script.run tool.
script_list
¶
script_list() -> ScriptListOutput
List available Python scripts from configured directories.
Scans MAYA_MCP_SCRIPT_DIRS for .py files, excluding underscore-prefixed files. This is a server-side operation that does not require a Maya connection.
| RETURNS | DESCRIPTION |
|---|---|
ScriptListOutput
|
Dictionary with script listing: - scripts: List of script info dicts (name, path, size_bytes, relative_path) - count: Number of scripts found - directories: List of configured script directories - errors: Error details if any, or None |
Source code in src/maya_mcp/tools/scripts.py
script_execute
¶
script_execute(file_path: str, args: dict[str, Any] | None = None, timeout: int | None = None) -> ScriptExecuteOutput
Execute a Python script file in Maya.
The script must be within a configured MAYA_MCP_SCRIPT_DIRS directory.
The script is read server-side and sent to Maya for execution. An
__args__ dict is injected into the script namespace.
| PARAMETER | DESCRIPTION |
|---|---|
file_path
|
Absolute path to the .py script file.
TYPE:
|
args
|
Optional arguments dict injected as
TYPE:
|
timeout
|
Optional timeout override in seconds.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
ScriptExecuteOutput
|
Dictionary with execution result: - success: Whether execution completed without error - script: Path of the executed script - output: Captured stdout from the script - errors: Error details if any, or None |
| RAISES | DESCRIPTION |
|---|---|
ValidationError
|
If the path fails security validation. |
Source code in src/maya_mcp/tools/scripts.py
166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 | |
script_run
¶
script_run(code: str, language: Literal['python', 'mel'] = 'python', timeout: int | None = None) -> ScriptRunOutput
Execute raw Python or MEL code in Maya.
This tool requires MAYA_MCP_ENABLE_RAW_EXECUTION=true to be set. Use with caution — raw execution has no sandboxing.
| PARAMETER | DESCRIPTION |
|---|---|
code
|
The code to execute.
TYPE:
|
language
|
Code language ("python" or "mel").
TYPE:
|
timeout
|
Optional timeout override in seconds.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
ScriptRunOutput
|
Dictionary with execution result: - success: Whether execution completed without error - output: Captured stdout from execution - language: The language used - errors: Error details if any, or None |
| RAISES | DESCRIPTION |
|---|---|
ValidationError
|
If raw execution is disabled or code exceeds size limit. |
Source code in src/maya_mcp/tools/scripts.py
256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 | |
Maya Panel¶
maya_panel
¶
Maya MCP Control Panel.
This package provides a dockable Qt widget inside Maya for controlling the MCP server connection via commandPort.
Note
This module is designed to run INSIDE Maya's Python interpreter. It imports maya.cmds and uses PySide2 (Maya's Qt binding).
Example
Show the panel in Maya::
from maya_mcp.maya_panel import show_panel
show_panel()
Or from Maya's script editor::
import maya_mcp.maya_panel
maya_mcp.maya_panel.show_panel()
auto_start_if_enabled
¶
Auto-start commandPort if enabled in preferences.
This function should be called from userSetup.py to automatically open the commandPort when Maya starts.
Example
In userSetup.py::
from maya_mcp.maya_panel import auto_start_if_enabled
auto_start_if_enabled()
Source code in src/maya_mcp/maya_panel/panel.py
show_panel
¶
Show the MCP Control Panel.
Creates and shows the dockable panel. If the panel already exists, it will be deleted and recreated.
| RETURNS | DESCRIPTION |
|---|---|
Any
|
The MCPControlPanel widget instance. |
Example
from maya_mcp.maya_panel import show_panel panel = show_panel()
Source code in src/maya_mcp/maya_panel/panel.py
controller
¶
CommandPort controller for Maya.
This module provides functions for managing Maya's commandPort from within Maya. It handles opening, closing, and querying the status of the commandPort.
Note
This module MUST be run inside Maya's Python interpreter as it imports maya.cmds.
Example
Open commandPort on default port::
from maya_mcp.maya_panel.controller import open_command_port
open_command_port()
Check if commandPort is open::
from maya_mcp.maya_panel.controller import is_command_port_open
if is_command_port_open():
print("CommandPort is running")
get_open_ports
¶
Get a list of currently open commandPorts.
| RETURNS | DESCRIPTION |
|---|---|
list[str]
|
List of port names (e.g., [":7001", ":7002"]). |
Example
ports = get_open_ports() print(ports) [':7001']
Source code in src/maya_mcp/maya_panel/controller.py
is_command_port_open
¶
Check if commandPort is open on the specified port.
| PARAMETER | DESCRIPTION |
|---|---|
port
|
Port number to check.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
bool
|
True if the commandPort is open on the specified port. |
Example
is_command_port_open(7001) True
Source code in src/maya_mcp/maya_panel/controller.py
open_command_port
¶
open_command_port(port: int = DEFAULT_PORT, source_type: str = 'python', echo_output: bool = True) -> bool
Open Maya's commandPort on the specified port.
If the port is already open, this function returns True without reopening.
| PARAMETER | DESCRIPTION |
|---|---|
port
|
Port number to open (1-65535).
TYPE:
|
source_type
|
Command interpreter ("python" or "mel").
TYPE:
|
echo_output
|
If True, send command output back to client.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
bool
|
True if the port is now open (either opened or was already open). |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If port is out of valid range. |
RuntimeError
|
If commandPort could not be opened. |
Example
open_command_port(7001) True
Source code in src/maya_mcp/maya_panel/controller.py
close_command_port
¶
Close Maya's commandPort on the specified port.
If the port is not open, this function returns True.
| PARAMETER | DESCRIPTION |
|---|---|
port
|
Port number to close.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
bool
|
True if the port is now closed (either closed or was already closed). |
Example
close_command_port(7001) True
Source code in src/maya_mcp/maya_panel/controller.py
toggle_command_port
¶
Toggle commandPort on/off.
| PARAMETER | DESCRIPTION |
|---|---|
port
|
Port number to toggle.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
bool
|
True if the port is now open, False if closed. |
Example
toggle_command_port(7001) True # Port was closed, now open toggle_command_port(7001) False # Port was open, now closed
Source code in src/maya_mcp/maya_panel/controller.py
get_port_status
¶
Get detailed status of the commandPort.
| PARAMETER | DESCRIPTION |
|---|---|
port
|
Port number to check.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
dict[str, object]
|
Dictionary with status information: - is_open: Whether the port is open - port: Port number - port_name: Port name string (e.g., ":7001") - all_ports: List of all open ports |
Example
get_port_status(7001)
Source code in src/maya_mcp/maya_panel/controller.py
preferences
¶
Preferences management for Maya MCP Panel.
This module handles saving and loading user preferences for the MCP panel, including auto-start settings and port configuration.
Preferences are stored using Maya's optionVar system, which persists across Maya sessions.
Example
Get and set port::
from maya_mcp.maya_panel.preferences import get_port, set_port
port = get_port() # Returns 7001 by default
set_port(7002)
Get and set auto-start::
from maya_mcp.maya_panel.preferences import get_auto_start, set_auto_start
set_auto_start(True)
get_port
¶
Get the configured commandPort port number.
| RETURNS | DESCRIPTION |
|---|---|
int
|
Port number from preferences, or DEFAULT_PORT if not set. |
Example
get_port() 7001
Source code in src/maya_mcp/maya_panel/preferences.py
set_port
¶
Set the commandPort port number in preferences.
| PARAMETER | DESCRIPTION |
|---|---|
port
|
Port number to save (1-65535).
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If port is out of valid range. |
Example
set_port(7002)
Source code in src/maya_mcp/maya_panel/preferences.py
get_auto_start
¶
Get the auto-start preference.
| RETURNS | DESCRIPTION |
|---|---|
bool
|
True if commandPort should auto-start on Maya launch. |
Example
get_auto_start() False
Source code in src/maya_mcp/maya_panel/preferences.py
set_auto_start
¶
Set the auto-start preference.
| PARAMETER | DESCRIPTION |
|---|---|
enabled
|
Whether to auto-start commandPort on Maya launch.
TYPE:
|
Example
set_auto_start(True)
Source code in src/maya_mcp/maya_panel/preferences.py
reset_preferences
¶
Reset all MCP preferences to defaults.
Example
reset_preferences()
Source code in src/maya_mcp/maya_panel/preferences.py
get_all_preferences
¶
Get all MCP preferences as a dictionary.
| RETURNS | DESCRIPTION |
|---|---|
dict[str, object]
|
Dictionary with all preference values. |
Example
get_all_preferences()