can1357/oh-my-pi · error · Error

MCP error: ${mcpResponse.error.message}

Error message

MCP error: ${mcpResponse.error.message}

What it means

The MCP JSON-RPC response contained a top-level error object. The provider surfaces the server's error message as 'MCP error: <message>'. This is the MCP protocol's way of reporting request-level failures (auth, invalid params, server-side rejection).

Source

Thrown at packages/coding-agent/src/web/search/providers/exa.ts:408

			`Exa MCP request failed (${response.status}): ${errorText}`,
			response.status,
		);
	}
	const mcpResponse = parseSSE(await response.text()) as {
		result?: {
			content?: Array<{ type: string; text?: string }>;
			isError?: boolean;
		};
		error?: {
			code: number;
			message: string;
		};
	} | null;
	if (!mcpResponse) {
		throw new Error("Failed to parse MCP response");
	}
	if (mcpResponse.error) {
		throw new Error(`MCP error: ${mcpResponse.error.message}`);
	}
	if (mcpResponse.result?.isError) {
		const message = mcpResponse.result.content
			?.find(item => item.type === "text" && typeof item.text === "string")
			?.text?.trim();
		throw new SearchProviderError("exa", message || "Exa MCP returned an error");
	}
	const responsePayload = normalizeExaMcpPayload(mcpResponse.result);
	if (isSearchResponse(responsePayload)) {
		return responsePayload as ExaSearchResponse;
	}

	const parsed = parseExaMcpTextPayload(responsePayload);
	if (parsed) {
		return parsed;
	}

	throw new Error("Exa MCP search returned unexpected response shape.");

View on GitHub (pinned to 9690622007)

Solutions

  1. Read the embedded <message> for the server's exact complaint.
  2. Validate/adjust the search parameters being sent (query, numResults).
  3. Retry if the message suggests a transient server issue.
  4. Switch to the REST API with an API key, which returns more standard HTTP errors.
Defensive patterns

Strategy: try-catch

Try / catch

try {
  const res = await searchExa({ query });
} catch (e) {
  if (e instanceof Error && e.message.startsWith("MCP error:")) {
    // server-side protocol error; inspect message, adjust params or retry
  } else throw e;
}

Prevention

When it happens

Trigger: The Exa MCP server returned { error: { code, message } } in its JSON-RPC response — e.g. invalid request parameters, authentication rejection at the protocol level, or server-side handling failure.

Common situations: Malformed or unsupported search parameters forwarded to MCP; keyless quota violations surfaced as protocol errors; Exa MCP server bugs.

Related errors


AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31). Data as JSON: /api/errors/217dc611237e3f28. Report an issue: GitHub.