Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
There was a problem hiding this comment.
🟡 Changes recommended
The MCP listener architecture lacks required client authentication, authorization, RBAC, and listener-binding/TLS controls.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR adds an LFX Mentorship proposal for an AI-native Kmesh MCP server.
Changes:
- Defines goals, scope, and security approach.
- Adds Mermaid architecture and lifecycle diagrams.
- Provides a 12-week implementation timeline.
File summaries
| File | Summary | Findings |
|---|---|---|
docs/proposal/MCP_Server_AI_Native_Kmesh.md |
Adds the MCP server proposal, architecture, security approach, and timeline. | Nit: capitalize the sentence after the period. Critical: add MCP client authentication/authorization, least-privilege RBAC, and listener-binding/TLS policy. |
Review details
Suppressed comments (2)
docs/proposal/MCP_Server_AI_Native_Kmesh.md:70
- The diagram introduces
get_kmesh_daemonsandget_xds_config, but the planned core API in the linked issue useslist_daemon_podsandconfig_dump. Keeping these names inconsistent makes the proposal and implementation/client examples disagree; use the canonical tool names here or explicitly define aliases.
C["Tool: get_kmesh_daemons"]
D["Tool: get_bpf_maps"]
E["Tool: get_xds_config"]
docs/proposal/MCP_Server_AI_Native_Kmesh.md:158
- The linked issue's tech stack specifies
github.com/modelcontextprotocol/go-sdk, but this proposal names the ambiguousmcp-gopackage and says it generates rules. That can lead the implementation to choose a different SDK and an inaccurate schema model; use the intended module path and describe tool-schema definition accurately.
- **Smart Data Models**: Using the `mcp-go` library to automatically generate the rules so the AI knows exactly what to ask for.
- Files reviewed: 1/1 changed files
- Comments generated: 2
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| end | ||
|
|
||
| subgraph MCP_Server [Kmesh MCP Server] | ||
| B["MCP Server (:8080)"] |
9d7bca4 to
ee4e0a0
Compare
There was a problem hiding this comment.
🟡 Changes recommended
Five unresolved review comments must be addressed before approval.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review details
Suppressed comments (3)
docs/proposal/MCP_Server_AI_Native_Kmesh.md:68
- The architecture exposes an MCP endpoint at
:8080but does not define any authentication or authorization for clients. Port-forwarding protects the daemon's backend connection, not the MCP endpoint itself, so a reachable server could expose cluster data; specify the service-account/mTLS/auth-handler boundary and enforce it before describing this path as secure and read-only.
B["MCP Server (:8080)"]
docs/proposal/MCP_Server_AI_Native_Kmesh.md:25
- The second sentence starts with a lowercase
it, which is a grammatical error in the proposal text.
- **The Solution:** This proposal introduces an **MCP (Model Context Protocol) Server** for Kmesh. it works like a translator that lets AI assistants talk directly to Kmesh.
docs/proposal/MCP_Server_AI_Native_Kmesh.md:93
- The text says this is a four-step lifecycle, but the diagram defines Steps 1–8 across two phases. This contradiction makes the proposed process ambiguous; describe it as a two-phase, eight-step lifecycle.
To make sure these tools are built cleanly and securely, every tool will go through a strict, four-step lifecycle:
- Files reviewed: 1/1 changed files
- Comments generated: 2
- Review effort level: Lite
| C["Tool: get_kmesh_daemons"] | ||
| D["Tool: get_bpf_maps"] | ||
| E["Tool: get_xds_config"] |
|
|
||
| To make this happen, we will build: | ||
|
|
||
| - **Smart Data Models**: Using the `mcp-go` library to automatically generate the rules so the AI knows exactly what to ask for. |
Signed-off-by: devGP7 <gauravpatil232005@gmail.com>
ee4e0a0 to
526c264
Compare
There was a problem hiding this comment.
🟡 Changes recommended
Unresolved integration, API, SDK, security-boundary, and port-forwarding design issues remain.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review details
Suppressed comments (5)
docs/proposal/MCP_Server_AI_Native_Kmesh.md:189
- The planned
get_daemon_healthtool is mapped to/debug/ready, but the current handler unconditionally returns200 OKand even notes that component checks are still TODO. This tool would therefore report a daemon as healthy when only the HTTP server is reachable; either define it as a liveness check or provide a real readiness/health signal before including it as a health tool.
- Build cluster discovery tools: `get_version`, `list_daemon_pods`, and `get_daemon_health`.
docs/proposal/MCP_Server_AI_Native_Kmesh.md:190
get_authz_statuscannot currently be implemented as the proposed read-only GET against/authz:pkg/status/status_server.gorejects every method except POST, and that POST changes the authz offload setting. Add a read-only status endpoint or remove/replace this tool; otherwise one of the ten core tools will always fail and the read-only guarantee is inaccurate.
- Build Status Server tools: `config_dump`, `get_bpf_maps`, `get_logger_levels`, and `get_authz_status`.
docs/proposal/MCP_Server_AI_Native_Kmesh.md:79
- The diagram names tools
get_kmesh_daemonsandget_xds_config, while the workflow and implementation timeline uselist_daemon_podsandconfig_dump. Keeping both spellings makes the proposed tool API ambiguous; use one canonical name for each tool throughout the proposal.
C["Tool: get_kmesh_daemons"]
D["Tool: get_bpf_maps"]
E["Tool: get_xds_config"]
docs/proposal/MCP_Server_AI_Native_Kmesh.md:87
- The architecture shows AI clients connecting directly to
:8080with no authentication or authorization boundary, even though the server can expose cluster-wide config/eBPF data and create Kubernetes port-forwards. Read-only access does not prevent unauthorized reads; define and show the Kubernetes service-account/RBAC or mTLS auth boundary before describing this wiring as secure.
A -- "JSON-RPC over SSE" --> B
docs/proposal/MCP_Server_AI_Native_Kmesh.md:108
- This workflow creates and closes a Kubernetes port-forward for every tool call. Chained or concurrent AI requests will repeatedly pay API/websocket setup latency and can create a connection burst; define bounded per-pod/session reuse or a concurrency limit, along with timeout and cleanup behavior, for the long-lived MCP server.
*Workflow:* The server dynamically locates the daemon pod using `client-go` -> Sets up a secure port-forward tunnel to `15200` -> Executes the HTTP GET request -> Closes the tunnel.
- Files reviewed: 1/1 changed files
- Comments generated: 2
- Review effort level: Lite
| 1. **Kmesh Daemon (`daemon/`)**: The core process running as a DaemonSet. The MCP server will query the daemon to understand the lifecycle and current state. | ||
| 2. **eBPF Data Plane (`bpf/`)**: The heart of Kmesh. The server will fetch states of both Kernel-Native Mode and Dual-Engine Mode by extracting data from eBPF maps. | ||
| 3. **Status Server (`pkg/status/`)**: The internal HTTP server listening on `localhost:15200`. This will be our primary data source. The MCP tools will securely route requests to endpoints like `/version`, `/debug/config_dump`, and `/authz`. | ||
| 4. **CLI Utilities (`ctl/`)**: The MCP server will reuse the robust `setupPortForward` logic found in `kmeshctl` to securely tunnel requests into the daemon pods without exposing new Kubernetes services. |
|
|
||
| - **Phase 1: Environment Setup & Core Server Foundation (Weeks 1-2)** | ||
| - Establish a local Kubernetes test cluster (Kind/Minikube) and deploy Kmesh. | ||
| - Scaffold the Go-based MCP server using the official `mark3labs/mcp-go` SDK. |
|
Adding label DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
| - **Phase 2: Core Tool Implementation (Weeks 3-5)** | ||
| - Build cluster discovery tools: `get_version`, `list_daemon_pods`, and `get_daemon_health`. | ||
| - Build Status Server tools: `config_dump`, `get_bpf_maps`, `get_logger_levels`, and `get_authz_status`. | ||
| - Build K8s API tools: `list_waypoints`, `get_waypoint_status`, and `get_mesh_namespaces`. | ||
|
|
There was a problem hiding this comment.
Could we add a compact contract table for the 10 core tools, covering their inputs, backing endpoint or Kubernetes resource, and expected output?
In particular, please clarify how config_dump and get_bpf_maps select between kernel-native and dual-engine modes, and what happens when the requested mode is unavailable on the target daemon. Please also define whether omitting pod_name queries all daemons or selects a single one.
A short table would be sufficient for this proposal;
| *Workflow:* The server dynamically locates the daemon pod using `client-go` -> Sets up a secure port-forward tunnel to `15200` -> Executes the HTTP GET request -> Closes the tunnel. | ||
|
|
||
| **C. Data Formatting & Noise Reduction:** | ||
| Raw xDS and eBPF dumps can easily exceed an LLM's context window. The MCP server will aggressively parse and filter JSON payloads, stripping irrelevant boilerplate before packaging the response into a `CallToolResult`. |
There was a problem hiding this comment.
Could we make the filtering behavior more explicit rather than describing it as “aggressively” removing boilerplate? An omitted entry could otherwise be mistaken for a missing route or endpoint during diagnosis.
What this PR does
This PR adds my project proposal for the LFX Mentorship 2026.
The idea is to build an MCP (Model Context Protocol) server for Kmesh. Right now, debugging Kmesh usually means running a bunch of
kmeshctlcommands and manually reading heavy xDS/eBPF dumps.This proposal introduces an MCP server that acts as a bridge, allowing AI agents (like Claude or Cursor) to directly fetch and analyze Kmesh data. So instead of manual debugging, users can just ask their AI questions like "Why is service A failing?", and the AI will chain our MCP tools to find the root cause automatically.
I've included the architecture, the approach for safely port-forwarding the status server, and a 12-week timeline. Would love to get your thoughts and feedback on this.
Fixes #1800
#Special notes for your reviewer: