version: '3.8'
services:
ros-mcp-server:
build:
context: .
dockerfile: Dockerfile
container_name: ros-mcp-server
network_mode: host # Required for ROS networking
environment:
- ROS_MASTER_URI=${ROS_MASTER_URI:-http://localhost:11311}
- ROS_IP=${ROS_IP:-127.0.0.1}
- MCP_TRANSPORT=${MCP_TRANSPORT:-http}
- MCP_PORT=${MCP_PORT:-8000}
volumes:
# Mount source for development (optional)
- ./src:/app/src:ro
restart: unless-stopped
# For HTTP transport, expose the port
# Note: When using network_mode: host, ports are already exposed
# ports:
# - "${MCP_PORT:-8000}:8000"
# Optional: Run with stdio transport for local development
ros-mcp-server-stdio:
build:
context: .
dockerfile: Dockerfile
container_name: ros-mcp-server-stdio
network_mode: host
environment:
- ROS_MASTER_URI=${ROS_MASTER_URI:-http://localhost:11311}
- ROS_IP=${ROS_IP:-127.0.0.1}
volumes:
- ./src:/app/src:ro
stdin_open: true
tty: true
command: ["--transport", "stdio"]
profiles:
- stdio # Only start with: docker compose --profile stdio up ros-mcp-server-stdio