Python implementation to spawn ephemeral Model Context Protocol (MCP) servers using the kubernetes API.
Project description
mcp-ephemeral-k8s
A Python library for spawning ephemeral Model Context Protocol (MCP) servers on Kubernetes using Server-Sent Events (SSE).
- Github: https://github.com/BobMerkus/mcp-ephemeral-k8s/
- Documentation: https://BobMerkus.github.io/mcp-ephemeral-k8s/
Features
- Supports multiple runtimes:
- Node.js (via
npx) - Python (via
uvx)
- Node.js (via
- Works with mcp-proxy for
uvxornpxruntimes - Supports both local kubeconfig and in-cluster configuration
- Can be run as MCP server
- Can be run as FastAPI server
Usage
Running the MCP Server
uvx mcp-ephemeral-k8s
Using the Library
from mcp_ephemeral_k8s import KubernetesSessionManager, presets
with KubernetesSessionManager() as session_manager:
mcp_server = session_manager.create_mcp_server(presets.GITHUB, wait_for_ready=True)
print(mcp_server.sse_url)
Installation
Prerequisites
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
-
Clone the repository
git clone https://github.com/BobMerkus/mcp-ephemeral-k8s.git cd mcp-ephemeral-k8s
-
Set up development environment
make install -
Run pre-commit hooks
make check -
Run tests
make test
-
Build Docker images
make docker-build-local make docker-build-local-proxy
-
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
-
Install Helm chart
helm upgrade -i mcp-ephemeral-k8s charts/mcp-ephemeral-k8s --set image.tag=latest
-
Port forward the FastAPI server
kubectl port-forward svc/mcp-ephemeral-k8s 8000:8000
-
Visit the FastAPI server
open http://localhost:8000/docs
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mcp_ephemeral_k8s-0.0.2.tar.gz.
File metadata
- Download URL: mcp_ephemeral_k8s-0.0.2.tar.gz
- Upload date:
- Size: 149.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
15865126634bfac5ffb71fb230bda91b03ab4bfb452bee5e59036d205a5e171b
|
|
| MD5 |
d4596a46c20a0af16e6e1a72dc5e9eb1
|
|
| BLAKE2b-256 |
23cc1e0b40278e051c5f54d94f50bd92a3d685e3d85232478c0896ec68117f94
|
File details
Details for the file mcp_ephemeral_k8s-0.0.2-py3-none-any.whl.
File metadata
- Download URL: mcp_ephemeral_k8s-0.0.2-py3-none-any.whl
- Upload date:
- Size: 24.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8c54fa2d982538a702d04981f09d5acf33c81b419d6e8f0266fbd37919e5d099
|
|
| MD5 |
35ae709f603195c3555be1ff9c04b018
|
|
| BLAKE2b-256 |
bdaea0b1f557ae60cc4da2ea7d633b7b1a39b6ac08771612f66d9c2f34532654
|