maya-mcp-server

v0.1.0
maya-mcp-server Checked 3 days ago Published 11 months ago

MCP server for interacting with Autodesk Maya sessions

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

list_sessions

List all active Maya sessions. Returns a list of session information including: - session_key: Session key used to interact with tools and resources - host: Session host address - port: Session port number - pid: Maya process ID - user: Logged-in user - maya_version: Maya version string - scene_name: Current scene filename - scene_path: Full path to current scene Note: To detect new or removed sessions, clients should call this tool periodically (e.g., every 10-30 seconds) and compare results. The SessionManager automatically scans for new Maya sessions in the background.

write_module

Create a virtual Python module in a Maya session. Args: name: Module name. Can be a dotted path (e.g., 'mypackage.utils') in which case parent packages are created automatically. code: Python source code for the module. overwrite: If True, replace existing module. If False, raise error if module already exists. session_key: Session key (optional if only one session exists) Returns: Success message Example: write_module("mytools", ''' import maya.cmds as cmds def create_cube(name="cube1"): return cmds.polyCube(name=name)[0]…

ParameterTypeDescription
code *string
name *string
overwriteboolean
session_key

execute_code

Execute Python code in a Maya session. Args: code: Python code to execute. result_type: How to handle the result: - "NONE": Execute statements, don't capture result - "JSON": Evaluate expression, JSON encode result - "RAW": Evaluate expression, return string representation session_key: Session key (optional if only one session exists) Returns: Captured result (None if result_type is NONE) Note: stdout and stderr are delivered in real-time via MCP Resource subscriptions (maya://sessions/{session_key}/stdout and /stderr). Call get_output() to retrieve b…

ParameterTypeDescription
code *string
result_typestring
session_key

add_session

Manually add a Maya session at a specific host and port. Use this when auto-discovery doesn't find your Maya session, or to connect to a Maya instance on a specific port. Args: host: The session host (default: "127.0.0.1") port: The session port number (default: 7001) Returns: Session information for the added session Before using this, ensure Maya has a Python command port open. In Maya's Script Editor (Python), run: import maya.cmds as cmds cmds.commandPort(name=':7001', sourceType='python')

ParameterTypeDescription
hoststring
portinteger