ComposioHQ/composio · error · ValidationError
Failed to parse MCP create response
Error message
Failed to parse MCP create response
What it means
transformMcpCreateResponse validates the backend's MCP-server create payload against a Zod schema; if safeParse fails, a ValidationError is thrown with the Zod issues as cause. It signals the API response shape does not match the SDK's expectations — usually a backend/API version mismatch.
Source
Thrown at ts/packages/core/src/utils/transformers/mcp.ts:41
McpRetrieveResponse as McpRetrieveResponseRaw,
} from '@composio/client/resources/mcp';
/**
* Transform MCP create response from snake_case to camelCase
*/
export function transformMcpCreateResponse(
response: CustomCreateResponseRaw | McpCreateResponseRaw
): CustomCreateResponse {
const result = CustomCreateResponseSchema.safeParse({
id: response.id,
name: response.name,
createdAt: (response as unknown as Record<string, unknown>).created_at,
updatedAt: (response as unknown as Record<string, unknown>).updated_at,
status: (response as unknown as Record<string, unknown>).status,
});
if (!result.success) {
throw new ValidationError('Failed to parse MCP create response', {
cause: result.error,
});
}
return result.data;
}
/**
* Transform MCP list response from snake_case to camelCase
*/
export function transformMcpListResponse(response: McpListResponseRaw): McpListResponse {
const transformedItems = response.items?.map(item => ({
id: item.id,
name: item.name,
createdAt: item.created_at,
updatedAt: item.updated_at,
status: (item as unknown as Record<string, unknown>).status,
}));View on GitHub (pinned to 64b1b85502)
Solutions
- Upgrade @composio/core to the latest version to realign with the backend contract
- Check error.cause (ZodError) to see exactly which fields failed
- Verify baseURL points to the intended environment (production vs staging/self-hosted)
- Report the Zod issues with the raw response to Composio if versions are current
Defensive patterns
Strategy: try-catch
Try / catch
try { const mcp = await composio.mcp.create(payload); } catch (e) { if (e instanceof ValidationError && /MCP create/.test(e.message)) { console.error('Contract mismatch', e.cause); } throw e; } Prevention
- Pin a known-good @composio/core version and upgrade deliberately
- Log e.cause ZodError issues for fast diagnosis
- Verify backend environment matches SDK version
When it happens
Trigger: Calling composio.mcp.create(...) (or any flow that routes through transformMcpCreateResponse) against a backend that returns unexpected/missing fields such as id, created_at, status, or toolkits.
Common situations: SDK version behind or ahead of the deployed backend; proxy stripping fields; using a self-hosted/staging backend URL with a different contract; generated client drift.
Understand the failure class
Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.
- Parsing and encoding errors: unexpected token, malformed input — why parsers reject input and how to find the real culprit.
Related errors
- Failed to parse MCP list response
- Failed to parse MCP retrieve response
- Invalid parameters passed to create mcp config
- Failed to validate list options
- Failed to validate update params
AI-assisted analysis of ComposioHQ/composio@64b1b85502 (2026-08-28).
Data as JSON: /api/errors/f57f67970cd27ab1.
Report an issue: GitHub.