mcpField
M
mcp-ephemeral-k8s

mcp-ephemeral-k8s

Local
github.com/BobMerkusCloud & Infra2Updated 38w ago

About mcp-ephemeral-k8s

mcp-ephemeral-k8s is a Python library and MCP server for creating temporary MCP servers on Kubernetes. It supports Node.js and Python runtimes, with SSE connections and local or in-cluster Kubernetes configuration.

Key features

  1. 01Create temporary MCP servers on Kubernetes
  2. 02Support Node.js via npx and Python via uvx
  3. 03Connect over SSE
  4. 04Use local kubeconfig or in-cluster configuration
  5. 05Run as an MCP server

Use cases

  1. 01Launch short-lived MCP server instances in Kubernetes
  2. 02Expose Node.js or Python MCP runtimes through SSE
  3. 03Run the service with local or in-cluster Kubernetes access

MCP support

It creates temporary MCP servers on Kubernetes and exposes them to MCP clients over SSE. It can also run as an MCP server.

Configuration

Local server config is the same for every client. Copy it into your client’s MCP config file.

mcp.json · Universal config
{
"mcpServers": {
"ephemeral-k8s": {
"command": "uvx",
"args": [
"mcp-ephemeral-k8s"
]
}
}
}
Run commanduvx mcp-ephemeral-k8s

Local servers need a runtime on your machine (e.g. Node.js 18+). Config file locations differ by client; see your client’s docs.

Packages
pypimcp-ephemeral-k8s

Tools

No tool list yet

Local servers expose tools only once running on your machine, and the maintainer has not provided a tool list.

Details

From the project README

mcp-ephemeral-k8s

Release Build status codecov Commit activity License

A Python library for spawning ephemeral Model Context Protocol (MCP) servers on Kubernetes using Server-Sent Events (SSE).

Features

  • Supports multiple runtimes:
    • Node.js (via npx)
    • Python (via uvx)
  • Works with mcp-proxy for uvx or npx runtimes
  • Supports both local kubeconfig and in-cluster configuration
  • Can be run as MCP server

Usage

Running the MCP Server
uvx mcp-ephemeral-k8s
Using the Library
import asyncio
from mcp_ephemeral_k8s import KubernetesSessionManager, presets

async def main():
    async with KubernetesSessionManager() as session_manager:
        mcp_server = await session_manager.create_mcp_server(
            presets.K8S_MCP_SERVER, wait_for_ready=True, expose_port=True
        )
        print(mcp_server.sse_url)

if __name__ == "__main__":
    asyncio.run(main())
Job 'mcp-ephemeral-k8s-proxy-1762291156-x17zuayy' in unknown state, waiting...
http://mcp-ephemeral-k8s-proxy-1762291156-x17zuayy.default.svc.cluster.local:8080/sse

Installation

Prerequisites
  • Docker
  • Kind or any Kubernetes cluster with valid kubectl configuration
Option 1: Using uvx (Recommended)
uvx mcp-ephemeral-k8s

To connect to the MCP server, use the following config:

{
   "mcp-ephemeral-k8s": {
      "url": "http://localhost:8000/sse",
      "transport": "sse"
   }
}
Option 2: As a Python Package
pip install mcp-ephemeral-k8s
mcp-ephemeral-k8s
Option 3: Using Helm Chart

To install the Helm chart, run:

helm repo add mcp-ephemeral-k8s https://BobMerkus.github.io/mcp-ephemeral-k8s/
helm repo update
helm install mcp-ephemeral-k8s mcp-ephemeral-k8s/mcp-ephemeral-k8s

To upgrade the Helm chart, run:

helm upgrade -i mcp-ephemeral-k8s mcp-ephemeral-k8s/mcp-ephemeral-k8s

To install a specific version, run:

helm install mcp-ephemeral-k8s mcp-ephemeral-k8s/mcp-ephemeral-k8s --version <replace-with-version>

To uninstall the Helm chart, run:

helm uninstall mcp-ephemeral-k8s
Option 4: From Source
  1. Clone the repository

    git clone https://github.com/BobMerkus/mcp-ephemeral-k8s.git
    cd mcp-ephemeral-k8s
    
  2. Set up development environment

    make install
    
  3. Run pre-commit hooks

    make check
    
  4. Run tests

    make test
    
  5. Build Docker images

    make docker-build-local
    make docker-build-local-proxy
    
  6. Load images to cluster

    kind load docker-image ghcr.io/bobmerkus/mcp-ephemeral-k8s:latest
    kind load docker-image ghcr.io/bobmerkus/mcp-ephemeral-k8s-proxy:latest
    
  7. Install Helm chart

    helm upgrade -i mcp-ephemeral-k8s charts/mcp-ephemeral-k8s --set image.tag=latest
    
  8. Port forward the MCP server

    kubectl port-forward svc/mcp-ephemeral-k8s 8000:8000
    
  9. Visit the FastAPI server

    npx @modelcontextprotocol/inspector --sse http://localhost:8000/sse
    

Comments

Markdown supported

New to MCP?

From what the protocol is to installing your first server, these answers cover most first questions.

An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.