import { Edit3, Globe, Plus, Server, Terminal, Trash2, Users, Zap } from 'lucide-react'; import { useTranslation } from 'react-i18next'; import { Badge, Button } from '../../../../../../../shared/view/ui'; import { IS_PLATFORM } from '../../../../../../../constants/config'; import PremiumFeatureCard from '../../../../PremiumFeatureCard'; import type { McpServer, McpToolsResult, McpTestResult } from '../../../../../types/types'; const getTransportIcon = (type: string | undefined) => { if (type === 'stdio') { return ; } if (type === 'sse') { return ; } if (type === 'http') { return ; } return ; }; const maskSecret = (value: unknown): string => { const normalizedValue = String(value ?? ''); if (normalizedValue.length <= 4) { return '****'; } return `${normalizedValue.slice(0, 2)}****${normalizedValue.slice(-2)}`; }; type ClaudeMcpServersProps = { agent: 'claude'; servers: McpServer[]; onAdd: () => void; onEdit: (server: McpServer) => void; onDelete: (serverId: string, scope?: string) => void; onTest: (serverId: string, scope?: string) => void; onDiscoverTools: (serverId: string, scope?: string) => void; testResults: Record; serverTools: Record; toolsLoading: Record; deleteError?: string | null; }; function ClaudeMcpServers({ servers, onAdd, onEdit, onDelete, testResults, serverTools, deleteError, }: Omit) { const { t } = useTranslation('settings'); return (

{t('mcpServers.title')}

{t('mcpServers.description.claude')}

{deleteError && (
{deleteError}
)}
{servers.map((server) => { const serverId = server.id || server.name; const testResult = testResults[serverId]; const toolsResult = serverTools[serverId]; return (
{getTransportIcon(server.type)} {server.name} {server.type || 'stdio'} {server.scope === 'local' ? t('mcpServers.scope.local') : server.scope === 'user' ? t('mcpServers.scope.user') : server.scope}
{server.type === 'stdio' && server.config?.command && (
{t('mcpServers.config.command')}:{' '} {server.config.command}
)} {(server.type === 'sse' || server.type === 'http') && server.config?.url && (
{t('mcpServers.config.url')}:{' '} {server.config.url}
)} {server.config?.args && server.config.args.length > 0 && (
{t('mcpServers.config.args')}:{' '} {server.config.args.join(' ')}
)}
{testResult && (
{testResult.message}
)} {toolsResult && toolsResult.tools && toolsResult.tools.length > 0 && (
{t('mcpServers.tools.title')} {t('mcpServers.tools.count', { count: toolsResult.tools.length })}
{toolsResult.tools.slice(0, 5).map((tool, index) => ( {tool.name} ))} {toolsResult.tools.length > 5 && ( {t('mcpServers.tools.more', { count: toolsResult.tools.length - 5 })} )}
)}
); })} {servers.length === 0 && (
{t('mcpServers.empty')}
)}
{!IS_PLATFORM && ( } title="Team MCP Configs" description="Share MCP server configurations across your team. Everyone stays in sync automatically." /> )}
); } type CursorMcpServersProps = { agent: 'cursor'; servers: McpServer[]; onAdd: () => void; onEdit: (server: McpServer) => void; onDelete: (serverId: string) => void; }; function CursorMcpServers({ servers, onAdd, onEdit, onDelete }: Omit) { const { t } = useTranslation('settings'); return (

{t('mcpServers.title')}

{t('mcpServers.description.cursor')}

{servers.map((server) => { const serverId = server.id || server.name; return (
{server.name} stdio
{server.config?.command && (
{t('mcpServers.config.command')}:{' '} {server.config.command}
)}
); })} {servers.length === 0 && (
{t('mcpServers.empty')}
)}
); } type CodexMcpServersProps = { agent: 'codex'; servers: McpServer[]; onAdd: () => void; onEdit: (server: McpServer) => void; onDelete: (serverId: string) => void; deleteError?: string | null; }; function CodexMcpServers({ servers, onAdd, onEdit, onDelete, deleteError }: Omit) { const { t } = useTranslation('settings'); return (

{t('mcpServers.title')}

{t('mcpServers.description.codex')}

{deleteError && (
{deleteError}
)}
{servers.map((server) => (
{server.name} stdio
{server.config?.command && (
{t('mcpServers.config.command')}:{' '} {server.config.command}
)} {server.config?.args && server.config.args.length > 0 && (
{t('mcpServers.config.args')}:{' '} {server.config.args.join(' ')}
)} {server.config?.env && Object.keys(server.config.env).length > 0 && (
{t('mcpServers.config.environment')}:{' '} {Object.entries(server.config.env).map(([key, value]) => `${key}=${maskSecret(value)}`).join(', ')}
)}
))} {servers.length === 0 && (
{t('mcpServers.empty')}
)}

{t('mcpServers.help.title')}

{t('mcpServers.help.description')}

); } type McpServersContentProps = ClaudeMcpServersProps | CursorMcpServersProps | CodexMcpServersProps; export default function McpServersContent(props: McpServersContentProps) { if (props.agent === 'claude') { return ; } if (props.agent === 'cursor') { return ; } return ; }