MCP Rancher
Provides tools for managing etcd backups, including backup and restore operations, through the Rancher management plane.
Provides tools for interacting with Kubernetes resources (pods, deployments, services, etc.) via Rancher's proxy, enabling CRUD, actions, and monitoring across clusters.
Provides tools for Prometheus monitoring, enabling access to metrics, alerts, and monitoring configuration within Rancher-managed clusters.
Provides tools for managing Rancher-managed Kubernetes clusters, including cluster operations, projects, workloads, nodes, and settings, through the Rancher API.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
Why this exists
Rancher is how real fleets run Kubernetes — and it speaks two APIs (the legacy
Norman /v3 plane and the modern Steve /v1 plane), varies by version, and wraps
every cluster behind its own proxy. Pointing a generic Kubernetes MCP server at it
misses everything Rancher-specific; pointing an agent at raw kubectl gives up
auditability, guardrails, and the management-plane view entirely.
MCP Rancher is built for that reality:
Capability-aware, not version-naive. It detects what each connected Rancher actually supports instead of assuming. One binary spans 2.6.5 → 2.9.3 with the same tool surface.
Multi-instance first. Lab, staging, prod — configure them all; mark prod
read_only: trueand every mutation is refused at the config layer, before any guard even has to fire.Nothing is out of reach. Curated tools cover the common 95%; the generic engine reaches every resource either API plane exposes — even types nobody wrote a tool for yet.
Related MCP server: mcp-keycloak
The tool surface
207 tools: 179 read-only · 28 writes · 5 destructive — counted from the
registry itself, not by hand. docs/tool-manifest.json
is generated from the live tool registry (make tool-manifest) and a CI
gate fails the build if it ever drifts from the code. Per-tool descriptions,
safety annotations, and parameters all live there; the narrative registry with
slice tracking is docs/tool-catalog.md.
Layer | What it does | Examples |
Discovery & schema | Explore what any instance can do |
|
Generic engine | CRUD + actions + links + watch on any resource, both planes |
|
Curated reads | Typed, shaped responses across ~25 domains |
|
Curated writes | Guarded mutations |
|
Operator rollups | One-call triage, and waiting on a change |
|
Domains covered: clusters & nodes · projects & namespaces · workloads · pods & services · storage · networking · config & secrets (values masked) · certificates (keys masked) · RBAC · auth & identity · apps & catalogs · logging pipeline · Prometheus monitoring · policy reports · CIS compliance · backup operator · etcd backups · Longhorn · Fleet · provisioning · settings & features · alerts & notifiers.
All 207 stay exposed by default — every tool schema is deferred behind
Claude Code's own search, so a small default would only help other hosts at
the good host's expense. A constrained host (a small local model, a tight
context budget) can opt into a smaller surface via RANCHER_TOOLSETS; see
Toolset profiles under Configuration.
Quick start
Requirements
uv — it brings its own Python (3.12 or newer)
A Rancher API token (creating one)
There is nothing to clone or install first: uvx rancher-mcp fetches the
package from PyPI and runs it. Start
with a read-only token, or add RANCHER_READ_ONLY=true, until you have seen
what an agent does with it — see the safety model.
Claude Code
claude mcp add rancher \
-e RANCHER_URL=https://rancher.example.com \
-e RANCHER_TOKEN=token-xxxxx:yyyyyyyyy \
-- uvx rancher-mcpClaude Desktop, and any client that takes a JSON server entry
{
"mcpServers": {
"rancher": {
"command": "uvx",
"args": ["rancher-mcp"],
"env": {
"RANCHER_URL": "https://rancher.example.com",
"RANCHER_TOKEN": "token-xxxxx:yyyyyyyyy"
}
}
}
}uvx keeps using the version it first downloaded. Write rancher-mcp@latest
in place of rancher-mcp to pick up a new release.
On 1.59.0 or earlier? Upgrade. Those versions do not start from a normal install, and 1.77.0 closed security issues that affect every version before it — see the security history.
From source
git clone https://github.com/rex/mcp-rancher.git
cd mcp-rancher
make setup # deps, .env scaffold, pre-commit hooks
$EDITOR .env # set RANCHER_URL + RANCHER_TOKEN
make dev # run the MCP server (stdio)To point a client at a checkout, use
uv run --directory /path/to/mcp-rancher rancher-mcp in place of
uvx rancher-mcp.
Multiple instances
RANCHER_INSTANCES_JSON='{
"production": {"url": "https://rancher.prod.example.com", "token": "token-a:xxx", "verify_ssl": true, "read_only": true},
"lab": {"url": "https://rancher.lab.example.com", "token": "token-b:yyy", "verify_ssl": false, "read_only": false}
}'
RANCHER_DEFAULT_INSTANCE=productionEvery tool takes an optional instance argument. Instances flagged
read_only: true refuse all mutations at the settings layer.
RANCHER_DEFAULT_INSTANCE has to name one of them.
Architecture
flowchart LR
A[MCP client<br/>Claude Code · Claude Desktop · any] -- stdio --> S
subgraph S[rancher-mcp]
direction TB
L1[Discovery & schema<br/>planes · schemas · capabilities]
L2[Generic engine<br/>any resource · both planes<br/>CRUD · actions · links · watch]
L3[Curated tools<br/>typed models · shaped output<br/>next-step hints]
G[Safety layer<br/>read-only guard · request guard<br/>confirmation phrases · human approval<br/>audit log · rate limit · masking]
L1 --> L2 --> L3
L3 --> G
L2 --> G
end
G -- Norman /v3 --> R1[(Rancher<br/>instance A)]
G -- Steve /v1 + k8s proxy --> R1
G -- Norman + Steve --> R2[(Rancher<br/>instance B)]Three layers, deliberately separate: discovery tells you what an instance can
do, the generic engine can touch anything it exposes, and curated tools
make the common paths typed, shaped, and self-describing (every response carries
suggested_next_steps). Most curated tools are generated from YAML descriptors
(catalog/curated_tools/) with a drift gate — the editorial decisions live in
descriptors, not boilerplate.
Safety model
Built for the day an agent is pointed at the cluster that pays your salary:
Guard | Behavior |
Read-only instances |
|
One resource, as named | A request goes to the resource its arguments name, by the method it was sent with — nothing else. Every identifier is checked where it enters a path (no |
Destructive confirmation | Deletes require an explicit typed phrase (e.g. |
Human approval | A phrase the model can type proves the model read it; this proves a person agreed. Any client that supports MCP elicitation is shown a question the server worded — Delete deployment "web" in namespace "shop" on cluster "c-m-abc"? — with every option the call carries, and the tool does not run unless a person ticks the box and accepts. The destructive tools (deletes and action invokes) ask every time. The generic apply and patch tools ask too, and there a person may also tick Keep going: further calls of that one tool, on that one instance and cluster, then go through unasked for 15 minutes — never a delete, never another cluster, and only until a person declines a prompt: a no to anything ends every "keep going". Claude Code additionally shows its own permission prompt on every destructive call, in every permission mode including bypass ( |
Tool annotations | Every tool declares |
Audit log | Every mutation emits a structured |
Rate limiting | Token-bucket on writes (default 60/min) — a runaway loop can't machine-gun your API |
Secret & key masking | Secret values and certificate private keys are structurally absent from curated responses (reveal is an explicit generic-tool opt-in) |
Structured errors | Guard rejections return typed |
Compatibility
Primary target | Rancher 2.9.3 (production-validated) |
Compatibility floor | Rancher 2.6.5 (kept green via capability detection) |
API planes | Norman |
MCP protocol |
|
Transport | stdio |
Capability detection bridges version differences at runtime — no version-pinned builds, no "works on my Rancher." Both targets are exercised by the same test suite, and read paths have been validated live against both a 2.6.5 lab and a 2.9.3 production fleet (validation report).
Configuration
Variable | Default | Purpose |
| — | Rancher server URL (single-instance mode) |
| — | API token ( |
|
| TLS verification |
| — | Path to a CA bundle, for a Rancher behind a private CA |
|
| Refuse every mutation (single-instance mode; per instance it is |
| — | Multi-instance config (see above) |
|
| Instance used when a tool call names none. |
|
| Server identity announced to clients |
| built-in | Server description announced to clients |
|
| Write rate limit ( |
|
| Comma-separated toolset profile(s) exposed at startup — see below |
| — | Comma-separated tool names force-included on top of the selected profile(s) |
| — | Comma-separated tool names removed, applied last — always wins over |
|
| Require a person's approval for the destructive tools and for the generic apply and patch tools: an elicitation prompt in any client that can show one, plus Claude Code's permission prompt on every destructive call. Set |
|
| How long a person's "Keep going" on an apply or patch prompt lets further calls of that tool, on that instance and cluster, through unasked. |
| packaged | Override the capability catalog the server ships with |
|
| Log verbosity. Logs go to stderr; stdout is the protocol |
Toolset profiles
The default is all: every tool stays exposed. Claude Code, the primary
host, defers every tool schema behind its own search, so a small default
would only help other hosts at the cost of making the good host worse — this
is a deliberate choice, not an oversight.
RANCHER_TOOLSETS opts a constrained host (a small local model, or a context
budget) into a smaller surface. Values are either a family name — one per
src/rancher_mcp/tools/ module (storage, workloads, pods_services,
rbac, …; see rancher_mcp.toolsets.FAMILY_REGISTRARS for the full list) —
or the cross-family core profile: a ~32-tool triage/orientation set
(rancher_find_*, the health/summary rollups, core list/get pairs, and the
generic rancher_{steve,norman}_resource_{list,get} escape hatches). core
cuts the tools/list payload from 207 tools / ~405 KB to 32 tools / ~78 KB
(~80% smaller). Profiles compose: RANCHER_TOOLSETS=core,storage gives the
triage set plus everything storage-related.
RANCHER_TOOLSETS=core # small triage surface
RANCHER_TOOLSETS=core,storage,workloads # triage + two full families
RANCHER_TOOLS=rancher_secret_get # add one extra tool on top
RANCHER_EXCLUDE_TOOLS=rancher_secret_create # remove one, wins over the aboveAn unknown profile name fails loudly at startup rather than silently
producing an empty or shrunken surface. Calling a real tool that exists but
isn't in the active profile returns a structured TOOLSET_NOT_ENABLED error
naming the tool, the toolset that would enable it, and the env var to set —
never a bare "unknown tool", which would make a disabled tool indistinguishable
from a typo.
Front-door tools
Because Claude Code defers tool definitions, the model's first Rancher call
normally costs a tool-search round trip. Five tools opt out and load upfront —
the ones that are plausible first calls in a session:
rancher_clusters_health_summary, rancher_cluster_health_check,
rancher_find_failing_pods, rancher_find_unready_nodes and
rancher_resource_events. They carry _meta["anthropic/alwaysLoad"], cost
about 590 tokens of context between them, and a test budgets the set so it
cannot grow by accretion.
Other clients ignore the hint. To defer everything again in Claude Code, set
"alwaysLoad": false on this server's entry in your MCP configuration.
Project status
Shipping and stable for read, triage, and guarded write operations. Honest ledger of what's beyond that:
Destructive workflows (node drain, etcd/backup restore, cert rotation, cluster upgrade/delete) are roadmap — deliberately staged after real-world read-path mileage. The generic engine + confirmation guard already covers these cases for operators who need them today.
The Alertmanager routes/silences surface needs an in-cluster API integration and is deferred.
The full per-version compatibility matrix (Track G) is in progress; the first live validation run covers the read matrix on both targets.
Work is tracked to the tool level: docs/tool-catalog.md
(every tool has a row, every gap a slice ID) and ROADMAP.md.
Development
make help # every target, documented
make validate # codegen drift + manifest drift + architecture + lint + typecheck + tests
make smoke-wheel # build the wheel, run it from an empty directory, handshake on both protocol eras
make tool-manifest # regenerate docs/tool-manifest.json from the registry
make lab-up # local Rancher 2.6.5 lab (kind + helm), fully scripted
make integration-current # isolated Rancher 2.14.3 end-to-end test run
make live-read-matrix # read-only validation probes against configured instances
make mock-rancher # fixture-backed mock Rancher for provider-config testingLocal lab — a self-contained Rancher 2.6.5 on kind with a simulated downstream cluster; repo-local kubeconfigs, never touches your machine state.
Current integration lab — Rancher 2.14.3 on separate Kind clusters and port
9443; run it serially withmake integration-currentto avoid overlapping Docker resource demand with the legacy lab.Contract fixtures — sanitized captures from live Rancher committed under
tests/fixtures/;respxpins the HTTP boundary in tests.Codegen — curated tools are emitted from
catalog/curated_tools/*.ymldescriptors;make check-codegenfails on drift.Fleet-wide gates — the safety model is tested by calling every tool through the real request path with the network intercepted, not tool by tool: every tool that can write obeys read-only mode, the rate limit and the audit log; every result matches its published schema; every tool that asks a person takes no for an answer; and every string argument of every tool is given hostile values to see what reaches the wire. A tool added tomorrow is covered the day it is registered.
Gates — ruff, pyright strict, the test suite with a coverage floor, architecture line-limits, module-shape checks, secret scanning. All fail closed, all wired into pre-commit.
Stack: Python 3.12 · MCP Python SDK 2.x · httpx · Pydantic v2 · structlog · uv
Security
See SECURITY.md for the threat model, token guidance, and how to report vulnerabilities.
License
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Governed MCP gateway: one endpoint for your tools, with credential custody and audit log.
MCP server for mandates, delegation, policy-gated execution, credential grants, and audit.
Hosted remote MCP for protected account access, permissions, activity history and supported undo.
Governed MCP gateway for business apps: roles, previews, approvals and one audit log.
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceAn MCP server exposing scoped, read-only enterprise operations tools with fail-closed credential handling. It returns opaque approval IDs for mutations and requires a separate operator approval command to release one-time capabilities.MIT
- AlicenseAqualityBmaintenanceEnables MCP-capable clients to inspect and manage Keycloak realms, users, clients, roles, and groups with layered security modes, realm allowlisting, protected realms, delete gating, dry-run, and audit logging.8249 npm1MIT
- AlicenseAqualityBmaintenanceEnables MCP clients to inspect and operate Kubernetes clusters across multiple contexts, with read-only/read-write/admin access modes and security flags controlling namespaces, contexts, deletes, applies, and exec.10351 npm3MIT
- AlicenseAqualityCmaintenanceEnables policy-governed MCP interactions with deterministic authorization, tenant isolation, minimized PII exposure, and human approval gates for sensitive mutations, while producing structured audit events.3MIT