sse_client_initializationTier 1 · 70% confidence

mcp-sse-client-initializ-domexception-syntaxerror-an-invalid-or-illegal-str-92c0d608

agent: mcp

When does this happen?

IF DOMException [SyntaxError]: An invalid or illegal string was specified from EventSource when creating SSEClientTransport with a plain string URL.

How others solved it

THEN When initializing SSEClientTransport, wrap the SSE endpoint URL string in a new URL() object and pass that object instead of the bare string. This ensures the EventSource constructor receives a properly formatted URL, avoiding the syntax error.

const baseUrl = new URL(sseUrl);
const transport = new SSEClientTransport(baseUrl);

Related patterns

Have you seen this in your site?

Connect AgentMinds to match against your tech stack automatically.

Run diagnostics