Summary
Add three new MCP tools to the kagent-controller's existing MCP endpoint at :8083/mcp for dynamic tool server discovery and invocation:
| Tool |
Purpose |
list_tool_servers |
List all tool servers across RemoteMCPServer, Service (with kagent.dev/mcp-service=true), and MCPServer CRs |
list_tools |
Connect to a specific tool server and return its available tools |
call_tool |
Invoke a specific tool on a specific tool server |
Motivation
This was originally proposed as kagent-dev/kmcp#123 but the reviewer correctly noted that it belongs in kagent instead of kmcp, because:
- kagent already watches all three tool source types — RemoteMCPServer, Service, and MCPServer (optional)
- kagent already has an MCP handler at
:8083/mcp with list_agents / invoke_agent
- kmcp should stay focused on deployment — translating MCPServer CRs into Kubernetes resources
Moving to kagent provides unified discovery across all tool sources, not just MCPServer CRs.
Design
- Ref format:
Kind/namespace/name (e.g. RemoteMCPServer/default/my-server, Service/tools/prometheus, MCPServer/default/weather)
- Session caching:
sync.Map with evict-and-retry on stale connections
- URL derivation: Reuses existing
ConvertServiceToRemoteMCPServer and ConvertMCPServerToRemoteMCPServer from the translator package
- MCPServer CRD is optional: Gracefully returns empty list if kmcp is not installed
Summary
Add three new MCP tools to the kagent-controller's existing MCP endpoint at
:8083/mcpfor dynamic tool server discovery and invocation:list_tool_serverskagent.dev/mcp-service=true), and MCPServer CRslist_toolscall_toolMotivation
This was originally proposed as kagent-dev/kmcp#123 but the reviewer correctly noted that it belongs in kagent instead of kmcp, because:
:8083/mcpwithlist_agents/invoke_agentMoving to kagent provides unified discovery across all tool sources, not just MCPServer CRs.
Design
Kind/namespace/name(e.g.RemoteMCPServer/default/my-server,Service/tools/prometheus,MCPServer/default/weather)sync.Mapwith evict-and-retry on stale connectionsConvertServiceToRemoteMCPServerandConvertMCPServerToRemoteMCPServerfrom the translator package