Skip to content

Commit f7fa572

Browse files
authored
feat: added method to check if mcp is enabled (#456)
1 parent 3a3fb59 commit f7fa572

File tree

3 files changed

+8
-0
lines changed

3 files changed

+8
-0
lines changed

bluemix/env.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ var (
3333
// for internal use
3434
EnvCLIName = newEnv("IBMCLOUD_CLI", "BLUEMIX_CLI")
3535
EnvPluginNamespace = newEnv("IBMCLOUD_PLUGIN_NAMESPACE", "BLUEMIX_PLUGIN_NAMESPACE")
36+
EnvMCP = newEnv("IBMCLOUD_MCP_ENABLED")
3637
)
3738

3839
// Env is an environment variable supported by IBM Cloud CLI for specific purpose

plugin/plugin.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,4 +298,7 @@ type PluginContext interface {
298298

299299
// CLIName returns binary name of the Bluemix CLI that is invoking the plugin
300300
CLIName() string
301+
302+
// MCPEnabled returns true if the CLI is functioning as an MCP server
303+
MCPEnabled() bool
301304
}

plugin/plugin_context.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,10 @@ func (c *pluginContext) VersionCheckEnabled() bool {
116116
return !c.CheckCLIVersionDisabled()
117117
}
118118

119+
func (c *pluginContext) MCPEnabled() bool {
120+
return bluemix.EnvMCP.Get() != ""
121+
}
122+
119123
func envOrConfig(env bluemix.Env, config string) string {
120124
if v := env.Get(); v != "" {
121125
return v

0 commit comments

Comments
 (0)