MCP Server for Traefik edge routing, traffic splitting, and NGINX migrations
323
Traefik MCP Server empowers AI assistants (like Claude, Cline, or your own agent) to autonomously manage your Kubernetes edge traffic seamlessly. Without writing any YAML, your AI can execute advanced Canary routing, enable zero-impact Shadow Traffic mirroring, and instantly apply resilient Middlewares like rate limits and circuit breakers. It also ships with an intelligent migration pipeline—automatically translating complex legacy NGINX configurations into pristine Traefik resources natively via the Model Context Protocol.
This Docker image is designed to be used as an MCP server. It requires access to your Kubernetes cluster via a kubeconfig file.
Run the container mapping port 8769 so clients can connect locally:
docker run --rm -it \
-p 8769:8769 \
-v ~/.kube:/app/.kube:ro \
-e K8S_KUBECONFIG=/app/.kube/config \
talkopsai/traefik-mcp-server:latest
Tip: Mount the full
~/.kubedirectory (not justconfig) so certificate paths referenced in your kubeconfig (e.g. minikube, kind) are available inside the container.
Then configure your MCP client to connect over HTTP/SSE:
{
"mcpServers": {
"traefik": {
"url": "http://localhost:8769/mcp",
"description": "MCP Server for managing Traefik Edge Routing and Middlewares"
}
}
}
Cluster access is entirely handled via the mounted kubeconfig. Ensure your kubeconfig has appropriate RBAC permissions for Traefik CRDs (IngressRoute, Middleware, TraefikService, IngressRouteTCP, etc.) and native Kubernetes networking types (Ingress, Service).
To use this image securely over stdio transport directly inside Claude Desktop, format the invocation like this:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"traefik-mcp-server": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"-v", "/Users/YOUR_USERNAME/.kube:/app/.kube:ro",
"-e", "K8S_KUBECONFIG=/app/.kube/config",
"-e", "K8S_CONTEXT=production-cluster",
"-e", "MCP_TRANSPORT=stdio",
"-e", "MCP_LOG_LEVEL=INFO",
"-e", "MCP_ALLOW_WRITE=true",
"talkopsai/traefik-mcp-server:latest"
]
}
}
}
Replace /Users/YOUR_USERNAME/.kube with your actual kubeconfig path (e.g. C:\Users\YourUser\.kube on Windows).
Note: Set
MCP_ALLOW_WRITE=trueto allow the AI to actively mutate the cluster (e.g., executing NGINX migrations or creating actual Traffic Splitting resources). If omitted or false, the server handles operations in read-only/dry-run mode.
The image supports several environment variables for cluster access and advanced configuration:
| Variable | Default | Description |
|---|---|---|
K8S_KUBECONFIG | /app/.kube/config | Path to kubeconfig file inside the container |
K8S_CONTEXT | (empty) | Specific Kubernetes context to use (e.g. production-cluster) |
K8S_IN_CLUSTER | false | Set to true if running inside a Kubernetes pod (in-cluster config) |
MCP_ALLOW_WRITE | false | Required to be true for mutating actions (creating middlewares, modifying routes, migrations) |
MCP_TRANSPORT | http | Transport protocol (stdio or http) |
MCP_HOST | 0.0.0.0 | Host interface to bind to (if HTTP transport) |
MCP_PORT | 8769 | Port to bind to (if HTTP transport) |
MCP_PATH | /mcp | MCP endpoint path |
MCP_LOG_LEVEL | INFO | Logging level (DEBUG, INFO, WARNING, ERROR) |
:ro so the container cannot modify your credentials.K8S_CONTEXT and namespace-scoped RBAC to limit the AI to specific clusters or namespaces.MCP_ALLOW_WRITE=false to test generation offline via action=generate before trusting your Agent with live cluster-mutating workflows.If you find this MCP server useful, consider leaving a ⭐ on the GitHub repository!
Content type
Image
Digest
sha256:6fee3a8cd…
Size
92.6 MB
Last updated
3 months ago
docker pull talkopsai/traefik-mcp-server