Webots MCP

Webots MCP

Full-access MCP server for the Webots robot simulator that enables AI assistants to see, understand, and modify a running simulation, including scene-tree inspection/editing, robot control, viewport screenshots, and arbitrary code execution.

Category
访问服务器

README

Webots MCP

Full-access MCP server for the Webots robot simulator — modeled on Unity MCP. Lets an AI assistant see, understand, and modify a running simulation: scene-tree inspection/editing, node spawning/deletion, viewport screenshots, simulation control, generic control of any robot (motors, sensors, cameras, LEDs, motions), and arbitrary code execution inside Webots.

Architecture

Claude (MCP client)
   │ stdio (MCP protocol)
Python MCP server (server/main.py, FastMCP)
   │ TCP JSON frames, localhost:10022
mcp_bridge — Supervisor controller inside Webots (full scene/simulation API)
   │ localhost:10023
mcp_robot  — generic agent controller, attachable to any robot (auto-discovers devices)

Setup

  1. pip install -r requirements.txt
  2. Register the server with Claude Code (use this repo's actual path):
    claude mcp add webots -- python <path-to-this-repo>/server/main.py
    
    or add to .mcp.json:
    { "mcpServers": { "webots": { "command": "python", "args": ["<path-to-this-repo>/server/main.py"] } } }
    
  3. Get a world with the bridge running — either:
    • ask for launch_webots (opens the bundled worlds/demo.wbt), or
    • for your own project: install_bridge_into_world("path\\to\\your.wbt"), then open it in Webots.

Whole-software control

Beyond the loaded world, the MCP controls the Webots application itself:

  • Any world, any project: launch_webots auto-installs the bridge into worlds that don't have it (backup created). Works on Webots' own sample worlds too (list_sample_worlds).
  • Full asset library: search_protos / get_proto_info index all ~850 official PROTOs (robots, furniture, environments, appearances); add_proto_to_world declares one so spawn_node('Nao { }') etc. works after a reload.
  • Projects: create_project scaffolds a new Webots project; create_controller writes robot controllers.
  • Recording: start/stop_movie_recording (.mp4), start/stop_animation_recording (interactive HTML5), export_screenshot to file.
  • Application settings: get_webots_preferences / set_webots_preference (registry-backed: startup mode, python command, rendering options...).
  • Process control: launch (windowed/fullscreen/minimized/no-rendering), quit, console capture, docs search.

Dynamic scene observation

The MCP sees the scene in motion, not just as snapshots:

  • watch_simulation(duration_s) — run the sim and get a motion digest: every object's trajectory (positions over time), displacement, path length, top speed, plus interaction events (contact_start/contact_end: who touched whom, when, where — attributed by matching contact points across objects).
  • start_tracking / get_object_trajectories / get_interactions / stop_tracking — record continuously while you drive robots or apply forces.
  • capture_sequence(steps, frames, follow=...) — filmstrip of the 3D view as the sim advances; follow keeps a moving object in frame.
  • set_viewpoint(look_at=[x,y,z]) — aim the camera at any point (orientation is computed; Webots cameras look along +x with +z up).

Scene understanding (Unity-MCP-style)

  • screenshot_multiview(target=..., batch='surround'|'orbit') — capture 6 canonical views (or an azimuth × elevation orbit grid) around any node or the whole scene in one call, each returned inline with its angle caption; viewpoint restored after.
  • get_viewport_screenshot(view_target=..., view_position=[x,y,z]) — positioned one-shot capture: aim at a node (auto-framed from scene bounds) or from an exact position, without permanently moving the camera.
  • find_nodes(query, base_type) — search the scene by name/DEF/type substring; returns summaries with world positions.
  • get_scene_tree(page_size=..., parent=..., cursor=...) — paged one-level listing for large worlds (returns next_cursor), in addition to the recursive summary.
  • get_scene_bounds() — center + radius of the dynamic part of the scene.
  • batch_execute([{action, params}, ...]) — run many scene/simulation commands in one call (bulk spawning, mass field edits) with per-command results and stop_on_error control.
  • MCP resources — read-only live state at webots://simulation, webots://scene, webots://robots, and webots://scene/{node}.

Ground-truth perception

Webots cameras can report what they see — no ML needed:

  • get_camera_recognition(robot) — labeled detections from a robot camera: model name, node id, 3D pose relative to the camera, physical size, pixel bounding box, colors. Run enable_camera_recognition(robot) once first (adds the Recognition node via the supervisor). Objects need a non-empty recognitionColors field.
  • get_segmentation_image(robot) — per-object color mask image (enable_camera_recognition(robot, segmentation=True) first).
  • get_depth_image(robot) — RangeFinder depth map as an image + distance stats.
  • get_radar_targets(robot) — radar detections (distance, azimuth, speed, power).

Scene authoring extras

  • get_node_string(node) — export any node's full "source" (all field values); clone_node(node, new_def, position) — duplicate it in one call.
  • get_node_pose(node, relative_to=...) — pose in another node's frame (e.g. cup relative to gripper); include_center_of_mass=True adds CoM + static balance.
  • get_selected_node() — the node the user clicked in the Webots GUI: lets a human point at an object for the assistant.
  • world_reload() / get_recording_status() — reload world; poll movie encoding.
  • save_checkpoint(name) / restore_checkpoint(name) — snapshot all dynamic objects and rewind: try an action, undo, try again.
  • set_joint_position(joint, pos) — pose articulated joints through the supervisor, no motors/controllers needed (e.g. pose an arm for a screenshot).
  • insert_field_item / remove_field_item — full MF-field editing (append points to coordinate arrays, remove children by index...).
  • frame_node(node) — Webots' built-in "move viewpoint to object" fast path.

Robot control extras

  • configure_motor — acceleration limits, available force/torque, PID gains [kp, ki, kd], or direct force/torque actuation (bypass position control).
  • get_motor_state(..., include_feedback=True) — measured force/torque feedback.
  • get_lidar_summary — now includes a polar occupancy digest (nearest obstacle per sector, degrees, null = clear) and optional 3D point cloud.
  • export_urdf(robot) — the robot's kinematic model as URDF.
  • send_message / get_messages — inter-robot radio (Emitter/Receiver), with signal strength and direction to sender.
  • set_connector(lock=...) / vacuum_gripper(on=...) — docking and suction grasping.
  • speak(text) — robot text-to-speech; set_brake(damping); display_draw(commands) — draw text/shapes on robot Display devices; get_battery; robot_custom_data.
  • set_node_visibility — hide/show objects per viewer (declutter screenshots).
  • get_node_proto — introspect a PROTO instance's parameters and derivation chain.

Diagnostics, tool groups & tests

  • preflight() — one call that health-checks the stack (Webots process, bridge port, round-trip latency, sim state, agents) and tells you the fix for anything failing. Run it first when something misbehaves.
  • list_tool_groups() / manage_tool_groups(group, enabled) — disable tool groups you don't need (observe, app, assets) to keep the tool list lean; core stays on.
  • Tests: pip install pytest, then cd server && python -m pytest tests -q (fake-bridge unit tests for every tool module + TCP frame-protocol tests; no Webots required).

Typical workflow

  1. get_simulation_state — confirm the bridge is connected
  2. get_scene_tree (paged for big worlds) + get_viewport_screenshot / screenshot_multiview — see and understand the scene; find_nodes to search it
  3. Edit: spawn_node, move_node, set_node_field, delete_node, set_viewpoint (batch_execute for bulk edits)
  4. Control a robot: list_robotsattach_mcp_controller(robot)get_robot_devicesset_motor / get_camera_image / get_sensor_values
  5. Drive time: set_simulation_mode (pause/realtime/fast), step_simulation, reset_simulation
  6. Anything else: execute_supervisor_code / execute_robot_code

Notes & limitations

  • The Webots installation is auto-detected (WEBOTS_HOME env var → Windows registry → webots on PATH → standard install locations on Windows/Linux/macOS). Set WEBOTS_HOME explicitly only for unusual install paths.
  • Ports are configurable: WEBOTS_MCP_PORT (default 10022) and WEBOTS_MCP_AGENT_PORT (default 10023).
  • Pause is implemented by the bridge not stepping (the GUI shows "0.00x"). While paused, scene/simulation tools work and step_simulation is deterministic, but per-robot commands may time out — step or resume first.
  • Pausing from the Webots GUI blocks the bridge until resumed; prefer the set_simulation_mode tool.
  • Viewport screenshots capture the 3D view as rendered — keep the Webots window reasonably large and unobstructed for useful images.
  • attach_mcp_controller replaces the robot's own controller (the previous name is returned; restore it with set_node_field(robot, "controller", old_name) + execute_supervisor_code restartController if needed).
  • If Webots was force-killed, stale mcp_bridge.py python processes can hold port 10022 and freeze new sessions — kill leftover python.exe mcp_bridge.py processes.

Layout

  • server/ — FastMCP server (main.py), TCP client (connection.py), tool modules (tools/)
  • controllers/mcp_bridge/ — supervisor bridge controller (runs inside Webots)
  • controllers/mcp_robot/ — generic robot agent controller
  • worlds/demo.wbt — demo world with bridge + a simple camera/lidar-less wheeled robot

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选