Skip to main content
Glama

k8s-docs-mcp ☸️

License Python MCP Kubernetes

Official Kubernetes Documentation & Canonical YAML Manifest Assistant for Autonomous AI Agents via the Model Context Protocol (MCP).

k8s-docs-mcp connects your AI coding assistant (Cursor, Claude Desktop, Antigravity, VS Code) directly to the upstream source of truth: github.com/kubernetes/website.


πŸ’‘ The Problem: LLM "Version Blindness" & Hallucinations

General-purpose Large Language Models regularly fail when generating Kubernetes configurations because their training sets mix documentation across outdated releases:

  • ❌ Deprecated APIs: Emitting apiVersion: extensions/v1beta1 for Ingress instead of networking.k8s.io/v1.

  • ❌ Removed Features: Suggesting PodSecurityPolicy (removed in K8s 1.25) instead of modern PodSecurityStandards or in-tree CEL ValidatingAdmissionPolicy.

  • ❌ Formatting Corruption: Mangling YAML indentation, missing mandatory spec fields, or hallucinating non-existent controller flags.

k8s-docs-mcp solves this deterministically:

  1. Canonical YAML Manifest Extraction: Extracts exact, verified YAML manifests directly from upstream Kubernetes documentation and examples in < 20 ms, completely bypassing generative LLM mutation.

  2. Current Upstream Documentation: Delivers authoritative explanations with exact links to https://kubernetes.io/docs/....

  3. Continuous Upstream Synchronization: Pulls weekly updates directly from kubernetes/website (content/en/docs and content/en/examples) using sparse git checkouts to stay aligned with current Kubernetes releases.


Related MCP server: DevOps AI Toolkit

πŸ›οΈ The Cloud Native Agent Trifecta

k8s-docs-mcp works as an independent standalone tool or as the authoritative documentation engine paired with syllabus guides and architectural tutors:

flowchart TD
    IDE["AI Coding Assistant / Agent\n(Claude Desktop, Cursor, Antigravity)"]
    
    IDE -->|"MCP 1: Syllabus & Learning Paths"| S["study-cybercirujas\n(Official CKA/CKS/CNPE Exam Objectives)"]
    IDE -->|"MCP 2: Canonical Docs & Syntax"| K["k8s-docs-mcp\n(Authoritative kubernetes.io Docs & Verified YAMLs)"]
    IDE -->|"MCP 3: In-Depth Architecture"| R["rag-tutor\n(Engineering Books & GraphRAG Platform Patterns)"]
    
    style K fill:#326CE5,stroke:#fff,stroke-width:2px,color:#fff

πŸ› οΈ Available MCP Tools

Tool Name

Parameters

Description

search_k8s_docs

query: str, limit: int = 3

Performs high-speed BM25 search over official Kubernetes documentation via SQLite FTS5. Returns authoritative excerpts and official https://kubernetes.io/docs/... URLs.

get_canonical_manifest

kind: str

Retrieves verified, unaltered Kubernetes YAML manifests directly from official examples for any resource Kind (NetworkPolicy, ValidatingAdmissionPolicy, Deployment, ValidatingWebhookConfiguration, etc.). Inlines Hugo {{< codenew >}} files automatically.

check_api_version

kind: str, api_version: Optional[str]

Deterministically verifies API version validity, deprecation status, and removal history using the official Kubernetes OpenAPI registry.

list_supported_resources

None

Lists all Kubernetes API resource Kinds currently indexed with canonical YAML manifests.

sync_upstream_docs

None

Fetches or updates documentation and examples from github.com/kubernetes/website and rebuilds the local SQLite FTS5 index.


πŸš€ Quickstart & MCP Configuration

1. Claude Desktop

Add k8s-docs-mcp to your claude_desktop_config.json:

{
  "mcpServers": {
    "k8s-docs": {
      "command": "uvx",
      "args": ["k8s-docs-mcp"]
    }
  }
}

Or for a local development clone:

{
  "mcpServers": {
    "k8s-docs": {
      "command": "uv",
      "args": [
        "--directory",
        "/path/to/k8s-docs-mcp",
        "run",
        "k8s-docs-mcp"
      ]
    }
  }
}

2. Cursor IDE

In your project root, add to .cursor/mcp.json:

{
  "mcpServers": {
    "k8s-docs": {
      "command": "uvx",
      "args": ["k8s-docs-mcp"]
    }
  }
}

3. Local Development & Testing

# Clone the repository
git clone https://github.com/villadalmine/k8s-docs-mcp.git
cd k8s-docs-mcp

# Install dependencies using uv
uv sync

# Run test suite
uv run pytest tests/

# Execute interactive tool verification
uv run python -c "
from k8s_docs_mcp.server import search_k8s_docs, get_canonical_manifest

print(search_k8s_docs('validating admission policy'))
print('---')
print(get_canonical_manifest('NetworkPolicy'))
"

πŸ”„ Automated Upstream Synchronization

k8s-docs-mcp uses a lightweight sparse checkout mechanism:

# Pulls only Markdown documentation and YAML examples (~25 MB instead of a 2 GB full clone)
uv run python -c "from k8s_docs_mcp.server import sync_upstream_docs; print(sync_upstream_docs())"

The repository includes a scheduled GitHub Action (.github/workflows/sync-upstream.yml) that runs weekly to verify and update indexed Kubernetes documentation against the latest kubernetes/website main branch.


πŸ“œ Intellectual Property & Fair Use

  • All documentation and manifest examples retrieved from kubernetes/website are licensed by the Kubernetes Authors under Apache License 2.0 and Creative Commons Attribution 4.0 International (CC-BY-4.0).

  • k8s-docs-mcp attributes all excerpts directly to their canonical origin on kubernetes.io.

  • This project software is open-source under the Apache License 2.0. See LICENSE for details.

Available Tools

5 tools
check_api_versionB

Verifies Kubernetes API version compatibility, deprecations, and removals deterministically via OpenAPI registry.

Args:
    kind: The Kubernetes resource Kind (e.g. 'Ingress', 'PodSecurityPolicy', 'CronJob', 'ValidatingAdmissionPolicy').
    api_version: Optional apiVersion to test (e.g. 'extensions/v1beta1', 'networking.k8s.io/v1').

Returns:
    Authoritative validation report with current stable apiVersion, deprecation notices, and migration advice.
ParametersJSON Schema
NameRequiredDescriptionDefault
kindYes
api_versionNo

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

B3.4/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the behavioral burden. It usefully discloses that results are deterministic and sourced from an authoritative OpenAPI registry, and summarizes the return payload, but it never states that the call is side-effect-free, nor any auth or rate-limit constraints.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Front-loaded purpose sentence followed by tight Args/Returns sections; every line earns its place. Slightly formulaic but no filler or repetition.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a two-parameter, read-only verification tool with an output schema present, the definition covers both inputs and indicates the shape of the report. Only the absence of usage guidance and annotation-level guarantees keeps it from being fully complete.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must compensate, and it does: it explains kind as the resource Kind with four concrete examples and api_version as an optional version to test with real syntax examples ('extensions/v1beta1', 'networking.k8s.io/v1'). This adds genuine meaning beyond the bare schema titles.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb (verifies) and resource (Kubernetes API version compatibility, deprecations, removals) plus the mechanism (OpenAPI registry). This implicitly distinguishes it from the docs-oriented siblings like search_k8s_docs, but it never names an alternative tool explicitly.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

There is no when-to-use or when-not-to-use guidance, no prerequisites, and no routing to siblings such as list_supported_resources or get_canonical_manifest. The agent must infer the usage context purely from the purpose sentence.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_canonical_manifestA

Retrieves verified, unaltered Kubernetes YAML manifests directly from official kubernetes.io examples.

Bypasses LLM generative alterations to prevent indentation errors, invalid fields, or deprecated apiVersions.

Args:
    kind: The Kubernetes resource kind (e.g. 'NetworkPolicy', 'Deployment', 'ValidatingAdmissionPolicy', 'ValidatingWebhookConfiguration').

Returns:
    Exact canonical YAML manifests with source file provenance.
ParametersJSON Schema
NameRequiredDescriptionDefault
kindYes

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A3.6/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It does disclose the data source and that output is verified/unaltered with provenance, but it omits error behavior for unsupported kinds, case sensitivity of the kind value, and any coverage limits of the underlying corpus.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Front-loaded with the purpose, then Args and Returns sections. There is mild redundancy between 'verified, unaltered' and 'Bypasses LLM generative alterations', and the Returns block restates what the output schema already covers.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a single-parameter lookup with an output schema present, the description covers purpose, source, and argument meaning adequately. The Returns section is redundant given the output schema, and the main gap is guidance on discovering valid kinds via the list_supported_resources sibling.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must carry the parameter meaning, and it does: 'kind' is defined as the Kubernetes resource kind with four concrete examples (NetworkPolicy, Deployment, ValidatingAdmissionPolicy, ValidatingWebhookConfiguration). It adds no format or case constraints, but the examples are more than the bare schema offers.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and resource ('Retrieves verified, unaltered Kubernetes YAML manifests') and pins the source to official kubernetes.io examples, which separates it from search_k8s_docs. It stops short of naming which sibling to use when a canonical manifest is not available.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The rationale ('Bypasses LLM generative alterations to prevent indentation errors, invalid fields, or deprecated apiVersions') implies the tool should be preferred over generating YAML, which is useful context. However, there is no explicit when-to-use/when-not statement and no reference to list_supported_resources for discovering valid kinds.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

list_supported_resourcesA

Lists all Kubernetes API resource Kinds currently indexed with canonical YAML manifests.

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A3.7/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations exist, so the description carries the full burden. It usefully discloses that the set is dynamic ('currently indexed') and that entries correspond to canonical YAML manifests, but says nothing about read-only safety, ordering, completeness limits, or how indexing relates to sync_upstream_docs. For a zero-parameter read this is adequate but thin.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

A single front-loaded sentence with no filler; the scope qualifiers ('all', 'currently indexed', 'canonical YAML manifests') all carry information.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

With an output schema present, return-value detail is unnecessary, and a no-arg read tool has little else to explain. The only real gap is the missing link to its siblings and to the sync workflow that determines what appears in the list.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool takes no parameters (empty properties object, 100% coverage), so per the rubric there is nothing for the description to clarify and the baseline of 4 applies.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and a precisely scoped resource: 'Lists all Kubernetes API resource Kinds currently indexed with canonical YAML manifests.' This clearly separates it from get_canonical_manifest (single manifest retrieval) and search_k8s_docs, though it never names a sibling to contrast with.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Usage is only implied: a discovery/enumeration tool is obviously called before fetching a manifest, and the phrase 'currently indexed' hints the result depends on sync state. The description never states when to use this versus check_api_version or sync_upstream_docs, and gives no prerequisites or exclusions.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

search_k8s_docsA

Searches official Kubernetes documentation (kubernetes.io) for concepts, policies, and architectures.

Args:
    query: Search keywords or question (e.g., 'network policies ingress rules', 'validating admission webhook cel').
    limit: Maximum number of documentation sections to return (default: 3).

Returns:
    Authoritative documentation sections with official kubernetes.io URLs.
ParametersJSON Schema
NameRequiredDescriptionDefault
limitNo
queryYes

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A3.6/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the full behavioral burden. It does disclose the data source (official kubernetes.io docs) and that results are authoritative sections with official URLs, which is meaningful context for trust. However it omits any mention of network dependency, latency, failure behavior, or result ranking/scope limits.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The Args/Returns structure front-loads the purpose and keeps parameter info scannable; every line carries information. Slightly formulaic but no filler sentences.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a 2-parameter search tool with an output schema, the definition covers purpose, both params, and the nature of results. The remaining gap is input-side semantics (query syntax, limit bounds) rather than missing essentials.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 0%, so the description is doing real work: it names both parameters, explains 'limit' as the maximum number of documentation sections to return (matching the schema default of 3), and gives concrete query examples. It stops short of guidance on limit ranges or query syntax nuance.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and resource ('Searches official Kubernetes documentation (kubernetes.io)') plus the scope of content covered (concepts, policies, architectures). It doesn't explicitly distinguish itself from siblings, but the sibling names (list_supported_resources, get_canonical_manifest, check_api_version, sync_upstream_docs) are functionally distinct enough that confusion is unlikely.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Usage is only implied: the example queries ('network policies ingress rules', 'validating admission webhook cel') suggest conceptual/policy questions, which hints at when this tool is appropriate over the sibling lookups. There is no explicit when-to-use, when-not-to-use, or named alternative.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

sync_upstream_docsB

Fetches or updates the latest official documentation and examples from github.com/kubernetes/website.

Preprocesses Hugo shortcodes (resolving {{< codenew >}} into inline YAML) and rebuilds the SQLite FTS5 database.
ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

B3.3/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the full burden and does disclose meaningful behavior: fetching remote docs, preprocessing Hugo shortcodes, and rebuilding an SQLite FTS5 database. However, it omits whether the sync overwrites local data, requires network access, needs authentication, or what failure modes exist.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is two focused sentences: the first states the core sync operation, and the second adds relevant implementation detail. It is front-loaded and avoids repetition, though a slightly clearer separation of scope versus side effects could improve it.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

An output schema exists, so return values need not be explained. However, for a zero-parameter sync tool with no annotations, the description should more fully address prerequisites, safety implications of rebuilding the database, and when an agent should invoke it relative to sibling tools.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool has zero parameters, so the baseline is 4. The schema has full description coverage and the description correctly does not invent parameter details that do not exist.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states a specific verb and resource: it fetches or updates official Kubernetes documentation and examples from a named repository. It is clear what the tool operates on, though it does not explicitly distinguish itself from sibling search or lookup tools.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description does not say when to use this tool versus alternatives such as search_k8s_docs or get_canonical_manifest. It implies that syncing must happen before search, but no explicit guidance or prerequisites are given.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 5 tool updatesv0.1.0
    • First observedcheck_api_version
    • First observedget_canonical_manifest
    • First observedlist_supported_resources
    • First observedsearch_k8s_docs
    • First observedsync_upstream_docs

TDQS

A3.8/5.0

Scored across 5 tools

Disambiguation5/5

Each tool has a clearly distinct role: listing indexed kinds, searching official docs, retrieving canonical manifests, checking API version compatibility, and syncing upstream docs. Overlap is minimal, so an agent can reliably select the right tool.

Naming Consistency5/5

All tool names use consistent snake_case with a verb-first pattern: list_supported_resources, search_k8s_docs, get_canonical_manifest, check_api_version, sync_upstream_docs. The style is predictable and readable throughout.

Tool Count5/5

Five tools is well-scoped for a Kubernetes documentation and manifest helper. Each tool covers a distinct operation, and none feels redundant or unnecessary.

Completeness4/5

The surface covers discovery, documentation search, canonical manifest retrieval, API version validation, and upstream syncing. Minor gaps remain, such as validating arbitrary user-supplied YAML or browsing doc sections by category, but core workflows are supported.

Maintenance

ActivityMaintained
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers

  • A
    license
    A
    quality
    D
    maintenance
    A version-aware Kubernetes documentation assistant that connects LLMs to trusted, real-time Kubernetes docs to reduce hallucinations and ensure accurate, version-specific responses.
    2
    28 npm
    4
    MIT
  • A
    license
    Not graded
    quality
    A
    maintenance
    Enables intelligent Kubernetes deployments, automated documentation testing, organizational pattern management, and shared prompt libraries. Provides AI-powered recommendations based on cluster capabilities and automates DevOps workflows through conversational interfaces.
    305 npm
    337
    MIT
  • A
    license
    A
    quality
    C
    maintenance
    Enables AI assistants to interact with and manage Kubernetes clusters, supporting operations on pods, deployments, services, configmaps, secrets, namespaces, metrics, and events with built-in safety features for destructive actions.
    9
    2 npm
    1
    MIT
  • A
    license
    A
    quality
    D
    maintenance
    Provides AI assistants with tools to access Kubernetes enhancement proposals (KEPs), contributor guidelines, and official documentation via the Model Context Protocol.
    7
    Apache 2.0