shadcn-ui/ui · error
Unknown client: ${client}. Available clients: ${CLIENTS.map(
Error message
Unknown client: ${client}. Available clients: ${CLIENTS.map((c) => c.name).join(", ")} What it means
runMcpInit throws when --client doesn't match any entry in the CLIENTS array (claude, cursor, vscode, codex, opencode). The value selects both the config file path and the config format (JSON vs TOML).
Source
Thrown at packages/shadcn/src/commands/mcp.ts:234
installSpinner.succeed("Installing dependencies.")
}
logger.break()
logger.success(`Configuration saved to ${configPath}.`)
logger.break()
} catch (error) {
handleError(error)
}
})
const overwriteMerge = (_: any[], sourceArray: any[]) => sourceArray
async function runMcpInit(options: z.infer<typeof mcpInitOptionsSchema>) {
const { client, cwd } = options
const clientInfo = CLIENTS.find((c) => c.name === client)
if (!clientInfo) {
throw new Error(
`Unknown client: ${client}. Available clients: ${CLIENTS.map(
(c) => c.name
).join(", ")}`
)
}
const configPath = path.join(cwd, clientInfo.configPath)
const dir = path.dirname(configPath)
await fsExtra.ensureDir(dir)
// Handle JSON format.
let existingConfig = {}
try {
const content = await fs.readFile(configPath, "utf-8")
existingConfig = JSON.parse(content)
} catch {}
const mergedConfig = deepmerge(View on GitHub (pinned to efac598707)
Solutions
- Use exactly one of: claude, cursor, vscode, codex, opencode.
- Omit --client to choose interactively from the prompt.
- Upgrade shadcn to a version that ships support for your client.
Example fix
// before shadcn mcp init --client claude-code // after shadcn mcp init --client claude
Defensive patterns
Strategy: validation
Validate before calling
const SUPPORTED_CLIENTS = ["claude", "cursor", "vscode", "codex", "opencode"] as const
function assertSupportedClient(client: string) {
if (!SUPPORTED_CLIENTS.includes(client as never)) {
throw new Error(`client must be one of: ${SUPPORTED_CLIENTS.join(", ")}`)
}
} Type guard
const SUPPORTED_CLIENTS = ["claude", "cursor", "vscode", "codex", "opencode"] as const
type SupportedClient = typeof SUPPORTED_CLIENTS[number]
function isSupportedClient(c: unknown): c is SupportedClient {
return typeof c === "string" && (SUPPORTED_CLIENTS as readonly string[]).includes(c)
} Prevention
- Rely on the zod enum in mcpInitOptionsSchema to reject unknown clients at the boundary.
- Upgrade shadcn before adopting a newly released MCP client.
When it happens
Trigger: Calling `shadcn mcp init --client <name>` with <name> outside the supported list. The commander option / zod enum (mcpInitOptionsSchema) normally rejects unknown values first, so this fires on programmatic API use or a bypassed schema.
Common situations: Typo (e.g., 'claude-code' instead of 'claude', 'vs-code' instead of 'vscode'), a newer client this shadcn version doesn't yet support, schema bypass via direct runMcpInit call.
Related errors
- Failed to read config at ${options.cwd}.
- Missing value for --only. Use one or more of: ${APPLY_ONLY_V
- Invalid value for --only: ${value}. Use one or more of: ${AP
- Missing preset for --only. Use: shadcn apply <preset> --only
- Invalid base: ${String(resolvedBase)}. Expected one of: ${PR
AI-assisted analysis of shadcn-ui/ui@efac598707 (2026-08-12).
Data as JSON: /api/errors/01f0a8dce4be6074.
Report an issue: GitHub.