{"record":{"id":"aabfa99e8e0026c9","repo":"mastra-ai/mastra","slug":"mcpclientserverproxy-does-not-support-stdio-transp","errorCode":null,"errorMessage":"MCPClientServerProxy does not support stdio transport","messagePattern":"MCPClientServerProxy does not support stdio transport","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/mcp/src/client/server-proxy.ts","lineNumber":194,"sourceCode":"      })),\n    };\n  }\n\n  public async readResource(uri: string): Promise<{ contents: Array<{ uri: string; text?: string; blob?: string }> }> {\n    const client = await this.getClient();\n    const result = await client.resources.read(uri);\n    return {\n      contents: (result.contents ?? []).map((c: any) => ({\n        uri: c.uri ?? uri,\n        ...(c.text !== undefined ? { text: c.text } : {}),\n        ...(c.blob !== undefined ? { blob: c.blob } : {}),\n      })),\n    };\n  }\n\n  // Transport methods — not applicable for client proxies\n  public async startStdio(): Promise<void> {\n    throw new Error('MCPClientServerProxy does not support stdio transport');\n  }\n  public async startSSE(_options: MCPServerSSEOptions): Promise<void> {\n    throw new Error('MCPClientServerProxy does not support SSE transport');\n  }\n  public async startHonoSSE(_options: MCPServerHonoSSEOptions): Promise<Response | undefined> {\n    throw new Error('MCPClientServerProxy does not support Hono SSE transport');\n  }\n  public async startHTTP(_options: MCPServerHTTPOptions): Promise<void> {\n    throw new Error('MCPClientServerProxy does not support HTTP transport');\n  }\n  public async close(): Promise<void> {\n    this.cachedClient = null;\n  }\n\n  public getServerInfo(): ServerInfo {\n    return {\n      id: this.id,\n      name: this.name,","sourceCodeStart":176,"sourceCodeEnd":212,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/packages/mcp/src/client/server-proxy.ts#L176-L212","documentation":"MCPClientServerProxy wraps a remote MCP client and intentionally does not implement server-side transports. Calling startStdio() throws because a client proxy never hosts a stdio server; stdio only applies to Mastra MCPServer instances serving tools locally.","triggerScenarios":"Calling startStdio() on an MCPClientServerProxy instance obtained from MCPClients registry (e.g. iterating servers and calling transport start methods uniformly).","commonSituations":"Generic code that starts every server in a registry without distinguishing real MCPServer instances from client proxies; copy-pasting server bootstrap code onto proxy objects.","solutions":["Only call startStdio() on actual MCPServer instances, not MCPClientServerProxy","Type-check or instanceof-check the object before calling transport methods","Remove the startStdio call — client proxies are already connected via getClient()"],"exampleFix":"// before\nfor (const s of registry.getAll()) await s.startStdio();\n// after\nfor (const s of registry.getAll()) {\n  if (!(s instanceof MCPClientServerProxy)) await s.startStdio();\n}","handlingStrategy":"validation","validationCode":"if (proxy instanceof MCPClientServerProxy) throw new Error('startStdio is only valid on MCPServer instances');","typeGuard":"function isRealServer(s: unknown): s is MCPServer {\n  return !(s instanceof MCPClientServerProxy);\n}","tryCatchPattern":"try {\n  await maybeServer.startStdio();\n} catch (e) {\n  if (e instanceof Error && e.message.includes('does not support stdio transport')) return;\n  throw e;\n}","preventionTips":["Distinguish MCPClient proxies from MCPServer instances in registry code","Use instanceof checks before calling transport methods","Remember client proxies connect lazily via getClient(); no start needed"],"tags":["mcp","unsupported-transport","stdio","client-proxy"],"backgroundTag":"unsupported-transport","analyzedSha":"75dd419e613fe9c39f846ffc500716141b74fda6","analyzedAt":"2026-08-30T00:15:31.844Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}