MuJoCo MCP Server
Provides optional video export capability, rendering recorded trajectories as MP4 videos using FFmpeg.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@MuJoCo MCP ServerRun iLQR on Franka arm to reach [0.4,0,0.5] in 50 steps"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
MuJoCo MCP Server
65 MCP tools that expose MuJoCo physics simulation to Claude Code and any Model Context Protocol client.
Load robots, step physics, analyze contacts, optimize trajectories, export videos — all through natural language in your AI assistant.
Requirements
Python ≥ 3.10, MuJoCo ≥ 2.3
Linux with EGL (GPU) or OSMesa (CPU headless) for rendering
uv recommended
Related MCP server: Blender MCP Server
Quick Start
git clone https://github.com/Rongxuan-Zhou/mujoco-mcp-server.git
cd mujoco-mcp-server
pip install -e .Add to Claude Code
claude mcp add mujoco-sim -- uv run --directory /path/to/mujoco-mcp-server mujoco-mcpOr manually in ~/.claude.json:
{
"mcpServers": {
"mujoco-sim": {
"type": "stdio",
"command": "uv",
"args": ["run", "--directory", "/path/to/mujoco-mcp-server", "mujoco-mcp"],
"env": { "MUJOCO_GL": "egl" }
}
}
}HTTP Transport (remote)
python -m mujoco_mcp --transport streamable-http --host 0.0.0.0 --port 8080What you can do
Once connected, just ask Claude:
Trajectory optimization & control
"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"Robustness & sim-to-real
"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?"Contact mechanics & model validation
"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"Kinematics & workspace analysis
"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 & data pipelines
"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"Tools
Group | Tools | Description |
Simulation |
| Load MJCF/XML models and step physics |
Rendering |
| PNG snapshots and depth maps |
Analysis |
| Contacts, energy, forces, Jacobians, linearized dynamics |
Model |
| In-place parameter edits (no recompile) or full XML reload |
Batch |
| Parallel parameter sweeps via |
Export |
| Save trajectories to CSV and plot |
Media (optional) |
| Render trajectory as MP4 or GIF video |
Spatial |
| AABB, surface anchors, placement computation |
Menagerie |
| Download and load 50+ robots from MuJoCo Menagerie |
Control |
| PID + min-jerk trajectory for arms/quadrupeds/humanoids |
Sensor Fusion |
| Low-pass filtered joint state estimation |
Coordination |
| Multi-robot fleet management |
RL |
| Gymnasium-compatible RL environment wrapper |
Viewer |
| Live interactive viewer (requires display) |
Vision (optional) |
| Gemini 2.5 Pro scene analysis and trajectory tracking |
Kinematics |
| Damped Least Squares IK for end-effector sites |
Optimization |
| iLQR and MPPI trajectory optimization |
Robustness |
| Perturbation robustness analysis and domain randomization |
Diagnostics |
| Pre-load XML validation, model overview, contact tuning, instability detection |
Workflow |
| Composite research workflows |
Meta |
| Server health, GL backend, and loaded slots |
Optional Extras
Video Export
pip install -e ".[media]"Enables export_video — render any recorded trajectory as MP4 (requires imageio[ffmpeg]) or GIF (Pillow only, no extra deps).
Vision Analysis
pip install -e ".[vision]"
export GEMINI_API_KEY=your_keyEnables analyze_scene, compare_scenes, track_object, and render_figure_strip via Gemini 2.5 Pro.
Environment Variables
Variable | Default | Description |
| auto-probed | GL backend: |
|
| Render width in pixels |
|
| Render height in pixels |
|
| Set |
|
| Worker processes for |
| — | Required for Vision tools |
|
| Override Gemini model |
Architecture
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 importKey patterns:
Each tool group has a
_XXX_impl()sync function (for tests) + async MCP wrapper@mcp.tool()outer decorator,@safe_toolinner — all exceptions return JSON errors, never raiseSimManagerholds named slots ("default","exp1", …), each with model, data, trajectory, and optional controller/RL env
Development
# Run all tests
pytest tests/
# Single file
pytest tests/test_sim_tools.py -v
# Lint
ruff check src/mujoco_mcpTests require OSMesa for headless rendering (conftest.py sets MUJOCO_GL=osmesa automatically).
Contributing
Contributions are welcome. A few guidelines:
New tool group: create
src/mujoco_mcp/tools/<group>.py, register inserver.py, add tests intests/test_<group>.py_implpattern: keep a synchronous_XXX_impl()function for direct test invocation; the async MCP wrapper is a thin shellTests first: write failing tests before implementing
No new hard dependencies without discussion — optional extras go in
pyproject.toml[project.optional-dependencies]
Open an issue before starting large features.
License
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/Rongxuan-Zhou/mujoco-mcp-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server