Build an MCP Client for AI Agents: Config, Auth, Transport A developer detailed a pattern for building an MCP-compatible client that generates per-platform configuration files for clients like Cursor, Claude Desktop, and Windsurf, rather than hand-pasting JSON. The approach pins a single upstream URL, emits auth headers deliberately, normalizes non-object JSON-RPC params before validation, and monkey-patches the session layer so clients that skip the initialize handshake still get a stateless session. The writeup argues that MCP client failures stem from divergent config shapes across desktop clients, not from protocol complexity. Short answer: building an MCP-compatible client for AI agents is 20% protocol and 80% edge-case handling. Each client Cursor, Claude Desktop, Windsurf, OpenClaw https://smartgate.network/integration/openclaw , Hermes wants a slightly different JSON shape for the same Streamable HTTP server; the only way to keep one server working across all of them is to generate that shape per platform, pin the single upstream URL in one place, forward exactly two headers deliberately, normalise non-object JSON-RPC params before validation, and stay stateless for clients that never send initialize . mcp client is searched about 1,600 times a month; almost none of those readers need the specification - they need the config that does not 401. Key takeaways mcpStreamableUpstreamUrl trims a trailing slash and returns