Skip to content

Commit 842c0e6

Browse files
authored
Merge pull request #134 from robotmcp/release/v2.1.4
Release v2.1.4
2 parents 48ae8f8 + 773643e commit 842c0e6

27 files changed

+2736
-132
lines changed

.devcontainer/Dockerfile

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
FROM osrf/ros:humble-desktop
2+
3+
# Install dev tools, ROS2 extras, git, Python and pip
4+
RUN apt-get update && apt-get install -y \
5+
python3 \
6+
python3-colcon-common-extensions \
7+
python3-rosdep \
8+
python3-vcstool \
9+
python3-pip \
10+
git \
11+
build-essential \
12+
ros-humble-rosbridge-server \
13+
# GUI + X11/WSL2 compatibility
14+
x11-apps \
15+
libx11-xcb1 libxcb-icccm4 libxcb-image0 libxcb-keysyms1 \
16+
libxcb-randr0 libxcb-render-util0 libxcb-xinerama0 \
17+
mesa-utils \
18+
libgl1-mesa-glx \
19+
libglu1-mesa \
20+
libxext6 \
21+
libxrender1 \
22+
libxrandr2 \
23+
libxi6 \
24+
&& rm -rf /var/lib/apt/lists/*
25+
26+
# Ensure pip is accessible as `pip`
27+
RUN ln -sf /usr/bin/pip3 /usr/bin/pip
28+
29+
# Initialize rosdep
30+
RUN rosdep init || true && rosdep update
31+
32+
# Install Ruff, pre-commit, uv globally
33+
RUN pip install --no-cache-dir ruff pre-commit uv
34+
35+
# Add non-root user for VSCode devcontainer
36+
ARG USERNAME=vscode
37+
ARG USER_UID=1000
38+
ARG USER_GID=$USER_UID
39+
40+
RUN groupadd --gid $USER_GID $USERNAME \
41+
&& useradd --uid $USER_UID --gid $USER_GID -m $USERNAME \
42+
&& echo "$USERNAME ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers.d/$USERNAME \
43+
&& chmod 0440 /etc/sudoers.d/$USERNAME
44+
45+
# Auto-source ROS2 for all users
46+
RUN echo "source /opt/ros/humble/setup.bash" >> /etc/bash.bashrc
47+
48+
# Set locale
49+
ENV LANG=C.UTF-8
50+
ENV LC_ALL=C.UTF-8
51+
52+
# Ensure Qt apps can run
53+
ENV QT_X11_NO_MITSHM=1
54+
ENV QT_QPA_PLATFORM=xcb
55+
ENV LIBGL_ALWAYS_SOFTWARE=1
56+
ENV QT_XCB_GL_INTEGRATION=none
57+
58+
# Create a workspace for the non-root user
59+
RUN mkdir -p /home/$USERNAME/workspace \
60+
&& chown -R $USERNAME:$USERNAME /home/$USERNAME/workspace
61+
62+
# Set workspace directory
63+
WORKDIR /home/$USERNAME/workspace
64+
65+
# Switch to non-root user by default in devcontainer
66+
USER $USERNAME
67+
68+
# Allow pre-commit to run even if no config exists
69+
ENV PRE_COMMIT_ALLOW_NO_CONFIG=1
70+
71+
RUN git init . \
72+
&& pre-commit install --allow-missing-config || true

.devcontainer/devcontainer.json

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
{
2+
"name": "ROS2 Humble Dev",
3+
"build": { "dockerfile": "Dockerfile" },
4+
"workspaceFolder": "/home/vscode/workspace",
5+
"mounts": [
6+
"source=${localWorkspaceFolder},target=/home/vscode/workspace,type=bind"
7+
],
8+
"runArgs": [
9+
"--gpus=all",
10+
"-v", "${env:SSH_AUTH_SOCK}:/ssh-agent",
11+
"-e", "SSH_AUTH_SOCK=/ssh-agent",
12+
"-e", "DISPLAY=${localEnv:DISPLAY}",
13+
"-e", "LIBGL_ALWAYS_SOFTWARE=1",
14+
"-e", "QT_XCB_GL_INTEGRATION=none",
15+
"-v", "/tmp/.X11-unix:/tmp/.X11-unix:rw"
16+
],
17+
"containerEnv": {
18+
"QT_X11_NO_MITSHM": "1",
19+
"QT_QPA_PLATFORM": "xcb",
20+
"DISPLAY": "${localEnv:DISPLAY}",
21+
"SSH_AUTH_SOCK": "/ssh-agent",
22+
"LIBGL_ALWAYS_SOFTWARE": "1",
23+
"QT_XCB_GL_INTEGRATION": "none",
24+
"TERM": "xterm-256color"
25+
},
26+
"remoteUser": "vscode",
27+
"postStartCommand": "xhost +local:vscode || true",
28+
"forwardPorts": [5000, 9000, 9090],
29+
"portsAttributes": {
30+
"9000": { "label": "MCP Server", "onAutoForward": "ignore" },
31+
"9090": { "label": "ROSBridge", "onAutoForward": "ignore" }
32+
},
33+
"customizations": {
34+
"vscode": {
35+
"extensions": [
36+
"ms-python.python",
37+
"ms-azuretools.vscode-docker",
38+
"twxs.cmake",
39+
"ms-vscode.cpptools",
40+
"ms-python.vscode-pylance",
41+
"astral-sh.ruff"
42+
],
43+
"settings": {
44+
"terminal.integrated.defaultProfile.linux": "bash"
45+
}
46+
}
47+
}
48+
}

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
![Static Badge](https://img.shields.io/badge/ROS2-Available-green)
55
![Static Badge](https://img.shields.io/badge/License-Apache%202.0-blue)
66
![Python](https://img.shields.io/badge/python-3.10%2B-blue)
7+
![Dev Container](https://img.shields.io/badge/Dev-Container%20Ready-blue)
78
![GitHub Repo stars](https://img.shields.io/github/stars/robotmcp/ros-mcp-server?style=social)
89
![GitHub last commit](https://img.shields.io/github/last-commit/robotmcp/ros-mcp-server)
910

config/mcp.json

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{
2+
"mcpServers": {
3+
"ros-mcp-server-http": {
4+
"name": "ROS-MCP Server (http)",
5+
"transport": "http",
6+
"url": "http://127.0.0.1:9000/mcp"
7+
},
8+
"ros-mcp-server-stdio-linux": {
9+
"name": "ROS-MCP Server (stdio)",
10+
"transport": "stdio",
11+
"command": "uv",
12+
"args": [
13+
"--directory",
14+
"/home/<YOUR_USER>/ros-mcp-server",
15+
"run",
16+
"server.py"
17+
]
18+
},
19+
"ros-mcp-server-stdio-wsl": {
20+
"name": "ROS-MCP Server (stdio)",
21+
"transport": "stdio",
22+
"command": "wsl",
23+
"args": [
24+
"-d", "Ubuntu",
25+
"/home/<YOUR_USER>/.local/bin/uv",
26+
"--directory",
27+
"/home/<YOUR_USER>/ros-mcp-server",
28+
"run",
29+
"server.py"
30+
]
31+
}
32+
}
33+
}

docs/contributing.md

Lines changed: 67 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@
1616

1717
1. **Fork the repository:** Click the "Fork" button in the top right corner of the GitHub page.
1818

19-
2. **Create a new branch:** Create a separate branch for your changes to keep them isolated from the main project.
19+
2. **Create a new branch:** Create a separate branch for your changes to keep them isolated from the main project.
2020

2121
```bash
2222
git checkout -b "your_branch_name"
2323
```
2424

25-
3. **Make your changes:** Edit files with your additions or corrections. Please follow the existing format and style. When adding a new function, make sure to include:
25+
3. **Make your changes:** Edit files with your additions or corrections. Please follow the existing format and style guidelines. When adding a new function, make sure to include:
2626

2727
* The function name and format.
2828
* A brief description of the function's functionality.
@@ -66,6 +66,71 @@ We use **Ruff** for both linting and formatting. CI requires:
6666

6767
---
6868

69+
## Optional: Using Devcontainer
70+
71+
The devcontainer provides a stable testing platform with ROS2 humble pre-installed as well as an environment to test the MCP server in http transport. (stdio transport is not compatible with the devcontainer)
72+
73+
1. Install [VSCode](https://code.visualstudio.com/) and the **Remote - Containers** extension.
74+
2. Open the `ros-mcp-server` repository in VSCode.
75+
3. When prompted, **reopen in container**.
76+
- The container includes ROS2 Humble, Python 3.10+, `ruff`, `pre-commit`, `uv`, and `git`.
77+
- The repository is mounted at `/root/workspace`.
78+
- **Note for GUI apps** (`turtlesim`, `rviz`, `Gazebo`):
79+
Ensure the container can access your host X server by running the following command once on the host:
80+
81+
<details>
82+
<summary> Ubuntu host </summary>
83+
84+
```bash
85+
sudo apt install x11-xserver-utils # if xhost is not installed
86+
xhost +local:root # allow container user access
87+
```
88+
</details>
89+
90+
<details>
91+
<summary> Windows WSL2 host </summary>
92+
93+
```bash
94+
export DISPLAY=$(grep nameserver /etc/resolv.conf | awk '{print $2}'):0
95+
export QT_X11_NO_MITSHM=1
96+
xhost +local:root
97+
```
98+
</details>
99+
100+
101+
4. You can now control the Turtlesim robot following **Step-2** and **Step-4** from the [installation guide](installation.md).
102+
5. Initialize pre-commit hooks (optional but recommended):
103+
```bash
104+
pre-commit install
105+
pre-commit run --all-files
106+
```
107+
6. Check Python code formatting with `ruff`
108+
```bash
109+
ruff check .
110+
ruff format --check .
111+
```
112+
<details>
113+
<summary>SSH Agent Setup for Git (click to expand)</summary>
114+
115+
This should be run on the host side prior to building the devcontainer.
116+
```bash
117+
# Start the SSH agent
118+
eval "$(ssh-agent -s)"
119+
120+
# List keys currently loaded
121+
ssh-add -l
122+
```
123+
124+
If it says “The agent has no identities”, you must load your key, for example:
125+
```bash
126+
ssh-add ~/.ssh/id_ed25519
127+
ssh-add -l # confirm fingerprint shows up
128+
```
129+
</details>
130+
131+
**Note:** This setup has been tested and verified on Ubuntu.
132+
133+
69134
## License
70135

71136
This project is licensed under the **Apache License 2.0**. By contributing to this project, you agree that your contributions will be licensed under the same license.

0 commit comments

Comments
 (0)