mcp-k8s-ephemeral-job
Spawns ephemeral Kubernetes Jobs/pods from caller-chosen images, runs commands, captures output and artifacts, and automatically deletes the pod after completion.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@mcp-k8s-ephemeral-jobRun 'npm test' in a node:20 ephemeral pod and show me the output."
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
mcp-k8s-ephemeral-job
English | Русский
Public OSS MCP server (Go, MIT) that spawns an ephemeral Kubernetes Job/pod from a
caller-chosen image, runs a command inside it, returns exit_code / stdout / artifacts, and
deletes the pod. The server builds the pod manifest in code — the caller passes parameters
only, never raw YAML.
It is the "operating room" counterpart to mcp-exec (the
"scalpel"): where mcp-exec runs a single Python file in a locked-down, network-less sandbox in
milliseconds, this one spins up a full pod with the toolchain/image you choose, controlled
network (clone repos, pull deps), long tasks and file artifacts out. They complement each
other.
Works over three transports — stdio / HTTP / SSE — with an identical tool set everywhere
(official modelcontextprotocol/go-sdk).
Tools
run_job — run and wait
Input: { image (required), command (required), files?, env?, limits?, timeout_s?, workdir?, clone? }
Output: { exit_code, stdout, stderr, duration_ms, status, artifacts, truncated }
statusis one ofsucceeded/failed/timeout/error. A non-zeroexit_codeor atimeoutis a normal result, not a tool error. Only invalid input (empty image/command, image not in the allowlist, bad file path) is a tool-call error.stdoutcarries the container's combined stdout+stderr — Kubernetes merges the two streams in pod logs.stderris reserved and always empty, so adding stream separation later stays backward-compatible.Artifacts (files from the working directory) come back inline (base64) under a size cap. Exceeding a cap never loses data silently: the matching
truncatedflag is set.The manifest is built deterministically by the server — no raw YAML from the caller.
submit_job / fetch_job — run in the background
submit_job takes the same arguments as run_job but returns a job_token immediately;
fetch_job collects the result later. This is what lets an agent start a long job (a full test
battery, a build) and keep working instead of idling inside one synchronous call for its whole
wall-clock time.
fetch_jobreturnsstatus=runningwhile the job is in flight; passwait_s(≤120) to long-poll instead of hammering. It answers as soon as the job is done rather than sitting out the full wait.Results are retained for 60 minutes and can be fetched more than once.
Arguments are validated at submit time, so a bad image fails the submit while the caller can still fix it.
Handles live in memory (the server is single-replica by design): a restart drops pending tokens and the caller simply resubmits.
Cloning a repository
With clone: { repo_url, ref, subdir? } an init container checks the repo out into the working
directory before the command runs. The caller never handles credentials: the server holds a
secret with one token per git host, mounts it only on the cloner, and the token is masked in
.git/config afterwards — the main container never sees it. The clone field is accepted only when
the operator has configured MCP_K8S_CLONE_IMAGE + MCP_K8S_CLONE_SECRET.
Related MCP server: FastMCP Production Server
Security model (invariants)
Per run: a fresh ephemeral pod, deleted afterwards (success / failure / timeout). The server's
RBAC is namespace-scoped (Role/RoleBinding, never ClusterRole) — create/delete jobs,pods
plus pods/log, pods/exec in one namespace. Spawned pods run with cap-drop=ALL,
no-privilege-escalation, seccomp RuntimeDefault. The blast radius is that one namespace:
LimitRange (per-pod default+max) + ResourceQuota (namespace ceiling) + wall-clock timeout
(→ kill) + TTL/owner-reference GC + a concurrency cap. Images must pass a strict allowlist
(MCP_K8S_ALLOWED_IMAGES; empty = nothing runs). Caller data (command / files / output /
artifacts) is never persisted and never logged in full — only metadata.
run_jobis the most powerful surface there is (it creates pods). When embedding it in an agent, gate it behind that agent's tool-policy (trusted roles only).
Network note: the pod's network is not disabled (it's needed to clone repos / pull deps).
Egress is controlled by a namespace NetworkPolicy (allowlist) as a deployment concern, not a
right baked into the code. The invariant is ephemerality + deletion, not the absence of network.
Resources: the server's MCP_K8S_DEFAULT_CPU/MEMORY are pod requests (the scheduler's
reservation). Limits are set only when the caller passes limits; otherwise the ceiling comes from
the namespace LimitRange. Passing limits.memory also raises the memory request to match, since
memory is incompressible and the pod must land on a node that actually has it.
Run
Published in the MCP Registry as
io.github.inhuman/mcp-k8s-ephemeral-job; the image is on Docker Hub as
idconstruct/mcp-k8s-ephemeral-job.
docker run --rm -i \
-v "$HOME/.kube:/kube:ro" \
-e MCP_K8S_KUBECONFIG=/kube/config \
-e MCP_K8S_NAMESPACE=ephemeral-dev \
-e MCP_K8S_ALLOWED_IMAGES=busybox:1.36,python:3.12-slim \
idconstruct/mcp-k8s-ephemeral-job:latestFrom source, against a dev cluster, over stdio:
go build -o mcp-k8s-ephemeral-job ./cmd/mcp-k8s-ephemeral-job
export MCP_K8S_KUBECONFIG=$HOME/.kube/config
export MCP_K8S_NAMESPACE=ephemeral-dev
export MCP_K8S_ALLOWED_IMAGES=busybox:1.36,python:3.12-slim
./mcp-k8s-ephemeral-jobIn production the server runs in-cluster as a Deployment with its own ServiceAccount +
Role/RoleBinding on the ephemeral namespace + ResourceQuota/LimitRange (+ optional egress
NetworkPolicy), usually on the http transport.
Example call (run_job)
{
"image": "python:3.12-slim",
"command": ["python", "gen.py"],
"files": [{ "path": "gen.py", "content_b64": "<base64 of a script writing out.png>" }],
"limits": { "cpu": "500m", "memory": "256Mi" },
"timeout_s": 30
}Returns exit_code, captured output, and out.png inline in artifacts. Afterwards the pod is
gone (kubectl get jobs,pods -n $NS is empty).
Optional auth (HTTP/SSE)
Set MCP_K8S_AUTH_TOKEN to require every HTTP/SSE request to carry a matching X-MCP-AUTH header
(constant-time compare; 401 otherwise). Empty token disables it. Not applicable to stdio.
Configuration
Env var | Purpose | Default |
|
|
|
| listen address for http/sse |
|
| namespace where ephemeral pods are spawned |
|
| default wall-clock timeout (s) |
|
| timeout ceiling (s) |
|
| combined stdout+stderr cap |
|
| total artifacts size cap |
|
| pod CPU request (scheduling reservation; limits come from the caller's |
|
| pod memory request (see above) |
|
| max concurrent ephemeral pods (over → queue/error) |
|
| strict image allowlist (CSV); empty = deny everything | `` |
| helper sidecar image for artifact collection (pinned) |
|
| image with git for the clone init container; empty = | `` |
| secret holding one token per git host (key = host); mounted only on the cloner | `` |
| existing PVC mounted into every job pod as a shared cache; empty = no cache | `` |
| where the cache PVC is mounted, e.g. | `` |
| JSON object | `` |
| path to kubeconfig; empty = in-cluster | `` |
| if set, http/sse require | `` |
Both cache variables must be set together for the cache to mount. The PVC itself is provisioned out-of-band (helm/manifest); the server only references it by name and fails fast at startup if it is missing.
Not implemented
PVC / object-storage delivery for artifacts too large to inline, multi-cluster support, and proxying other MCP servers into the pod.
License
MIT.
This server cannot be installed
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- Flicense-qualityFmaintenanceEnables running arbitrary JavaScript code in isolated Docker containers with on-the-fly npm dependency installation, supporting both ephemeral one-shot executions and persistent sandbox environments.Last updated175156
- Alicense-qualityDmaintenanceProvides secure filesystem operations, HTTP fetching with SSRF protection, JSON validation, artifact logging, and optional Redis key-value storage through both stdio and HTTP transports. Features production-ready security controls including sandbox enforcement, allowlist validation, and comprehensive input validation.Last updatedApache 2.0
- AlicenseAqualityDmaintenanceProvides secure access to containerized build environments for software projects, enabling AI assistants to execute builds, run tests, manage git operations, and inspect build artifacts without requiring local installation of dependencies.Last updated6MIT
- FlicenseAqualityDmaintenanceDelegates expensive or long-running AI tasks to Kubernetes-hosted Claude agents running on OpenShift. Enables creating, managing, and monitoring remote agentic sessions for complex work like codebase analysis and security audits.Last updated41
Related MCP Connectors
Execute code in 8 languages (Python, JS, TS, Go, Java, C++, C, Bash) in gVisor sandboxes.
Reliable async execution for agent tool calls: schema gating, retries, idempotency, audit trail.
Create, browse, remix, collaborate on, and run durable AI workflow nodes from MCP hosts.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/inhuman/mcp-k8s-ephemeral-job'
If you have feedback or need assistance with the MCP directory API, please join our Discord server