Skip to content

Conversation

@jmhbh
Copy link
Contributor

@jmhbh jmhbh commented Sep 23, 2025

This PR contains the following changes and is the first in two PRs to migrate KMCP into Kagent. The second PR will focus on migrating the KMCP cli functionalities into the Kagent CLI.

  • Added KMCP's mcpServer CRD to Kagent.
  • Added a new controller that watches for the mcpServer CRD and handles the deployment lifecycle of the mcp server deployment.
  • Refactored existing mcp server controller into mcp_server_tool_controller to better reflect its responsibilities of managing tool discovery.
  • Added new e2e test for a declarative agent using tools derived from a mcp server deployed using the mcpServer CRD.

Manual Testing:

  • Interacted with agent using tools derived from the deployed mcp server.
  • Tested deleting mcp tool server in the UI. (This is the only portion of the UI that was using kmcp resources)

- added mcp server crd
- added mcp server controller to manage mcp server deployment lifecycle
- added transport adapter layer to support stdio -> http transport conversion
- refactored existing mcp_server_controller iinto mcp_server_tool_controller to manage tool discovery for mcp server tools

Signed-off-by: JM Huibonhoa <jm.huibonhoa@solo.io>
… helm chart

Signed-off-by: JM Huibonhoa <jm.huibonhoa@solo.io>
Signed-off-by: JM Huibonhoa <jm.huibonhoa@solo.io>
- add e2e test using agent with tool from mcp server deployed using mcpServer CRD
- fix issue with mcpServer deployment status not being updated after deployment becomes ready

Signed-off-by: JM Huibonhoa <jm.huibonhoa@solo.io>
Signed-off-by: JM Huibonhoa <jm.huibonhoa@solo.io>

// +kubebuilder:rbac:groups=kagent.dev,resources=mcpservers,verbs=get;list;watch

func (r *MCPServerToolController) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was the original mcp server controller that was implemented as a part of the kmcp integration. I renamed it to mcp_server_tool_controller to better represent its responsibility of updating the tool server.

Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we need 2 controllers? Now we can re-use since all of the logic is internal

@jmhbh jmhbh changed the title Merge KMCP into Kagent feat: Merge KMCP into Kagent Sep 23, 2025
@jmhbh jmhbh changed the title feat: Merge KMCP into Kagent feat: Merge KMCP as an optional component into Kagent Sep 23, 2025
@jmhbh jmhbh changed the title feat: Merge KMCP as an optional component into Kagent feat: Merge KMCP into Kagent Sep 23, 2025
Signed-off-by: JM Huibonhoa <jm.huibonhoa@solo.io>
@jmhbh jmhbh changed the title feat: Merge KMCP into Kagent feat: Merge KMCP crd and controller into Kagent Sep 23, 2025
Signed-off-by: JM Huibonhoa <jm.huibonhoa@solo.io>
@jmhbh jmhbh marked this pull request as ready for review September 23, 2025 23:20
@jmhbh jmhbh requested a review from EItanya as a code owner September 23, 2025 23:20
Copilot AI review requested due to automatic review settings September 23, 2025 23:20
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR migrates KMCP CRD and controller functionality into Kagent, removing the external KMCP dependency. It adds a new MCPServer CRD to Kagent with deployment lifecycle management capabilities and refactors existing MCP server handling to separate tool discovery from deployment concerns.

  • Adds MCPServer CRD to Kagent with comprehensive status conditions and deployment configuration
  • Introduces MCPServerController for deployment lifecycle management and MCPServerToolController for tool discovery
  • Removes KMCP dependency and migrates transport adapter functionality into Kagent

Reviewed Changes

Copilot reviewed 26 out of 29 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
go/api/v1alpha1/mcpserver_types.go Defines new MCPServer CRD with transport types, status conditions, and deployment specifications
go/internal/controller/mcp_server_controller.go Implements MCPServer deployment lifecycle controller with RBAC permissions
go/internal/controller/mcp_server_tool_controller.go Handles tool discovery functionality for MCPServer resources
go/internal/controller/translator/translator_adapter.go Provides transport adapter translation logic for MCPServer to Kubernetes resources
go/internal/controller/reconciler/reconciler.go Adds MCPServer deployment reconciliation method
go/test/e2e/manifests/*.yaml Test manifests for declarative agent using MCPServer tools

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Signed-off-by: JM Huibonhoa <jm.huibonhoa@solo.io>
Signed-off-by: JM Huibonhoa <jm.huibonhoa@solo.io>
Signed-off-by: JM Huibonhoa <jm.huibonhoa@solo.io>
Copy link
Contributor

@EItanya EItanya left a comment

Choose a reason for hiding this comment

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

Overall looking great. The main themes of my review are to clean up the controllers and translation. For future work I would like us to try and unify our approach for mcp server outputs and agent outputs.


// +kubebuilder:rbac:groups=kagent.dev,resources=mcpservers,verbs=get;list;watch

func (r *MCPServerToolController) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we need 2 controllers? Now we can re-use since all of the logic is internal

- partition agent and mcp translator into respective directories in the translator dir
- use mock server in e2e test
- reverted CI changes

Signed-off-by: JM Huibonhoa <jm.huibonhoa@solo.io>
Signed-off-by: JM Huibonhoa <jm.huibonhoa@solo.io>
Signed-off-by: JM Huibonhoa <jm.huibonhoa@solo.io>
Signed-off-by: JM Huibonhoa <jm.huibonhoa@solo.io>
@EItanya EItanya merged commit c605477 into kagent-dev:main Sep 25, 2025
16 checks passed
supreme-gg-gg pushed a commit to supreme-gg-gg/kagent that referenced this pull request Oct 7, 2025
This PR contains the following changes and is the first in two PRs to
migrate KMCP into Kagent. The second PR will focus on migrating the KMCP
cli functionalities into the Kagent CLI.

- Added KMCP's `mcpServer` CRD to Kagent.
- Added a new controller that watches for the `mcpServer` CRD and
handles the deployment lifecycle of the mcp server deployment.
- Refactored existing mcp server controller into
`mcp_server_tool_controller` to better reflect its responsibilities of
managing tool discovery.
- Added new e2e test for a declarative agent using tools derived from a
mcp server deployed using the `mcpServer` CRD.

Manual Testing:
- Interacted with agent using tools derived from the deployed mcp
server.
- Tested deleting mcp tool server in the UI. (This is the only portion
of the UI that was using kmcp resources)

---------

Signed-off-by: JM Huibonhoa <jm.huibonhoa@solo.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants