Skip to content

Conversation

kasanatte
Copy link
Contributor

@kasanatte kasanatte commented Sep 26, 2025

What type of PR is this?
/kind feature

What this PR does / why we need it:
This PR implements the MCP (Model Context Protocol) client. This client is responsible for communicating with an MCP server to fetch available tools and real-time cluster information.

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

Special notes for your reviewer:
It depends on the changes from PR #274

Does this PR introduce a user-facing change?:

NONE

@karmada-bot karmada-bot added the kind/feature Categorizes issue or PR as related to a new feature. label Sep 26, 2025
@karmada-bot karmada-bot added the size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label Sep 26, 2025
Copy link

Summary of Changes

Hello @kasanatte, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces the foundational implementation of the Model Context Protocol (MCP) client within the Karmada dashboard. This client is crucial for enabling AI-powered capabilities, allowing the dashboard to communicate with an MCP server to fetch available tools and real-time cluster information. The changes include adding necessary configuration options for both MCP and OpenAI integration, updating build processes, and providing extensive documentation to guide users on setting up and utilizing this new AI assistant feature.

Highlights

  • MCP Client Implementation: Introduces a new Model Context Protocol (MCP) client to enable AI-powered interaction with Karmada clusters, allowing the dashboard to communicate with an MCP server to fetch available tools and real-time cluster information.
  • OpenAI Integration: Adds configuration options and dependencies for integrating with OpenAI models, facilitating AI assistant functionality within the dashboard.
  • Flexible Transport Modes: The MCP client supports both standard I/O (stdio) and Server-Sent Events (SSE) for communication with the MCP server, offering flexibility in deployment.
  • Build and Configuration Updates: Modifies the Makefile to include new command-line flags for MCP and OpenAI configuration, and adds a Dockerfile for building the karmada-mcp-server binary.
  • Comprehensive Documentation: Includes a detailed README for the pkg/mcp directory, explaining the Karmada Assistant, its prerequisites, usage examples, configuration instructions, and migration from environment variables.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces an MCP client to enable AI-powered chat features in the Karmada dashboard. The changes include adding new dependencies, command-line options, a Dockerfile for the MCP server, and the client implementation itself. The code is well-structured, but I have a few suggestions to improve maintainability, security, and correctness.

Most critically, the new MCP feature is not activated in the main application entrypoint. The mcp.InitMCPConfig(opts) function needs to be called in cmd/api/app/api.go for the feature to be enabled when the corresponding flags are used. Since I cannot comment on unchanged files, I'm highlighting this crucial omission here.

My other review comments focus on a potential risk in the Docker build process, and areas for code simplification and design improvement in the client implementation.

WORKDIR /src

# Clone the specified git repository
RUN git clone https://github.com/warjiang/karmada-mcp-server.git .

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

For better security and build reproducibility, it's recommended to avoid cloning from a personal repository and to pin the dependency to a specific version.

  1. Repository: The build clones from warjiang/karmada-mcp-server, which is a personal repository. This can be a security and maintenance risk. It would be safer to use a repository under the official karmada-io organization.
  2. Versioning: The git clone command uses the default branch, which means the build can change unexpectedly. Pinning to a specific git tag or commit hash ensures that builds are reproducible.
RUN git clone https://github.com/warjiang/karmada-mcp-server.git . && git checkout <specific-version-tag>

@karmada-bot karmada-bot added the do-not-merge/contains-merge-commits Indicates a PR which contains merge commits. label Sep 26, 2025
@karmada-bot karmada-bot removed the do-not-merge/contains-merge-commits Indicates a PR which contains merge commits. label Sep 26, 2025
@warjiang
Copy link
Contributor

/assign

@warjiang
Copy link
Contributor

@kasanatte it seems that there are some conflicts, plz fix the conflicts first

@karmada-bot
Copy link
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 ask for approval from warjiang. For more information see the Kubernetes Code Review Process.

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

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
Labels
kind/feature Categorizes issue or PR as related to a new feature. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Umbrella][Summer OSPP 2025] Integrate Karmada-MCP-Server into the Karmada Dashboard
3 participants