K8s MCP Fdfa8fa6

MCP运维云端

提供方 christian-schlichtherle

运维云端 stdio · 本地进程 会话登录 社区 / 第三方
查看接入方式

K8s MCP Server是一个增强型Kubernetes访问工具,提供AI友好的端口转发管理功能,支持无头服务,适用于Kubernetes集群管理和调试场景。

一句话选型结论

按资料字段整理

K8s MCP Fdfa8fa6 属于运维云端类 MCP 服务器,stdio · 本地进程,会话登录,有可直接执行的安装命令。接入前先确认权限范围;涉及写入、删除或付款的操作,建议先在测试环境验证。

分类运维云端 传输方式stdio · 本地进程 鉴权会话登录 部署方式本地部署
GitHub 星标 1 仓库热度,无公开仓库时显示未标注
工具数 未标注 暴露给模型的工具数量
资源 / 提示词 0 / 0 资源与提示词模板数量
维护方 社区 / 第三方 核验等级 仅资料核对

工具与能力

运维云端
数量来自来源目录的标注,具体工具清单以官方文档为准
工具数量未标注暴露给模型可调用的工具个数
资源数量0可读取的资源条目
提示词数量0内置提示词模板数量

能力标签

适用场景

Kubernetes管理Python本地部署端口转发集群调试AI集成无头服务

安装与配置

stdio · 本地进程 会话登录
客户端在本机拉起子进程,数据不出本机
pip install -e .

这条命令只是入口,具体启动参数请按官方文档补齐,不要直接照搬到别的服务器。

  1. 1
    准备运行环境

    stdio 服务在本地起进程,需要先装好 Node.js 等运行时,再按安装命令拉取依赖。

  2. 2
    安装服务

    复制上面的安装命令执行;命令里带占位符的位置,换成自己的密钥或路径。

  3. 3
    写入客户端配置

    在客户端的 MCP 配置里填好启动命令和参数,保存后完全退出客户端再打开,让新配置生效。

  4. 4
    验证是否可用

    连接成功后随便调一个只读工具,确认能返回结果,再接入正式流程。

典型使用场景

3 类
按分类与标签整理的常见用法,具体以官方文档为准
云资源查询

查实例、存储、账单等云上资源状态。

部署与发布

把部署、重启、回滚这类操作接进对话。

监控与告警

拉取监控指标,异常时让模型帮你判断。

选择建议

选之前先看这几条
按条目字段给出的判断,不替你决定用不用

值得选的地方

  • 有现成的安装命令,不用自己找入口,照着跑就能起服务。

先想清楚的地方

  • stdio 方式要求本地装好运行时(如 Node.js),换机器要重新装一遍。
  • 使用前要准备好会话登录对应的凭据,并按最小权限配置。
  • 资料没标注工具数量,实际能力要装好后确认。
  • 版本更新与行为细节以官方仓库为准。

更适合

  • 需要在运维云端场景里让模型直接调用外部能力的人。
  • 想先快速试一下、能接受在本地或自有环境跑服务的人。

不太适合

  • 完全不想在本地装环境的人。
  • 不方便管理密钥或第三方授权的人。
  • 需要厂商级 SLA 和技术支持的生产环境。

同类对比

6 个同类
同分类里挑最接近的几条,字段以各自详情页为准
MCP 服务器工具数传输方式部署方式安装命令最后核验
K8s MCP Fdfa8fa6当前 未标注 stdio · 本地进程 本地部署 有 2026-05-17
lobehub 未标注 stdio · 本地进程 本地部署 有 2026-04-11
TrendRadar 未标注 stdio · 本地进程 本地部署 有 2026-04-13
Ui Tars Desktop 8a825770 未标注 stdio · 本地进程 本地部署 有 2026-05-17
ruflo 未标注 stdio · 本地进程 本地部署 有 2026-04-13
FastGPT 未标注 stdio · 本地进程 本地部署 有 2026-04-11

服务器档案

运维云端
字段来自项目仓库与公开索引,中文说明由本站标注
提供方christian-schlichtherle上游标注的维护方 christian-schlichtherle
分类运维云端本站按上游分类展示
连接方式stdio · 本地进程客户端在本机拉起子进程,数据不出本机
鉴权方式会话登录远程服务建议用最小权限凭据
维护方社区 / 第三方核验等级 仅资料核对
包名 / 运行时未标注 · 未标注本地安装时用到的包标识与运行时
部署类型本地部署上游给出的部署形态
最近核验2026-05-17上游最后核验时间

详细介绍

12.9 KB
来自项目仓库与上游目录的原文,未做删改

K8s MCP Server

Enhanced Kubernetes access with AI-friendly port-forward management supporting headless services.

✅ Implementation Complete - All core features have been implemented.

Features

  • kubectl-Inspired Output Formats: Multiple output formats (table, wide, json, yaml, custom-columns, jsonpath) for efficient token usage
  • Resource Kind Discovery: Natural language queries to find Custom Resource Definitions and builtin resources by keywords
  • URL-based Configuration: Share port-forward configs via GitHub Gists or local files
  • Headless Service Support: Direct pod targeting via label selectors
  • AI-Optimized: Clean service/target structure for intelligent fuzzy matching
  • Multi-format Support: YAML, JSON, TOML configuration files
  • kubectl-like Behavior: Selects first ready pod, same as kubectl port-forward
  • Session Management: In-memory port-forward tracking with list and teardown capabilities
  • Parameterless Discovery: Easy cluster, alias, and service discovery for AI agents

Quick Start

1. Install Dependencies```bash

pip install -e .


### 2. Set Environment Variables```bash
# Required: Kubernetes cluster configurations
export KUBECONFIG_URLS="dev=file:///path/to/dev.yaml prod=file:///path/to/prod.yaml"

# Optional: Cluster aliases
export KUBECONFIG_ALIASES="development=dev production=prod"

# Required: Port-forward configuration URL
export PORT_FORWARD_CONFIG_URL="file://$(pwd)/example-port-forward-config.yaml"
# Or use a GitHub Gist:
# export PORT_FORWARD_CONFIG_URL="https://gist.githubusercontent.com/user/abc123/raw/port-forward.yaml"

3. Run the Server```bash

python main.py


## Usage Examples

### AI Agent Interactions```
User: "Setup port-forward to the FRET Druid in development"
AI Agent:
1. Calls discover_port_forward_services() to understand available services
2. Maps "FRET Druid in development" → service="druid", target="fret-dev"
3. Calls setup_port_forward_to_target("druid", "fret-dev")
4. Returns: "✅ Connected to fret-dev Druid: http://localhost:8082 → pod/druid-router-0"

Direct Tool Calls

  • connect_to_service_targets("druid", ["fret-dev"]) - Connect to specific target
  • connect_to_service_targets("druid", []) - Connect to all Druid environments
  • list_resources("prod", "pods", labels={"app": "nginx"}) - List pods with labels
  • get_resource("dev", "deployment", "my-app", "default") - Get specific resource
  • discover_resource_kinds("dev", ["druid", "ingestion"]) - Find resource kinds by keywords
  • list_resources("dev", "pods", output_format="custom-columns", custom_columns="NAME:.metadata.name,IP:.status.podIP") - Custom output
  • list_port_forwards() - Show active port-forward sessions
  • teardown_port_forward("forward-id") - Stop a port-forward session
  • Supports kubectl naming variants: "pods", "pod", "po" all work

Output Format Examples

Token-Efficient Resource Listing```bash

Default table format (kubectl-like)

list_resources(cluster="dev", kind="pods", namespace="fret-dev")

Returns clean table: NAME | READY | STATUS | RESTARTS | AGE


### Custom Columns for Specific Data```bash
# Extract specific fields with JSONPath
list_resources(
    cluster="dev",
    kind="services",
    output_format="custom-columns",
    custom_columns="NAME:.metadata.name,TYPE:.spec.type,PORTS:.spec.ports[*].port"
)

Resource Kind Discovery```bash

Find resource kinds by keywords

discover_resource_kinds(
cluster="dev",
keywords=["druid", "ingestion"],
match_mode="OR"
)

Returns: DruidIngestion resource kind info with all naming variants


## Resource Naming Conventions

The K8s MCP server follows kubectl naming conventions:

### Resource Kind Support
- **Plural forms**: `pods`, `services`, `deployments`
- **Singular forms**: `pod`, `service`, `deployment`
- **Abbreviations**: `po`, `svc`, `deploy`, `sts` (for StatefulSet)
- **Case insensitive**: `Pod`, `POD`, `pod` all work

### Discovery vs Search
- **`discover_*`** tools find available resource kinds/types
- **`search_*`** and **`list_*`** tools find specific instances

### Example Workflow```bash
# 1. Discover what kinds are available
discover_resource_kinds(cluster="dev", keywords=["druid"])
# Returns: DruidIngestion kind with variants ["druidingestions", "druidingestion"]

# 2. List instances using any variant
list_resources(cluster="dev", kind="druidingestions")
# or
list_resources(cluster="dev", kind="DruidIngestion")

Configuration

Port-Forward Config Format```yaml

druid:
fret-dev:
k8s_cluster: "dev-us-east"
namespace: "druid"
labels:
app.kubernetes.io/component: "router"
local_port: 8082
remote_port: 8888

grafana:
dev:
k8s_cluster: "dev-us-east"
namespace: "monitoring"
labels:
app.kubernetes.io/name: "grafana"
local_port: 3000
remote_port: 3000


## Common Workflows

These workflow examples demonstrate how AI agents can combine multiple tools to accomplish complex Kubernetes tasks:

### 1. Cluster Overview Workflow```
User: "Show me the status of all my clusters"
AI Agent Flow:
1. discover_clusters() → Get available clusters ["dev", "staging", "prod"]
2. For each cluster:
   - cluster_health() → Check API server connectivity
   - list_resources("cluster", "nodes") → Get node count and status
   - list_resources("cluster", "namespaces") → Get namespace overview
3. Summarize: "3 clusters online, 12 total nodes, 8 namespaces"

2. Application Debugging Workflow```

User: "My app isn't working in staging"
AI Agent Flow:
1. list_resources("staging", "pods", labels={"app": "user-app"}) → Find app pods
2. For each pod:
- describe_resource("staging", "pod", pod_name) → Get detailed status
- get_logs("staging", pod_name, lines=50) → Check recent logs
- list_resources("staging", "events", field_selector=f"involvedObject.name={pod_name}") → Get events
3. Analyze patterns: "Found 2 pods crash-looping due to missing config map 'app-config'"


### 3. Safe Deployment Update Workflow```
User: "Update nginx deployment to version 1.21"
AI Agent Flow:
1. get_resource("prod", "deployment", "nginx") → Get current deployment
2. Modify image version in manifest
3. Present proposed changes: "Will update image from nginx:1.20 to nginx:1.21"
4. User confirms: "Apply it"
5. update_resource("prod", "deployment", "nginx", new_manifest) → Apply update
6. Monitor rollout status with deployment_status()

4. Resource Cleanup Workflow```

User: "Clean up all test resources from last week"
AI Agent Flow:
1. list_resources("dev", "all", labels={"purpose": "test", "created": "2024-01-15"}) → Find test resources
2. Group by type: "Found 5 pods, 3 services, 2 configmaps"
3. For each resource:
- Show resource details and age
4. Present deletion plan with resource details
5. User confirms: "Yes, delete them"
6. Execute deletions with proper cascade handling


### 5. Enhanced Port-Forward Workflow```
User: "Setup port-forward to the FRET Druid in development"
AI Agent Flow:
1. discover_port_forward_services() → Get available services/targets
2. AI reasoning: "FRET Druid in development" → service="druid", target="fret-dev"
3. connect_to_service_targets("druid", ["fret-dev"]) → Setup to specific target
4. Return: "✅ Connected to fret-dev Druid: http://localhost:8082 → pod/druid-router-0"

6. Troubleshooting Performance Workflow```

User: "Why is my app slow in production?"
AI Agent Flow:
1. list_resources("prod", "pods", labels={"app": "slow-app"}) → Find app pods
2. For each pod:
- describe_resource() → Check resource limits/requests
- get_logs(since="1h") → Check for performance-related logs
- execute_in_pod(["top", "-b", "-n", "1"]) → Get resource usage
3. list_resources("prod", "nodes") → Check node capacity
4. query_by_labels("prod", "hpa", "app=slow-app") → Check auto-scaling
5. Analyze: "App is CPU-throttled, increase CPU requests from 100m to 250m"


### 7. Security Audit Workflow```
User: "Audit RBAC permissions for the finance team"
AI Agent Flow:
1. list_resources("prod", "rolebindings") → Get all role bindings
2. list_resources("prod", "clusterrolebindings") → Get cluster-wide bindings
3. Filter by subjects containing "finance"
4. For each binding:
   - get_resource("prod", "role", role_name) → Get role permissions
5. Summarize: "Finance team has read access to secrets in finance namespace"

8. Disaster Recovery Workflow```

User: "Restore the database from backup"
AI Agent Flow:
1. list_resources("prod", "pods", labels={"app": "database"}) → Find DB pods
2. scale_resource("prod", "deployment", "database", replicas=0) → Scale down
3. Wait for pods to terminate
4. apply_manifest("prod", restore_job_manifest) → Apply restore job
5. Monitor job status until completion
6. scale_resource("prod", "deployment", "database", replicas=1) → Scale back up
7. Verify database connectivity


### Best Practices for AI Agents

1. **Always Preview Changes**: Use diff/dry-run before modifications
2. **Provide Context**: Include relevant information when reporting issues
3. **Batch Operations**: Group related operations for efficiency
4. **Handle Pagination**: Be aware of large result sets
5. **Respect Cluster Boundaries**: Never assume operations across clusters

## Tool Safety Classifications

All MCP tools are classified by their safety level for AI agent operations:

### [READ-ONLY] Tools - Safe for autonomous use
These tools only read data and never modify cluster or local state:

**Resource Operations:**
- `get_resource()` - Get specific resource details
- `get_resource_yaml()` - Get resource as YAML
- `list_resources()` - List resources with formatting options
- `list_resources_yaml()` - List resources as YAML
- `query_by_labels()` - Advanced label-based queries
- `query_by_labels_yaml()` - Label queries as YAML

**Monitoring & Analysis:**
- `troubleshoot_pod()` - Comprehensive pod debugging
- `troubleshoot_pod_yaml()` - Pod debugging as YAML
- `cluster_health()` - Overall cluster health assessment
- `deployment_status()` - Deployment rollout analysis
- `deployment_status_yaml()` - Deployment analysis as YAML
- `resource_usage()` - Resource consumption analysis
- `get_logs()` - Retrieve pod logs
- `list_port_forwards()` - List active port-forward sessions

**Discovery:**
- `discover_resource_kinds()` - Find resource types by keywords
- `discover_clusters()` - List available clusters
- `discover_cluster_aliases()` - List cluster aliases
- `discover_port_forward_services()` - List port-forward configurations

### [MODIFIES STATE] Tools - Require user approval
These tools modify cluster state or local network configuration:

**Resource Management:**
- `create_resource()` - Create new Kubernetes resources
- `update_resource()` - Update existing resources
- `patch_resource()` - Partially update resources
- `scale_resource()` - Change replica counts
- `apply_manifest()` - Apply YAML manifests

**Network Operations:**
- `connect_to_service_targets()` - Connect to configured service environments
- `setup_port_forward()` - Generic port-forward setup
- `teardown_port_forward()` - Close port-forward sessions

### [DANGEROUS] Tools - Require explicit user confirmation
These tools can cause data loss or security risks:

- `delete_resource()` - **Permanently delete resources** (cannot be undone)
- `execute_in_pod()` - **Run arbitrary commands in pods** (potential security risk)

### AI Agent Safety Guidelines

1. **Autonomous Operations**: AI agents can freely use [READ-ONLY] tools
2. **State Changes**: [MODIFIES STATE] tools should require user approval
3. **High-Risk Operations**: [DANGEROUS] tools must have explicit user confirmation
4. **Error Handling**: All tools return consistent error formats for safe parsing

## Architecture```
k8s-mcp/
├── main.py                 # MCP server entry point with tool definitions
├── config/                 # Configuration management
│   ├── loader.py          # URL-based config loading
│   ├── manager.py         # Cluster and port-forward session management
│   └── config.py          # Environment validation and configuration
├── tools/                  # Modular tool implementations
│   ├── resources.py       # Common resource operation patterns
│   ├── formatting.py      # All resource formatting (table, YAML, JSON)
│   ├── columns.py         # Default column definitions for resources
│   ├── discovery.py       # Resource kind discovery and CRD enumeration
│   └── port_forward.py    # Port-forward specific operations
└── utils/                  # Shared utilities
    ├── helpers.py         # Common helper functions
    └── jsonpath.py        # JSONPath processing for custom columns

Code Organization Principles

  • Single Responsibility: Each module has a clear, focused purpose
  • DRY Compliance: No duplicate implementations across files
  • Separation of Concerns: Client management, formatting, and business logic are separated
  • Modular Design: Tools can be imported and reused independently

常见问题

7 问
答案由本站依据条目字段整理,不引用上游原文
K8s MCP Fdfa8fa6 怎么安装?

在客户端按下面的安装命令接入:pip install -e .。装完在客户端配置里引用同一个包或端点。

K8s MCP Fdfa8fa6 怎么在客户端里配置?

它的传输方式未标注,在客户端 MCP 配置里按官方文档填写启动命令和参数,保存后重启客户端生效。

K8s MCP Fdfa8fa6 收费吗?

本站不代收费用,也没有标注具体价格。是否收费取决于服务本身和背后的接口额度,正式使用前按官方说明确认。

K8s MCP Fdfa8fa6 需要 API Key 吗?

资料标注需要会话登录认证,使用前准备好对应凭据,并按最小权限配置。

K8s MCP Fdfa8fa6 能提供哪些能力?

资料显示能力标签包括 Kubernetes管理、Python、云端部署。具体工具清单以官方文档为准。

K8s MCP Fdfa8fa6 需要什么运行环境?

属于本地进程,需要在本机装好运行环境。

K8s MCP Fdfa8fa6 是本地还是远程?

它是本地进程(stdio),由客户端在本机拉起。传输方式为stdio · 本地进程。

热门专题

按标签挑服务器
全部专题 →

服务器信息以作者仓库与官方文档为准;分类、传输方式与鉴权方式的中文说明为中文整理,最近核验 2026-05-17。