Rancher MCP Server

MCP server for the Rancher ecosystem: Kubernetes, Harvester HCI, and Fleet.

README.md

rancher-mcp-server

rancher-mcp-server banner

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

Demo

A walkthrough of how this MCP server works (example in Cursor).

https://github.com/user-attachments/assets/7d8fb814-e504-47b4-956d-28f43aeea3b8

Features

  • Harvester toolset: List/get VMs, images, volumes, networks, hosts; VM actions; addon list/switch (enable/disable)
  • Rancher toolset: List clusters and projects, cluster get, overview (management API)
  • Kubernetes toolset: List/get/create/patch/delete resources by apiVersion/kind; describe (resource + events), events, capacity
  • Helm toolset: List/get/history of releases; install, upgrade, rollback, uninstall; repo list
  • Fleet toolset: GitRepo list/get/create; Bundle list; Fleet cluster list; drift detection
  • Rancher Steve API: Single token, multi-cluster access; no CLI wrappers
  • Security: Read-only default, disable-destructive, sensitive data masking
  • Config: Flags, env (RANCHER_MCP_*), or file (YAML/TOML)

Quick start

Install

npm install -g rancher-mcp-server

Cursor

Add to .cursor/mcp.json (project-level) or ~/.cursor/mcp.json (global):

{
  "mcpServers": {
    "rancher": {
      "command": "npx",
      "args": [
        "-y", "rancher-mcp-server",
        "--rancher-server-url", "https://rancher.example.com",
        "--rancher-token", "token-xxxxx:yyyy",
        "--toolsets", "harvester,rancher,kubernetes,fleet"
      ]
    }
  }
}

Restart Cursor after saving. Check Settings → Tools & MCP that rancher is listed and enabled.

Claude Desktop

Add to your Claude Desktop config (claude_desktop_config.json):

{
  "mcpServers": {
    "rancher": {
      "command": "npx",
      "args": [
        "-y", "rancher-mcp-server",
        "--rancher-server-url", "https://rancher.example.com",
        "--rancher-token", "token-xxxxx:yyyy",
        "--toolsets", "harvester,rancher,kubernetes,fleet"
      ]
    }
  }
}

With env vars instead of args

If you prefer to keep the token out of the JSON config:

{
  "mcpServers": {
    "rancher": {
      "command": "npx",
      "args": ["-y", "rancher-mcp-server"],
      "env": {
        "RANCHER_MCP_RANCHER_SERVER_URL": "https://rancher.example.com",
        "RANCHER_MCP_RANCHER_TOKEN": "token-xxxxx:yyyy",
        "RANCHER_MCP_TOOLSETS": "harvester,rancher,kubernetes"
      }
    }
  }
}

Enable write operations

For VM create, snapshots, backups, image/volume create, addon switch, host maintenance mode, VPC create/update/delete, Kubernetes create/patch/delete, Helm install/upgrade/rollback, and Fleet gitrepo create/delete, add --read-only=false. Delete operations also require --disable-destructive=false (default).

{
  "mcpServers": {
    "rancher": {
      "command": "npx",
      "args": [
        "-y", "rancher-mcp-server",
        "--rancher-server-url", "https://rancher.example.com",
        "--rancher-token", "token-xxxxx:yyyy",
        "--toolsets", "harvester,rancher,kubernetes,helm,fleet",
        "--read-only=false"
      ]
    }
  }
}

Streamable HTTP transport

For web clients or remote access (e.g. Claude Code claude mcp add -t http), add --transport and --port:

{
  "mcpServers": {
    "rancher": {
      "command": "npx",
      "args": [
        "-y", "rancher-mcp-server",
        "--rancher-server-url", "https://rancher.example.com",
        "--rancher-token", "token-xxxxx:yyyy",
        "--transport", "http",
        "--port", "8080"
      ]
    }
  }
}

The server uses the MCP Streamable HTTP transport. The default MCP path is /mcp; connect to http://localhost:8080/mcp (or your server base URL + /mcp). Best supported with Claude Code; Cursor support may vary.

Build from source

If you prefer to build the Go binary yourself:

go build -o rancher-mcp-server ./cmd/rancher-mcp-server

Then reference the binary directly in 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",

Tools 5

harvesterManage Harvester HCI resources including VMs, images, volumes, networks, and hosts.
rancherInteract with Rancher management API to list clusters and projects.
kubernetesPerform CRUD operations on Kubernetes resources and describe cluster capacity.
helmManage Helm releases and repositories.
fleetManage Fleet GitOps bundles and cluster drift detection.

Environment Variables

RANCHER_MCP_RANCHER_SERVER_URLrequiredThe URL of the Rancher server instance.
RANCHER_MCP_RANCHER_TOKENrequiredThe API token for Rancher authentication.
RANCHER_MCP_TOOLSETSComma-separated list of toolsets to enable (e.g., harvester,rancher,kubernetes).

Try it

List all Kubernetes clusters currently managed by Rancher.
Show me the status of all virtual machines in the Harvester cluster.
Check for any drift in the Fleet GitOps bundles.
Describe the current capacity and resource usage of the production Kubernetes cluster.
List all installed Helm releases in the default namespace.

Frequently Asked Questions

What are the key features of Rancher MCP Server?

Multi-cluster Kubernetes resource management and monitoring. Harvester HCI integration for VM, volume, and network operations. Fleet GitOps support for bundle management and drift detection. Helm release lifecycle management including install, upgrade, and rollback. Secure access via Rancher Steve API with sensitive data masking.

What can I use Rancher MCP Server for?

Automating Kubernetes resource patching and deletion via natural language. Monitoring VM health and storage status in Harvester HCI environments. Auditing GitOps deployments by checking Fleet bundle status. Streamlining Helm chart deployments across multiple clusters.

How do I install Rancher MCP Server?

Install Rancher MCP Server by running: npm install -g rancher-mcp-server

What MCP clients work with Rancher MCP Server?

Rancher MCP Server works with any MCP-compatible client including Claude Desktop, Claude Code, Cursor, and other editors with MCP support.

Turn this server into reusable context

Keep Rancher MCP Server docs, env vars, and workflow notes in Conare so your agent carries them across sessions.

Open Conare