rancher-mcp-server
Exposes Rancher-managed clusters as tools for AI assistants, enabling SRE tasks like inspecting clusters, workloads, pods, logs, and events.
README
Rancher MCP Server
Servidor MCP (Model Context Protocol) que expõe clusters gerenciados pelo Rancher como ferramentas para assistentes de IA. Na prática: um copiloto de SRE. Você pergunta "por que o serviço de inferência está reiniciando?" e o assistente inspeciona clusters, workloads, pods, logs e eventos para responder.
MCP server that exposes Rancher-managed clusters as tools for AI assistants, turning Claude into an SRE copilot.
Ferramentas
| Tool | Descrição | Modo |
|---|---|---|
list_clusters |
Clusters com estado, versão e capacidade | leitura |
list_nodes |
Nós com papéis, estado e recursos | leitura |
list_projects |
Projetos Rancher de um cluster | leitura |
list_workloads |
Workloads de um projeto | leitura |
list_pods |
Pods, com filtro only_unhealthy (CrashLoop, Pending, +3 restarts) |
leitura |
get_pod_logs |
Últimas N linhas de log (inclui container anterior com previous=True) |
leitura |
get_events |
Eventos recentes do cluster (Warnings por padrão) | leitura |
diagnose_workload |
Diagnóstico em uma chamada: estado + pods doentes + eventos | leitura |
scale_workload |
Escala um workload | escrita (gated) |
redeploy_workload |
Redeploy rolling | escrita (gated) |
Segurança
- Somente leitura por padrão.
scale_workloaderedeploy_workloadsó funcionam comRANCHER_MCP_ALLOW_WRITE=true. - Escala limitada por
RANCHER_MCP_MAX_REPLICAS(padrão 20), evitando um "scale to 5000" acidental. - Credenciais apenas via variáveis de ambiente. Nada de token em arquivo de configuração ou código.
- Respostas resumidas: as tools devolvem os campos que um SRE precisa, não o payload bruto da API.
Instalação
git clone https://github.com/flaviagaia/rancher-mcp-server.git
cd rancher-mcp-server
pip install -e .
Crie um token de API no Rancher (avatar > Account & API Keys > Create API Key; prefira escopo por cluster) e exporte:
export RANCHER_URL="https://rancher.example.com"
export RANCHER_TOKEN="token-xxxxx:yyyyyyyyyyyy"
# opcional:
# export RANCHER_MCP_ALLOW_WRITE=true
# export RANCHER_MCP_MAX_REPLICAS=10
# export RANCHER_VERIFY_TLS=false # apenas para labs com certificado self-signed
Uso com Claude
Claude Code / Cowork:
claude mcp add rancher --env RANCHER_URL=$RANCHER_URL --env RANCHER_TOKEN=$RANCHER_TOKEN -- rancher-mcp-server
Claude Desktop (claude_desktop_config.json):
{
"mcpServers": {
"rancher": {
"command": "rancher-mcp-server",
"env": {
"RANCHER_URL": "https://rancher.example.com",
"RANCHER_TOKEN": "token-xxxxx:yyyyyyyyyyyy"
}
}
}
}
Exemplos de conversa:
- "Liste meus clusters e me diga se algum está degradado."
- "Quais pods estão em crash loop no projeto Default?"
- "Diagnostique o workload deployment:ml-serving:inference-api e me mostre os logs do container que caiu."
Sem um Rancher à mão?
Suba um em um container para testar:
docker run -d --name rancher --privileged -p 8443:443 rancher/rancher:latest
# depois: export RANCHER_URL=https://localhost:8443 e RANCHER_VERIFY_TLS=false
Testes
pip install -e ".[dev]"
pytest
Os testes usam um cliente mockado; não precisam de um Rancher real.
Roadmap
- Métricas de uso (CPU/memória por workload) para sugestões de rightsizing
- Suporte a Fleet (GitOps) e Rancher apps
- Tool de comparação de estado entre clusters (staging vs prod)
Licença
MIT. Feita com carinho por Flávia Gaia.
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.