Skip to content

Commit 1ed0775

Browse files
JAORMXclaude
andcommitted
Enable MCP tool proxy by default
Replace --mcp opt-in flag with --no-mcp opt-out flag, following the same pattern as --no-review. Users can also disable via mcp.enabled: false in config. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 37d4821 commit 1ed0775

2 files changed

Lines changed: 11 additions & 11 deletions

File tree

cmd/apiary/main.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ func rootCmd() *cobra.Command {
6666
logFile string
6767
egressProfile string
6868
allowHosts []string
69-
mcpEnabled bool
69+
noMCP bool
7070
mcpGroup string
7171
mcpPort uint16
7272
mcpConfig string
@@ -92,8 +92,8 @@ Example:
9292
apiary claude-code --exclude "*.log" --exclude "tmp/"
9393
apiary claude-code --egress-profile locked
9494
apiary claude-code --allow-host "custom-api.example.com:443"
95-
apiary claude-code --mcp
96-
apiary claude-code --mcp --mcp-group "coding-tools"`,
95+
apiary claude-code --no-mcp
96+
apiary claude-code --mcp-group "coding-tools"`,
9797
Args: cobra.ExactArgs(1),
9898
Version: fmt.Sprintf("%s (%s)", version.Version, version.Commit),
9999
RunE: func(cmd *cobra.Command, args []string) error {
@@ -110,7 +110,7 @@ Example:
110110
logFile: logFile,
111111
egressProfile: egressProfile,
112112
allowHosts: allowHosts,
113-
mcpEnabled: mcpEnabled,
113+
noMCP: noMCP,
114114
mcpGroup: mcpGroup,
115115
mcpPort: mcpPort,
116116
mcpConfig: mcpConfig,
@@ -132,7 +132,7 @@ Example:
132132
cmd.Flags().StringVar(&logFile, "log-file", "", "Override log file path (default: ~/.config/apiary/vms/<vm-name>/apiary.log)")
133133
cmd.Flags().StringVar(&egressProfile, "egress-profile", "", "Egress restriction level: permissive, standard, locked (default: agent's built-in default)")
134134
cmd.Flags().StringSliceVar(&allowHosts, "allow-host", nil, "Additional allowed egress host, format: hostname[:port] (repeatable)")
135-
cmd.Flags().BoolVar(&mcpEnabled, "mcp", false, "Enable MCP tool proxy (discovers servers from ToolHive)")
135+
cmd.Flags().BoolVar(&noMCP, "no-mcp", false, "Disable MCP tool proxy (enabled by default, discovers servers from ToolHive)")
136136
cmd.Flags().StringVar(&mcpGroup, "mcp-group", "default", "ToolHive group to discover MCP servers from")
137137
cmd.Flags().Uint16Var(&mcpPort, "mcp-port", 4483, "Port for MCP proxy on VM gateway")
138138
cmd.Flags().StringVar(&mcpConfig, "mcp-config", "", "Path to custom vmcp config YAML")
@@ -171,7 +171,7 @@ type runFlags struct {
171171
logFile string
172172
egressProfile string
173173
allowHosts []string
174-
mcpEnabled bool
174+
noMCP bool
175175
mcpGroup string
176176
mcpPort uint16
177177
mcpConfig string
@@ -304,10 +304,10 @@ func run(parentCtx context.Context, agentName string, flags runFlags) error {
304304
Observer: observer,
305305
}
306306

307-
// Wire MCP proxy when enabled (CLI flag or config).
308-
mcpEnabled := flags.mcpEnabled
309-
if !mcpEnabled && cfg != nil && cfg.MCP.Enabled {
310-
mcpEnabled = true
307+
// Wire MCP proxy (enabled by default, --no-mcp to disable).
308+
mcpEnabled := !flags.noMCP
309+
if mcpEnabled && cfg != nil && !cfg.MCP.Enabled {
310+
mcpEnabled = false
311311
}
312312
if mcpEnabled {
313313
mcpGroup := flags.mcpGroup

internal/domain/config/config.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ type Config struct {
3333

3434
// MCPConfig configures the in-process MCP proxy.
3535
type MCPConfig struct {
36-
// Enabled controls whether the MCP proxy is active. Default: false.
36+
// Enabled controls whether the MCP proxy is active. Default: true.
3737
Enabled bool `yaml:"enabled"`
3838

3939
// Group is the ToolHive group to discover servers from. Default: "default".

0 commit comments

Comments
 (0)