From 96f27ff8bcf6372feead7520cebd997d814e9c41 Mon Sep 17 00:00:00 2001 From: Gabriel Gordon-Hall Date: Wed, 23 Jul 2025 14:10:38 +0100 Subject: [PATCH] define executors with mcp configuration (#310) --- backend/src/bin/generate_types.rs | 9 +++++++++ backend/src/executor.rs | 2 +- frontend/src/pages/McpServers.tsx | 17 ++++++++++++++--- shared/types.ts | 9 +++++++++ 4 files changed, 33 insertions(+), 4 deletions(-) diff --git a/backend/src/bin/generate_types.rs b/backend/src/bin/generate_types.rs index 0395c738..8235ae50 100644 --- a/backend/src/bin/generate_types.rs +++ b/backend/src/bin/generate_types.rs @@ -47,6 +47,15 @@ export const EDITOR_LABELS: Record = { "custom": "Custom" }; +export const MCP_SUPPORTED_EXECUTORS: string[] = [ + "claude", + "amp", + "gemini", + "sst-opencode", + "charm-opencode", + "claude-code-router" +]; + export const SOUND_FILES: SoundFile[] = [ "abstract-sound1", "abstract-sound2", diff --git a/backend/src/executor.rs b/backend/src/executor.rs index 8dc8322b..66de5d54 100644 --- a/backend/src/executor.rs +++ b/backend/src/executor.rs @@ -499,7 +499,7 @@ impl ExecutorConfig { ExecutorConfig::CharmOpencode => Some(vec!["mcpServers"]), ExecutorConfig::SstOpencode => Some(vec!["mcp"]), ExecutorConfig::Claude => Some(vec!["mcpServers"]), - ExecutorConfig::ClaudePlan => Some(vec!["mcpServers"]), + ExecutorConfig::ClaudePlan => None, // Claude Plan shares Claude config ExecutorConfig::Amp => Some(vec!["amp", "mcpServers"]), // Nested path for Amp ExecutorConfig::Gemini => Some(vec!["mcpServers"]), ExecutorConfig::ClaudeCodeRouter => Some(vec!["mcpServers"]), diff --git a/frontend/src/pages/McpServers.tsx b/frontend/src/pages/McpServers.tsx index 630de189..f352efda 100644 --- a/frontend/src/pages/McpServers.tsx +++ b/frontend/src/pages/McpServers.tsx @@ -18,7 +18,11 @@ import { Label } from '@/components/ui/label'; import { Alert, AlertDescription } from '@/components/ui/alert'; import { Textarea } from '@/components/ui/textarea'; import { Loader2 } from 'lucide-react'; -import { EXECUTOR_TYPES, EXECUTOR_LABELS } from 'shared/types'; +import { + EXECUTOR_TYPES, + EXECUTOR_LABELS, + MCP_SUPPORTED_EXECUTORS, +} from 'shared/types'; import { useConfig } from '@/components/config-provider'; import { mcpServersApi } from '../lib/api'; @@ -35,7 +39,12 @@ export function McpServers() { // Initialize selected MCP executor when config loads useEffect(() => { if (config?.executor?.type && !selectedMcpExecutor) { - setSelectedMcpExecutor(config.executor.type); + // If current executor supports MCP, use it; otherwise use first available MCP executor + if (MCP_SUPPORTED_EXECUTORS.includes(config.executor.type)) { + setSelectedMcpExecutor(config.executor.type); + } else { + setSelectedMcpExecutor(MCP_SUPPORTED_EXECUTORS[0] || 'claude'); + } } }, [config?.executor?.type, selectedMcpExecutor]); @@ -314,7 +323,9 @@ export function McpServers() { - {EXECUTOR_TYPES.map((type) => ( + {EXECUTOR_TYPES.filter((type) => + MCP_SUPPORTED_EXECUTORS.includes(type) + ).map((type) => ( {EXECUTOR_LABELS[type]} diff --git a/shared/types.ts b/shared/types.ts index e72813e2..9b10d63d 100644 --- a/shared/types.ts +++ b/shared/types.ts @@ -169,6 +169,15 @@ export const EDITOR_LABELS: Record = { "custom": "Custom" }; +export const MCP_SUPPORTED_EXECUTORS: string[] = [ + "claude", + "amp", + "gemini", + "sst-opencode", + "charm-opencode", + "claude-code-router" +]; + export const SOUND_FILES: SoundFile[] = [ "abstract-sound1", "abstract-sound2",