Token导航 LogoToken导航TokenDH.com
Mujoco MCP Server logo
AI代理stdio官方级别未说明来源级核验

Mujoco MCP Server

MCP Server

MuJoCo MCP Server是一个通过自然语言接口为AI助手提供MuJoCo物理模拟能力的工具,支持机器人加载、物理步进、接触分析、轨迹优化和视频导出等功能。

工具数

65

提示词数

0

GitHub Stars

3

资源数

0
PythonClaude机器人控制Claude

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

作者 / 组织

Rongxuan-Zhou

提供方

Rongxuan-Zhou

最后核验

2026/5/17 20:21

快速接入

先看主来源和安装命令,再打开仓库或文档;下面只保留这个条目的关键接入事实。

命令预览

pip install -e .

详细介绍

MuJoCo MCP服务器

![Python](https://www.python.org/) ![MuJoCo](https://mujoco.org/) ![Tests](<>) ![License: MIT](LICENSE)

65个MCP工具 暴露 MuJoCo 物理模拟 克劳德代码 以及任何 模型上下文协议 客户。

加载机器人、步进物理、分析联系人、优化轨迹、导出视频——所有这些都可以通过人工智能助手中的自然语言完成。

______________________________________________________________________

需求

  • Python≥3.10,MuJoCo≥2.3
  • 带有EGL(GPU)或OSMesa(CPU无头)的Linux用于渲染
  • 紫外线 推荐

______________________________________________________________________

快速开始

git clone https://github.com/Rongxuan-Zhou/mujoco-mcp-server.git
cd mujoco-mcp-server
pip install -e .

添加到克劳德代码

claude mcp add mujoco-sim -- uv run --directory /path/to/mujoco-mcp-server mujoco-mcp

或手动输入 ~/.claude.json:

{
  "mcpServers": {
    "mujoco-sim": {
      "type": "stdio",
      "command": "uv",
      "args": ["run", "--directory", "/path/to/mujoco-mcp-server", "mujoco-mcp"],
      "env": { "MUJOCO_GL": "egl" }
    }
  }
}

HTTP传输(远程)

python -m mujoco_mcp --transport streamable-http --host 0.0.0.0 --port 8080

______________________________________________________________________

你能做什么

连接后,只需问克劳德:

轨迹优化与控制

"Run iLQR on the Franka arm to reach [0.4, 0, 0.5] in 50 steps — show the control sequence and waypoints"
"Compare MPPI (200 samples) vs iLQR on the hopper reaching task; which converges to lower cost?"
"Plan a min-jerk Cartesian trajectory for the end-effector, step the PD controller, and plot joint torques over time"

稳健性&逼真

"Sweep body mass ±40% and floor friction [0.1, 2.0] over 50 random samples — report mean/std of max CoM speed"
"Apply 30 N lateral impulses across 16 Fibonacci sphere directions; what is the stability margin of the current controller?"
"At what force magnitude does the bipedal walker fail to recover in more than 25% of directions?"

接触力学和模型验证

"Validate this MJCF for dangling actuators and solref instabilities before I load it"
"Are the contact parameters between the gripper fingers and the object causing numerical stiffness? Suggest alternatives"
"Show the active contact forces and check whether the friction cone constraints are satisfied"

运动学和工作空间分析

"Compute the manipulability index at this Franka configuration — is it near a singularity?"
"Solve IK for site 'ee' at [0.5, 0.2, 0.3] and verify the joint limits are respected"
"Map reachable workspace by sweeping joint angles and recording Cartesian ee positions"

RL和数据管道

"Set up a Gymnasium env for the hopper, run 500 steps with random actions, and export a phase portrait of hip angle vs angular velocity"
"Record a 10-second rollout, export full state log with body positions and sensor data, then plot the 3D CoM trajectory"
"Run domain randomization on link masses and timestep — export CSV and show which parameter range produces the worst instability"

______________________________________________________________________

工具

工具描述
模拟sim_load sim_step sim_forward sim_reset sim_get_state sim_set_state sim_record sim_list加载MJCF/XML模型和步骤物理
渲染render_snapshot render_depthPNG快照和深度图
分析analyze_contacts analyze_energy analyze_forces compute_jacobian compute_derivatives read_sensors接触、能量、力、雅可比矩阵、线性动力学
模型modify_model reload_from_xml就地编辑参数(无需重新编译)或完全重新加载XML
批次run_sweep并行参数扫描通过 ProcessPoolExecutor
出口export_csv plot_data export_state_log plot_trajectory将轨迹保存到CSV并绘制
媒体 *(可选)*export_video将轨迹渲染为MP4或GIF视频
空间scene_map body_aabb surface_anchor compute_placementAABB、表面锚、位置计算
动物园list_menagerie_models validate_menagerie_model load_menagerie_model从MuJoCo动物园下载并加载50多个机器人
控制create_controller plan_trajectory step_controller get_controller_statePID+手臂/四足动物/类人机器人的最小急动轨迹
传感器融合configure_sensor_fusion get_fused_state低通滤波联合状态估计
协调coordinator_add_robot coordinator_get_status coordinator_check_collisions coordinator_assign_task多机器人车队管理
强化学习create_rl_env rl_step体育馆兼容RL环境包装
观众viewer_open viewer_sync viewer_close实时交互式查看器(需要显示)
视觉 *(可选)*analyze_scene compare_scenes track_object render_figure_stripGemini 2.5 Pro场景分析和轨迹跟踪
运动学solve_ik末端效应器位置的阻尼最小二乘IK
优化optimize_ilqr optimize_mppiiLQR和MPPI轨迹优化
鲁棒性apply_perturbation stability_analysis randomize_dynamics扰动鲁棒性分析和域随机化
诊断validate_mjcf model_summary suggest_contact_params diagnose_instability预加载XML验证、模型概述、联系人调优、不稳定性检测
工作流程run_and_analyze debug_contacts evaluate_trajectory compare_trajectories复合研究工作流程
server_diagnostics服务器运行状况、GL后端和已加载插槽

______________________________________________________________________

任选附件

视频导出

pip install -e ".[media]"

启用 export_video --将任何记录的轨迹渲染为 四个 (要求 imageio[ffmpeg])或 图形交换格式 (仅提供枕头,不额外收费)。

视觉分析

pip install -e ".[vision]"
export GEMINI_API_KEY=your_key

启用 analyze_scene, compare_scenes, track_object,以及 render_figure_strip 通过Gemini 2.5 Pro。

______________________________________________________________________

环境变量

变量默认值描述
MUJOCO_GL自动探测GL后端: egl (GPU)或 osmesa (CPU无头)
MUJOCO_MCP_RENDER_WIDTH640渲染宽度(像素)
MUJOCO_MCP_RENDER_HEIGHT480渲染高度(像素)
MUJOCO_MCP_NO_RENDER0设置 1 完全跳过GL初始化
MUJOCO_MCP_MAX_WORKERS8工人流程 run_sweep
GEMINI_API_KEY--视觉工具需要
GEMINI_VISION_MODELgemini-2.5-pro覆盖Gemini模型

______________________________________________________________________

建筑

src/mujoco_mcp/
├── server.py           # FastMCP app + lifespan context
├── sim_manager.py      # Multi-slot simulation manager (thread-safe)
├── _registry.py        # FastMCP instance (avoids circular imports)
├── constants.py        # Shared constants (yield intervals, thresholds)
├── tools/              # All @mcp.tool() registrations (one file per group)
├── resources.py        # MCP Resources
├── prompts.py          # MCP Prompts (7 workflow prompts)
└── utils/
    └── gl_setup.py     # Probe EGL → OSMesa; sets MUJOCO_GL before mujoco import

关键模式:

  • 每个工具组都有一个 _XXX_impl() 同步功能(用于测试)+异步MCP包装器
  • @mcp.tool() 外部装饰师, @safe_tool internal——所有异常都返回JSON错误,从不引发
  • SimManager 保存命名插槽("default", "exp1",…),每个都有模型、数据、轨迹和可选的控制器/RL环境

______________________________________________________________________

发展

# Run all tests
pytest tests/

# Single file
pytest tests/test_sim_tools.py -v

# Lint
ruff check src/mujoco_mcp

测试需要OSMesa进行无头渲染(conftest.pyMUJOCO_GL=osmesa 自动)。

______________________________________________________________________

贡献

欢迎捐款。一些指导方针:

  • 新工具组: 创建 src/mujoco_mcp/tools/.py,注册 server.py,在中添加测试 tests/test_.py
  • _impl 图案: 保持同步 _XXX_impl() 用于直接测试调用的函数;异步MCP包装器是一个薄壳
  • 先测试: 在实现之前编写失败的测试
  • 没有新的硬依赖关系 无需讨论——可选附加内容 pyproject.toml [project.optional-dependencies]

在启动大型功能之前打开一个问题。

______________________________________________________________________

许可证

麻省理工学院

目录标签

目录标签

PythonClaude机器人控制物理模拟本地部署轨迹优化自然语言接口AI助手

支持客户端

Claude

接入字段

传输方式(transport,传输协议)

stdio

鉴权方式(authType,认证方式)

none

工具数量(toolCount,工具数)

65

资源数量(resourceCount,资源数)

0

提示词数量(promptCount,提示词数)

0

权限和风险

stdionone部署方式未说明

接入前请确认传输方式、认证方式和部署位置,并根据实际工具能力限制访问范围。

安装前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

来源信息

继续浏览同类 MCP