This release is a pre-release and may not be stable for production use.
Kubeflow MCP Server
Quickstart · Architecture · Blog · KEP-936 · Roadmap · Security · Contributing
Overview
The Kubeflow MCP Server exposes Kubeflow operations as Model Context Protocol (MCP) tools. AI agents (Claude, Cursor, Claude Code, or custom agents) can plan, submit, monitor, and manage ML workloads in natural language — without requiring users to write Kubernetes YAML or Kubeflow SDK boilerplate.
Why Kubeflow MCP Server?
- Agent-Native: Tools are auto-discovered via MCP with guided workflow phases (
Plan → Discover → Run → Monitor) - Preview-Before-Submit: Every mutating operation previews its action first and requires explicit
confirmed=True - Security-First: Persona gating (
readonlyby default), namespace allowlists, input validation, and Bearer/JWT HTTP auth - Multi-Platform: Auto-detects OpenShift, EKS, and GKE with platform-specific guidance
- Token-Efficient: Progressive and semantic tool modes compress tools into 2–3 meta-tools
- Modular Clients: Load only what you need (
trainer,spark,pipelines,optimizer; planned:hub)
Demo
Quick Start
New to Kubeflow MCP? Follow the Quickstart & Troubleshooting Guide for step-by-step cluster verification, RBAC checks, and common fixes.
Prerequisites
- Python 3.10, 3.11, or 3.12
- Kubernetes cluster with
kubectland a configuredkubeconfig(see RBAC Configuration) - Kubeflow component(s) installed for the clients you enable: Kubeflow Trainer, Spark Operator, and/or Kubeflow Pipelines
Install & Run
# Default (Trainer client)
pip install kubeflow-mcp
# Optional client extras
pip install "kubeflow-mcp[pipelines]" # Kubeflow Pipelines (kfp)
pip install "kubeflow-mcp[spark]" # Kubeflow Spark
# Start the MCP server (stdio transport by default)
kubeflow-mcp serve
Connect an MCP Client
Cursor (stdio)
Add to .cursor/mcp.json:
{
"mcpServers": {
"kubeflow": {
"command": "kubeflow-mcp",
"args": ["serve"]
}
}
}
Claude Code (stdio)
claude mcp add kubeflow -- kubeflow-mcp serve
Docker & HTTP Transport (remote / in-cluster)
Pre-built multi-arch images are published to GHCR on every release. Replace <your-secret-token> with a unique secret before running:
docker run --rm -p 127.0.0.1:8000:8000 \
-v ~/.kube/config:/kubeconfig:ro \
-e KUBECONFIG=/kubeconfig \
-e KUBEFLOW_MCP_AUTH_TOKEN="<your-secret-token>" \
ghcr.io/kubeflow/mcp-server:latest
Connect your MCP client to http://localhost:8000/mcp:
{
"mcpServers": {
"kubeflow": {
"url": "http://localhost:8000/mcp",
"headers": { "Authorization": "Bearer <your-secret-token>" }
}
}
}
For local clusters (e.g., Kind/Minikube) whose kubeconfig points to 127.0.0.1, use --network host (Linux) or a kubeconfig targeting host.docker.internal so the container can reach the host API server. For in-cluster Kubernetes deployments, omit the kubeconfig mount (the pod uses its ServiceAccount credentials) and set KUBEFLOW_MCP_ALLOWED_HOSTS when exposing behind a Service or Ingress. Unauthenticated container probes are exposed at GET /health (liveness) and GET /ready (readiness).
Example Workflow
Start the server with data-scientist (the default readonly persona blocks job submission):
kubeflow-mcp serve --persona data-scientist
User: "Fine-tune gemma-2b on the alpaca dataset"
Agent → check_compatibility() # K8s + Trainer CRD verified
Agent → get_cluster_resources() # 4x A100 GPUs available
Agent → estimate_resources("google/gemma-2b") # Needs ~16GB GPU, 1x A100
Agent → list_runtimes() # torchtune-gemma-2b found
Agent → fine_tune(..., confirmed=False) # Returns preview for approval
Agent → fine_tune(..., confirmed=True) # TrainJob "train-gemma-abc" created
Agent → get_training_logs("train-gemma-abc") # Streams training progress
Agent Skills
Agent Skills catalog: a skeleton for independently released skill
plugins. Register the catalog, then install a plugin by replacing <plugin-name> with its name:
# Claude Code
claude plugin marketplace add kubeflow/mcp-server
claude plugin install "<plugin-name>@kubeflow-mcp"
# Codex CLI
codex plugin marketplace add kubeflow/mcp-server
codex plugin add "<plugin-name>@kubeflow-mcp"
Available Tools
Trainer (--clients trainer, default — 23 tools)
| Phase | Tools | Description |
|---|---|---|
| Planning | pre_flight, check_compatibility, get_cluster_resources, estimate_resources |
Environment checks and GPU/memory estimation |
| Discovery | list_training_jobs, get_training_job, list_runtimes, get_runtime |
Browse TrainJobs and ClusterTrainingRuntimes |
| Training | fine_tune, run_custom_training, run_container_training |
Submit LoRA/QLoRA fine-tuning, Python scripts, or container jobs |
| Monitoring | get_training_logs, get_training_events, wait_for_training |
Track job status, logs, and Kubernetes events |
| Lifecycle | update_training_job, delete_training_job |
Suspend, resume, or delete MCP-managed jobs |
| Platform | inspect_crd, inspect_controller, create_runtime, patch_runtime, delete_runtime |
Cluster inspection and runtime administration |
| Health | health_check, get_server_logs |
Server diagnostics |
Pipelines (--clients pipelines — 14 tools)
Requires pip install "kubeflow-mcp[pipelines]" and Kubeflow Pipelines on the cluster.
| Phase | Tools | Description |
|---|---|---|
| Discovery | list_pipelines, get_pipeline, list_experiments, get_experiment |
Browse pipelines, versions, and experiments |
| Authoring | create_pipeline, delete_pipeline |
Compile and register KFP v2 pipelines from Python, or delete them |
| Monitoring | list_pipeline_runs, get_pipeline_run, get_pipeline_logs |
Follow runs and read task pod logs |
| Runs | create_pipeline_run, stop_pipeline_run, retry_pipeline_run, create_experiment, delete_experiment |
Launch, stop, or retry runs and manage experiments |
Spark (--clients spark — 5 tools)
Requires kubeflow[spark] extra.
| Phase | Tools | Description |
|---|---|---|
| Discovery | list_spark_sessions, get_spark_session |
Browse SparkConnect sessions |
| Sessions | create_spark_session, delete_spark_session |
Provision and delete MCP-managed SparkConnect sessions |
| Monitoring | get_spark_session_logs |
Read Spark driver logs |
Optimizer (--clients optimizer — 17 tools)
Requires Katib v0.19 on the cluster, and the katib.kubeflow.org/metrics-collector-injection=enabled label on the experiment namespace.
| Phase | Tools | Description |
|---|---|---|
| Planning | katib_pre_flight |
Check the Experiment CRD, controller readiness, and admission webhooks |
| Discovery | list_hpo_experiments, get_hpo_experiment, get_hpo_experiment_status, get_trial, get_successful_trials, list_suggestions |
Browse Katib experiments, trials, and suggestions |
| Optimization | create_hpo_experiment, create_hpo_experiment_from_spec |
Create experiments from flat parameters or a full V1beta1Experiment manifest |
| Monitoring | get_hpo_experiment_trials, get_best_trial, get_suggestion, get_hpo_experiment_trial_logs, get_hpo_experiment_events |
Follow trials and read the best result, trial logs, and events |
| Lifecycle | wait_for_hpo_experiment, update_hpo_experiment, delete_hpo_experiment |
Wait for completion, change the trial budget or parallelism, or delete MCP-managed experiments |
Katib has no pause: lowering parallel_trial_count makes Katib delete trials, newest first and whatever their state, so update_hpo_experiment is destructive and its preview lists those trials. See optimizer://guides/hpo-patterns.
Personas & Configuration
--persona controls which tools are exposed. Each level includes all tools from the level above it:
| Persona | Scope |
|---|---|
readonly (default) |
Planning, browsing resources/jobs, reading logs and events |
data-scientist |
Submitting training/pipeline runs, deleting MCP-created jobs/sessions |
ml-engineer |
Container training, job lifecycle controls, pipeline authoring, CRD/controller inspection |
platform-admin |
Full access, including runtime and pipeline/experiment administration |
Custom personas can also be defined in ~/.kf-mcp-policy.yaml (see Architecture).
CLI Reference (kubeflow-mcp serve)
| Flag | Values / Default | Description |
|---|---|---|
--clients |
trainer, spark, pipelines, optimizer (default: trainer) |
Comma-separated client modules to enable |
--persona |
readonly | data-scientist | ml-engineer | platform-admin |
Tool access persona |
--mode |
full | progressive | semantic |
progressive (3 meta-tools) and semantic (2 meta-tools) reduce token usage |
--instruction-tier |
full | compact | minimal |
Agent instruction verbosity |
--transport |
stdio | http (default: stdio) |
Transport protocol (sse is deprecated) |
--auth-token |
<token> |
Bearer token for HTTP authentication |
--otel-endpoint |
<url> |
Optional OTLP HTTP endpoint for OpenTelemetry tracing |
--log-level |
DEBUG | INFO | WARNING | ERROR |
Server log verbosity |
--log-format |
console | json |
Auto-detected if omitted |
--no-banner |
flag | Suppress the startup banner |
Environment Variables & HTTP Authentication
| Variable | Default | Description |
|---|---|---|
MCP_TRANSPORT |
stdio |
Transport protocol (http, stdio) |
KUBEFLOW_MCP_CLIENTS |
trainer |
Comma-separated client modules |
KUBEFLOW_MCP_PERSONA |
readonly |
Active persona name |
KUBEFLOW_MCP_INSTRUCTION_TIER |
full |
Instruction verbosity (full, compact, minimal) |
KUBEFLOW_MCP_AUTH_TOKEN |
(none) | Bearer token for HTTP auth (dev/staging) |
KUBEFLOW_MCP_JWKS_URI |
(none) | JWKS endpoint for JWT verification (production) |
KUBEFLOW_MCP_JWT_ISSUER |
(none) | Expected JWT issuer (required with KUBEFLOW_MCP_JWKS_URI) |
KUBEFLOW_MCP_JWT_AUDIENCE |
(none) | Expected JWT audience (required with KUBEFLOW_MCP_JWKS_URI) |
KUBEFLOW_MCP_ALLOWED_HOSTS |
(loopback) | Allowed Host headers for DNS rebinding protection |
KUBEFLOW_MCP_ALLOWED_ORIGINS |
(loopback) | Allowed Origin headers |
KUBEFLOW_MCP_DNS_REBINDING_PROTECTION |
true |
Set false to disable Host/Origin checks (not recommended) |
KUBEFLOW_MCP_PIPELINES_URL |
(auto) | Override Kubeflow Pipelines endpoint URL |
KUBEFLOW_MCP_PIPELINES_TOKEN |
(auto) | Override Kubeflow Pipelines auth token |
KUBEFLOW_MCP_PIPELINES_NAMESPACE |
(auto) | Override Kubeflow Pipelines namespace |
LOG_FORMAT / LOG_LEVEL |
auto / INFO |
Logging format and level |
KUBEFLOW_MCP_JWT_ISSUER and KUBEFLOW_MCP_JWT_AUDIENCE are required with KUBEFLOW_MCP_JWKS_URI; the server refuses to start without them.
Without --auth-token or JWT settings on --transport http, the server logs a warning that the endpoint is open.
Observability
Optional OpenTelemetry tracing can be enabled with --otel-endpoint http://localhost:4318 (or OTEL_EXPORTER_OTLP_ENDPOINT) after installing uv sync --group otel. See examples/observability/README.md for collector setup, span attributes, and log correlation.
Compatibility
| MCP Server | Kubeflow Trainer | Kubeflow SDK | Python | Kubernetes |
|---|---|---|---|---|
0.2.x (upcoming) |
>= 2.3.0, < 2.4.0 |
>= 0.5.0, < 0.6.0 |
3.10 – 3.12 |
>= 1.27 |
0.1.x |
== 2.2.1 |
== 0.4.1 |
3.10 – 3.12 |
>= 1.27 |
Development
git clone https://github.com/kubeflow/mcp-server.git
cd mcp-server
make install-dev # setup environment
make verify # lint + format check
make test-python # run unit tests
make inspector # launch MCP Inspector (stdio; or TRANSPORT=http)
Community & Documentation
- Slack: #kubeflow-wg-agents and #kubeflow-mcp-server on CNCF Slack
- Meetings: Kubeflow WG Agents Meeting Notes
- Blog: Introducing Kubeflow MCP: An Agent Interface for Cloud Native AI at Scale
- Docs: Quickstart · Architecture · Client Conventions · Contributing · Roadmap · Security
License
Apache License 2.0 — see LICENSE.
Contributors
Metadata
Release files for kubeflow-mcp 0.2.0rc3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| kubeflow_mcp-0.2.0rc3.tar.gz | 24.4 MB | With provenance | Details for kubeflow_mcp-0.2.0rc3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| kubeflow_mcp-0.2.0rc3-py3-none-any.whl | Python 3 | none | any | Details for kubeflow_mcp-0.2.0rc3-py3-none-any.whl |
Total release size: 24.9 MB
Release files / kubeflow_mcp-0.2.0rc3.tar.gz
| Download URL | kubeflow_mcp-0.2.0rc3.tar.gz |
|---|---|
| Size | 24.4 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d439fd26a4f1544cec91bdf7cc7fe1f38943769e30a74db20db30778da9828f3
|
|
BLAKE2b-256 checksum How to use checksums |
5e1c6dfa4823a233dacf20a9af9a81265558b816b550fbb5bc12f0f265ff3e1c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 25, 2026.
Transparency logRelease files / kubeflow_mcp-0.2.0rc3-py3-none-any.whl
| Download URL | kubeflow_mcp-0.2.0rc3-py3-none-any.whl |
|---|---|
| Size | 532.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8b96baf3f0a1e2a81097a8e9897566d453a2638b4a968a04de36b21fcaed9a4a
|
|
BLAKE2b-256 checksum How to use checksums |
6d00e8a142753ce9a52c7d127f5e98e853a6c33e85348c469dd6fcdc3c7e2208
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 25, 2026.
Transparency logSecurity for kubeflow-mcp 0.2.0rc3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for kubeflow_mcp-0.2.0rc3.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 25, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.