mastra-ai/mastra · error · Error

MCPClientServerProxy does not support SSE transport

Error message

MCPClientServerProxy does not support SSE transport

What it means

MCPClientServerProxy represents a client connection to a remote MCP server, so it cannot act as an SSE server. startSSE() is part of the MCPServer interface and throws here by design to signal misuse of the proxy as a server.

Source

Thrown at packages/mcp/src/client/server-proxy.ts:197

  public async readResource(uri: string): Promise<{ contents: Array<{ uri: string; text?: string; blob?: string }> }> {
    const client = await this.getClient();
    const result = await client.resources.read(uri);
    return {
      contents: (result.contents ?? []).map((c: any) => ({
        uri: c.uri ?? uri,
        ...(c.text !== undefined ? { text: c.text } : {}),
        ...(c.blob !== undefined ? { blob: c.blob } : {}),
      })),
    };
  }

  // Transport methods — not applicable for client proxies
  public async startStdio(): Promise<void> {
    throw new Error('MCPClientServerProxy does not support stdio transport');
  }
  public async startSSE(_options: MCPServerSSEOptions): Promise<void> {
    throw new Error('MCPClientServerProxy does not support SSE transport');
  }
  public async startHonoSSE(_options: MCPServerHonoSSEOptions): Promise<Response | undefined> {
    throw new Error('MCPClientServerProxy does not support Hono SSE transport');
  }
  public async startHTTP(_options: MCPServerHTTPOptions): Promise<void> {
    throw new Error('MCPClientServerProxy does not support HTTP transport');
  }
  public async close(): Promise<void> {
    this.cachedClient = null;
  }

  public getServerInfo(): ServerInfo {
    return {
      id: this.id,
      name: this.name,
      description: this.description,
      version_detail: {
        version: this.version,

View on GitHub (pinned to 75dd419e61)

Solutions

  1. Only call startSSE() on genuine MCPServer instances
  2. Filter the registry with instanceof MCPClientServerProxy before starting transports
  3. Drop the call — the proxy already communicates over its configured client transport

Example fix

// before
await proxy.startSSE({ path: '/mcp' });
// after
if (server instanceof MCPServer) await server.startSSE({ path: '/mcp' });
Defensive patterns

Strategy: validation

Validate before calling

if (proxy instanceof MCPClientServerProxy) throw new Error('startSSE is only valid on MCPServer instances');

Type guard

function canStartSSE(s: unknown): s is MCPServer {
  return !(s instanceof MCPClientServerProxy);
}

Try / catch

try {
  await maybeServer.startSSE(opts);
} catch (e) {
  if (e instanceof Error && e.message.includes('does not support SSE transport')) return;
  throw e;
}

Prevention

When it happens

Trigger: Calling startSSE(options) on an MCPClientServerProxy — e.g. generic server bootstrap code that starts SSE endpoints for every entry in a server registry.

Common situations: Mounting Mastra servers on a Hono/Express app by iterating a mixed registry of real MCPServers and client proxies; confusing MCPClient (consumer) with MCPServer (provider).

Related errors


AI-assisted analysis of mastra-ai/mastra@75dd419e61 (2026-08-30). Data as JSON: /api/errors/fddb107804fb7601. Report an issue: GitHub.