rancher-mcp-server

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).