USD操作服务器

Omniverse USD MCP Server是一个为Universal Scene Description (USD)和NVIDIA Omniverse提供标准化API的Model Context Protocol (MCP)服务器,支持基本的USD操作。

  • by jph2
  • Python
  • 本地部署
  • 更新于
在 GitHub 查看 jph2/Omniverse_USD_MCPServer_byJPH2

使用说明

Omniverse美元MCP服务器

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!警告:完全禁止!!!我已经有一段时间没看了。..|我认为它没有任何意义!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 但是。…如果你能让它发挥作用…我很高兴能开始它:)所以公关

用于通用场景描述(USD)和NVIDIA Omniverse的模型上下文协议(MCP)服务器。此服务器为基本的美元操作提供标准化的API。

核心功能

服务器目前提供以下核心美元操作:

  • 创建、打开和保存USD阶段
  • 列出并分析阶段内容
  • 创建图元并定义基本几何图形
  • 添加对外部USD文件的引用
  • 适当的资源管理和阶段清理

安装

# Clone the repository
git clone https://github.com/yourusername/omniverse-usd-mcp-server.git
cd omniverse-usd-mcp-server

# Install dependencies
pip install -r requirements.txt

快速开始

# Start the server with stdio protocol (for CLI interaction)
python -m usd_mcp_server

# Start the server with HTTP protocol (for web clients)
python -m usd_mcp_server --protocol=http --host=0.0.0.0 --port=5000

使用服务器

该服务器可以与任何模型上下文协议(MCP)客户端一起使用。下面是一个使用Python客户端的示例:

import asyncio
import sys
import os

# Add the parent directory to the path
sys.path.insert(0, os.path.abspath(os.path.dirname(__file__)))
from usd_mcp_client import UsdMcpClient

async def run_example():
    # Create client and connect
    client = UsdMcpClient("stdio", ["python", "-m", "usd_mcp_server"])
    await client.connect()
    
    try:
        # Create a new stage
        result = await client.call_tool("create_new_stage", {
            "file_path": "example.usda",
            "template": "basic",
            "up_axis": "Y"
        })
        stage_id = result["data"]["stage_id"]
        
        # Add a cube
        await client.call_tool("define_stage_prim", {
            "stage_id": stage_id,
            "prim_path": "/World/Cube",
            "prim_type": "Cube"
        })
        
        # Save the stage
        await client.call_tool("save_usd_stage", {
            "stage_id": stage_id
        })
        
        # Close and cleanup the stage when done
        await client.call_tool("close_stage", {
            "stage_id": stage_id
        })
        
    finally:
        await client.close()

# Run the example
asyncio.run(run_example())

服务器协议

服务器支持多种通信协议:

  • stdio:标准输入/输出(默认,用于嵌入应用程序)
  • http:web客户端的HTTP协议
  • websocket:用于实时应用程序的WebSocket协议
  • sse:服务器发送单向实时更新事件
  • tcp:原始TCP协议
  • zmq:用于高性能应用程序的ZeroMQ协议

可用工具

服务器为USD操作提供了以下工具:

核心美元工具

  • create_new_stage:创建一个新的美元舞台
  • open_usd_stage:打开现有的美元阶段
  • save_usd_stage:将更改保存到阶段
  • close_stage:关闭并卸载舞台,释放资源
  • list_stage_prims:列出一个阶段中的所有首字母
  • analyze_usd_stage:分析阶段内容
  • define_stage_prim:创建新的prim
  • create_stage_reference:创建对另一个USD文件的引用
  • create_stage_mesh:使用几何数据创建网格

示例脚本

在 examples/ 在目录中,您将找到演示如何使用服务器的示例脚本:

  • basic_example.py:显示基本阶段创建和操作

生产准备:

需要约20小时的抛光(测试、CI、错误处理)才能达到企业标准。

这种实现有着坚实的基础,但需要加强关键任务工作流。如果你愿意贡献缺失的测试/维护工具,这是USD自动化的一个可行起点。

未来路线图

未来的版本将扩展功能,包括:

  • 物理模拟工具
  • 材料创建和管理
  • 动画关键帧
  • 场景图可视化
  • 高级几何操作

贡献

欢迎投稿!请随时提交拉取请求。

许可证

此项目根据MIT许可证获得许可-有关详细信息,请参阅许可证文件。

致谢


由Jan Haluszka维护