Skip to content

MayaMcpServer API ​

The MayaMcpServer class is the main entry point for embedding an MCP server inside Maya.

Module-Level Functions ​

start_server ​

python
dcc_mcp_maya.start_server(
    port: Optional[int] = None,
    server_name: str = "maya-mcp",
    register_builtins: bool = True,
    extra_skill_paths: Optional[List[str]] = None,
    include_bundled: bool = True,
    gateway_port: Optional[int] = None,
    registry_dir: Optional[str] = None,
    dcc_version: Optional[str] = None,
    scene: Optional[str] = None,
    enable_hot_reload: bool = False,
    enable_gateway_failover: bool = True,
    metrics_enabled: Optional[bool] = None,
    job_storage_path: Optional[str] = None,
    job_recovery: Optional[str] = None,
    dcc_pid: Optional[int] = None,
    dcc_window_title: Optional[str] = None,
    dcc_window_handle: Optional[int] = None,
    enable_workflows: Optional[bool] = None,
    host_dispatcher: Optional[Any] = None,
    readiness_timeout_secs: Optional[int] = None,
) -> McpServerHandle

Start (or return the already-running) module-level singleton server.

Parameters:

ParameterTypeDefaultDescription
portOptional[int]NoneOptional fixed TCP port; core/env then the OS selects a free port.
server_namestr"maya-mcp"Name shown in MCP initialize response.
register_builtinsboolTrueDiscover built-in skills during startup; concrete toolsets load on demand.
extra_skill_pathsList[str]NoneAdditional directories to scan for SKILL.md files.
include_bundledboolTrueInclude bundled dcc-mcp-core skills during discovery.
gateway_portint | NoneNonePort used for the multi-instance gateway.
registry_dirstr | NoneNoneShared registry directory for service discovery metadata.
dcc_versionstr | NoneNoneMaya version reported to the discovery registry.
scenestr | NoneNoneCurrent scene path reported to the discovery registry.
enable_hot_reloadboolFalseEnable skill hot-reload support.
enable_gateway_failoverboolTrueAllow non-gateway instances to promote themselves on gateway loss.
metrics_enabledbool | NoneNoneEnable Prometheus /metrics endpoint. None reads DCC_MCP_MAYA_METRICS=1.
job_storage_pathstr | NoneNoneSQLite job persistence DB path. None reads DCC_MCP_MAYA_JOB_STORAGE, else defaults to <data_dir>/jobs.db. Set "" to disable.
job_recoverystr | NoneNoneInterrupted job recovery: "drop" (default) or "requeue". None reads DCC_MCP_MAYA_JOB_RECOVERY.
dcc_pidint | NoneNonePID advertised to the registry and gateway diagnostics.
dcc_window_titlestr | NoneNoneWindow title advertised to discovery surfaces.
dcc_window_handleint | NoneNoneNative window handle advertised to discovery surfaces.
enable_workflowsbool | NoneNoneEnable core workflow tools (workflows.run/resume/list_runs).
host_dispatcherAny | NoneNoneMaya host dispatcher used by the core dispatcher bridge.
readiness_timeout_secsint | NoneNoneAdvisory timeout value published with runtime readiness state.

Returns: McpServerHandle with .mcp_url(), .port, .shutdown().

Example:

python
import dcc_mcp_maya

# Basic start
handle = dcc_mcp_maya.start_server()
print(handle.mcp_url())  # exact OS-assigned instance URL

# Custom port + extra skills
handle = dcc_mcp_maya.start_server(
    port=9000,
    extra_skill_paths=["C:/studio/maya-skills"],
    include_bundled=False,
)

stop_server ​

python
dcc_mcp_maya.stop_server() -> None

Stop the module-level singleton server.


Class: MayaMcpServer ​

python
from dcc_mcp_maya.server import MayaMcpServer

Constructor ​

python
MayaMcpServer(
    port: Optional[int] = None,
    server_name: str = "maya-mcp",
    server_version: str = "0.9.43",  # x-release-please-version
    gateway_port: Optional[int] = None,
    registry_dir: Optional[str] = None,
    dcc_version: Optional[str] = None,
    scene: Optional[str] = None,
    enable_gateway_failover: bool = True,
    metrics_enabled: Optional[bool] = None,
    job_storage_path: Optional[str] = None,
    job_recovery: Optional[str] = None,
    dcc_pid: Optional[int] = None,
    dcc_window_title: Optional[str] = None,
    dcc_window_handle: Optional[int] = None,
    enable_workflows: Optional[bool] = None,
    host_dispatcher: Optional[Any] = None,
    readiness_timeout_secs: Optional[int] = None,
)

Methods ​

register_builtin_actions ​

python
server.register_builtin_actions(
    extra_skill_paths: Optional[List[str]] = None,
    include_bundled: bool = True,
) -> MayaMcpServer

Discover built-in Maya skills and register diagnostics. Returns self for fluent chaining.

Registration runs in phases: core built-ins, recipe tools, skill reference docs, strict skill scan, capability manifest, project tools, and MCP resources. load_skill MCP tooling can then materialize a specific skill on demand.

start ​

python
server.start() -> McpServerHandle

Start the HTTP server. Returns a McpServerHandle.

stop ​

python
server.stop() -> None

Gracefully stop the server.

Properties ​

PropertyTypeDescription
is_runningboolWhether the server is currently running
mcp_urlOptional[str]The MCP endpoint URL, or None if not running
registryToolRegistryThe underlying tool registry

Example: Full Lifecycle ​

python
from dcc_mcp_maya.server import MayaMcpServer

# Create and configure
server = MayaMcpServer(server_name="hero-maya")
server.register_builtin_actions(
    extra_skill_paths=["C:/pipeline/maya-actions"]
)

# Start
handle = server.start()
print(f"Server at {handle.mcp_url()}")

# ... Maya session ...

# Stop
server.stop()

McpServerHandle ​

Returned by server.start() and start_server().

MemberTypeDescription
.mcp_url()strFull MCP endpoint URL
.portintActual bound TCP port
.shutdown()—Stop the server

Environment Variables ​

VariableDefaultDescription
DCC_MCP_MAYA_PORTOS-assignedOptional fixed TCP port for direct instances
DCC_MCP_MAYA_SERVER_NAMEmaya-mcpDefault server name
DCC_MCP_MAYA_SKILL_PATHS—Maya-specific skill search roots (; on Windows, : on Unix); each root may be one skill package or a parent of skill packages
DCC_MCP_SKILL_PATHS—Global fallback skill search roots
DCC_MCP_MAYA_HOT_RELOAD0Enable skill hot-reload when set to 1
DCC_MCP_MAYA_METRICS0Enable Prometheus /metrics endpoint when set to 1
DCC_MCP_MAYA_JOB_STORAGE<data_dir>/jobs.dbSQLite job persistence database path
DCC_MCP_MAYA_JOB_RECOVERYdroprequeue to resume idempotent interrupted jobs on startup
DCC_MCP_MAYA_ENABLE_GATEWAY_FAILOVER1Enable automatic gateway failover election
DCC_MCP_MAYA_ENABLE_WORKFLOWS0Enable core workflow tools
DCC_MCP_MAYA_READINESS_TIMEOUT_SECS—Advisory timeout value for readiness consumers
DCC_MCP_MAYA_EXCLUDE_STUBS_FROM_TOOLS_LIST0Hide unloaded skill/group stubs from tools/list
DCC_MCP_MAYA_SIDECAR1Set 0 to disable the default dcc-mcp-server sidecar from the Maya plugin
DCC_MCP_GATEWAY_PORT9765 in plugin modeStandalone gateway port; 0 disables gateway mode
DCC_MCP_GATEWAY_NAMEdcc-mcp-gateway@<hostname> in sidecar modeHuman-readable standalone gateway label surfaced in admin, health, and CLI diagnostics
DCC_MCP_GATEWAY_REMOTE_PORT0LAN listener disabled by default; set a positive port to opt in
DCC_MCP_GATEWAY_REMOTE_HOST0.0.0.0Bind address for the LAN gateway listener
DCC_MCP_REGISTRY_DIROS temp dirShared registry directory for service discovery

Released under the MIT License.