Skip to content

快速开始

安装

公开 Agent Skills

按 Agent 任务安装对应 Skill,无需克隆本仓库:

任务Skill
操作实时 DCC、发现工具或搜索 Marketplace@loonghao/dcc-mcp
创建或现代化完整 DCC-MCP adapter/runtime@loonghao/dcc-mcp-creator
创建、验证或改进 DCC 专项 Skill 包@loonghao/dcc-mcp-skills-creator
bash
# OpenClaw workspace:默认实时 DCC 控制 Skill
openclaw skills install @loonghao/dcc-mcp

# 直接使用 ClawHub CLI
npx --yes clawhub@0.23.1 install @loonghao/dcc-mcp

只有任务进入对应开发边界时才替换为 creator slug。安装后开启新的 agent turn。

dcc-mcp Skill 安装 CLI

bash
# 在已安装的 dcc-mcp Skill 目录中运行。
python scripts/check_cli.py --ensure-cli --pretty

Agent 在安装或下载新二进制前必须先征得用户同意。这个 bundled helper 只接受 官方 dcc-mcp/dcc-mcp-core release;它会先验证当前平台的 update manifest 和 CLI SHA-256,再替换二进制。URL、manifest、摘要或下载异常时会 fail closed, 不会覆盖已有 CLI。SHA-256 用于确认二进制与 release manifest 一致;该 helper 是首次安装的信任边界,安装完成后由 gateway 驱动的更新还会验证 release workflow 的 detached Sigstore provenance。

如果没有安装 Skill,请把官方 installer 下载为本地文件,先检查内容,再执行该 本地文件:

bash
curl -fL https://raw.githubusercontent.com/dcc-mcp/dcc-mcp-core/main/scripts/install-cli.sh -o install-cli.sh
cat install-cli.sh
# 检查完成后:
sh ./install-cli.sh
powershell
Invoke-WebRequest https://raw.githubusercontent.com/dcc-mcp/dcc-mcp-core/main/scripts/install-cli.ps1 -OutFile .\install-cli.ps1
Get-Content -Raw .\install-cli.ps1
# 检查完成后,遵循当前执行策略:
& .\install-cli.ps1

installer 与 bundled helper 使用相同的固定官方来源、manifest 和 SHA-256 校验。不要把远程 installer 直接通过管道交给 shell,也不要绕过机器的脚本执行 策略。

固定版本可运行 sh ./install-cli.sh --version v0.19.63,或 & .\install-cli.ps1 -Version v0.19.63

官方安装可以通过以下命令保持最新:

bash
dcc-mcp-cli update check
dcc-mcp-cli update apply

update apply 会强制读取 release manifest 的 SHA-256、校验下载的 CLI,并为 下一次启动暂存。替换前会再次校验 staged bytes,之后用相同参数重启 CLI。它不会 替换正在运行的 dcc-mcp-server,server 需要在自己的运行环境中单独更新。

CLI 也提供了独立 ZIP 包(dcc-mcp-cli-<version>-<platform>.zip), 可从每个 GitHub Release 下载。

从 PyPI 安装

bash
pip install dcc-mcp-core

从源代码安装(需要 Rust 工具链)

bash
git clone https://github.com/dcc-mcp/dcc-mcp-core.git
cd dcc-mcp-core
pip install -e .

TIP

从源代码构建需要 Rust 工具链,可从 rustup.rs 安装。 构建由 maturin 处理,它会编译 Rust 核心并安装 Python 包。

环境要求

  • Python:3.7–3.14。Linux 与 Windows 上对原生 CPython 3.7 wheel 做强制门禁;其他平台可使用 py37-lite sidecar 回退。Python 3.8+ 使用 abi3-py38 — 详见 Python 3.7 LTS 策略
  • Rust: >= 1.95(从源代码构建时需要)
  • 许可证: MIT
  • Python 依赖: 零 — 所有功能都在编译的 Rust 扩展中

快速上手

Agent 操作实时 DCC

加载 dcc-mcp 后,把 CLI 作为结构化控制路径:

bash
dcc-mcp-cli dcc-types
dcc-mcp-cli list
dcc-mcp-cli search --query "create sphere" --dcc-type maya
dcc-mcp-cli describe <tool-slug>
dcc-mcp-cli call <tool-slug> --json '{"radius":2.0}'

只使用 search 返回的 slug,不要自行拼接。如果 list 返回零实例,按 Skill 中需要用户同意的 setup 流程处理,不要切换到原始 DCC 脚本或通用 GUI 自动化。

Skills-First:create_skill_server(推荐)

将脚本暴露为 MCP 工具最快捷的方式。在脚本目录创建 SKILL.md,然后一键完成所有配置:

python
import os
from dcc_mcp_core import create_skill_server, McpHttpConfig

# 设置应用专属 Skill 路径
os.environ["DCC_MCP_MAYA_SKILL_PATHS"] = "/path/to/my-skills"

# 一键:发现 Skills + 启动 MCP HTTP 服务器
server = create_skill_server("maya", McpHttpConfig())
handle = server.start()
print(f"Maya MCP 服务器地址:{handle.mcp_url()}")
# CLI 和网关会通过共享注册表发现这个实际地址。

本地实例默认使用操作系统分配的端口。只有外部集成明确要求固定监听端口时, 才传入 port=<端口号>

如需更多控制,可直接使用 SkillCatalog

python
import os
from dcc_mcp_core import SkillCatalog, ToolRegistry

os.environ["DCC_MCP_SKILL_PATHS"] = "/path/to/my-skills"

registry = ToolRegistry()
catalog = SkillCatalog(registry)

discovered = catalog.discover(dcc_name="maya")
print(f"发现了 {discovered} 个 Skill")

# 加载 Skill,并查看注册后的工具名称
tool_names = catalog.load_skill("maya-geometry")
print(tool_names)

参见 Skills 系统指南 了解 SKILL.md 的编写方式和更多选项。

工具注册表

python
from dcc_mcp_core import ToolRegistry

registry = ToolRegistry()
registry.register(
    name="create_sphere",
    description="Creates a sphere in the scene",
    category="geometry",
    tags=["geometry", "creation"],
    dcc="maya",
)

tool = registry.get_action("create_sphere")
print(tool)  # 包含工具元数据的字典

maya_tools = registry.list_actions(dcc_name="maya")

Action → Tool 术语说明

v0.13+ 项目在概念层面将 "action" 重命名为 "tool"。但部分 Rust API 方法名(get_actionlist_actionssearch_actions)仍使用 "action" 以保持向后兼容——这不是 bug,而是兼容别名。

工具结果

python
from dcc_mcp_core import success_result, error_result

result = success_result("创建了 5 个球体", prompt="接下来使用 modify", count=5)
print(result.success)  # True
print(result.message)  # "创建了 5 个球体"
print(result.context)  # {"count": 5}

err = error_result("失败", "file_not_found", prompt="检查路径")
print(err.success)  # False

事件总线

python
from dcc_mcp_core import EventBus

bus = EventBus()
sid = bus.subscribe("scene.changed", lambda: print("场景已更新!"))
bus.publish("scene.changed")
bus.unsubscribe("scene.changed", sid)

MCP HTTP 服务器

一行代码将注册表暴露给 AI 客户端(Claude Desktop 等):

python
from dcc_mcp_core import ToolRegistry, McpHttpServer, McpHttpConfig

registry = ToolRegistry()
# ... 注册 Actions 或加载 Skills ...

config = McpHttpConfig(port=8765)
server = McpHttpServer(registry, config)
handle = server.start()

print(f"MCP 服务器运行在 {handle.mcp_url()}")
# handle.shutdown() 停止服务器

开发环境设置

bash
git clone https://github.com/dcc-mcp/dcc-mcp-core.git
cd dcc-mcp-core

# 使用 vx 安装(推荐)
vx just install

# 或手动设置
pip install maturin
maturin develop

运行测试

bash
vx just test
vx just lint

下一步

使用 DccServerBase 构建 DCC 适配器

DccServerBase 是构建 DCC 适配器的推荐基类。它集成了所有适配器需要的样板代码:

python
from pathlib import Path
from dcc_mcp_core import DccServerBase, DccServerOptions

class BlenderMcpServer(DccServerBase):
    def __init__(self, port: int = 8765, **kwargs):
        opts = DccServerOptions.from_env(
            "blender",
            Path(__file__).parent / "skills",
            port=port,
            **kwargs,
        )
        super().__init__(options=opts)

    def _version_string(self) -> str:
        import bpy
        return bpy.app.version_string

# 仅此而已 — 技能管理、热重载、网关选举均已继承
server = BlenderMcpServer(gateway_port=9765)
server.register_builtin_actions()  # 发现并加载技能
server.enable_hot_reload()         # 可选:文件变更时自动重载
handle = server.start()            # 返回 McpServerHandle
print(f"运行于 {handle.mcp_url()}")

零样板适配器可使用 make_start_stop

python
from dcc_mcp_core import make_start_stop

start_server, stop_server = make_start_stop(
    BlenderMcpServer,
    hot_reload_env_var="DCC_MCP_BLENDER_HOT_RELOAD",
)

Released under the MIT License.