rancher
Model Context Protocol (MCP) server for the Rancher ecosystem: multi-cluster Kubernetes, Harvester HCI (VMs, storage, networks), and Fleet GitOps.
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)
- Install the package globally:
npm install -g rancher-mcp-server
- 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
- Ensure Go is installed and GOPATH configured.
- Build the binary:
go build -o rancher-mcp-server ./cmd/rancher-mcp-server
- 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)
- 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
trpc-agent-go
trpc-agent-go is a powerful Go framework for building intelligent agent systems using large language models (LLMs) and tools.
station
Station is our open-source runtime that lets teams deploy agents on their own infrastructure with full control.
tiger-cli
Tiger CLI is the command-line interface for Tiger Cloud. It includes an MCP server for helping coding agents write production-level Postgres code.
gopls
MCP server for golang projects development: Expand AI Code Agent ability boundary to have a semantic understanding and determinisic information for golang projects.
kubernetes
A Model Context Protocol (MCP) server for the Kubernetes API.
gcp-cost
💰 An MCP server that enables AI assistants to estimate Google Cloud costs, powered by Cloud Billing Catalog API and built with Genkit for Go