Get the FREE Ultimate OpenClaw Setup Guide →

rancher

Model Context Protocol (MCP) server for the Rancher ecosystem: multi-cluster Kubernetes, Harvester HCI (VMs, storage, networks), and Fleet GitOps.

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio mrostamii-rancher-mcp-server npx -y rancher-mcp-server --rancher-server-url https://rancher.example.com --rancher-token token-xxxxx:yyyy --toolsets harvester,rancher,kubernetes,fleet

How to use

This MCP server provides a unified command-line and API surface to interact with the Rancher ecosystem, including Harvester VM and image management, Rancher cluster and project visibility, Kubernetes resource operations, Helm releases, and Fleet GitOps functionality. It exposes an MCP endpoint that clients can connect to (via HTTP/SSE) or through standard I/O transports. Use the included toolsets to perform read-only or write-enabled operations depending on the configuration. Start by pointing the server at your Rancher server using the --rancher-server-url and authenticating with --rancher-token; then enable the desired toolsets (harvester, rancher, kubernetes, fleet) to access the corresponding capabilities. The server supports both read-only mode and protected destructive actions via flags like --read-only and --disable-destructive, so you can tailor security for your environment.

How to install

Prerequisites:

  • Node.js and npm installed on your machine (for the npm package option) or go installed if building from source.
  • Access to a Rancher server and valid token for API access.

Option A: Install the MCP server via npm (recommended for quick start)

  1. Install the package globally:
npm install -g rancher-mcp-server
  1. Run or configure via your MCP client (see mcp_config example below):
# Example using npx as in the README configuration
npx -y rancher-mcp-server \
  --rancher-server-url https://rancher.example.com \
  --rancher-token token-xxxxx:yyyy \
  --toolsets harvester,rancher,kubernetes,fleet

Option B: Build from source (Go) and reference the binary directly

  1. Ensure Go is installed and GOPATH configured.
  2. Build the binary:
go build -o rancher-mcp-server ./cmd/rancher-mcp-server
  1. Reference the binary from your MCP config:
{
  "mcpServers": {
    "rancher": {
      "command": "/absolute/path/to/rancher-mcp-server",
      "args": [
        "--rancher-server-url", "https://rancher.example.com",
        "--rancher-token", "token-xxxxx:yyyy",
        "--toolsets", "harvester,rancher,kubernetes,fleet"
      ]
    }
  }
}

Option C: Docker (if you package a container image)

  1. Run the container with appropriate environment/args (example):
docker run -i rancher-mcp-server \
  --rancher-server-url https://rancher.example.com \
  --rancher-token token-xxxxx:yyyy \
  --toolsets harvester,rancher,kubernetes,fleet

Note: The above commands assume the image is prepared to accept these CLI arguments. Adjust as needed for your deployment method.

Additional notes

Tips and notes:

  • Always keep your Rancher server URL and token secure. Consider using env variables to avoid embedding credentials in JSON (RANCHER_MCP_RANCHER_SERVER_URL, RANCHER_MCP_RANCHER_TOKEN).
  • Use --read-only to prevent unintended mutations; add --disable-destructive when you want to block delete operations.
  • If you need external clients (web UI or code editors) to connect, enable HTTP/SSE transport with --transport http and set a port with --port (e.g., 8080).
  • The toolsets parameter accepts a comma-separated list (harvester, rancher, kubernetes, helm, fleet). Tailor this to your environment to minimize surface area.
  • If you plan to build from source, ensure you have Go installed and follow the Build from source section; otherwise, the npm distribution is the simplest path.

Related MCP Servers

Sponsor this space

Reach thousands of developers