🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.
TypeScript agentagent-collaborationagent-harnessloop-engineeringmcppersonal-assistantproactive-agentskillssuper-agenttask-management
🌐 chore: translate non-English comments to English in MCP module (#12520)
LobeHub Bot1c11921a323e
diff --git a/src/features/MCP/MCPDetail/index.tsx b/src/features/MCP/MCPDetail/index.tsxindex f3c42cfbfcf..21eb0bb1dc4 100644--- a/src/features/MCP/MCPDetail/index.tsx+++ b/src/features/MCP/MCPDetail/index.tsx@@ -39,7 +39,7 @@ const Detail = memo<DetailProps>(({ identifier: defaultIdentifier, defaultTab, nconst useMcpDetail = useDiscoverStore((s) => s.useFetchMcpDetail);const { data, isLoading } = useMcpDetail({ identifier });- // 如果有明确传入的 identifier,跳过 isMcpListInit 检查+ // If an explicit identifier is passed in, skip the isMcpListInit checkconst shouldWaitForInit = !defaultIdentifier && !isMcpListInit;if (shouldWaitForInit || isLoading) return <Loading />;diff --git a/src/features/MCP/MCPInstallProgress/MCPConfigForm.tsx b/src/features/MCP/MCPInstallProgress/MCPConfigForm.tsxindex 0a7ccb7bbdc..cf12462ba8b 100644--- a/src/features/MCP/MCPInstallProgress/MCPConfigForm.tsx+++ b/src/features/MCP/MCPInstallProgress/MCPConfigForm.tsx@@ -65,7 +65,7 @@ const MCPConfigForm = memo<MCPConfigFormProps>(({ configSchema, identifier, onCaif (onCancel) {onCancel();} else {- // 默认行为:清理安装进度+ // Default behavior: clear installation progressuseToolStore.getState().updateMCPInstallProgress(identifier, undefined);}};diff --git a/src/features/MCP/MCPInstallProgress/MCPDependenciesGuide.tsx b/src/features/MCP/MCPInstallProgress/MCPDependenciesGuide.tsxindex c4ec06c13cf..bf89d4b3b21 100644--- a/src/features/MCP/MCPInstallProgress/MCPDependenciesGuide.tsx+++ b/src/features/MCP/MCPInstallProgress/MCPDependenciesGuide.tsx@@ -82,12 +82,12 @@ const MCPDependenciesGuide = memo<MCPDependenciesGuideProps>(};const handleRetryCheck = async () => {- // 重新检查依赖,重新开始安装流程+ // Re-check dependencies, restart the installation processawait installMCPPlugin(identifier);};const handleSkipCheck = async () => {- // 跳过依赖检查,继续安装流程+ // Skip dependency check, continue installation processawait installMCPPlugin(identifier, { skipDepsCheck: true });};diff --git a/src/features/MCP/MCPSettings/index.tsx b/src/features/MCP/MCPSettings/index.tsxindex e14d6cf2177..66e83220345 100644--- a/src/features/MCP/MCPSettings/index.tsx+++ b/src/features/MCP/MCPSettings/index.tsx@@ -186,7 +186,7 @@ const Settings = ({ ref, identifier, hideFooter }: SettingsProps & { ref?: React},}));- // 获取已安装插件信息+ // Get installed plugin infoconst installedPlugin = useToolStore(pluginSelectors.getInstalledPluginById(identifier));const pluginSettings = useToolStore(pluginSelectors.getPluginSettingsById(identifier));@@ -251,7 +251,7 @@ const Settings = ({ ref, identifier, hideFooter }: SettingsProps & { ref?: React</div>{!isEditingConnection ? (- // 预览模式+ // Preview mode<Flexbox paddingInline={8}><div className={styles.previewItem}><span className={styles.previewLabel}>{t('settings.connection.type')}</span>@@ -291,7 +291,7 @@ const Settings = ({ ref, identifier, hideFooter }: SettingsProps & { ref?: React)}</Flexbox>) : (- // 编辑模式+ // Edit mode<div className={styles.connectionForm}><AFormclassName={styles.compactForm}@@ -340,7 +340,7 @@ const Settings = ({ ref, identifier, hideFooter }: SettingsProps & { ref?: React)}</Flexbox>- {/* 环境变量配置(仅 stdio 类型) */}+ {/* Environment variable configuration (stdio type only) */}{isStdioType && (<Flexbox gap={12}><div className={styles.sectionTitle}>@@ -374,7 +374,7 @@ const Settings = ({ ref, identifier, hideFooter }: SettingsProps & { ref?: React</Flexbox>)}- {/* HTTP 类型提示 */}+ {/* HTTP type notice */}{!isStdioType && (<div><div className={styles.sectionTitle}>diff --git a/src/features/MCP/Scores.tsx b/src/features/MCP/Scores.tsxindex df6f348125b..099fe135ff1 100644--- a/src/features/MCP/Scores.tsx+++ b/src/features/MCP/Scores.tsx@@ -80,11 +80,11 @@ interface ScoresProps {license?: string;};identifier: string;- // 列表页支持+ // List page supportinstallationMethods?: string;isClaimed?: boolean;isValidated?: boolean;- // 原始数据属性+ // Raw data propertiesoverview?: {readme?: string;};@@ -108,18 +108,18 @@ const Scores = memo<ScoresProps>(}) => {const { t } = useTranslation('discover');- // 使用工具函数计算所有的 has* 值,但需要处理类型转换+ // Use utility function to calculate all has* values, but need to handle type conversionconst scoreFlags = calculateScoreFlags({- // 只传递兼容的属性,或者进行类型转换+ // Only pass compatible properties, or perform type conversiondeploymentOptions: deploymentOptions?.map((item) => ({- // 确保不为 undefined+ // Ensure not undefinedconnection: { type: 'stdio' as const },- installationMethod: item.installationMethod || 'manual', // 提供默认的 connection+ installationMethod: item.installationMethod || 'manual', // Provide default connection})),github: github?.license? {license: github.license,- url: '', // 提供默认的 url+ url: '', // Provide default url}: undefined,installationMethods,@@ -135,7 +135,7 @@ const Scores = memo<ScoresProps>(toolsCount,});- // 计算评分+ // Calculate scoreconst scoreItems = createScoreItems(scoreFlags);const scoreResult = calculateScore(scoreItems);const { grade, percentage } = scoreResult;diff --git a/src/features/MCP/calculateScore.ts b/src/features/MCP/calculateScore.tsindex aa1a44ba7b3..09cd1851360 100644--- a/src/features/MCP/calculateScore.ts+++ b/src/features/MCP/calculateScore.ts@@ -5,7 +5,7 @@ import { type DiscoverMcpDetail } from '@/types/discover';export interface ScoreItem {check: boolean;required?: boolean;- weight?: number; // 权重,可选+ weight?: number; // weight, optional}export interface ScoreResult {@@ -18,14 +18,14 @@ export interface ScoreResult {totalScore: number;}-// 扩展的评分项目接口,用于显示+// Extended score item interface, used for displayexport interface ScoreListItem extends ScoreItem {desc: string;key: string;title: string;}-// 原始数据接口+// Raw data interfaceexport interface ScoreDataInput {deploymentOptions?: Array<{installationMethod?: string;@@ -33,7 +33,7 @@ export interface ScoreDataInput {github?: {license?: string;};- installationMethods?: string; // 列表页使用+ installationMethods?: string; // Used by list pageisClaimed?: boolean;isValidated?: boolean;overview?: {@@ -44,7 +44,7 @@ export interface ScoreDataInput {toolsCount?: number;}-// 计算后的布尔值结果+// Calculated boolean resultexport interface ScoreFlags {hasClaimed: boolean;hasDeployment: boolean;@@ -60,26 +60,26 @@ export interface ScoreFlags {export const DEFAULT_WEIGHTS = {claimed: 4,- // 必需项+ // RequireddeployMoreThanManual: 12,deployment: 15,- // 必需项+ // Requiredlicense: 8,- // 必需项+ // Requiredprompts: 8,readme: 10,resources: 8,- // 必需项,权重最高+ // Required, highest weighttools: 15,validated: 20,};-// 评分计算输入数据类型+// Score calculation input data typeexport interface ScoreCalculationInput extends Partial<Pick<DiscoverMcpDetail,@@ -92,14 +92,14 @@ export interface ScoreCalculationInput extends Partial<| 'toolsCount'>> {- installationMethods?: string; // 列表页使用- isClaimed?: boolean; // 添加 isClaimed 属性+ installationMethods?: string; // Used by list page+ isClaimed?: boolean; // Add isClaimed property}/**- * 根据原始数据计算所有的评分标志- * @param data 原始数据- * @returns 计算后的布尔值标志+ * Calculates all score flags from raw data+ * @param data Raw data+ * @returns Calculated boolean flags*/export function calculateScoreFlags(data: ScoreCalculationInput): ScoreFlags {const {@@ -114,11 +114,11 @@ export function calculateScoreFlags(data: ScoreCalculationInput): ScoreFlags {isClaimed,} = data;- // 计算基础标志+ // Calculate base flagsconst hasReadme = Boolean(overview?.readme);const hasLicense = Boolean(github?.license);- // 优先使用 deploymentOptions(详情页),然后使用 installationMethods(列表页)+ // Prefer deploymentOptions (detail page), then fall back to installationMethods (list page)const effectiveDeploymentOptions: DeploymentOption[] =deploymentOptions ||(installationMethods ? [{ installationMethod: installationMethods } as DeploymentOption] : []);@@ -151,10 +151,10 @@ export function calculateScoreFlags(data: ScoreCalculationInput): ScoreFlags {}/**- * 获取评级对应的颜色- * @param grade 评级- * @param theme 主题对象(可选)- * @returns 颜色值+ * Gets the color corresponding to the grade+ * @param grade Grade+ * @param theme Theme object (optional)+ * @returns Color value*/export function getGradeColor(grade: string, theme?: any): string {if (theme) {@@ -174,7 +174,7 @@ export function getGradeColor(grade: string, theme?: any): string {}}- // 默认颜色值(用于没有主题对象的情况)+ // Default color values (for when no theme object is provided)switch (grade) {case 'a': {return '#52c41a';@@ -192,10 +192,10 @@ export function getGradeColor(grade: string, theme?: any): string {}/**- * 获取评级对应的样式类名映射- * @param grade 评级- * @param styles 样式对象- * @returns 对应的样式类名+ * Gets the style class name mapping corresponding to the grade+ * @param grade Grade+ * @param styles Styles object+ * @returns Corresponding style class name*/export function getGradeStyleClass(grade: string, styles: any): string {switch (grade) {@@ -215,25 +215,25 @@ export function getGradeStyleClass(grade: string, styles: any): string {}/**- * 按优先级排序评分项目- * @param items 评分项目数组- * @returns 排序后的项目数组+ * Sorts score items by priority+ * @param items Score item array+ * @returns Sorted item array*/export function sortItemsByPriority<T extends ScoreItem>(items: T[]): T[] {return items.sort((a, b) => {- // 1. 必需项优先+ // 1. Required items firstif (a.required !== b.required) {return a.required ? -1 : 1;}- // 2. 按权重从高到低+ // 2. By weight from high to lowconst weightA = a.weight || 0;const weightB = b.weight || 0;if (weightA !== weightB) {return weightB - weightA;}- // 3. 已完成的在前+ // 3. Completed items firstif (a.check !== b.check) {return a.check ? -1 : 1;}@@ -243,10 +243,10 @@ export function sortItemsByPriority<T extends ScoreItem>(items: T[]): T[] {}/**- * 计算 MCP Server 的总分和评级- * @param items 评分项目- * @param weights 权重配置,默认使用 DEFAULT_WEIGHTS- * @returns 包含总分、最高分、百分比和评级的结果+ * Calculates the total score and grade for an MCP Server+ * @param items Score items+ * @param weights Weight configuration, defaults to DEFAULT_WEIGHTS+ * @returns Result containing total score, max score, percentage, and grade*/export function calculateScore(items: Record<string, ScoreItem>,@@ -257,9 +257,9 @@ export function calculateScore(let requiredScore = 0;let maxRequiredScore = 0;- // 计算实际得分和最大可能得分+ // Calculate actual score and maximum possible scoreObject.entries(items).forEach(([key, item]) => {- const weight = weights[key] || 5; // 默认权重为 5+ const weight = weights[key] || 5; // Default weight is 5maxScore += weight;if (item.required) {@@ -277,20 +277,20 @@ export function calculateScore(const percentage = maxScore > 0 ? (totalScore / maxScore) * 100 : 0;const requiredPercentage = maxRequiredScore > 0 ? (requiredScore / maxRequiredScore) * 100 : 0;- // 评级计算逻辑+ // Grade calculation logiclet grade: 'a' | 'b' | 'f';- // 如果必需项没有全部满足,直接评为 F+ // If not all required items are met, grade as F directlyif (requiredPercentage < 100) {grade = 'f';} else {- // 必需项全部满足的情况下,根据总分百分比评级+ // When all required items are met, grade based on total score percentageif (percentage >= 80) {- grade = 'a'; // 80% 以上为 A+ grade = 'a'; // 80% and above is A} else if (percentage >= 60) {- grade = 'b'; // 60-79% 为 B+ grade = 'b'; // 60-79% is B} else {- grade = 'f'; // 60% 以下为 F+ grade = 'f'; // Below 60% is F}}@@ -306,7 +306,7 @@ export function calculateScore(}/**- * 根据评分项目数据创建用于计算的对象+ * Creates an object for calculation from score item data*/export function createScoreItems(data: ScoreFlags): Record<string, ScoreItem> {return {diff --git a/src/features/MCP/useScoreList.ts b/src/features/MCP/useScoreList.tsindex ee4a106896b..a25261c0d42 100644--- a/src/features/MCP/useScoreList.ts+++ b/src/features/MCP/useScoreList.ts@@ -7,8 +7,8 @@ import { calculateScoreFlags, DEFAULT_WEIGHTS } from './calculateScore';/*** Hook for creating score list items with translations- * 直接从 DetailContext 获取数据,完全自包含- * @returns 包含描述和标题的评分项目列表+ * Directly fetches data from DetailContext, fully self-contained+ * @returns Score item list with descriptions and titles*/export function useScoreList(): ScoreListItem[] {const { t } = useTranslation('discover');@@ -22,11 +22,11 @@ export function useScoreList(): ScoreListItem[] {deploymentOptions,} = useDetailContext();- // 计算评分标志+ // Calculate score flagsconst scoreFlags = calculateScoreFlags({deploymentOptions,github,- isClaimed: false, // 详情页暂时没有 claimed 状态+ isClaimed: false, // Detail page temporarily has no claimed statusisValidated,overview,promptsCount,diff --git a/src/features/MCP/utils.ts b/src/features/MCP/utils.tsindex dcc02acf146..d288f5e17c6 100644--- a/src/features/MCP/utils.ts+++ b/src/features/MCP/utils.ts@@ -1,9 +1,9 @@import { type ConnectionConfig, type DeploymentOption } from '@lobehub/market-types';export const genServerConfig = (identifier?: string, connection?: ConnectionConfig) => {- // 检查是否为 HTTP 类型+ // Check if it is HTTP typeif (connection?.url) {- // HTTP 类型配置+ // HTTP type configurationreturn JSON.stringify({mcpServers: {@@ -17,7 +17,7 @@ export const genServerConfig = (identifier?: string, connection?: ConnectionConf);}- // stdio 类型配置+ // stdio type configurationreturn JSON.stringify({mcpServers: {