0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

ROSA / ARO 用に OpenShift MCP Server をデプロイする

0
Posted at

2026/09/10 の時点で OpenShift MCP Server は、Technical Preview ですが、OpenShift 幾つか関連記事が出ていますが、

  1. OpenShift MCP Server の単独デプロイ (Red Hat Blog)
  2. MCP Lifecycle Operator を使用した OpenShift MCP Server のデプロイ (Red Hat Blog)

このドキュメントは1の手順で、ARO / ROSA で動作を確認しました。とは言え、この記事作成時点で Tech Preview 中のソフトウェアですので、時間が経つとこの手順では動かなくなる可能性があるのはご了承ください。

MCP Server 用の namespace の作成

MCP Server 用の namepsace を作成します。

oc new-project mcp-server

Ingress の hostname を取得

Helm チャートに、MCP Server の hostname を事前に渡す必要があるので、以下の方法で取得します。この方法は、ROSA / ARO で検証しています。

export APPS_DOMAIN=$(oc get ingresses.config cluster -o jsonpath='{.spec.domain}')
export MCP_ROUTE_HOST="kubernetes-mcp-server-mcp-server.${APPS_DOMAIN}"
echo "${MCP_ROUTE_HOST}"

MCP Server のインストール

OpenShift MCP Server の Repository をダウンロードし、Helm チャートのディレクトリに移動します。

git clone https://github.com/openshift/openshift-mcp-server.git
cd openshift-mcp-server/charts/kubernetes-mcp-server

Respository の設定を上書きする、custom 用の変数ファイル values-custom.yaml を作成します。この設定はあくまでサンプルなので、要件によって書き替えましょう。

cat << EOF > values-custom.yaml
openshift: true

service:
  type: ClusterIP
  port: 8080

# Ingress を作成
# Keep disabled for safe local testing; enable after auth works (see below).
ingress:
  enabled: true 
  termination: edge
  host: ""  # set by "--set ingress.host"


# ClusterRole と ClusterRoleBinding の作成
rbac:
  # -- Specifies whether RBAC resources should be created.
  # -- When set to false, no RBAC resources will be created regardless of the
  # -- contents of extraClusterRoles, extraClusterRoleBindings, extraRoles, and extraRoleBindings.
  create: true

  # ClusterRole の定義
  # -- Extra ClusterRoles to create. Each entry creates a ClusterRole named
  # -- "<release-fullname>-<name>" with the specified rules.
  extraClusterRoles:
   - name: my-provider
     rules:
     - apiGroups: [""]
       resources:
        - pods
        - pods/log
        - pods/status
        - services
        - configmaps
        - namespaces
        - events
        - nodes
        - persistentvolumeclaims
        - persistentvolumes
        - replicationcontrollers
        - serviceaccounts
       verbs: ["get", "list", "watch"]
  # ClusterRoleBinding の定義
  # -- Extra ClusterRoleBindings to create. Each entry creates a ClusterRoleBinding
  # -- that binds to the release's ServiceAccount by default.
  # -- Use roleRef.external: true to reference existing cluster roles (e.g., "view", "edit", "admin")
  # -- without prefixing the release fullname.
  extraClusterRoleBindings:
   - name: my-provider
     roleRef:
       name: my-provider  # References "<release-fullname>-my-provider" ClusterRole
   - name: use-view-role
     roleRef:
       name: view
       external: true  # References the existing "view" ClusterRole directly

# セキュリティ系の設定。
config:
  # MCP を Read only モードで動かす (create, update, delete の禁止)
  read_only: true
  # OpenShift の OAuth で Baearer token を使って認証をさせる設定
  require_oauth: true
  skip_jwt_verification: true 
  cluster_auth_mode: passthrough
  trust_proxy_headers: true

EOF

Helm チャートをつかって MCP Server をインストールします。

helm install kubernetes-mcp-server . \
-n mcp-server \
-f values.yaml \
-f values-custom.yaml \
--set ingress.host=$MCP_ROUTE_HOST

作成された生成物を確認します。

helm list -n mcp-server
oc get clusterrole | grep mcp
oc get clusterrolebinding | grep mcp
oc get sa -n mcp-server
oc get pods -n mcp-server
oc get route 

MCP Server のログを確認して稼働しているか確かめます。

oc logs deployment/kubernetes-mcp-server -n mcp-server

以下のようなログが出ているはずです。

[Sample Log]
$ oc logs deployment/kubernetes-mcp-server -n mcp-server
I0910 01:52:18.062430       1 config.go:584] "skip_jwt_verification is enabled: JWTs will be accepted without cryptographic signature verification. Only use this behind a trusted reverse proxy that performs token verification."
I0910 01:52:18.162509       1 http.go:163] "HTTP server starting on port 8080 (endpoints: /mcp, /sse, /message, /healthz, /stats, /metrics)"
$ 

MCP Server に対して Request を送る

インストールされた MCP Server に対してサンプル・リクエストを送ります。

mcp-server namespace 内の、kubernetes-mcp-server Service Account に対して Token を作成します。こちらは JWT 形式の Token です。

export OCP_TOKEN=$(oc create token kubernetes-mcp-server -n mcp-server)

実際にリクエストを投げてみます。

curl -si -X POST "https://${MCP_ROUTE_HOST}/mcp" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer ${OCP_TOKEN}" \
  -d '{
    "jsonrpc":"2.0",
    "id":1,
    "method":"initialize",
    "params":{
      "protocolVersion":"2025-03-26",
      "capabilities":{},
      "clientInfo":{"name":"test-client","version":"1.0"}
    }
  }' | head -30

以下のようなレスポンスが返ってくるはずです。

HTTP/1.1 200 OK
cache-control: no-cache, no-transform
content-type: text/event-stream
mcp-session-id: GJUSYIXO7SO32OH6HL7DWUVUTN
date: Wed, 09 Sep 2026 12:04:18 GMT
transfer-encoding: chunked
set-cookie: bb2537b721f84b5bc150f7534b7c7fed=e5077098572ed676c74610785fc4b7a3; path=/; HttpOnly; Secure; SameSite=None

event: message
data: {"jsonrpc":"2.0","id":1,"result":{"capabilities":{"logging":{},"prompts":{"listChanged":true},"resources":{"listChanged":true},"tools":{"listChanged":true}},"protocolVersion":"2025-03-26","serverInfo":{"name":"kubernetes-mcp-server","title":"kubernetes-mcp-server","version":"","websiteUrl":"https://github.com/containers/kubernetes-mcp-server"}}}

MCP Server をアンインストールする

以下で MCP Server と作成した ClusterRole 等を削除します。

helm uninstall kubernetes-mcp-server

作成した Project を削除します。

oc delete project mcp-server
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?