nav2_mcp_server

ajtudela/nav2_mcp_server

3.5

If you are the rightful owner of nav2_mcp_server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.

The Nav2 MCP Server is a Model Context Protocol server designed to facilitate the control and monitoring of Nav2 navigation operations, enabling seamless integration with Nav2-enabled robots through the MCP protocol.

Tools
12
Resources
0
Prompts
0

Nav2 MCP Server

License

An MCP (Model Context Protocol) server that provides tools and resources to control and monitor Nav2 navigation operations, allowing seamless integration with Nav2-enabled robots through the MCP protocol.

Tools

ToolDescriptionParameters
navigate_to_poseNavigate the robot to a specific pose (position and orientation) in the map framex: float, y: float, yaw: float
follow_waypointsNavigate the robot through a sequence of waypoints in orderwaypoints: str (JSON array)
spin_robotRotate the robot in place by a specified angleangle: float
backup_robotMove the robot backward by a specified distancedistance: float, speed: float
dock_robotDock the robot to a charging station or dockx: float, y: float, yaw: float, dock_id: str, dock_type: str, nav_to_dock: bool
undock_robotUndock the robot from a charging station or dockdock_type: str
clear_costmapsClear robot navigation costmaps to remove stale obstacle datacostmap_type: str
get_robot_poseGet the current position and orientation of the robot
cancel_navigationCancel the currently active navigation task
nav2_lifecycleControl Nav2 lifecycle (startup or shutdown)action: str
get_pathCompute a navigation path between two posesstart_x: float, start_y: float, start_yaw: float, goal_x: float, goal_y: float, goal_yaw: float, planner_id: str
get_path_from_robotCompute a navigation path from the robot's current pose to a goal posegoal_x: float, goal_y: float, goal_yaw: float, planner_id: str

Environment Variables

VariableDefaultDescription
ROS_DOMAIN_IDROS 2 domain ID for network isolation (recommended to set)
ROS_LOCALHOST_ONLYSet to '1' to restrict ROS 2 communication to localhost only

Features

  • Navigation control: Navigate to specific poses, follow waypoint sequences, and execute precise robot movements
  • Real-time status: Monitor navigation progress, robot pose, and system status with comprehensive feedback
  • Costmap management: Clear stale obstacle data and manage navigation costmaps for optimal path planning
  • Lifecycle management: Control Nav2 system startup and shutdown for complete system control
  • ROS 2 integration: Full compatibility with Nav2 navigation stack and ROS 2 ecosystem
  • Async operations: Non-blocking navigation commands with progress monitoring and cancellation support

Installation

Dependencies

Install with uv (recommended)

Clone the repository and install with uv:

git clone https://github.com/ajtudela/nav2_mcp_server.git
cd nav2_mcp_server
# Set up ROS 2 environment variables if needed
export ROS_DOMAIN_ID=0
uv sync

Or install directly from the repository:

uv add git+https://github.com/ajtudela/nav2_mcp_server.git

Install with pip

Install the package in development mode:

git clone https://github.com/ajtudela/nav2_mcp_server.git
cd nav2_mcp_server
# Set up ROS 2 environment variables if needed
export ROS_DOMAIN_ID=0
python3 -m pip install .

Or install directly from the repository:

python3 -m pip install git+https://github.com/ajtudela/nav2_mcp_server.git

Docker

Build the image

Build the image:

docker build -t nav2_mcp_server:latest .
Pull the image

Pull the latest image from the Docker registry:

docker pull ghcr.io/ajtudela/nav2_mcp_server:latest

Usage

Running with uv

uv run nav2_mcp_server

Running with pip installation

python3 -m nav2_mcp_server

Configuration example for Claude Desktop/Cursor/VSCode

Add this configuration to your application's settings (mcp.json):

Using uv (recommended)
{
  "nav2 mcp server": {
    "type": "stdio",
    "command": "uv",
    "args": [
      "run",
      "--directory",
      "/path/to/nav2_mcp_server",
      "nav2_mcp_server"
    ],
    "env": {
      "ROS_DOMAIN_ID": "0",
      "ROS_LOCALHOST_ONLY": "1"
    }
  }
}
Using pip installation
{
  "nav2 mcp server": {
    "type": "stdio",
    "command": "python3",
    "args": [
      "-m",
      "nav2_mcp_server"
    ],
    "env": {
      "ROS_DOMAIN_ID": "0",
      "ROS_LOCALHOST_ONLY": "1"
    }
  }
}
Using Docker
"nav2 mcp server": {
    "type": "stdio",
    "command": "docker",
    "args": [
        "run",
        "-i",
        "--rm",
        "ghcr.io/ajtudela/nav2_mcp_server"
    ],
    "env": {
      "ROS_DOMAIN_ID": "0",
      "ROS_LOCALHOST_ONLY": "1"
    }
}