|
| 1 | +# Installation from Source |
| 2 | + |
| 3 | +> ⚠️ **Prerequisite**: You need either ROS installed locally on your machine OR access over the network to a robot/computer with ROS installed. This MCP server connects to ROS systems on a robot, so a running ROS environment is required. |
| 4 | +
|
| 5 | +This guide covers installing the ROS MCP Server from source code. For most users, we recommend using the [pip install method](installation.md) instead. |
| 6 | + |
| 7 | +## 1. Clone the Repository |
| 8 | + |
| 9 | +```bash |
| 10 | +git clone https://github.com/robotmcp/ros-mcp-server.git |
| 11 | +``` |
| 12 | + |
| 13 | +> ⚠️ **WSL Users**: Clone the repository in your WSL home directory (e.g., `/home/username/`) instead of the Windows filesystem mount (e.g., `/mnt/c/Users/username/`). Using the native Linux filesystem provides better performance and avoids potential permission issues. |
| 14 | +
|
| 15 | +Note the **absolute path** to the cloned directory — you'll need this later when configuring your language model client. |
| 16 | + |
| 17 | +## 2. Install UV (Python Virtual Environment Manager) |
| 18 | + |
| 19 | +You can install [`uv`](https://github.com/astral-sh/uv) using one of the following methods: |
| 20 | + |
| 21 | +<details> |
| 22 | +<summary><strong>Option A: Shell installer</strong></summary> |
| 23 | + |
| 24 | +```bash |
| 25 | +curl -LsSf https://astral.sh/uv/install.sh | sh |
| 26 | +``` |
| 27 | + |
| 28 | +</details> |
| 29 | + |
| 30 | +<details> |
| 31 | +<summary><strong>Option B: Using pip</strong></summary> |
| 32 | + |
| 33 | +```bash |
| 34 | +pip install uv |
| 35 | +``` |
| 36 | + |
| 37 | +</details> |
| 38 | + |
| 39 | +## 3. Install Dependencies |
| 40 | + |
| 41 | +Navigate to the cloned repository and install dependencies: |
| 42 | + |
| 43 | +```bash |
| 44 | +cd ros-mcp-server |
| 45 | +uv sync |
| 46 | +``` |
| 47 | + |
| 48 | +## 4. Configure Language Model Client |
| 49 | + |
| 50 | +Any LLM client that supports MCP can be used. We use **Claude Desktop** for testing and development. |
| 51 | + |
| 52 | +### 4.1. Download Claude Desktop |
| 53 | + |
| 54 | +<details> |
| 55 | +<summary><strong>Linux (Ubuntu)</strong></summary> |
| 56 | + |
| 57 | +- Follow the installation instructions from the community-supported [claude-desktop-debian](https://github.com/aaddrick/claude-desktop-debian) |
| 58 | + |
| 59 | +</details> |
| 60 | + |
| 61 | +<details> |
| 62 | +<summary><strong>MacOS</strong></summary> |
| 63 | + |
| 64 | +- Download from [claude.ai](https://claude.ai/download) |
| 65 | + |
| 66 | +</details> |
| 67 | + |
| 68 | +<details> |
| 69 | +<summary><strong>Windows (Using WSL)</strong></summary> |
| 70 | + |
| 71 | +This will have Claude running on Windows and the MCP server running on WSL. We assume that you have cloned the repository and installed UV on your [WSL](https://apps.microsoft.com/detail/9pn20msr04dw?hl=en-US&gl=US) |
| 72 | + |
| 73 | +- Download from [claude.ai](https://claude.ai/download) |
| 74 | + |
| 75 | +</details> |
| 76 | + |
| 77 | +### 4.2. Configure Claude Desktop to launch the MCP server |
| 78 | + |
| 79 | +<details> |
| 80 | +<summary><strong>Linux (Ubuntu)</strong></summary> |
| 81 | + |
| 82 | +- Locate and edit the `claude_desktop_config.json` file: |
| 83 | +- (If the file does not exist, create it) |
| 84 | +```bash |
| 85 | +~/.config/Claude/claude_desktop_config.json |
| 86 | +``` |
| 87 | + |
| 88 | +- Add the following to the `"mcpServers"` section of the JSON file |
| 89 | +- Make sure to replace `<ABSOLUTE_PATH>` with the **full absolute path** to your `ros-mcp-server` folder (note: `~` for home directory may not work in JSON files): |
| 90 | + |
| 91 | +```json |
| 92 | +{ |
| 93 | + "mcpServers": { |
| 94 | + "ros-mcp-server": { |
| 95 | + "command": "uv", |
| 96 | + "args": [ |
| 97 | + "--directory", |
| 98 | + "/<ABSOLUTE_PATH>/ros-mcp-server", |
| 99 | + "run", |
| 100 | + "server.py" |
| 101 | + ] |
| 102 | + } |
| 103 | + } |
| 104 | +} |
| 105 | +``` |
| 106 | + |
| 107 | +</details> |
| 108 | + |
| 109 | +<details> |
| 110 | +<summary><strong>MacOS</strong></summary> |
| 111 | + |
| 112 | +- Locate and edit the `claude_desktop_config.json` file: |
| 113 | +- (If the file does not exist, create it) |
| 114 | +```bash |
| 115 | +~/Library/Application\ Support/Claude/claude_desktop_config.json |
| 116 | +``` |
| 117 | + |
| 118 | +- Add the following to the `"mcpServers"` section of the JSON file |
| 119 | +- Make sure to replace `<ABSOLUTE_PATH>` with the **full absolute path** to your `ros-mcp-server` folder (note: `~` for home directory may not work in JSON files): |
| 120 | + |
| 121 | +```json |
| 122 | +{ |
| 123 | + "mcpServers": { |
| 124 | + "ros-mcp-server": { |
| 125 | + "command": "uv", |
| 126 | + "args": [ |
| 127 | + "--directory", |
| 128 | + "/<ABSOLUTE_PATH>/ros-mcp-server", |
| 129 | + "run", |
| 130 | + "server.py" |
| 131 | + ] |
| 132 | + } |
| 133 | + } |
| 134 | +} |
| 135 | +``` |
| 136 | + |
| 137 | +</details> |
| 138 | + |
| 139 | +<details> |
| 140 | +<summary><strong>Windows (Using WSL)</strong></summary> |
| 141 | + |
| 142 | +- Locate and edit the `claude_desktop_config.json` file: |
| 143 | +- (If the file does not exist, create it) |
| 144 | +```bash |
| 145 | +~/.config/Claude/claude_desktop_config.json |
| 146 | +``` |
| 147 | + |
| 148 | +- Add the following to the `"mcpServers"` section of the JSON file |
| 149 | +- Make sure to replace `<ABSOLUTE_PATH>` with the **full absolute path** to your `ros-mcp-server` folder (note: `~` for home directory may not work in JSON files): |
| 150 | +- Set the **full WSL path** to your `uv` installation (e.g., `/home/youruser/.local/bin/uv`) |
| 151 | +- Use the correct **WSL distribution name** (e.g., `"Ubuntu-22.04"`) |
| 152 | + |
| 153 | +```json |
| 154 | +{ |
| 155 | + "mcpServers": { |
| 156 | + "ros-mcp-server": { |
| 157 | + "command": "wsl", |
| 158 | + "args": [ |
| 159 | + "-d", "Ubuntu-22.04", |
| 160 | + "/home/<YOUR_USER>/.local/bin/uv", |
| 161 | + "--directory", |
| 162 | + "/<ABSOLUTE_PATH>/ros-mcp-server", |
| 163 | + "run", |
| 164 | + "server.py" |
| 165 | + ] |
| 166 | + } |
| 167 | + } |
| 168 | +} |
| 169 | +``` |
| 170 | + |
| 171 | +</details> |
| 172 | + |
| 173 | +### 4.3. Alternative Configuration - HTTP Transport |
| 174 | + |
| 175 | +The above configurations sets up the MCP server using the default STDIO transport layer, which launches the server as a plugin automatically on launching Claude. |
| 176 | + |
| 177 | +It is also possible to configure the MCP server using the http transport layer, which configures Claude to connect to the MCP server when it is launched as a standalone application. |
| 178 | + |
| 179 | +For HTTP transport, the configuration is the same across all platforms. First start the MCP server manually: |
| 180 | + |
| 181 | +**Linux/macOS/Windows(WSL):** |
| 182 | +```bash |
| 183 | +cd /<ABSOLUTE_PATH>/ros-mcp-server |
| 184 | +# Using command line arguments (recommended) |
| 185 | +uv run server.py --transport streamable-http --host 127.0.0.1 --port 9000 |
| 186 | + |
| 187 | +# Or using environment variables (legacy) |
| 188 | +export MCP_TRANSPORT=streamable-http |
| 189 | +export MCP_HOST=127.0.0.1 |
| 190 | +export MCP_PORT=9000 |
| 191 | +uv run server.py |
| 192 | +``` |
| 193 | + |
| 194 | +Then configure Claude Desktop to connect to the HTTP server (same for all platforms): |
| 195 | + |
| 196 | +```json |
| 197 | +{ |
| 198 | + "mcpServers": { |
| 199 | + "ros-mcp-server-http": { |
| 200 | + "name": "ROS-MCP Server (http)", |
| 201 | + "transport": "http", |
| 202 | + "url": "http://127.0.0.1:9000/mcp" |
| 203 | + } |
| 204 | + } |
| 205 | +} |
| 206 | +``` |
| 207 | + |
| 208 | +<details> |
| 209 | +<summary> Comparison between STDIO and HTTP Transport</summary> |
| 210 | + |
| 211 | +#### STDIO Transport (Default) |
| 212 | +- **Best for**: Local development, single-user setups |
| 213 | +- **Pros**: Simple setup, no network configuration needed |
| 214 | +- **Cons**: MCP server and LLM/MCP client need to be running on the local machine. |
| 215 | +- **Use case**: Running MCP server directly with your LLM client |
| 216 | + |
| 217 | +#### HTTP/Streamable-HTTP Transport |
| 218 | +- **Best for**: Remote access, multiple clients, production deployments |
| 219 | +- **Pros**: Network accessible, multiple clients can connect |
| 220 | +- **Cons**: Requires network configuration, MCP server needs to be run independently. |
| 221 | +- **Use case**: Remote robots, team environments, web-based clients |
| 222 | + |
| 223 | +</details> |
| 224 | + |
| 225 | +### 4.4. Test the connection |
| 226 | +- Launch Claude Desktop and check connection status. |
| 227 | +- The ros-mcp-server should be visible in your list of tools. |
| 228 | + |
| 229 | +<p align="center"> |
| 230 | + <img src="https://github.com/robotmcp/ros-mcp-server/blob/main/docs/images/connected_mcp.png" width="500"/> |
| 231 | +</p> |
| 232 | + |
| 233 | +<details> |
| 234 | +<summary><strong> Troubleshooting </strong></summary> |
| 235 | + |
| 236 | +- If the `ros-mcp-server` doesn't appear even after correctly configuring `claude_desktop_config.json`, try completely shutting down Claude Desktop using the commands below and then restarting it. This could be a Claude Desktop caching issue. |
| 237 | +```bash |
| 238 | +# Completely terminate Claude Desktop processes |
| 239 | +pkill -f claude-desktop |
| 240 | +# Or alternatively |
| 241 | +killall claude-desktop |
| 242 | + |
| 243 | +# Restart Claude Desktop |
| 244 | +claude-desktop |
| 245 | +``` |
| 246 | + |
| 247 | +</details> |
| 248 | + |
| 249 | +## Next Steps |
| 250 | + |
| 251 | +Once you have the MCP server installed from source, continue with the remaining setup steps: |
| 252 | + |
| 253 | +- **Install and run rosbridge** (on the target robot) |
| 254 | +- **Test your connection** |
| 255 | +- **Troubleshooting** (if needed) |
| 256 | + |
| 257 | +For detailed instructions on these steps, see the [main installation guide](installation.md#3-install-and-run-rosbridge-on-the-target-robot-where-ros-will-be-running). |
0 commit comments