Skip to content

Conversation

@EItanya
Copy link
Contributor

@EItanya EItanya commented Aug 4, 2025

This PR bring official KMCP support to KAGENT 🎉

  1. Changes Agent API to allow pointing to Service, MCPServer or new RemoteMCPServer
  2. Removed ToolServer in favor of new RemoteMCPServer

EItanya added 5 commits August 4, 2025 11:59
Signed-off-by: Eitan Yarmush <eitan.yarmush@solo.io>
Signed-off-by: Eitan Yarmush <eitan.yarmush@solo.io>
Signed-off-by: Eitan Yarmush <eitan.yarmush@solo.io>
Signed-off-by: Eitan Yarmush <eitan.yarmush@solo.io>
Signed-off-by: Eitan Yarmush <eitan.yarmush@solo.io>
Copilot AI review requested due to automatic review settings August 4, 2025 19:40
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 brings official KMCP (Kubernetes Model Control Protocol) support to KAGENT by refactoring the Agent API to support multiple server types including Service, MCPServer, and the new RemoteMCPServer. The major change is replacing the legacy ToolServer with RemoteMCPServer while adding support for MCP service discovery.

  • Introduces new RemoteMCPServer CRD (v1alpha2) to replace legacy ToolServer
  • Updates Agent API to reference tools using typed object references instead of string references
  • Adds support for MCP service auto-discovery through Kubernetes Services

Reviewed Changes

Copilot reviewed 91 out of 94 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
ui/src/types/index.ts Updates TypeScript interfaces for tool references from string refs to typed references
ui/src/lib/toolUtils.ts Refactors tool utility functions to use new typed reference structure
ui/src/components/*/tsx Updates UI components to handle new tool reference format
ui/src/app/actions/agents.ts Modifies agent actions to work with typed tool references
helm/*/yaml Migrates Helm charts from v1alpha1 to v1alpha2 API versions
go/pkg/client/api/types.go Updates API types to use v1alpha2 versions
go/internal/*/go Refactors Go code to support new KMCP architecture
go/controller/*/go Implements new controllers for RemoteMCPServer and MCP service discovery

break
}
}
return nil, fmt.Errorf("no port found for service %s with protocol %s", svc.Name, protocol)
Copy link

Copilot AI Aug 4, 2025

Choose a reason for hiding this comment

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

This error is returned even when a port is found (port != 0). The return statement should be moved outside the for loop or the logic should be restructured to only return this error when no matching port is found.

Suggested change
return nil, fmt.Errorf("no port found for service %s with protocol %s", svc.Name, protocol)
if port == 0 {
return nil, fmt.Errorf("no port found for service %s with protocol %s", svc.Name, protocol)
}

Copilot uses AI. Check for mistakes.
if state.isVisited(toolRef) {
return nil, nil, fmt.Errorf("cycle detected in agent tool chain: %s -> %s", agentRef, toolRef)
if state.isVisited(agentRef.String()) {
return nil, nil, fmt.Errorf("cycle detected in agent tool chain: %s -> %s", agentRef, agentRef.String())
Copy link

Copilot AI Aug 4, 2025

Choose a reason for hiding this comment

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

The error message shows the same reference twice (agentRef and agentRef.String()). It should show the current agent and the tool reference that creates the cycle.

Suggested change
return nil, nil, fmt.Errorf("cycle detected in agent tool chain: %s -> %s", agentRef, agentRef.String())
currentAgentRef := types.NamespacedName{Name: agent.Name, Namespace: agent.Namespace}
return nil, nil, fmt.Errorf("cycle detected in agent tool chain: %s -> %s", currentAgentRef, agentRef)

Copilot uses AI. Check for mistakes.

if state.depth > MAX_DEPTH {
return nil, nil, fmt.Errorf("recursion limit reached in agent tool chain: %s -> %s", agentRef, toolRef)
return nil, nil, fmt.Errorf("recursion limit reached in agent tool chain: %s -> %s", agentRef, agentRef.String())
Copy link

Copilot AI Aug 4, 2025

Choose a reason for hiding this comment

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

Same issue as above - the error message shows the same reference twice instead of showing the chain that caused the recursion limit.

Copilot uses AI. Check for mistakes.
Signed-off-by: Eitan Yarmush <eitan.yarmush@solo.io>
@EItanya EItanya changed the title Official KMP Support Official KMCP Support Aug 4, 2025
EItanya and others added 19 commits August 4, 2025 20:46
Signed-off-by: Eitan Yarmush <eitan.yarmush@solo.io>
Signed-off-by: Eitan Yarmush <eitan.yarmush@solo.io>
Signed-off-by: Eitan Yarmush <eitan.yarmush@solo.io>
Signed-off-by: Eitan Yarmush <eitan.yarmush@solo.io>
Signed-off-by: Eitan Yarmush <eitan.yarmush@solo.io>
Signed-off-by: Eitan Yarmush <eitan.yarmush@solo.io>
Signed-off-by: Peter Jausovec <peter.jausovec@solo.io>
Signed-off-by: Peter Jausovec <peter.jausovec@solo.io>
…nya/kmcp

* 'eitanya/kmcp' of github.com:kagent-dev/kagent:
  [FIX ] - fixes adk performance tuning (#689)
  update READMEs based on new architecture (#684)
  fix(ui): correctly display args for tool calls in chat (#688)
Signed-off-by: Eitan Yarmush <eitan.yarmush@solo.io>
Signed-off-by: Eitan Yarmush <eitan.yarmush@solo.io>
Signed-off-by: Peter Jausovec <peter.jausovec@solo.io>
…nya/kmcp

* 'eitanya/kmcp' of github.com:kagent-dev/kagent:
  fix(ui): display description for agent tools when editing an agent (#692)
  fix(ui): correct link to switch agent from within chat (#667)
  EP-685-kmcp (#686)
  eitanya/fix-python-release (#698)
  feat: make streaming buffer size configurable (#696)
Signed-off-by: Eitan Yarmush <eitan.yarmush@solo.io>
Signed-off-by: Eitan Yarmush <eitan.yarmush@solo.io>
Signed-off-by: Peter Jausovec <peter.jausovec@solo.io>
peterj and others added 10 commits August 8, 2025 15:30
Signed-off-by: Peter Jausovec <peter.jausovec@solo.io>
…nya/kmcp

* 'eitanya/kmcp' of github.com:kagent-dev/kagent:
  make audit bump go and some cve (#712)
  make shebang more portable (#715)
  feat: implement backend for models ui (#690)
Signed-off-by: Eitan Yarmush <eitan.yarmush@solo.io>
Signed-off-by: Peter Jausovec <peterj@users.noreply.github.com>
Signed-off-by: Peter Jausovec <peter.jausovec@solo.io>
Signed-off-by: Peter Jausovec <peter.jausovec@solo.io>
…state

Signed-off-by: Peter Jausovec <peter.jausovec@solo.io>
peterj
peterj previously approved these changes Aug 11, 2025
Signed-off-by: Peter Jausovec <peter.jausovec@solo.io>
@EItanya EItanya merged commit e73130d into main Aug 11, 2025
11 checks passed
@EItanya EItanya deleted the eitanya/kmcp branch August 11, 2025 12:33
@ashleywang1
Copy link
Contributor

@EItanya did we remove the ability to attach Memory to Agents for a reason?

qasmi pushed a commit to qasmi/kagent that referenced this pull request Aug 13, 2025
* feat(all): Add support for kmcp to kagent

Signed-off-by: Eitan Yarmush <eitan.yarmush@solo.io>

* fixed schema issues

Signed-off-by: Eitan Yarmush <eitan.yarmush@solo.io>

* make ui compile, but it needs to take into account kinds

Signed-off-by: Eitan Yarmush <eitan.yarmush@solo.io>

* fix up the charts to deploy using kmcp by default

Signed-off-by: Eitan Yarmush <eitan.yarmush@solo.io>

* run kmcp code inside of kagent

Signed-off-by: Eitan Yarmush <eitan.yarmush@solo.io>

* fixes helm unit tests

Signed-off-by: Eitan Yarmush <eitan.yarmush@solo.io>

* make kagent.dev default group

Signed-off-by: Eitan Yarmush <eitan.yarmush@solo.io>

* switch over to services and MCPService

Signed-off-by: Eitan Yarmush <eitan.yarmush@solo.io>

* update CR

Signed-off-by: Eitan Yarmush <eitan.yarmush@solo.io>

* fix service problem

Signed-off-by: Eitan Yarmush <eitan.yarmush@solo.io>

* local

Signed-off-by: Eitan Yarmush <eitan.yarmush@solo.io>

* remove failing test

Signed-off-by: Eitan Yarmush <eitan.yarmush@solo.io>

* fix the selected tool removal

Signed-off-by: Peter Jausovec <peter.jausovec@solo.io>

* Refactor tool handling and server integration

Signed-off-by: Peter Jausovec <peter.jausovec@solo.io>

* fix and add more ui tests

Signed-off-by: Peter Jausovec <peter.jausovec@solo.io>

* add support for creating MCPServers

Signed-off-by: Peter Jausovec <peter.jausovec@solo.io>

* update UI to allow creating MCPServer CRDs (stdio)

Signed-off-by: Peter Jausovec <peter.jausovec@solo.io>

* fix build break

Signed-off-by: Peter Jausovec <peter.jausovec@solo.io>

* sort namespace alphabetically

Signed-off-by: Peter Jausovec <peter.jausovec@solo.io>

* only show available models (from the same ns as agent) + fix loading state

Signed-off-by: Peter Jausovec <peter.jausovec@solo.io>

* fix go unit tests

Signed-off-by: Peter Jausovec <peter.jausovec@solo.io>

---------

Signed-off-by: Eitan Yarmush <eitan.yarmush@solo.io>
Signed-off-by: Peter Jausovec <peter.jausovec@solo.io>
Signed-off-by: Peter Jausovec <peterj@users.noreply.github.com>
Co-authored-by: Peter Jausovec <peter.jausovec@solo.io>
Co-authored-by: Peter Jausovec <peterj@users.noreply.github.com>
Signed-off-by: Sara Qasmi <saraqasmi@Saras-MacBook-Pro.local>
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.

4 participants