feat(mcp): inline presets in panel with one-click enable

- Show not-installed MCP presets directly in the list, consistent with existing UI (no modal)
- Toggle now supports enabling presets by writing to ~/.claude.json (mcpServers) and refreshing list
- Keep installed MCP entries unchanged (edit/delete/toggle)

fix(mcp): robust error handling and pre-submit validation

- Use extractErrorMessage in MCP panel and form to surface backend details
- Prevent pasting full config (with mcpServers) into single-server JSON field
- Add required-field checks: stdio requires non-empty command; http requires non-empty url

i18n: add messages for single-server validation and preset labels

chore: add data-only MCP presets file (no new dependencies)
This commit is contained in:
Jason
2025-10-09 17:21:03 +08:00
parent 2bb847cb3d
commit 0be596afb5
5 changed files with 214 additions and 36 deletions

View File

@@ -318,6 +318,7 @@
"idRequired": "Please enter identifier",
"jsonInvalid": "Invalid JSON format",
"commandRequired": "Please enter command",
"singleServerObjectRequired": "Please paste a single MCP server object (do not include top-level mcpServers)",
"saveFailed": "Save failed",
"deleteFailed": "Delete failed"
},
@@ -328,6 +329,14 @@
"confirm": {
"deleteTitle": "Delete MCP Server",
"deleteMessage": "Are you sure you want to delete MCP server \"{{id}}\"? This action cannot be undone."
},
"presets": {
"title": "Presets",
"enable": "Enable",
"enabled": "Enabled",
"installed": "Installed",
"docs": "Docs",
"requiresEnv": "Requires env"
}
}
}