Add your description here
Project description
mcp-server-k8s: A Kubernetes MCP Server
The Model Context Protocol (MCP) is an open protocol that enables seamless integration between LLM applications and external data sources and tools. Whether you're building an AI-powered IDE, enhancing a chat interface, or creating custom AI workflows, MCP provides a standardized way to connect LLMs with the context they need.
This repository is an example of how to create an MCP server for managing Kubernetes resources.
Overview
A Model Context Protocol server for interacting with Kubernetes clusters. It provides tools for creating, reading, updating, and deleting Kubernetes resources, as well as observability features like log retrieval and resource inspection.
Components
Tools
The server implements the following tools:
Resource Management
-
get_resources: Retrieve Kubernetes resources- Takes
resource_type(pod, deployment, service, job),namespace(default: "default"), and optionalname - Returns JSON-formatted resource information
- Takes
-
create_resource: Create new Kubernetes resources- Takes
resource_type,namespace, andmanifest(JSON string) - Creates the specified resource in the cluster
- Takes
-
delete_resource: Remove Kubernetes resources- Takes
resource_type,name, andnamespace(default: "default") - Deletes the specified resource
- Takes
Observability
-
get_pod_logs: Retrieve container logs- Takes
pod_name,namespace(default: "default"), optionalcontainer, andtail_lines(default: 100) - Returns pod logs
- Takes
-
describe_resource: Get detailed resource information- Takes
resource_type,name, andnamespace(default: "default") - Returns detailed JSON description of the resource
- Takes
-
get_namespaces: List all namespaces- Returns JSON array of namespace information
Advanced Features
apply_manifest_from_url: Apply Kubernetes manifests from URLs- Takes
urland optionalnamespace(default: "default") - Downloads and applies the manifest file
- Takes
Configuration
The server automatically configures Kubernetes client using:
- In-cluster configuration (when running inside Kubernetes)
- Local kubeconfig file (when running locally)
Quickstart
Claude Desktop
On MacOS: ~/Library/Application\ Support/Claude/claude_desktop_config.json
On Windows: %APPDATA%/Claude/claude_desktop_config.json
{
"kubernetes": {
"command": "uvx",
"args": [
"mcp-server-k8s"
]
}
}
Development
Building and Publishing
To prepare the package for distribution:
- Sync dependencies and update lockfile:
uv sync
- Build package distributions:
uv build
This will create source and wheel distributions in the dist/ directory.
- Publish to PyPI:
uv publish
Note: You'll need to set PyPI credentials via environment variables or command flags:
- Token:
--tokenorUV_PUBLISH_TOKEN - Or username/password:
--username/UV_PUBLISH_USERNAMEand--password/UV_PUBLISH_PASSWORD
Debugging
Since MCP servers run over stdio, debugging can be challenging. For the best debugging experience, we strongly recommend using the MCP Inspector.
You can launch the MCP Inspector via npm with this command:
npx @modelcontextprotocol/inspector uv --directory $(PWD) run mcp-server-k8s
Upon launching, the Inspector will display a URL that you can access in your browser to begin debugging.
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 k8s_mcp_server-0.1.0.tar.gz.
File metadata
- Download URL: k8s_mcp_server-0.1.0.tar.gz
- Upload date:
- Size: 4.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3f856fc395a55e990cb3f44b931eb9af7e8bea73cc22457413c2ff43c3d5009e
|
|
| MD5 |
964df382efbea77ad61629561e747d2b
|
|
| BLAKE2b-256 |
25cdc26bc8e3d4838e7c8563dad7abc5977a1c89c9c16203c4c097e6c484cf6c
|
File details
Details for the file k8s_mcp_server-0.1.0-py3-none-any.whl.
File metadata
- Download URL: k8s_mcp_server-0.1.0-py3-none-any.whl
- Upload date:
- Size: 5.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1475d7de4bf0649b25c42827ebaffbd743a2672b4463afae368349732f0059cb
|
|
| MD5 |
87d24cec144d1192f141c97d8a42b646
|
|
| BLAKE2b-256 |
562ce644700bcdd7a626679601a47d0f5cacd6d3ad60a1d771c6a745c9c60c6b
|