- Add i18n keys for all 5 MCP preset descriptions (fetch, time, memory, sequential-thinking, context7) - Refactor mcpPresets.ts to use i18n keys instead of hardcoded Chinese descriptions - Add getMcpPresetWithDescription() helper function for dynamic translation - Update McpFormModal to use translated descriptions when applying presets - Fix inconsistent key naming: sequentialThinking -> sequential-thinking This ensures MCP preset descriptions automatically switch language based on user's locale setting.
86 lines
2.7 KiB
TypeScript
86 lines
2.7 KiB
TypeScript
import { McpServer, McpServerSpec } from "../types";
|
||
|
||
export type McpPreset = Omit<McpServer, "enabled" | "description">;
|
||
|
||
// 预设 MCP(逻辑简化版):
|
||
// - 仅包含最常用、可快速落地的 stdio 模式示例
|
||
// - 不涉及分类/模板/测速等复杂逻辑,默认以 disabled 形式"回种"到 config.json
|
||
// - 用户可在 MCP 面板中一键启用/编辑
|
||
// - description 字段使用国际化 key,在使用时通过 t() 函数获取翻译
|
||
export const mcpPresets: McpPreset[] = [
|
||
{
|
||
id: "fetch",
|
||
name: "mcp-server-fetch",
|
||
tags: ["stdio", "http", "web"],
|
||
server: {
|
||
type: "stdio",
|
||
command: "uvx",
|
||
args: ["mcp-server-fetch"],
|
||
} as McpServerSpec,
|
||
homepage: "https://github.com/modelcontextprotocol/servers",
|
||
docs: "https://github.com/modelcontextprotocol/servers/tree/main/src/fetch",
|
||
},
|
||
{
|
||
id: "time",
|
||
name: "@modelcontextprotocol/server-time",
|
||
tags: ["stdio", "time", "utility"],
|
||
server: {
|
||
type: "stdio",
|
||
command: "npx",
|
||
args: ["-y", "@modelcontextprotocol/server-time"],
|
||
} as McpServerSpec,
|
||
homepage: "https://github.com/modelcontextprotocol/servers",
|
||
docs: "https://github.com/modelcontextprotocol/servers/tree/main/src/time",
|
||
},
|
||
{
|
||
id: "memory",
|
||
name: "@modelcontextprotocol/server-memory",
|
||
tags: ["stdio", "memory", "graph"],
|
||
server: {
|
||
type: "stdio",
|
||
command: "npx",
|
||
args: ["-y", "@modelcontextprotocol/server-memory"],
|
||
} as McpServerSpec,
|
||
homepage: "https://github.com/modelcontextprotocol/servers",
|
||
docs: "https://github.com/modelcontextprotocol/servers/tree/main/src/memory",
|
||
},
|
||
{
|
||
id: "sequential-thinking",
|
||
name: "@modelcontextprotocol/server-sequential-thinking",
|
||
tags: ["stdio", "thinking", "reasoning"],
|
||
server: {
|
||
type: "stdio",
|
||
command: "npx",
|
||
args: ["-y", "@modelcontextprotocol/server-sequential-thinking"],
|
||
} as McpServerSpec,
|
||
homepage: "https://github.com/modelcontextprotocol/servers",
|
||
docs: "https://github.com/modelcontextprotocol/servers/tree/main/src/sequentialthinking",
|
||
},
|
||
{
|
||
id: "context7",
|
||
name: "@upstash/context7-mcp",
|
||
tags: ["stdio", "docs", "search"],
|
||
server: {
|
||
type: "stdio",
|
||
command: "npx",
|
||
args: ["-y", "@upstash/context7-mcp"],
|
||
} as McpServerSpec,
|
||
homepage: "https://context7.com",
|
||
docs: "https://github.com/upstash/context7/blob/master/README.md",
|
||
},
|
||
];
|
||
|
||
// 获取带国际化描述的预设
|
||
export const getMcpPresetWithDescription = (
|
||
preset: McpPreset,
|
||
t: (key: string) => string,
|
||
): McpServer => {
|
||
const descriptionKey = `mcp.presets.${preset.id}.description`;
|
||
return {
|
||
...preset,
|
||
description: t(descriptionKey),
|
||
} as McpServer;
|
||
};
|
||
|
||
export default mcpPresets;
|