Skip to content

Feature/mcp server pr2 - #1919

Open
dolliecoder wants to merge 2 commits into
kmesh-net:mainfrom
dolliecoder:feature/mcp-server-pr2
Open

dolliecoder wants to merge 2 commits into
kmesh-net:mainfrom
dolliecoder:feature/mcp-server-pr2

Conversation

@dolliecoder

Copy link
Copy Markdown

What type of PR is this?

/kind feature

What this PR does / why we need it:
This PR implements the K8s Client & Daemon Discovery Tool (get_kmesh_daemon_pods), the overall Model Context Protocol (MCP) Server integration roadmap.

For AI agents to diagnose Kmesh effectively via MCP (e.g., fetching daemon logs, checking authz status, or dumping xDS configs in future PRs), they must first know which daemon pods are actively running in the cluster.

This PR:

  1. Adds a new mcp/tools/daemon package.
  2. Registers the get_kmesh_daemon_pods tool to the MCP server.
  3. Leverages Kmesh's internal utils.CreateKubeClient() to securely query the Kubernetes API for all active pods in the kmesh-system namespace.
  4. Formats the data (Pod Name, Node, Status, and IP) so AI agents can parse it and target specific pods dynamically.

Which issue(s) this PR fixes:
Fixes #1918

Special notes for your reviewer:
This tool reuses the existing kmeshctl utility functions (utils.KmeshNamespace, utils.KmeshLabel, and utils.CreateKubeClient) to ensure the K8s API authentication behaves identically to the rest of the CLI.

Does this PR introduce a user-facing change?:

Added the `get_kmesh_daemon_pods` tool to the Kmesh MCP server, allowing AI agents to dynamically discover active daemon pods in the cluster.

Signed-off-by: dolliecoder <dollychahar27@gmail.com>
Signed-off-by: dolliecoder <dollychahar27@gmail.com>
@kmesh-bot

Copy link
Copy Markdown
Collaborator

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign nlgwcy for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Enhancement: MCP Server K8s Client & Daemon Discovery

2 participants