{"record":{"id":"9e2175ef6477daeb","repo":"ComposioHQ/composio","slug":"invalid-parameters-passed-to-create-mcp-config","errorCode":null,"errorMessage":"Invalid parameters passed to create mcp config","messagePattern":"Invalid parameters passed to create mcp config","errorType":"validation","errorClass":"ValidationError","httpStatus":null,"severity":"error","filePath":"ts/packages/core/src/models/MCP.ts","lineNumber":95,"sourceCode":"   *  }\n   * });\n   *\n   * const server = await composio.mcpConfig.create(\"personal-mcp-server\", {\n   *   toolkits: [{ toolkit: \"gmail\", authConfigId: \"ac_243434343\" }],\n   *   allowedTools: [\"GMAIL_FETCH_EMAILS\"],\n   *   manuallyManageConnections: false\n   *  }\n   * });\n   * ```\n   */\n  async create(\n    name: string,\n    mcpConfig: MCPConfigCreationParams,\n    requestOptions?: ComposioRequestOptions\n  ): Promise<MCPConfigCreateResponse> {\n    const config = MCPConfigCreationParamsSchema.safeParse(mcpConfig);\n    if (config.error) {\n      throw new ValidationError('Invalid parameters passed to create mcp config', {\n        cause: config.error,\n      });\n    }\n\n    const toolkits: string[] = [];\n    const auth_config_ids: string[] = [];\n    const custom_tools: string[] = config.data.allowedTools ?? [];\n\n    // extract all the toolkits, authconfigs, and allowed tools to separate slugs\n    config.data.toolkits.forEach(toolkit => {\n      if (typeof toolkit === 'string') {\n        toolkits.push(toolkit);\n      } else if (toolkit.toolkit) {\n        toolkits.push(toolkit.toolkit);\n      } else if (toolkit.authConfigId) {\n        auth_config_ids.push(toolkit.authConfigId);\n      }\n    });","sourceCodeStart":77,"sourceCodeEnd":113,"githubUrl":"https://github.com/ComposioHQ/composio/blob/64b1b85502b1beeb2379e6c9e8bf1104504fa637/ts/packages/core/src/models/MCP.ts#L77-L113","documentation":"The mcpConfigs.create() arguments failed validation against MCPConfigCreationParamsSchema. The SDK validates the MCP server config (name, toolkits, auth config ids, etc.) before sending it, and attaches the Zod error as cause.","triggerScenarios":"Calling composio.mcp.configs.create(name, config) with an invalid config object — unknown keys, wrong types for toolkits/auths, or missing required fields per MCPConfigCreationParamsSchema.","commonSituations":"Hand-building the config from backend API docs instead of SDK types; version drift after the MCP config schema changed; passing tool names where toolkit ids are expected.","solutions":["Read error.cause (ZodError.issues) for the exact failing fields","Align the object with MCPConfigCreationParamsSchema (e.g. toolkits: string[], correct auth shapes)","Use the SDK's exported types (satisfies MCPConfigCreationParams) for compile-time checks"],"exampleFix":"// before\nawait mcp.configs.create('srv', { toolkits: 'github', auths: [123] });\n// after\nawait mcp.configs.create('srv', { toolkits: ['github'] });","handlingStrategy":"type-guard","validationCode":"import { MCPConfigCreationParamsSchema } from '@composio/core';\nconst r = MCPConfigCreationParamsSchema.safeParse(config);\nif (!r.success) throw new Error(JSON.stringify(r.error.issues, null, 2));\nawait mcp.configs.create(name, config);","typeGuard":"const isMcpConfig = (c: unknown): c is MCPConfigCreationParams =>\n  MCPConfigCreationParamsSchema.safeParse(c).success;","tryCatchPattern":"try { await mcp.configs.create(name, cfg); } catch (e) { if (e instanceof ValidationError && /create mcp config/.test(e.message)) { fixFromZod(e.cause); return; } throw e; }","preventionTips":["Type configs against exported schema types","safeParse dynamic/user-supplied configs first","Update SDK when MCP config schema evolves"],"tags":["mcp","zod","validation","typescript"],"backgroundTag":"schema-validation-failed","analyzedSha":"64b1b85502b1beeb2379e6c9e8bf1104504fa637","analyzedAt":"2026-08-28T15:39:33.623Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}