feat: add ENABLE_CLAUDEAI_MCP_SERVERS opt-out setting

Adds a toggle in the MCP Servers settings section to control whether
Claude Code connects to MCP servers configured in Claude.ai. When
disabled, sets ENABLE_CLAUDEAI_MCP_SERVERS=false. Also fixes a
pre-existing omission of disable_cron from the TypeScript HikariConfig
interface.

Closes #210
This commit is contained in:
2026-03-11 18:41:58 -07:00
committed by Naomi Carrigan
parent 1e9f641db0
commit 9aecec6f64
12 changed files with 73 additions and 4 deletions
+14
View File
@@ -40,6 +40,9 @@ pub struct ClaudeStartOptions {
#[serde(default = "default_include_git_instructions")]
pub include_git_instructions: bool,
#[serde(default = "default_enable_claudeai_mcp_servers")]
pub enable_claudeai_mcp_servers: bool,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
@@ -180,6 +183,9 @@ pub struct HikariConfig {
#[serde(default = "default_include_git_instructions")]
pub include_git_instructions: bool,
#[serde(default = "default_enable_claudeai_mcp_servers")]
pub enable_claudeai_mcp_servers: bool,
}
impl Default for HikariConfig {
@@ -228,6 +234,7 @@ impl Default for HikariConfig {
task_loop_include_summary: false,
disable_cron: false,
include_git_instructions: true,
enable_claudeai_mcp_servers: true,
}
}
}
@@ -276,6 +283,10 @@ fn default_include_git_instructions() -> bool {
true
}
fn default_enable_claudeai_mcp_servers() -> bool {
true
}
#[derive(Debug, Clone, Serialize, Deserialize, Default, PartialEq)]
#[serde(rename_all = "lowercase")]
pub enum BudgetAction {
@@ -372,6 +383,7 @@ mod tests {
assert!(!config.task_loop_include_summary);
assert!(!config.disable_cron);
assert!(config.include_git_instructions);
assert!(config.enable_claudeai_mcp_servers);
}
#[test]
@@ -420,6 +432,7 @@ mod tests {
task_loop_include_summary: true,
disable_cron: true,
include_git_instructions: false,
enable_claudeai_mcp_servers: false,
};
let json = serde_json::to_string(&config).unwrap();
@@ -439,6 +452,7 @@ mod tests {
assert!(deserialized.task_loop_include_summary);
assert!(deserialized.disable_cron);
assert!(!deserialized.include_git_instructions);
assert!(!deserialized.enable_claudeai_mcp_servers);
}
#[test]
+10
View File
@@ -320,6 +320,11 @@ impl WslBridge {
cmd.env("CLAUDE_CODE_DISABLE_GIT_INSTRUCTIONS", "1");
}
// Opt out of claude.ai MCP servers if requested
if !options.enable_claudeai_mcp_servers {
cmd.env("ENABLE_CLAUDEAI_MCP_SERVERS", "false");
}
cmd
} else {
// Running on Windows - use wsl with bash login shell to ensure PATH is loaded
@@ -382,6 +387,11 @@ impl WslBridge {
claude_cmd.push_str("CLAUDE_CODE_DISABLE_GIT_INSTRUCTIONS=1 ");
}
// Opt out of claude.ai MCP servers if requested
if !options.enable_claudeai_mcp_servers {
claude_cmd.push_str("ENABLE_CLAUDEAI_MCP_SERVERS=false ");
}
claude_cmd.push_str(
"claude --output-format stream-json --input-format stream-json --verbose",
);
+1
View File
@@ -66,6 +66,7 @@ vi.mock("$lib/stores/config", () => ({
disable_1m_context: false,
max_output_tokens: null,
include_git_instructions: true,
enable_claudeai_mcp_servers: true,
}),
},
}));
+2
View File
@@ -67,6 +67,7 @@ async function changeDirectory(path: string): Promise<void> {
disable_1m_context: config.disable_1m_context ?? false,
max_output_tokens: config.max_output_tokens ?? null,
include_git_instructions: config.include_git_instructions ?? true,
enable_claudeai_mcp_servers: config.enable_claudeai_mcp_servers ?? true,
},
});
@@ -145,6 +146,7 @@ async function startNewConversation(): Promise<void> {
disable_1m_context: config.disable_1m_context ?? false,
max_output_tokens: config.max_output_tokens ?? null,
include_git_instructions: config.include_git_instructions ?? true,
enable_claudeai_mcp_servers: config.enable_claudeai_mcp_servers ?? true,
},
});
+19 -2
View File
@@ -60,6 +60,7 @@
disable_1m_context: false,
disable_cron: false,
include_git_instructions: true,
enable_claudeai_mcp_servers: true,
max_output_tokens: null,
trusted_workspaces: [],
background_image_path: null,
@@ -562,8 +563,8 @@
<span class="text-sm text-[var(--text-primary)]">Disable cron scheduling</span>
</label>
<p class="text-xs text-[var(--text-tertiary)] mt-1 ml-7">
Sets <code class="font-mono">CLAUDE_CODE_DISABLE_CRON=1</code> to prevent Claude from
scheduling recurring tasks
Sets <code class="font-mono">CLAUDE_CODE_DISABLE_CRON=1</code> to prevent Claude from scheduling
recurring tasks
</p>
</div>
@@ -658,6 +659,22 @@
class="w-full px-3 py-2 bg-[var(--bg-primary)] border border-[var(--border-color)] rounded-lg text-[var(--text-primary)] font-mono text-sm focus:outline-none focus:border-[var(--accent-primary)] resize-none"
></textarea>
</div>
<!-- Enable Claude.ai MCP Servers -->
<div class="mb-4">
<label class="flex items-center gap-3 cursor-pointer">
<input
type="checkbox"
bind:checked={config.enable_claudeai_mcp_servers}
class="w-4 h-4 rounded border-[var(--border-color)] bg-[var(--bg-primary)] text-[var(--accent-primary)] focus:ring-[var(--accent-primary)]"
/>
<span class="text-sm text-[var(--text-primary)]">Enable Claude.ai MCP servers</span>
</label>
<p class="text-xs text-[var(--text-tertiary)] mt-1 ml-7">
When disabled, sets <code class="font-mono">ENABLE_CLAUDEAI_MCP_SERVERS=false</code> to prevent
Claude Code from connecting to MCP servers configured in Claude.ai.
</p>
</div>
</section>
<!-- Auto-Granted Tools Section -->
+1
View File
@@ -403,6 +403,7 @@ User: ${formattedMessage}`;
use_worktree: config.use_worktree ?? false,
disable_1m_context: config.disable_1m_context ?? false,
include_git_instructions: config.include_git_instructions ?? true,
enable_claudeai_mcp_servers: config.enable_claudeai_mcp_servers ?? true,
},
});
@@ -90,6 +90,7 @@
use_worktree: config.use_worktree ?? false,
disable_1m_context: config.disable_1m_context ?? false,
include_git_instructions: config.include_git_instructions ?? true,
enable_claudeai_mcp_servers: config.enable_claudeai_mcp_servers ?? true,
},
});
+11 -2
View File
@@ -88,6 +88,9 @@
task_loop_auto_commit: false,
task_loop_commit_prefix: "feat",
task_loop_include_summary: false,
disable_cron: false,
include_git_instructions: true,
enable_claudeai_mcp_servers: true,
});
let streamerModeActive = $state(false);
@@ -169,6 +172,7 @@
disable_1m_context: currentConfig.disable_1m_context ?? false,
max_output_tokens: currentConfig.max_output_tokens ?? null,
include_git_instructions: currentConfig.include_git_instructions ?? true,
enable_claudeai_mcp_servers: currentConfig.enable_claudeai_mcp_servers ?? true,
},
});
@@ -327,6 +331,7 @@
disable_1m_context: currentConfig.disable_1m_context ?? false,
max_output_tokens: currentConfig.max_output_tokens ?? null,
include_git_instructions: currentConfig.include_git_instructions ?? true,
enable_claudeai_mcp_servers: currentConfig.enable_claudeai_mcp_servers ?? true,
},
});
@@ -405,8 +410,12 @@
title="Worktree: {worktreeInfo.name} | Base: {worktreeInfo.original_repo_directory}"
>
<svg class="w-3 h-3" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
d="M13 10V3L4 14h7v7l9-11h-7z" />
<path
stroke-linecap="round"
stroke-linejoin="round"
stroke-width="2"
d="M13 10V3L4 14h7v7l9-11h-7z"
/>
</svg>
{worktreeInfo.branch}
</div>
+1
View File
@@ -219,6 +219,7 @@
disable_1m_context: cfg.disable_1m_context ?? false,
max_output_tokens: cfg.max_output_tokens ?? null,
include_git_instructions: cfg.include_git_instructions ?? true,
enable_claudeai_mcp_servers: cfg.enable_claudeai_mcp_servers ?? true,
},
});
} catch (error) {
@@ -109,6 +109,7 @@
use_worktree: config.use_worktree ?? false,
disable_1m_context: config.disable_1m_context ?? false,
include_git_instructions: config.include_git_instructions ?? true,
enable_claudeai_mcp_servers: config.enable_claudeai_mcp_servers ?? true,
},
});
+6
View File
@@ -220,7 +220,9 @@ describe("config store", () => {
task_loop_auto_commit: false,
task_loop_commit_prefix: "feat",
task_loop_include_summary: false,
disable_cron: false,
include_git_instructions: true,
enable_claudeai_mcp_servers: true,
};
expect(config.model).toBe("claude-sonnet-4");
@@ -280,7 +282,9 @@ describe("config store", () => {
task_loop_auto_commit: false,
task_loop_commit_prefix: "feat",
task_loop_include_summary: false,
disable_cron: false,
include_git_instructions: true,
enable_claudeai_mcp_servers: true,
};
expect(config.model).toBeNull();
@@ -895,7 +899,9 @@ describe("config store", () => {
task_loop_auto_commit: false,
task_loop_commit_prefix: "feat",
task_loop_include_summary: false,
disable_cron: false,
include_git_instructions: true,
enable_claudeai_mcp_servers: true,
};
const mockInvokeImpl = vi.mocked(invoke);
+6
View File
@@ -81,8 +81,12 @@ export interface HikariConfig {
task_loop_auto_commit: boolean;
task_loop_commit_prefix: string;
task_loop_include_summary: boolean;
// Disable cron scheduling
disable_cron: boolean;
// Git instructions setting
include_git_instructions: boolean;
// Claude.ai MCP servers setting
enable_claudeai_mcp_servers: boolean;
}
const defaultConfig: HikariConfig = {
@@ -136,7 +140,9 @@ const defaultConfig: HikariConfig = {
task_loop_auto_commit: false,
task_loop_commit_prefix: "feat",
task_loop_include_summary: false,
disable_cron: false,
include_git_instructions: true,
enable_claudeai_mcp_servers: true,
};
function createConfigStore() {