MCPcopy Index your code
hub / github.com/codeaashu/claude-code / MCPStdioServerMenu

Function MCPStdioServerMenu

src/components/mcp/MCPStdioServerMenu.tsx:30–176  ·  view source on GitHub ↗
({
  server,
  serverToolsCount,
  onViewTools,
  onCancel,
  onComplete,
  borderless = false
}: Props)

Source from the content-addressed store, hash-verified

28 borderless?: boolean;
29};
30export function MCPStdioServerMenu({
31 server,
32 serverToolsCount,
33 onViewTools,
34 onCancel,
35 onComplete,
36 borderless = false
37}: Props): React.ReactNode {
38 const [theme] = useTheme();
39 const exitState = useExitOnCtrlCDWithKeybindings();
40 const mcp = useAppState(s => s.mcp);
41 const reconnectMcpServer = useMcpReconnect();
42 const toggleMcpServer = useMcpToggleEnabled();
43 const [isReconnecting, setIsReconnecting] = useState(false);
44 const handleToggleEnabled = React.useCallback(async () => {
45 const wasEnabled = server.client.type !== 'disabled';
46 try {
47 await toggleMcpServer(server.name);
48 // Return to the server list so user can continue managing other servers
49 onCancel();
50 } catch (err) {
51 const action = wasEnabled ? 'disable' : 'enable';
52 onComplete(`Failed to ${action} MCP server '${server.name}': ${errorMessage(err)}`);
53 }
54 }, [server.client.type, server.name, toggleMcpServer, onCancel, onComplete]);
55 const capitalizedServerName = capitalize(String(server.name));
56
57 // Count MCP prompts for this server (skills are shown in /skills, not here)
58 const serverCommandsCount = filterMcpPromptsByServer(mcp.commands, server.name).length;
59 const menuOptions = [];
60
61 // Only show "View tools" if server is not disabled and has tools
62 if (server.client.type !== 'disabled' && serverToolsCount > 0) {
63 menuOptions.push({
64 label: 'View tools',
65 value: 'tools'
66 });
67 }
68
69 // Only show reconnect option if the server is not disabled
70 if (server.client.type !== 'disabled') {
71 menuOptions.push({
72 label: 'Reconnect',
73 value: 'reconnectMcpServer'
74 });
75 }
76 menuOptions.push({
77 label: server.client.type !== 'disabled' ? 'Disable' : 'Enable',
78 value: 'toggle-enabled'
79 });
80
81 // If there are no other options, add a back option so Select handles escape
82 if (menuOptions.length === 0) {
83 menuOptions.push({
84 label: 'Back',
85 value: 'back'
86 });
87 }

Callers

nothing calls this directly

Calls 15

useAppStateFunction · 0.85
useMcpReconnectFunction · 0.85
useMcpToggleEnabledFunction · 0.85
capitalizeFunction · 0.85
filterMcpPromptsByServerFunction · 0.85
colorFunction · 0.85
getMcpConfigByNameFunction · 0.85
handleReconnectResultFunction · 0.85
handleReconnectErrorFunction · 0.85
useThemeFunction · 0.50

Tested by

no test coverage detected