feat(mcp): add configuration wizard and simplify form modal

- Simplify McpFormModal to 3 inputs: title (required), description (optional), and JSON config (optional)
- Add JSON validation similar to ProviderForm (must be object, real-time error display)
- Create McpWizardModal component for quick configuration:
  - 5 input fields: type (stdio/sse), command (required), args, cwd, env
  - Real-time JSON preview
  - Emerald theme color (consistent with MCP button)
  - Z-index 70 (above McpFormModal's 60)
- Add "or use configuration wizard" link next to JSON config label
- Update i18n translations (zh/en) for form and wizard
- All changes pass TypeScript typecheck and Prettier formatting
This commit is contained in:
Jason
2025-10-09 11:30:28 +08:00
parent 59c13c3366
commit d0fe9d7533
4 changed files with 431 additions and 125 deletions

View File

@@ -265,6 +265,30 @@
"template": {
"fetch": "Quick Template: mcp-fetch"
},
"form": {
"title": "Server Title",
"titlePlaceholder": "my-mcp-server",
"description": "Description",
"descriptionPlaceholder": "Optional description",
"jsonConfig": "JSON Configuration",
"jsonPlaceholder": "{\n \"type\": \"stdio\",\n \"command\": \"uvx\",\n \"args\": [\"mcp-server-fetch\"]\n}",
"useWizard": "or use configuration wizard"
},
"wizard": {
"title": "MCP Configuration Wizard",
"hint": "Quickly configure MCP server and auto-generate JSON configuration",
"type": "Type",
"command": "Command",
"commandPlaceholder": "uvx",
"args": "Arguments",
"argsPlaceholder": "mcp-server-fetch",
"cwd": "Working Directory",
"cwdPlaceholder": "/path/to/project",
"env": "Environment Variables",
"envPlaceholder": "KEY=VALUE\n(one per line)",
"preview": "Configuration Preview",
"apply": "Apply Configuration"
},
"id": "Identifier (unique)",
"type": "Type",
"cwd": "Working Directory (optional)",
@@ -287,6 +311,7 @@
},
"error": {
"idRequired": "Please enter identifier",
"jsonInvalid": "Invalid JSON format",
"commandRequired": "Please enter command",
"saveFailed": "Save failed",
"deleteFailed": "Delete failed"

View File

@@ -265,6 +265,30 @@
"template": {
"fetch": "快速模板mcp-fetch"
},
"form": {
"title": "服务器标题",
"titlePlaceholder": "my-mcp-server",
"description": "描述",
"descriptionPlaceholder": "可选的描述信息",
"jsonConfig": "JSON 配置",
"jsonPlaceholder": "{\n \"type\": \"stdio\",\n \"command\": \"uvx\",\n \"args\": [\"mcp-server-fetch\"]\n}",
"useWizard": "或者使用配置向导"
},
"wizard": {
"title": "MCP 配置向导",
"hint": "快速配置 MCP 服务器,自动生成 JSON 配置",
"type": "类型",
"command": "命令",
"commandPlaceholder": "uvx",
"args": "参数",
"argsPlaceholder": "mcp-server-fetch",
"cwd": "工作目录",
"cwdPlaceholder": "/path/to/project",
"env": "环境变量",
"envPlaceholder": "KEY=VALUE\n(一行一个)",
"preview": "配置预览",
"apply": "应用配置"
},
"id": "标识 (唯一)",
"type": "类型",
"cwd": "工作目录 (可选)",
@@ -287,6 +311,7 @@
},
"error": {
"idRequired": "请填写标识",
"jsonInvalid": "JSON 格式错误,请检查",
"commandRequired": "请填写命令",
"saveFailed": "保存失败",
"deleteFailed": "删除失败"