Skip to content

🌱 Refactor UI to deploy and manage MCPServer as a Deployment/StatefulSet + Service - #552

Merged
pdettori merged 19 commits into
rossoctl:mainfrom
pdettori:issue-550
Jan 30, 2026
Merged

pdettori merged 19 commits into
rossoctl:mainfrom
pdettori:issue-550

Conversation

@pdettori

Copy link
Copy Markdown
Member

Summary

Refactor UI to deploy and manage MCPServer as a Deployment/StatefulSet + Service.

Goals:

  • Remove dependency on Toolhive operator for tool deployment
  • Use standard Kubernetes primitives for better portability
  • Maintain backward compatibility during transition
  • Support both Deployments and StatefulSets for tools

Scope:

  • Deployments (primary workload type)
  • StatefulSets (for tools requiring persistent state)
  • Services (must be created by UI - previously handled by Toolhive operator)

Target Architecture

┌─────────────┐     POST /tools      ┌─────────────────┐
│  Kagenti UI │ ──────────────────▶  │ Backend (FastAPI)│
└─────────────┘                      └────────┬────────┘
                                              │
                                              │ Creates directly
                                              ▼
                                     ┌─────────────────┐
                                     │  Kubernetes API │
                                     └────────┬────────┘
                                              │
                              ┌───────────────┼───────────────┐
                              │               │               │
                       ┌──────▼──────┐ ┌─────▼─────┐ ┌───────▼───────┐
                       │ Deployment  │ │  Service  │ │  HTTPRoute    │
                       │     or      │ │ {name}-mcp│ │  (optional)   │
                       │ StatefulSet │ └───────────┘ └───────────────┘
                       └─────────────┘

Benefits

  1. No operator dependency - Tools work without Toolhive operator running
  2. Standard K8s primitives - Better tooling support (kubectl, Lens, etc.)
  3. Simpler debugging - Direct inspection of Deployments/Services
  4. StatefulSet support - Enable tools requiring persistent storage
  5. Consistent with agents - Same patterns as agent migration

Service Naming Convention

Old (Toolhive): mcp-{name}-proxy
New (Direct): {name}-mcp

Implementation Timeline

Phase Description Dependencies
1 Backend Infrastructure None
2 Deployment Support Phase 1
3 StatefulSet Support Phase 2
4 Frontend Updates Phase 2-3
5 Migration Tooling Phase 2-4
6 CI/E2E Test Updates Phase 2

Related issue(s)

Fixes #550

@pdettori

Copy link
Copy Markdown
Member Author

Note - this PR builds on #545 so it includes all commits from that PR. Once #545 is merged this PR will be rebased from main and will show only related commits.

@pdettori pdettori moved this from Backlog to In review / Needs Testing in Rossoctl Issue Prioritization Jan 28, 2026
@pdettori
pdettori marked this pull request as ready for review January 28, 2026 02:19
@pdettori pdettori added Ready for Review! enhancement New feature or request labels Jan 28, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This pull request refactors the Kagenti UI to deploy and manage MCP tools as standard Kubernetes Deployments/StatefulSets + Services instead of using the Toolhive MCPServer CRD. This is a significant architectural change that removes the dependency on the Toolhive operator and uses standard Kubernetes primitives.

Changes:

  • Backend now creates Deployments/StatefulSets directly instead of MCPServer CRDs
  • Services are created with new naming convention ({name}-mcp instead of mcp-{name}-proxy)
  • Frontend updated to display workload types and service information
  • Migration tooling provided (CLI script and API endpoints) to migrate existing MCPServer CRDs
  • E2E tests and CI scripts updated to use new deployment approach
  • StatefulSet support added for tools requiring persistent storage

Reviewed changes

Copilot reviewed 23 out of 23 changed files in this pull request and generated 12 comments.

Show a summary per file
File Description
kagenti/backend/app/routers/tools.py Major refactoring with new manifest builders for Deployments/StatefulSets/Services, migration endpoints
kagenti/backend/app/core/constants.py Added constants for transport labels, service naming, migration tracking
kagenti/backend/app/core/config.py Added enable_legacy_mcpserver_crd flag for backward compatibility
kagenti/ui-v2/src/types/index.ts Updated types for workload types, status, and service info
kagenti/ui-v2/src/pages/*.tsx UI updates to display workload types, service info, and Shipwright build status
kagenti/tools/migrate_tools.py New CLI migration script (784 lines)
kagenti/backend/tests/test_tool_workloads.py New unit tests for manifest builders (674 lines)
kagenti/examples/mcpservers/weather_tool.yaml Replaced MCPServer CRD with Deployment + Service manifests
.github/workflows/e2e-kind.yaml Removed Toolhive CRD wait step, updated tool deployment
.github/scripts/kagenti-operator/*.sh Updated deployment scripts to use Deployments instead of MCPServer CRDs

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread kagenti/backend/app/routers/tools.py Resolved
Comment thread kagenti/backend/app/routers/tools.py Resolved
Comment thread kagenti/backend/app/routers/tools.py Resolved
Comment thread kagenti/backend/app/routers/tools.py Resolved
Comment thread kagenti/backend/app/routers/tools.py Resolved
Comment thread kagenti/backend/app/routers/tools.py Resolved
Comment thread kagenti/backend/app/routers/tools.py Resolved
@pdettori

pdettori commented Jan 28, 2026 •

Copy link
Copy Markdown
Member Author

How to test:

  • Delete existing agents, agentbuilds, builds, buildruns, mcpserver.toolhive from your dev namespaces (team1, team2)
    pull this PR in your local env
  • Install Kagenti as usual with deployments/ansible/run-install.sh --env dev (use the --preload flag if needed)
  • Run the command make build-load-ui
  • Copy and paste and run the helm command printed at the end of the build and load.
  • Check the new UI and backend starts with: kubectl get pods -n kagenti-system
    Now follow the usual flow to build and run a tool.

If testing the Weather tool with the Weather agent, copy the URL of the tool from the tool detail page and use that as MCP_URL for the weather agent. You may edit the MCP_URL before starting the build of the weather agent.

@cwiklik
cwiklik self-requested a review January 28, 2026 21:44
pdettori and others added 16 commits January 28, 2026 21:58
Signed-off-by: Paolo Dettori <[email protected]>
Signed-off-by: Paolo Dettori <[email protected]>

Co-authored-by: Copilot <[email protected]>
Signed-off-by: Paolo Dettori <[email protected]>

Co-authored-by: Copilot <[email protected]>
Signed-off-by: Paolo Dettori <[email protected]>

Co-authored-by: Copilot <[email protected]>
Signed-off-by: Paolo Dettori <[email protected]>

Co-authored-by: Copilot <[email protected]>
Signed-off-by: Paolo Dettori <[email protected]>
@cwiklik

cwiklik commented Jan 29, 2026

Copy link
Copy Markdown
Contributor

@paolo, I've installed pr-552 branch code and rebuilt the UI and backend (as documented ^^^). When I deploy the tool (weather-service) from source I see that the status of the pod is NotReady:
image
I stayed on the Import Tool page during the build and deploy.
I can see the pod is actually Running
image

And the Deployment status looks good:

status:
  availableReplicas: 1
  conditions:
  - lastTransitionTime: "2026-01-29T19:48:23Z"
    lastUpdateTime: "2026-01-29T19:48:23Z"
    message: Deployment has minimum availability.
    reason: MinimumReplicasAvailable
    status: "True"
    type: Available
  - lastTransitionTime: "2026-01-29T19:48:22Z"
    lastUpdateTime: "2026-01-29T19:48:23Z"
    message: ReplicaSet "test-weather-tool-78978d45dd" has successfully progressed.
    reason: NewReplicaSetAvailable
    status: "True"
    type: Progressing
  observedGeneration: 1
  readyReplicas: 1
  replicas: 1
  updatedReplicas: 1

@cwiklik cwiklik left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

lgtm

@pdettori
pdettori merged commit 0f16ae6 into rossoctl:main Jan 30, 2026
8 checks passed
@github-project-automation github-project-automation Bot moved this from In review / Needs Testing to Done in Rossoctl Issue Prioritization Jan 30, 2026
@pdettori
pdettori deleted the issue-550 branch January 30, 2026 15:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request Ready for Review!

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Refactor UI to deploy MCPServer as a Deployment + Service (initially without stdio support).

3 participants