HTTP MCP servers return 400 Bad Request during health check (Z.AI and others)
Author: mateuszruszkowskiCreated Jan 22, 2026Updated Jul 5, 2026
Labelsbugpriority/mediumarea/backendstale
Problem
HTTP-based MCP servers (including Z.AI) return HTTP 400 Bad Request errors during health checks and connection tests. This prevents users from successfully configuring and using these servers.
Root Cause
The MCP health check function was using GET requests, but many MCP servers (including Z.AI) only support POST requests with proper MCP protocol initialization.
Symptoms
- MCP server health check fails with HTTP 400
- Connection test fails for Z.AI and similar HTTP-based MCP servers
- No clear error message explaining why the connection failed
Solution
- Change health check from GET to POST with MCP initialize request
- Add
text/event-streamto Accept header for SSE-based servers - Add detailed logging for debugging connection issues
- Include proper capabilities in initialize request
- Extract shared
createMcpInitRequest()factory function (DRY) - Add warnings for non-standard SSE responses
Affected File
apps/frontend/src/main/ipc-handlers/mcp-handlers.ts
Environment
- Affects all HTTP-based MCP servers that don't support GET requests
- Specifically reported with Z.AI MCP server
Source: AndyMik90/Aperant