Files
wehub-resource-sync db1d565b64
Integration Tests / melodic (push) Has been cancelled
Integration Tests / noetic (push) Has been cancelled
Integration Tests / humble (push) Has been cancelled
Integration Tests / jazzy (push) Has been cancelled
Ruff Lint & Format / ruff (push) Has been cancelled
Sync main to develop / Check if sync is needed (push) Has been cancelled
Sync main to develop / Sync main to develop (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 12:36:23 +08:00

3.1 KiB

Step 2: Setting Up Rosbridge

Rosbridge runs on the robot's machine (wherever ROS is running). It provides a WebSocket interface that the MCP server on your machine connects to over the network.

Prerequisite: ROS must already be installed on the robot's machine. If you don't have ROS installed and want to try things out quickly, see the Turtlesim Docker example which runs ROS and rosbridge in a container.

Important — rosbridge and rosapi are both required. ros-mcp-server needs rosbridge_server (the WebSocket interface) and rosapi (the introspection services behind get_nodes, get_topics, get_services, detect_ros_version, parameter tools, etc.). The launch file used below starts both automatically. Do not start rosbridge with ros2 run rosbridge_server ... / rosrun rosbridge_server ... — those bring up the WebSocket without rosapi, and every introspection tool will fail with "Service does not exist". The ros-<distro>-rosbridge-server package pulls rosapi in as a dependency; if in doubt, install the full ros-<distro>-rosbridge-suite metapackage.

Install rosbridge_server

For ROS 2 Jazzy:

# Update package list
sudo apt update
# Install rosbridge for ROS2 Jazzy
sudo apt install ros-jazzy-rosbridge-server

For other ROS 2 distros:

# Install rosbridge for ROS2 Humble
sudo apt install ros-humble-rosbridge-server
# Install for other ROS distros
sudo apt install ros-<your-distro>-rosbridge-server

Using ROS 1? See ROS 1 instructions at the bottom of this page.

Launch rosbridge

source your ROS workspace first to ensure that the rosbridge has access to your ROS system.

ros2 launch rosbridge_server rosbridge_websocket_launch.xml

Don't forget to source your ROS workspace before launching, especially if you're using custom messages or services.

Verify rosbridge is running

From the robot's machine:

curl -I http://localhost:9090

A successful response confirms rosbridge is listening on its default port (9090).

Also confirm rosapi is running — its services must be present for the MCP tools to work:

# ROS 2
ros2 service list | grep rosapi

# ROS 1
rosservice list | grep rosapi

If this prints nothing, you launched rosbridge without rosapi — use the ros2 launch / roslaunch command above rather than ros2 run / rosrun.

Next Step

Connect to your robot and test it out: Step 3: Connect


Advanced

ROS 1 (End of Life)

Install rosbridge_server

For ROS Noetic:

sudo apt install ros-noetic-rosbridge-server

For other ROS 1 distros:

sudo apt install ros-<your-distro>-rosbridge-server

Launch rosbridge

roslaunch rosbridge_server rosbridge_websocket.launch

Don't forget to source your ROS workspace before launching, especially if you're using custom messages or services.


Back to Installation Guide | Troubleshooting