Skip to content

🤯 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.

🌐 chore: translate non-English comments to English in mcp service (#10407)

LobeHub Bote508f8abd2a5
diff --git a/src/server/services/mcp/contentProcessor.ts b/src/server/services/mcp/contentProcessor.ts
index 30ff5fbc22f..fcb852e77f9 100644
--- a/src/server/services/mcp/contentProcessor.ts
+++ b/src/server/services/mcp/contentProcessor.ts
@@ -13,9 +13,9 @@ const log = debug('lobe-mcp:content-processor');
export type ProcessContentBlocksFn = (blocks: ToolCallContent[]) => Promise<ToolCallContent[]>;
/**
- * 处理 MCP 返回的 content blocks
- * - 上传图片/音频到存储并替换 data 为代理 URL
- * - 保持其他类型的 block 不变
+ * Process content blocks returned by MCP
+ * - Upload images/audio to storage and replace data with proxy URL
+ * - Keep other types of blocks unchanged
*/
export const processContentBlocks = async (
blocks: ToolCallContent[],
@@ -64,10 +64,10 @@ export const processContentBlocks = async (
};
/**
- * 将 content blocks 转换为字符串
- * - text: 提取 text 字段
- * - image/audio: 提取 data 字段(通常是上传后的代理 URL)
- * - 其他: 返回空字符串
+ * Convert content blocks to string
+ * - text: Extract text field
+ * - image/audio: Extract data field (usually the proxy URL after upload)
+ * - others: Return empty string
*/
export const contentBlocksToString = (blocks: ToolCallContent[] | null | undefined): string => {
if (!blocks) return '';
diff --git a/src/server/services/mcp/deps/MCPSystemDepsCheckService.ts b/src/server/services/mcp/deps/MCPSystemDepsCheckService.ts
index 4def5e833db..716dd7240ea 100644
--- a/src/server/services/mcp/deps/MCPSystemDepsCheckService.ts
+++ b/src/server/services/mcp/deps/MCPSystemDepsCheckService.ts
@@ -195,13 +195,13 @@ class MCPSystemDepsCheckService {
// Check if all system dependencies meet requirements
const allDependenciesMet = systemDependenciesResults.every((dep) => dep.meetRequirement);
- // Check if configuration is required (有必填项)
+ // Check if configuration is required (has mandatory fields)
const configSchema = option.connection?.configSchema;
const needsConfig = Boolean(
configSchema &&
- // 检查是否有 required 数组且不为空
+ // Check if there's a non-empty required array
((Array.isArray(configSchema.required) && configSchema.required.length > 0) ||
- // 检查 properties 中是否有字段标记为 required
+ // Check if any field in properties is marked as required
(configSchema.properties &&
Object.values(configSchema.properties).some((prop: any) => prop.required === true))),
);
diff --git a/src/server/services/mcp/index.ts b/src/server/services/mcp/index.ts
index 0d21fc22311..6b9b6684788 100644
--- a/src/server/services/mcp/index.ts
+++ b/src/server/services/mcp/index.ts
@@ -250,7 +250,7 @@ export class MCPService {
} catch (error) {
console.error(`Failed to initialize MCP client:`, error);
- // 保留完整的错误信息,特别是详细的 stderr 输出
+ // Preserve complete error information, especially detailed stderr output
const errorMessage = error instanceof Error ? error.message : String(error);
if (typeof error === 'object' && !!error && 'data' in error) {
@@ -261,7 +261,7 @@ export class MCPService {
});
}
- // 记录详细的错误信息用于调试
+ // Log detailed error information for debugging
log('Detailed initialization error: %O', {
error: errorMessage,
params: this.sanitizeForLogging(params),
@@ -271,7 +271,7 @@ export class MCPService {
throw new TRPCError({
cause: error,
code: 'INTERNAL_SERVER_ERROR',
- message: errorMessage, // 直接使用完整的错误信息
+ message: errorMessage, // Use complete error message directly
});
}
}
@@ -307,12 +307,12 @@ export class MCPService {
): Promise<LobeChatPluginManifest> {
const mcpParams = { name: identifier, type: 'http' as const, url };
- // 如果有认证信息,添加到参数中
+ // Add authentication info to parameters if available
if (auth) {
(mcpParams as any).auth = auth;
}
- // 如果有 headers 信息,添加到参数中
+ // Add headers info to parameters if available
if (headers) {
(mcpParams as any).headers = headers;
}
@@ -383,23 +383,23 @@ export class MCPService {
log('Checking MCP plugin installation status: %O', loggableInput);
const results = [];
- // 检查每个部署选项
+ // Check each deployment option
for (const option of input.deploymentOptions) {
- // 使用系统依赖检查服务检查部署选项
+ // Use system dependency check service to check deployment option
const result = await mcpSystemDepsCheckService.checkDeployOption(option);
results.push(result);
}
- // 找出推荐的或第一个可安装的选项
+ // Find the recommended or first installable option
const recommendedResult = results.find((r) => r.isRecommended && r.allDependenciesMet);
const firstInstallableResult = results.find((r) => r.allDependenciesMet);
- // 返回推荐的结果,或第一个可安装的结果,或第一个结果
+ // Return the recommended result, or the first installable result, or the first result
const bestResult = recommendedResult || firstInstallableResult || results[0];
log('Check completed, best result: %O', bestResult);
- // 构造返回结果,确保包含配置检查信息
+ // Construct return result, ensure configuration check information is included
const checkResult: CheckMcpInstallResult = {
...bestResult,
allOptions: results,
@@ -407,7 +407,7 @@ export class MCPService {
success: true,
};
- // 如果最佳结果需要配置,确保在顶层设置相关字段
+ // If the best result requires configuration, ensure related fields are set at the top level
if (bestResult?.needsConfig) {
checkResult.needsConfig = true;
checkResult.configSchema = bestResult.configSchema;