MCPcopy Create free account
hub / github.com/modelcontextprotocol/mcpb / promptUserConfig

Function promptUserConfig

src/cli/init.ts:660–807  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

658}
659
660export async function promptUserConfig() {
661 const addUserConfig = await confirm({
662 message: "Add user-configurable options?",
663 default: false,
664 });
665
666 if (!addUserConfig) {
667 return {};
668 }
669
670 const userConfig: Record<
671 string,
672 {
673 type: "string" | "number" | "boolean" | "directory" | "file";
674 title: string;
675 description: string;
676 required?: boolean;
677 default?: string | number | boolean | string[];
678 multiple?: boolean;
679 sensitive?: boolean;
680 min?: number;
681 max?: number;
682 }
683 > = {};
684
685 let addMore = true;
686 while (addMore) {
687 const optionKey = await input({
688 message: "Configuration option key (unique identifier):",
689 validate: (value) => {
690 if (!value.trim()) return "Key is required";
691 if (userConfig[value]) return "Key must be unique";
692 return true;
693 },
694 });
695
696 const optionType = (await select({
697 message: "Option type:",
698 choices: [
699 { name: "String", value: "string" },
700 { name: "Number", value: "number" },
701 { name: "Boolean", value: "boolean" },
702 { name: "Directory", value: "directory" },
703 { name: "File", value: "file" },
704 ],
705 })) as "string" | "number" | "boolean" | "directory" | "file";
706
707 const optionTitle = await input({
708 message: "Option title (human-readable name):",
709 validate: (value) => value.trim().length > 0 || "Title is required",
710 });
711
712 const optionDescription = await input({
713 message: "Option description:",
714 validate: (value) => value.trim().length > 0 || "Description is required",
715 });
716
717 const optionRequired = await confirm({

Callers 1

initExtensionFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…