🐛 fix: Improve Error Handling when Adding MCP Server Fails (#10823)

* 🐛 fix: Improve error handling when adding MCP server fails

* Update api/server/controllers/mcp.js

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update api/server/controllers/mcp.js

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Atef Bellaaj <slalom.bellaaj@external.daimlertruck.com>
Co-authored-by: Danny Avila <danny@librechat.ai>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
Atef Bellaaj 2025-12-10 02:12:50 +01:00 committed by Danny Avila
parent 885508fc74
commit d08f7c2c8a
No known key found for this signature in database
GPG key ID: BF31EEB2C5CA0956
4 changed files with 30 additions and 3 deletions

View file

@ -283,7 +283,9 @@ export default function MCPServerDialog({
if (error && typeof error === 'object' && 'response' in error) {
const axiosError = error as any;
if (axiosError.response?.data?.error) {
if (axiosError.response?.data?.error === 'MCP_INSPECTION_FAILED') {
errorMessage = localize('com_ui_mcp_server_connection_failed');
} else if (axiosError.response?.data?.error) {
errorMessage = axiosError.response.data.error;
}
} else if (error.message) {