Kubernetes文档搜索服务器

一个基于MCP协议的服务器,提供Kubernetes文档的全文搜索和检索功能,支持结构化YAML数据索引和高效部署。

  • by martoc
  • Python
  • 本地部署
  • 更新于
在 GitHub 查看 martoc/mcp-kubernetes-documentation

使用说明

MCP Kubernetes文档服务器

MCP(模型上下文协议)服务器,为以下对象提供搜索和检索工具 Kubernetes 文档。该服务器使Claude等AI助手能够直接搜索和阅读Kubernetes文档,包括markdown页面和结构化的YAML数据文件(发布时间表、生命周期结束信息、公告)。

特性

  • 全文搜索 使用SQLite FTS5进行BM25排名和波特词干分析
  • 分段过滤 按文档类别缩小搜索结果范围
  • YAML数据索引 用于发布时间表、EOL发布和公告
  • 稀疏结账 用于从kubernetes/网站高效克隆所需目录
  • Docker支持 用于跨项目的可移植部署
  • STDIO传输 用于无缝MCP客户端集成

快速开始

使用容器映像(推荐)

这 martoc/mcp-kubernetes-documentation 容器映像已发布到Docker Hub,并预先构建了文档索引。可用于 linux/amd64 和 linux/arm64.

# Pull and run the server
docker run -i --rm martoc/mcp-kubernetes-documentation:latest

使用Docker在本地构建

# Build the Docker image (includes pre-indexed documentation)
make docker-build

# Test the server
make docker-run

利用紫外线(地方发展)

# Initialise the environment
make init

# Build the documentation index
make index

# Run the server
make run

容器图像

这 martoc/mcp-kubernetes-documentation 容器映像已发布到 Docker 中心。它包括预构建的文档索引,因此服务器可以立即使用。

财产 价值
注册表 Docker Hub
图片 martoc/mcp-kubernetes-documentation
平台 linux/amd64, linux/arm64
基础图像 python:3.12-slim
索引 在图像构建时预先构建 kubernetes/website main 分支机构
# Pull the latest image
docker pull martoc/mcp-kubernetes-documentation:latest

# Run the MCP server
docker run -i --rm martoc/mcp-kubernetes-documentation:latest

配置

克劳德代码/克劳德桌面

添加到您的 .mcp.json 或全局设置以使用已发布的容器映像:

{
  "mcpServers": {
    "kubernetes-documentation": {
      "command": "docker",
      "args": ["run", "-i", "--rm", "martoc/mcp-kubernetes-documentation:latest"]
    }
  }
}

对于本地构建的Docker镜像:

{
  "mcpServers": {
    "kubernetes-documentation": {
      "command": "docker",
      "args": ["run", "-i", "--rm", "mcp-kubernetes-documentation"]
    }
  }
}

对于没有Docker的本地开发:

{
  "mcpServers": {
    "kubernetes-documentation": {
      "command": "uv",
      "args": ["run", "mcp-kubernetes-documentation"],
      "cwd": "/path/to/mcp-kubernetes-documentation"
    }
  }
}

MCP工具

工具 说明
search_documentation 通过关键字查询搜索Kubernetes文档,可选部分过滤
read_documentation 检索特定文档页面的完整内容

搜索文档

使用带有词干支持的全文搜索搜索Kubernetes文档。

参数 类型 必填 默认 说明
query string 是 - 搜索词(支持词干)
section string 否 无 按部分筛选(例如,文档、博客、发布)
limit integer 否 10 最大结果(1-50)

常见部分: docs, blog, releases, announcements, case-studies, community

read_文档

检索文档页面的完整内容。

参数 类型 必填 说明
path string 是 文档的相对路径(来自搜索结果)

CLI命令

# Build/rebuild the documentation index
uv run kubernetes-docs-index index
uv run kubernetes-docs-index index --rebuild
uv run kubernetes-docs-index index --branch main

# Show index statistics
uv run kubernetes-docs-index stats

发展

make init       # Initialise development environment
make build      # Run full build (lint, typecheck, test)
make test       # Run tests with coverage
make format     # Format code
make lint       # Run linter
make typecheck  # Run type checker

文档

许可证

该项目根据麻省理工学院许可证获得许可-请参阅 许可证 文件以获取详细信息。