Nav2 MCP Server

Nav2 MCP Server

Enables control and monitoring of Nav2 navigation operations, including navigation, waypoints, costmap management, and lifecycle control, through the MCP protocol.

Category
访问服务器

README

Nav2 MCP Server

ROS2 License Build Docker image Python Dynamic TOML Badge codecov

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.

Demo of Nav2 MCP Server

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

Tools

Tool Description Parameters
navigate_to_pose Navigate the robot to a specific pose (position and orientation) in the map frame x: float, y: float, yaw: float
follow_waypoints Navigate the robot through a sequence of waypoints in order waypoints: str (JSON array)
spin_robot Rotate the robot in place by a specified angle angle: float
backup_robot Move the robot backward by a specified distance distance: float, speed: float
dock_robot Dock the robot to a charging station or dock x: float, y: float, yaw: float, dock_id: str, dock_type: str, nav_to_dock: bool
undock_robot Undock the robot from a charging station or dock dock_type: str
clear_costmaps Clear robot navigation costmaps to remove stale obstacle data costmap_type: str
get_robot_pose Get the current position and orientation of the robot
cancel_navigation Cancel the currently active navigation task
nav2_lifecycle Control Nav2 lifecycle (startup or shutdown) action: str
get_path Compute a navigation path between two poses start_x: float, start_y: float, start_yaw: float, goal_x: float, goal_y: float, goal_yaw: float, planner_id: str
get_path_from_robot Compute a navigation path from the robot's current pose to a goal pose goal_x: float, goal_y: float, goal_yaw: float, planner_id: str

Environment Variables

Variable Default Description
ROS_DOMAIN_ID ROS 2 domain ID for network isolation (recommended to set)
ROS_LOCALHOST_ONLY Set to '1' to restrict ROS 2 communication to localhost only

Configuration

Environment Variables

Variable Default Description
TRANSPORT_MODE stdio Transport mode: stdio (local integration) or http (network)
HTTP_HOST 0.0.0.0 HTTP host binding (only used when TRANSPORT_MODE=http)
HTTP_PORT 3001 HTTP port (only used when TRANSPORT_MODE=http)
LOG_LEVEL INFO Logging level: DEBUG, INFO, WARNING, ERROR, CRITICAL
ROS_DOMAIN_ID ROS 2 domain ID for network isolation (recommended)
ROS_LOCALHOST_ONLY Set to '1' to restrict ROS 2 communication to localhost only

Setup

  1. Copy the environment configuration template:
cp .env.example .env
  1. Edit .env to customize settings:
# Transport mode: 'stdio' for local, 'http' for containerized/network
TRANSPORT_MODE=stdio

# HTTP settings (only needed if using http transport)
HTTP_HOST=0.0.0.0
HTTP_PORT=3001

# Logging
LOG_LEVEL=INFO

Installation

Dependencies

Install with uv

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

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

Configuration example for Claude Desktop/Cursor/VSCode

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

Using uv (stdio transport)

{
  "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 Docker (stdio transport)

"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"
    }
}

Using HTTP transport

"nav2 mcp server": {
  "type": "http",
  "url": "http://localhost:3001/mcp",
  "env": {
    "TRANSPORT_MODE": "http",
    "LOG_LEVEL": "INFO"
  }
}

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选