-
Notifications
You must be signed in to change notification settings - Fork 122
refactor(toolsets): renamed Profile to Toolset #309
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -57,7 +57,7 @@ type MCPServerOptions struct { | |
HttpPort int | ||
SSEBaseUrl string | ||
Kubeconfig string | ||
Profile string | ||
Toolset string | ||
ListOutput string | ||
ReadOnly bool | ||
DisableDestructive bool | ||
|
@@ -77,7 +77,7 @@ type MCPServerOptions struct { | |
func NewMCPServerOptions(streams genericiooptions.IOStreams) *MCPServerOptions { | ||
return &MCPServerOptions{ | ||
IOStreams: streams, | ||
Profile: "full", | ||
Toolset: "full", | ||
ListOutput: "table", | ||
StaticConfig: &config.StaticConfig{}, | ||
} | ||
|
@@ -107,15 +107,15 @@ func NewMCPServer(streams genericiooptions.IOStreams) *cobra.Command { | |
|
||
cmd.Flags().BoolVar(&o.Version, "version", o.Version, "Print version information and quit") | ||
cmd.Flags().IntVar(&o.LogLevel, "log-level", o.LogLevel, "Set the log level (from 0 to 9)") | ||
cmd.Flags().StringVar(&o.ConfigPath, "config", o.ConfigPath, "Path of the config file. Each profile has its set of defaults.") | ||
cmd.Flags().StringVar(&o.ConfigPath, "config", o.ConfigPath, "Path of the config file.") | ||
cmd.Flags().IntVar(&o.SSEPort, "sse-port", o.SSEPort, "Start a SSE server on the specified port") | ||
cmd.Flag("sse-port").Deprecated = "Use --port instead" | ||
cmd.Flags().IntVar(&o.HttpPort, "http-port", o.HttpPort, "Start a streamable HTTP server on the specified port") | ||
cmd.Flag("http-port").Deprecated = "Use --port instead" | ||
cmd.Flags().StringVar(&o.Port, "port", o.Port, "Start a streamable HTTP and SSE HTTP server on the specified port (e.g. 8080)") | ||
cmd.Flags().StringVar(&o.SSEBaseUrl, "sse-base-url", o.SSEBaseUrl, "SSE public base URL to use when sending the endpoint message (e.g. https://example.com)") | ||
cmd.Flags().StringVar(&o.Kubeconfig, "kubeconfig", o.Kubeconfig, "Path to the kubeconfig file to use for authentication") | ||
cmd.Flags().StringVar(&o.Profile, "profile", o.Profile, "MCP profile to use (one of: "+strings.Join(mcp.ProfileNames, ", ")+")") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If kubernetes-mcp-server was GA'ed, we need to first deprecate this flag to not cause any breakages. However, I think we are fine to update the flag name now. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I didn't deprecate it because as of now, the flag was useless. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That is fine. But from the user's perspective There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. that should not be working in v0.0.49. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. $ npx -y kubernetes-mcp-server@latest --profile=invalid
Error: invalid profile name: invalid, valid names are: full
Usage:
... |
||
cmd.Flags().StringVar(&o.Toolset, "toolset", o.Toolset, "MCP toolset to use (one of: "+strings.Join(mcp.ToolsetNames, ", ")+")") | ||
cmd.Flags().StringVar(&o.ListOutput, "list-output", o.ListOutput, "Output format for resource list operations (one of: "+strings.Join(output.Names, ", ")+"). Defaults to table.") | ||
cmd.Flags().BoolVar(&o.ReadOnly, "read-only", o.ReadOnly, "If true, only tools annotated with readOnlyHint=true are exposed") | ||
cmd.Flags().BoolVar(&o.DisableDestructive, "disable-destructive", o.DisableDestructive, "If true, tools annotated with destructiveHint=true are disabled") | ||
|
@@ -237,17 +237,17 @@ func (m *MCPServerOptions) Validate() error { | |
} | ||
|
||
func (m *MCPServerOptions) Run() error { | ||
profile := mcp.ProfileFromString(m.Profile) | ||
if profile == nil { | ||
return fmt.Errorf("invalid profile name: %s, valid names are: %s", m.Profile, strings.Join(mcp.ProfileNames, ", ")) | ||
toolset := mcp.ToolsetFromString(m.Toolset) | ||
if toolset == nil { | ||
return fmt.Errorf("invalid toolset name: %s, valid names are: %s", m.Toolset, strings.Join(mcp.ToolsetNames, ", ")) | ||
} | ||
listOutput := output.FromString(m.StaticConfig.ListOutput) | ||
if listOutput == nil { | ||
return fmt.Errorf("invalid output name: %s, valid names are: %s", m.StaticConfig.ListOutput, strings.Join(output.Names, ", ")) | ||
} | ||
klog.V(1).Info("Starting kubernetes-mcp-server") | ||
klog.V(1).Infof(" - Config: %s", m.ConfigPath) | ||
klog.V(1).Infof(" - Profile: %s", profile.GetName()) | ||
klog.V(1).Infof(" - Toolset: %s", toolset.GetName()) | ||
klog.V(1).Infof(" - ListOutput: %s", listOutput.GetName()) | ||
klog.V(1).Infof(" - Read-only mode: %t", m.StaticConfig.ReadOnly) | ||
klog.V(1).Infof(" - Disable destructive tools: %t", m.StaticConfig.DisableDestructive) | ||
|
@@ -291,7 +291,7 @@ func (m *MCPServerOptions) Run() error { | |
} | ||
|
||
mcpServer, err := mcp.NewServer(mcp.Configuration{ | ||
Profile: profile, | ||
Toolset: toolset, | ||
ListOutput: listOutput, | ||
StaticConfig: m.StaticConfig, | ||
}) | ||
|
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
package mcp | ||
|
||
import ( | ||
"slices" | ||
|
||
"github.com/mark3labs/mcp-go/server" | ||
) | ||
|
||
type Toolset interface { | ||
GetName() string | ||
GetDescription() string | ||
GetTools(s *Server) []server.ServerTool | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure how can we achieve go-sdk transition by using There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You'll see in the follow up PRs. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sounds good to me. Thanks. |
||
} | ||
|
||
var Toolsets = []Toolset{ | ||
&Full{}, | ||
} | ||
|
||
var ToolsetNames []string | ||
|
||
func ToolsetFromString(name string) Toolset { | ||
for _, toolset := range Toolsets { | ||
if toolset.GetName() == name { | ||
return toolset | ||
} | ||
} | ||
return nil | ||
} | ||
|
||
type Full struct{} | ||
|
||
func (p *Full) GetName() string { | ||
return "full" | ||
} | ||
func (p *Full) GetDescription() string { | ||
return "Complete toolset with all tools and extended outputs" | ||
} | ||
func (p *Full) GetTools(s *Server) []server.ServerTool { | ||
return slices.Concat( | ||
s.initConfiguration(), | ||
s.initEvents(), | ||
s.initNamespaces(), | ||
s.initPods(), | ||
s.initResources(), | ||
s.initHelm(), | ||
) | ||
} | ||
|
||
func init() { | ||
ToolsetNames = make([]string, 0) | ||
for _, toolset := range Toolsets { | ||
ToolsetNames = append(ToolsetNames, toolset.GetName()) | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The removal of this statement is to fix the ambiguity or due to a behavior change in profiles/toolsets?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When I envisioned profiles, it was not only about tool and prompt groups but also about default settings for other MCP behaviors.
I never implemented that, and I don't think providing defaults is part of what we want from the toolsets feature.
I'm just removing it because it's setting inaccurate expectations and is also unrelated to config.