Start by deciding which MCP server owns the capability:
pkg/mcp/server/.pkg/deploy/mcp/.Keep handlers grouped by domain.
diagnostics.go or a new domain-specific file in pkg/mcp/server/.pkg/deploy/mcp/tools_*.go file.Expose the tool to MCP clients by adding it to the tool catalog in the relevant server file:
pkg/mcp/server/server.go → handleToolsListpkg/deploy/mcp/server.go → handleListToolsAt this stage define:
Add a new case in the tool dispatch switch:
pkg/mcp/server/server.go → handleToolsCallpkg/deploy/mcp/server.go → handleToolCallThis is what connects the public MCP tool name to your Go handler.
Implementation conventions differ slightly by binary.
kubestellar-ops*Server.context.Context when the tool performs Kubernetes I/O.getClientForCluster, discoverer, or shared helpers.kubestellar-deploy*Server.Executor, Selector, ClientManager, and pkg/gitops helpers as needed.error.Add focused unit tests beside the implementation.
Examples already in the repo:
pkg/mcp/server/tools_test.gopkg/mcp/server/diagnostics_test.gopkg/deploy/mcp/tools_app_test.gopkg/deploy/mcp/tools_gitops_test.goFavor the existing testing style:
If the tool changes the user experience, update the relevant files:
README.md or docs/ for developer and operator guidance.commands/ if the Claude Code command descriptions should surface the new workflow.