Mcp Openshift

io.github.dockndevai由 GitHub 账号 dockndevai 发布v0.2.0更新于 Oct 24, 2026

Safe-by-default MCP for OpenShift / Kubernetes: projects, pods, logs, deployments, routes.

概览

AI 生成的概览

一个默认安全的 MCP 服务器,让助手查看 OpenShift / Kubernetes 集群,并在更高模式下执行操作:项目、Pod、日志、部署、路由等。

可以做什么
确认身份,列出可见的项目/命名空间,按命名空间和标签筛选列出任意资源类型,并获取单个资源的完整 spec 与状态。读取 Pod 容器日志和命名空间近期事件。在读写模式下,调整 Deployment/DeploymentConfig 的副本数并重启 Deployment。在额外开关下,从清单创建或更新资源,以及删除资源。
适用场景
当需要助手协助排查或运维 OpenShift / Kubernetes 集群时使用,例如查看运行状态、读取日志与事件,以及执行扩缩容、重启等受控变更;默认只读。
运行要求
通过 npx 在本地运行(需要 Node.js)。需要集群 API 地址(OPENSHIFT_SERVER)和凭据:OPENSHIFT_TOKEN,或针对集群本地身份提供方的 OPENSHIFT_USERNAME 加 OPENSHIFT_PASSWORD。使用私有 CA 时,将 OPENSHIFT_CA_CERT 设为 CA 证书包。需要能访问集群 API 的网络。
安装前请注意
凭据属于机密:OPENSHIFT_TOKEN 和 OPENSHIFT_PASSWORD。密码模式会在磁盘缓存令牌并在过期后重新登录。更高模式允许写入:扩缩容、重启、应用清单和删除资源,受 OPENSHIFT_MODE、OPENSHIFT_ALLOW_APPLY、OPENSHIFT_ALLOW_DELETE 及人工确认约束。OPENSHIFT_INSECURE_TLS 会关闭 TLS 校验,仅限开发使用。可选的守护进程可对高风险操作进行分类。

安装

在 SourceWeft 中

  1. 打开 控制台中的 Mcp Openshift,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

mcp-openshift

[npm] [CI] [licence]

A safe-by-default Model Context Protocol server for OpenShift / Kubernetes. It lets an agent explore and operate a cluster — projects, pods and logs, deployments and deploymentconfigs, routes, services, builds, imagestreams, and any resource by kind — and, in higher modes, scale workloads, restart deployments, apply manifests, and delete.

Connect with a token from the web console you already use, or your username/password against the cluster's local identity provider.

Part of the dockndevai MCP server suite — one governance model across all of them.

What it gives an agent

Starts read-only (see Safe by default); higher-capability tools are only registered when you raise the mode.

ToolForNeeds mode
whoamiconfirm the authenticated identityread-only
list_projectsprojects/namespaces you can seeread-only
list_resourceslist any kind (± namespace, label selector)read-only
get_resourceone resource with full spec/statusread-only
pod_logsa pod's container logsread-only
list_eventsrecent events in a namespaceread-only
scaleset replicas on a Deployment/DeploymentConfigread-write
rollout_restartrestart a Deploymentread-write
apply_resourcecreate/update from a manifest (SSA)read-write + OPENSHIFT_ALLOW_APPLY
delete_resourcedelete a resourceadmin + OPENSHIFT_ALLOW_DELETE

Install

bash
npx -y @dockndevai/mcp-openshift

You need your cluster's API URL and a credential. The quickest, since you use the browser console:

In the OpenShift web console, click your username (top-right) → Copy login command → Display Token. Copy the value after --token= (sha256~…) and the URL after --server=.

Then set OPENSHIFT_SERVER + OPENSHIFT_TOKEN. (Console tokens are short-lived; grab a fresh one when it expires, or use username/password below, which re-logs in automatically.)

Configure

json
{  "mcpServers": {    "openshift": {      "command": "npx",      "args": ["-y", "@dockndevai/mcp-openshift"],      "env": {        "OPENSHIFT_SERVER": "https://api.cluster.example.com:6443",        "OPENSHIFT_TOKEN": "sha256~...",        "OPENSHIFT_MODE": "read-only"      }    }  }}

See docs/CLIENTS.md for Claude Code / Cursor / Codex / VS Code / Windsurf, and .env.example for every variable.

Authentication

Auth mode is chosen automatically (override with OPENSHIFT_AUTH):

  • token — OPENSHIFT_TOKEN (bearer). From the console (above) or oc whoami -t.
  • password — OPENSHIFT_USERNAME + OPENSHIFT_PASSWORD against the cluster's built-in OAuth server (HTPasswd / LDAP / any challenge-capable local IdP). The server runs the same request-token flow oc login -u … -p … uses, caches the token at ~/.mcp-openshift/token.json (0600), and re-logs in on expiry. The password is sent only to your cluster's OAuth endpoint and is never logged or written to disk.

TLS: clusters usually use a private CA — set OPENSHIFT_CA_CERT to the CA bundle, or (dev only) OPENSHIFT_INSECURE_TLS=true to skip verification.

Safe by default

Enforced by src/security.ts — defence in depth on top of your account's cluster RBAC:

  • OPENSHIFT_MODE — read-only (default) → read-write → admin. Tools above the mode aren't registered.
  • OPENSHIFT_NAMESPACE_ALLOWLIST / OPENSHIFT_PROTECTED_NAMESPACES — confine writes to named namespaces; system namespaces (kube-*, openshift, openshift-*, default) are readable but never mutable.
  • OPENSHIFT_ALLOW_APPLY — creating/updating resources needs this flag on top of read-write, plus a human confirmation.
  • OPENSHIFT_ALLOW_DELETE — deletes need admin mode plus this flag, plus confirmation.
  • OPENSHIFT_DRY_RUN — sends writes with Kubernetes dryRun=All: validated and admission-checked, but nothing persists.
  • Human-in-the-loop — apply, delete, and scale-to-zero pause and ask a person to approve via MCP elicitation.
  • OPENSHIFT_AUDIT_LOG — a JSON audit line per guarded op on stderr; Secret values are redacted from all output.

Optional AI risk guard. Set OPENSHIFT_GUARD_MODE=monitor|enforce to have apply_resource / delete_resource consult a local laya-guard daemon (pipx install laya-guard && laya-guard) that classifies the operation allow/confirm/block before it runs. Runs after the apply/delete gates; only tightens, never grants; fails closed.

There is a bundled skill, openshift-safe-operations, that teaches an agent how to authenticate (including from the browser console), the safety rules, and the standard triage/operate workflows. See also SECURITY.md.

Developing

bash
npm installnpm run build# list the tools without a live cluster:echo '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}' | OPENSHIFT_SERVER=https://x:6443 OPENSHIFT_TOKEN=x node dist/index.jsnpm test

Licence

MIT

来源:README.md,提交 9a57679

工具

0
SourceWeft 尚未在沙箱中启动过该软件包,因此其工具未知。

版本历史

2
  1. v0.2.0最新Sep 27, 2026
  2. v0.1.0Sep 19, 2026

评分

已满足适用检查项的 50%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分

    请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。

  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分