You're Invited:Meet the Socket Team at RSAC and BSidesSF 2026, March 23–26.RSVP
Socket
Book a DemoSign in
Socket

@mcp-apps-kit/create-app

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@mcp-apps-kit/create-app - npm Package Compare versions

Comparing version
0.2.4
to
0.2.5
+52
-48
dist/cli.js

@@ -99,5 +99,13 @@ #!/usr/bin/env node

import { createApp } from "@mcp-apps-kit/core";
import { createApp, defineTool, defineUI } from "@mcp-apps-kit/core";
import { z } from "zod";
// Define the UI for displaying greetings
const greetingUI = defineUI({
name: "Greeting Widget",
description: "Displays greeting messages",
html: "./${uiOutputDir}/index.html",
prefersBorder: true,
});
const app = createApp({

@@ -108,3 +116,4 @@ name: "${name}",

tools: {
hello: {
hello: defineTool({
title: "Hello",
description: "Say hello to someone",

@@ -124,13 +133,5 @@ input: z.object({

},
ui: "greeting",
},
ui: greetingUI,
}),
},
ui: {
greeting: {
html: "./${uiOutputDir}/index.html",
description: "Greeting widget",
prefersBorder: true,
},
},
});

@@ -150,5 +151,13 @@

import { createApp } from "@mcp-apps-kit/core";
import { createApp, defineTool, defineUI } from "@mcp-apps-kit/core";
import { z } from "zod";
// Define the UI for displaying greetings
const greetingUI = defineUI({
name: "Greeting Widget",
description: "Displays greeting messages",
html: "./ui/dist/index.html",
prefersBorder: true,
});
const app = createApp({

@@ -159,3 +168,4 @@ name: "${name}",

tools: {
hello: {
hello: defineTool({
title: "Hello",
description: "Say hello to someone",

@@ -175,13 +185,5 @@ input: z.object({

},
ui: "greeting",
},
ui: greetingUI,
}),
},
ui: {
greeting: {
html: "./ui/dist/index.html",
description: "Greeting widget",
prefersBorder: true,
},
},
});

@@ -490,5 +492,13 @@

import { createApp } from "@mcp-apps-kit/core";
import { createApp, defineTool, defineUI } from "@mcp-apps-kit/core";
import { z } from "zod";
// Define the UI for displaying greetings
const greetingUI = defineUI({
name: "Greeting Widget",
description: "Displays greeting messages",
html: "./${uiOutputDir}/index.html",
prefersBorder: true,
});
const app = createApp({

@@ -499,3 +509,4 @@ name: "${name}",

tools: {
hello: {
hello: defineTool({
title: "Hello",
description: "Say hello to someone",

@@ -515,13 +526,5 @@ input: z.object({

},
ui: "greeting",
},
ui: greetingUI,
}),
},
ui: {
greeting: {
html: "./${uiOutputDir}/index.html",
description: "Greeting widget",
prefersBorder: true,
},
},
});

@@ -541,5 +544,13 @@

import { createApp } from "@mcp-apps-kit/core";
import { createApp, defineTool, defineUI } from "@mcp-apps-kit/core";
import { z } from "zod";
// Define the UI for displaying greetings
const greetingUI = defineUI({
name: "Greeting Widget",
description: "Displays greeting messages",
html: "./ui/dist/index.html",
prefersBorder: true,
});
const app = createApp({

@@ -550,3 +561,4 @@ name: "${name}",

tools: {
hello: {
hello: defineTool({
title: "Hello",
description: "Say hello to someone",

@@ -566,13 +578,5 @@ input: z.object({

},
ui: "greeting",
},
ui: greetingUI,
}),
},
ui: {
greeting: {
html: "./ui/dist/index.html",
description: "Greeting widget",
prefersBorder: true,
},
},
});

@@ -579,0 +583,0 @@

@@ -1,1 +0,1 @@

{"version":3,"sources":["../src/index.ts","../src/cli.ts"],"names":[],"mappings":";;;;;;;;AAkCA,IAAI,cAAA,GAAyC,IAAA;AAK7C,SAAS,mBAAmB,WAAA,EAA6B;AACvD,EAAA,IAAI;AACF,IAAA,MAAM,MAAA,GAAS,QAAA,CAAS,CAAA,SAAA,EAAY,WAAW,CAAA,QAAA,CAAA,EAAY;AAAA,MACzD,QAAA,EAAU,OAAA;AAAA,MACV,KAAA,EAAO,CAAC,MAAA,EAAQ,MAAA,EAAQ,MAAM;AAAA,KAC/B,EAAE,IAAA,EAAK;AACR,IAAA,OAAO,IAAI,MAAM,CAAA,CAAA;AAAA,EACnB,CAAA,CAAA,MAAQ;AAEN,IAAA,OAAO,QAAA;AAAA,EACT;AACF;AAKA,SAAS,kBAAA,GAAsC;AAC7C,EAAA,IAAI,cAAA,EAAgB;AAClB,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I,KAAA,CAAM,IAAA,CAAK,iBAAiB,CAAC,CAAA;AAAA,IAC3C;AACA,IAAA,OAAA,CAAQ,GAAA,EAAI;AAAA,EACd,SAAS,KAAA,EAAO;AACd,IAAA,OAAA,CAAQ,KAAA,CAAM,MAAM,GAAA,CAAI,QAAQ,GAAG,KAAA,YAAiB,KAAA,GAAQ,KAAA,CAAM,OAAA,GAAU,KAAK,CAAA;AACjF,IAAA,OAAA,CAAQ,KAAK,CAAC,CAAA;AAAA,EAChB;AACF;AAGA,KAAK,IAAA,EAAK","file":"cli.js","sourcesContent":["/**\n * @mcp-apps-kit/create-app\n *\n * Project scaffolding for MCP applications.\n */\n\nimport * as fs from \"node:fs\";\nimport * as path from \"node:path\";\nimport { execSync } from \"node:child_process\";\n\n// =============================================================================\n// Types\n// =============================================================================\n\nexport interface CreateAppOptions {\n name: string;\n template: \"react\" | \"vanilla\";\n directory?: string;\n vercel?: boolean;\n skipInstall?: boolean;\n skipGit?: boolean;\n}\n\n// =============================================================================\n// Version Detection\n// =============================================================================\n\ninterface PackageVersions {\n core: string;\n ui: string;\n uiReact: string;\n}\n\n// Cache for fetched versions\nlet cachedVersions: PackageVersions | null = null;\n\n/**\n * Fetch the latest version of a package from npm registry\n */\nfunction fetchLatestVersion(packageName: string): string {\n try {\n const result = execSync(`npm view ${packageName} version`, {\n encoding: \"utf-8\",\n stdio: [\"pipe\", \"pipe\", \"pipe\"],\n }).trim();\n return `^${result}`;\n } catch {\n // Fallback to a reasonable default if we can't fetch\n return \"^0.2.0\";\n }\n}\n\n/**\n * Get the versions of @mcp-apps-kit packages from npm registry\n */\nfunction getPackageVersions(): PackageVersions {\n if (cachedVersions) {\n return cachedVersions;\n }\n\n cachedVersions = {\n core: fetchLatestVersion(\"@mcp-apps-kit/core\"),\n ui: fetchLatestVersion(\"@mcp-apps-kit/ui\"),\n uiReact: fetchLatestVersion(\"@mcp-apps-kit/ui-react\"),\n };\n\n return cachedVersions;\n}\n\n// =============================================================================\n// Template Content\n// =============================================================================\n\nfunction getReactTemplate(name: string, vercel = false): Record<string, string> {\n const uiOutputDir = vercel ? \"public\" : \"dist\";\n const packageManager = vercel ? \"npm\" : \"pnpm\";\n const versions = getPackageVersions();\n\n const files: Record<string, string> = {\n \"package.json\": JSON.stringify(\n {\n name,\n version: \"0.1.0\",\n type: \"module\",\n scripts: {\n dev: `concurrently \"${packageManager} run dev:server\" \"${packageManager} run dev:ui\"`,\n \"dev:server\": \"tsx watch server/index.ts\",\n \"dev:ui\": \"vite --config ui/vite.config.ts\",\n build: `${packageManager} run build:ui && tsc`,\n \"build:ui\": \"vite build --config ui/vite.config.ts\",\n start: \"node dist/server/index.js\",\n },\n dependencies: {\n \"@mcp-apps-kit/core\": versions.core,\n \"@mcp-apps-kit/ui\": versions.ui,\n \"@mcp-apps-kit/ui-react\": versions.uiReact,\n react: \"^18.2.0\",\n \"react-dom\": \"^18.2.0\",\n zod: \"^3.22.0\",\n ...(vercel ? { express: \"^4.21.0\" } : {}),\n },\n devDependencies: {\n \"@types/react\": \"^18.2.0\",\n \"@types/react-dom\": \"^18.2.0\",\n \"@vitejs/plugin-react\": \"^4.2.0\",\n concurrently: \"^8.2.0\",\n tsx: \"^4.7.0\",\n typescript: \"^5.3.0\",\n vite: \"^5.0.0\",\n \"vite-plugin-singlefile\": \"^2.0.0\",\n },\n },\n null,\n 2\n ),\n \"tsconfig.json\": JSON.stringify(\n {\n compilerOptions: {\n target: \"ES2020\",\n module: \"ESNext\",\n moduleResolution: \"bundler\",\n strict: true,\n esModuleInterop: true,\n skipLibCheck: true,\n declaration: true,\n outDir: \"dist\",\n jsx: \"react-jsx\",\n },\n include: [\"server/**/*\", \"ui/src/**/*\"],\n exclude: [\"node_modules\", \"dist\"],\n },\n null,\n 2\n ),\n \"server/index.ts\": vercel\n ? `/**\n * ${name} - MCP Server\n */\n\n// Required for Vercel to detect Express\nimport \"express\";\n\nimport { createApp } from \"@mcp-apps-kit/core\";\nimport { z } from \"zod\";\n\nconst app = createApp({\n name: \"${name}\",\n version: \"0.1.0\",\n\n tools: {\n hello: {\n description: \"Say hello to someone\",\n input: z.object({\n name: z.string().describe(\"Name to greet\"),\n }),\n output: z.object({\n message: z.string(),\n timestamp: z.string(),\n }),\n handler: async ({ name }) => {\n return {\n message: \\`Hello, \\${name}!\\`,\n timestamp: new Date().toISOString(),\n };\n },\n ui: \"greeting\",\n },\n },\n\n ui: {\n greeting: {\n html: \"./${uiOutputDir}/index.html\",\n description: \"Greeting widget\",\n prefersBorder: true,\n },\n },\n});\n\n// Only start locally - Vercel uses the exported Express app\nif (!process.env.VERCEL) {\n await app.start({ port: 3000 });\n console.log(\"MCP server running on http://localhost:3000\");\n}\n\n// Export Express app for Vercel\nexport default app.expressApp;\n`\n : `/**\n * ${name} - MCP Server\n */\n\nimport { createApp } from \"@mcp-apps-kit/core\";\nimport { z } from \"zod\";\n\nconst app = createApp({\n name: \"${name}\",\n version: \"0.1.0\",\n\n tools: {\n hello: {\n description: \"Say hello to someone\",\n input: z.object({\n name: z.string().describe(\"Name to greet\"),\n }),\n output: z.object({\n message: z.string(),\n timestamp: z.string(),\n }),\n handler: async ({ name }) => {\n return {\n message: \\`Hello, \\${name}!\\`,\n timestamp: new Date().toISOString(),\n };\n },\n ui: \"greeting\",\n },\n },\n\n ui: {\n greeting: {\n html: \"./ui/dist/index.html\",\n description: \"Greeting widget\",\n prefersBorder: true,\n },\n },\n});\n\n// Start server\nawait app.start({ port: 3000 });\nconsole.log(\"MCP server running on http://localhost:3000\");\n`,\n \"ui/src/App.tsx\": `/**\n * ${name} - UI Component\n */\n\nimport {\n useAppsClient,\n useHostContext,\n useDocumentTheme,\n useHostStyleVariables,\n} from \"@mcp-apps-kit/ui-react\";\n\nexport function App() {\n const client = useAppsClient();\n const context = useHostContext();\n\n // Apply theme and host styles\n useDocumentTheme(\"light\", \"dark\");\n useHostStyleVariables();\n\n // Get tool output from client\n const output = client.toolOutput as { message?: string; timestamp?: string } | undefined;\n\n return (\n <div className=\"container\">\n {output?.message ? (\n <div className=\"greeting\">\n <h1>{output.message}</h1>\n <p className=\"timestamp\">Sent at: {output.timestamp}</p>\n </div>\n ) : (\n <p className=\"waiting\">Waiting for greeting...</p>\n )}\n\n <button\n className=\"button\"\n onClick={() => client.sendFollowUpMessage(\"Please greet me again!\")}\n >\n Request New Greeting\n </button>\n\n <footer className=\"meta\">\n Theme: {context.theme} | Locale: {context.locale}\n </footer>\n </div>\n );\n}\n`,\n \"ui/src/main.tsx\": `/**\n * ${name} - UI Entry Point\n */\n\nimport React from \"react\";\nimport { createRoot } from \"react-dom/client\";\nimport { AppsProvider } from \"@mcp-apps-kit/ui-react\";\nimport { App } from \"./App\";\nimport \"./styles.css\";\n\nconst root = document.getElementById(\"root\");\nif (!root) throw new Error(\"Root element not found\");\n\ncreateRoot(root).render(\n <React.StrictMode>\n <AppsProvider>\n <App />\n </AppsProvider>\n </React.StrictMode>\n);\n`,\n \"ui/src/styles.css\": `* {\n margin: 0;\n padding: 0;\n box-sizing: border-box;\n}\n\nbody {\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;\n padding: 16px;\n}\n\n.container {\n max-width: 400px;\n margin: 0 auto;\n}\n\n.greeting h1 {\n font-size: 1.5rem;\n margin-bottom: 8px;\n}\n\n.timestamp {\n color: #666;\n font-size: 0.875rem;\n}\n\n.waiting {\n color: #999;\n font-style: italic;\n}\n\n.button {\n margin-top: 16px;\n padding: 8px 16px;\n background: #0066cc;\n color: white;\n border: none;\n border-radius: 4px;\n cursor: pointer;\n}\n\n.button:hover {\n background: #0052a3;\n}\n\n.meta {\n margin-top: 24px;\n padding-top: 16px;\n border-top: 1px solid #eee;\n font-size: 0.75rem;\n color: #999;\n}\n\n/* Dark mode support */\n.dark body {\n background: #1a1a1a;\n color: #fff;\n}\n\n.dark .timestamp {\n color: #aaa;\n}\n\n.dark .meta {\n border-color: #333;\n color: #666;\n}\n`,\n \"ui/index.html\": `<!DOCTYPE html>\n<html lang=\"en\">\n <head>\n <meta charset=\"UTF-8\" />\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n <title>${name}</title>\n </head>\n <body>\n <div id=\"root\"></div>\n <script type=\"module\" src=\"/src/main.tsx\"></script>\n </body>\n</html>\n`,\n \"ui/vite.config.ts\": `import { defineConfig } from \"vite\";\nimport react from \"@vitejs/plugin-react\";\nimport { viteSingleFile } from \"vite-plugin-singlefile\";\n\nexport default defineConfig({\n plugins: [react(), viteSingleFile()],\n root: \"./ui\",\n build: {\n outDir: \"${uiOutputDir}\",\n emptyOutDir: true,\n },\n});\n`,\n \".gitignore\": `node_modules/\ndist/\npublic/\n*.log\n.env\n.env.local\n`,\n \"README.md\": `# ${name}\n\nAn MCP application built with @mcp-apps-kit.\n\n## Development\n\n\\`\\`\\`bash\n${packageManager} install\n${packageManager} run dev\n\\`\\`\\`\n\n## Build\n\n\\`\\`\\`bash\n${packageManager} run build\n\\`\\`\\`\n\n## Connecting to Claude Desktop\n\nAdd to your Claude Desktop config:\n\n\\`\\`\\`json\n{\n \"mcpServers\": {\n \"${name}\": {\n \"command\": \"npx\",\n \"args\": [\"tsx\", \"path/to/${name}/server/index.ts\"]\n }\n }\n}\n\\`\\`\\`\n${\n vercel\n ? `\n## Deploy to Vercel\n\nThis project is configured for Vercel deployment:\n\n\\`\\`\\`bash\nvercel deploy\n\\`\\`\\`\n\nThen use the deployed URL as your MCP server endpoint.\n`\n : \"\"\n}\n`,\n };\n\n // Add vercel.json if Vercel setup is enabled\n if (vercel) {\n files[\"vercel.json\"] = JSON.stringify(\n {\n installCommand: \"npm install\",\n buildCommand: \"npm run build:ui\",\n outputDirectory: \".\",\n functions: {\n \"server/index.ts\": {\n includeFiles: `${uiOutputDir}/**`,\n },\n },\n rewrites: [\n {\n source: \"/(.*)\",\n destination: \"/server/index.ts\",\n },\n ],\n },\n null,\n 2\n );\n }\n\n return files;\n}\n\nfunction getVanillaTemplate(name: string, vercel = false): Record<string, string> {\n const uiOutputDir = vercel ? \"public\" : \"dist\";\n const packageManager = vercel ? \"npm\" : \"pnpm\";\n const versions = getPackageVersions();\n\n const files: Record<string, string> = {\n \"package.json\": JSON.stringify(\n {\n name,\n version: \"0.1.0\",\n type: \"module\",\n scripts: {\n dev: `concurrently \"${packageManager} run dev:server\" \"${packageManager} run dev:ui\"`,\n \"dev:server\": \"tsx watch server/index.ts\",\n \"dev:ui\": \"vite --config ui/vite.config.ts\",\n build: `${packageManager} run build:ui && tsc`,\n \"build:ui\": \"vite build --config ui/vite.config.ts\",\n start: \"node dist/server/index.js\",\n },\n dependencies: {\n \"@mcp-apps-kit/core\": versions.core,\n \"@mcp-apps-kit/ui\": versions.ui,\n zod: \"^3.22.0\",\n ...(vercel ? { express: \"^4.21.0\" } : {}),\n },\n devDependencies: {\n concurrently: \"^8.2.0\",\n tsx: \"^4.7.0\",\n typescript: \"^5.3.0\",\n vite: \"^5.0.0\",\n \"vite-plugin-singlefile\": \"^2.0.0\",\n },\n },\n null,\n 2\n ),\n \"tsconfig.json\": JSON.stringify(\n {\n compilerOptions: {\n target: \"ES2020\",\n module: \"ESNext\",\n moduleResolution: \"bundler\",\n strict: true,\n esModuleInterop: true,\n skipLibCheck: true,\n declaration: true,\n outDir: \"dist\",\n },\n include: [\"server/**/*\", \"ui/src/**/*\"],\n exclude: [\"node_modules\", \"dist\"],\n },\n null,\n 2\n ),\n \"server/index.ts\": vercel\n ? `/**\n * ${name} - MCP Server\n */\n\n// Required for Vercel to detect Express\nimport \"express\";\n\nimport { createApp } from \"@mcp-apps-kit/core\";\nimport { z } from \"zod\";\n\nconst app = createApp({\n name: \"${name}\",\n version: \"0.1.0\",\n\n tools: {\n hello: {\n description: \"Say hello to someone\",\n input: z.object({\n name: z.string().describe(\"Name to greet\"),\n }),\n output: z.object({\n message: z.string(),\n timestamp: z.string(),\n }),\n handler: async ({ name }) => {\n return {\n message: \\`Hello, \\${name}!\\`,\n timestamp: new Date().toISOString(),\n };\n },\n ui: \"greeting\",\n },\n },\n\n ui: {\n greeting: {\n html: \"./${uiOutputDir}/index.html\",\n description: \"Greeting widget\",\n prefersBorder: true,\n },\n },\n});\n\n// Only start locally - Vercel uses the exported Express app\nif (!process.env.VERCEL) {\n await app.start({ port: 3000 });\n console.log(\"MCP server running on http://localhost:3000\");\n}\n\n// Export Express app for Vercel\nexport default app.expressApp;\n`\n : `/**\n * ${name} - MCP Server\n */\n\nimport { createApp } from \"@mcp-apps-kit/core\";\nimport { z } from \"zod\";\n\nconst app = createApp({\n name: \"${name}\",\n version: \"0.1.0\",\n\n tools: {\n hello: {\n description: \"Say hello to someone\",\n input: z.object({\n name: z.string().describe(\"Name to greet\"),\n }),\n output: z.object({\n message: z.string(),\n timestamp: z.string(),\n }),\n handler: async ({ name }) => {\n return {\n message: \\`Hello, \\${name}!\\`,\n timestamp: new Date().toISOString(),\n };\n },\n ui: \"greeting\",\n },\n },\n\n ui: {\n greeting: {\n html: \"./ui/dist/index.html\",\n description: \"Greeting widget\",\n prefersBorder: true,\n },\n },\n});\n\n// Start server\nawait app.start({ port: 3000 });\nconsole.log(\"MCP server running on http://localhost:3000\");\n`,\n \"ui/src/main.ts\": `/**\n * ${name} - UI Entry Point\n */\n\nimport { createClient } from \"@mcp-apps-kit/ui\";\nimport \"./styles.css\";\n\nasync function main() {\n const client = await createClient();\n\n // Get container\n const container = document.getElementById(\"app\");\n if (!container) throw new Error(\"Container not found\");\n\n // Render initial UI\n render(container, client);\n\n // Subscribe to context changes\n client.onHostContextChange((context) => {\n document.documentElement.className = context.theme;\n render(container, client);\n });\n}\n\nfunction render(container: HTMLElement, client: ReturnType<typeof createClient> extends Promise<infer T> ? T : never) {\n const output = client.toolOutput as { message?: string; timestamp?: string } | undefined;\n const context = client.hostContext;\n\n container.innerHTML = \\`\n <div class=\"container\">\n \\${output?.message ? \\`\n <div class=\"greeting\">\n <h1>\\${output.message}</h1>\n <p class=\"timestamp\">Sent at: \\${output.timestamp}</p>\n </div>\n \\` : \\`\n <p class=\"waiting\">Waiting for greeting...</p>\n \\`}\n\n <button class=\"button\" id=\"request-btn\">\n Request New Greeting\n </button>\n\n <footer class=\"meta\">\n Theme: \\${context.theme} | Locale: \\${context.locale}\n </footer>\n </div>\n \\`;\n\n // Add event listener\n const btn = document.getElementById(\"request-btn\");\n btn?.addEventListener(\"click\", () => {\n client.sendFollowUpMessage(\"Please greet me again!\");\n });\n}\n\nmain();\n`,\n \"ui/src/styles.css\": `* {\n margin: 0;\n padding: 0;\n box-sizing: border-box;\n}\n\nbody {\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;\n padding: 16px;\n}\n\n.container {\n max-width: 400px;\n margin: 0 auto;\n}\n\n.greeting h1 {\n font-size: 1.5rem;\n margin-bottom: 8px;\n}\n\n.timestamp {\n color: #666;\n font-size: 0.875rem;\n}\n\n.waiting {\n color: #999;\n font-style: italic;\n}\n\n.button {\n margin-top: 16px;\n padding: 8px 16px;\n background: #0066cc;\n color: white;\n border: none;\n border-radius: 4px;\n cursor: pointer;\n}\n\n.button:hover {\n background: #0052a3;\n}\n\n.meta {\n margin-top: 24px;\n padding-top: 16px;\n border-top: 1px solid #eee;\n font-size: 0.75rem;\n color: #999;\n}\n\n/* Dark mode support */\n.dark body {\n background: #1a1a1a;\n color: #fff;\n}\n\n.dark .timestamp {\n color: #aaa;\n}\n\n.dark .meta {\n border-color: #333;\n color: #666;\n}\n`,\n \"ui/index.html\": `<!DOCTYPE html>\n<html lang=\"en\">\n <head>\n <meta charset=\"UTF-8\" />\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n <title>${name}</title>\n </head>\n <body>\n <div id=\"app\"></div>\n <script type=\"module\" src=\"/src/main.ts\"></script>\n </body>\n</html>\n`,\n \"ui/vite.config.ts\": `import { defineConfig } from \"vite\";\nimport { viteSingleFile } from \"vite-plugin-singlefile\";\n\nexport default defineConfig({\n plugins: [viteSingleFile()],\n root: \"./ui\",\n build: {\n outDir: \"${uiOutputDir}\",\n emptyOutDir: true,\n },\n});\n`,\n \".gitignore\": `node_modules/\ndist/\npublic/\n*.log\n.env\n.env.local\n`,\n \"README.md\": `# ${name}\n\nAn MCP application built with @mcp-apps-kit.\n\n## Development\n\n\\`\\`\\`bash\n${packageManager} install\n${packageManager} run dev\n\\`\\`\\`\n\n## Build\n\n\\`\\`\\`bash\n${packageManager} run build\n\\`\\`\\`\n\n## Connecting to Claude Desktop\n\nAdd to your Claude Desktop config:\n\n\\`\\`\\`json\n{\n \"mcpServers\": {\n \"${name}\": {\n \"command\": \"npx\",\n \"args\": [\"tsx\", \"path/to/${name}/server/index.ts\"]\n }\n }\n}\n\\`\\`\\`\n${\n vercel\n ? `\n## Deploy to Vercel\n\nThis project is configured for Vercel deployment:\n\n\\`\\`\\`bash\nvercel deploy\n\\`\\`\\`\n\nThen use the deployed URL as your MCP server endpoint.\n`\n : \"\"\n}\n`,\n };\n\n // Add vercel.json if Vercel setup is enabled\n if (vercel) {\n files[\"vercel.json\"] = JSON.stringify(\n {\n installCommand: \"npm install\",\n buildCommand: \"npm run build:ui\",\n outputDirectory: \".\",\n functions: {\n \"server/index.ts\": {\n includeFiles: `${uiOutputDir}/**`,\n },\n },\n rewrites: [\n {\n source: \"/(.*)\",\n destination: \"/server/index.ts\",\n },\n ],\n },\n null,\n 2\n );\n }\n\n return files;\n}\n\n// =============================================================================\n// Scaffolding Logic\n// =============================================================================\n\n/**\n * Scaffold a new MCP application project\n */\nexport async function scaffoldProject(options: CreateAppOptions): Promise<void> {\n const {\n name,\n template,\n directory,\n vercel = false,\n skipInstall = false,\n skipGit = false,\n } = options;\n\n // Determine project directory\n const projectDir = directory ?? path.resolve(process.cwd(), name);\n\n // Check if directory exists and is not empty\n if (fs.existsSync(projectDir)) {\n const files = fs.readdirSync(projectDir);\n if (files.length > 0) {\n throw new Error(`Directory ${projectDir} is not empty. Please use an empty directory.`);\n }\n } else {\n fs.mkdirSync(projectDir, { recursive: true });\n }\n\n // Get template files\n const templateFiles =\n template === \"react\" ? getReactTemplate(name, vercel) : getVanillaTemplate(name, vercel);\n\n // Write all files\n for (const [filePath, content] of Object.entries(templateFiles)) {\n const fullPath = path.join(projectDir, filePath);\n const dir = path.dirname(fullPath);\n\n // Create directory if needed\n if (!fs.existsSync(dir)) {\n fs.mkdirSync(dir, { recursive: true });\n }\n\n // Write file\n fs.writeFileSync(fullPath, content, \"utf-8\");\n }\n\n // Initialize git repository\n if (!skipGit) {\n try {\n execSync(\"git init\", { cwd: projectDir, stdio: \"ignore\" });\n } catch {\n // Ignore git init errors (git may not be installed)\n }\n }\n\n // Install dependencies\n if (!skipInstall) {\n try {\n if (vercel) {\n // Use npm for Vercel projects (better compatibility)\n execSync(\"npm install\", { cwd: projectDir, stdio: \"inherit\" });\n } else {\n // Try pnpm first, fall back to npm\n try {\n execSync(\"pnpm install\", { cwd: projectDir, stdio: \"inherit\" });\n } catch {\n execSync(\"npm install\", { cwd: projectDir, stdio: \"inherit\" });\n }\n }\n } catch {\n // eslint-disable-next-line no-console\n console.warn(\"Warning: Could not install dependencies automatically.\");\n }\n }\n}\n","/**\n * @mcp-apps-kit/create-app CLI\n *\n * Command-line interface for scaffolding MCP applications.\n */\n/* eslint-disable no-console */\n\nimport { Command, InvalidArgumentError } from \"commander\";\nimport prompts from \"prompts\";\nimport chalk from \"chalk\";\nimport { scaffoldProject } from \"./index.js\";\nimport type { CreateAppOptions } from \"./index.js\";\n\n// =============================================================================\n// Types\n// =============================================================================\n\nexport interface CLIOptions {\n name?: string;\n template: \"react\" | \"vanilla\";\n directory?: string;\n skipInstall: boolean;\n skipGit: boolean;\n vercel: boolean;\n interactive: boolean;\n}\n\n// =============================================================================\n// Validation\n// =============================================================================\n\n/**\n * Validate a project name follows npm package naming conventions\n */\nexport function validateProjectName(name: string): boolean {\n if (!name || name.length === 0) {\n return false;\n }\n\n // Check for scoped packages\n if (name.startsWith(\"@\")) {\n const parts = name.split(\"/\");\n if (parts.length !== 2 || !parts[0] || !parts[1]) return false;\n const scope = parts[0].slice(1);\n const pkg = parts[1];\n return validateSimpleName(scope) && validateSimpleName(pkg);\n }\n\n return validateSimpleName(name);\n}\n\nfunction validateSimpleName(name: string): boolean {\n // npm package name rules:\n // - lowercase\n // - one word (no spaces)\n // - can contain hyphens, underscores, dots\n // - cannot start with dot or underscore\n const validPattern = /^[a-z][a-z0-9._-]*$/;\n return validPattern.test(name);\n}\n\n// =============================================================================\n// Argument Parsing\n// =============================================================================\n\nconst VALID_TEMPLATES = [\"react\", \"vanilla\"] as const;\ntype Template = (typeof VALID_TEMPLATES)[number];\n\n/**\n * Parse CLI arguments\n */\nexport function parseArgs(args: string[]): CLIOptions {\n let result: CLIOptions = {\n template: \"react\",\n skipInstall: false,\n skipGit: false,\n vercel: false,\n interactive: false,\n };\n\n const program = new Command()\n .name(\"create-mcp-apps-kit\")\n .description(\"Scaffold a new MCP application\")\n .version(\"0.1.0\")\n .argument(\"[name]\", \"Project name\")\n .option(\n \"-t, --template <template>\",\n \"Template to use (react, vanilla)\",\n (value) => {\n if (!VALID_TEMPLATES.includes(value as Template)) {\n throw new InvalidArgumentError(\n `Invalid template: ${value}. Must be one of: ${VALID_TEMPLATES.join(\", \")}`\n );\n }\n return value as Template;\n },\n \"react\"\n )\n .option(\"-d, --directory <path>\", \"Directory to create project in\")\n .option(\"--skip-install\", \"Skip installing dependencies\", false)\n .option(\"--skip-git\", \"Skip initializing git repository\", false)\n .option(\"--vercel\", \"Add Vercel deployment configuration\", false)\n .allowUnknownOption(false)\n .parse([\"node\", \"create-mcp-apps-kit\", ...args]);\n\n const options = program.opts<{\n template: Template;\n directory?: string;\n skipInstall: boolean;\n skipGit: boolean;\n vercel: boolean;\n }>();\n const [name] = program.args;\n\n result = {\n name,\n template: options.template,\n directory: options.directory,\n skipInstall: options.skipInstall,\n skipGit: options.skipGit,\n vercel: options.vercel,\n interactive: !name,\n };\n\n return result;\n}\n\n// =============================================================================\n// Interactive Mode\n// =============================================================================\n\nasync function runInteractive(): Promise<CreateAppOptions> {\n console.log();\n console.log(chalk.bold(\"🚀 Create a new MCP application\"));\n console.log();\n\n const response = await prompts<\"name\" | \"template\" | \"vercel\" | \"skipInstall\" | \"skipGit\">([\n {\n type: \"text\",\n name: \"name\",\n message: \"Project name:\",\n validate: (value: string) => {\n if (!validateProjectName(value)) {\n return \"Invalid project name. Must be lowercase, no spaces, valid npm package name.\";\n }\n return true;\n },\n },\n {\n type: \"select\",\n name: \"template\",\n message: \"Template:\",\n choices: [\n { title: \"React\", value: \"react\", description: \"React + TypeScript with hooks\" },\n { title: \"Vanilla\", value: \"vanilla\", description: \"Vanilla TypeScript\" },\n ],\n initial: 0,\n },\n {\n type: \"confirm\",\n name: \"vercel\",\n message: \"Add Vercel deployment setup?\",\n initial: true,\n },\n {\n type: \"confirm\",\n name: \"skipInstall\",\n message: \"Skip installing dependencies?\",\n initial: false,\n },\n {\n type: \"confirm\",\n name: \"skipGit\",\n message: \"Skip initializing git?\",\n initial: false,\n },\n ]);\n\n if (!response.name) {\n console.log(chalk.yellow(\"Cancelled.\"));\n process.exit(0);\n }\n\n return {\n name: response.name as string,\n template: response.template as \"react\" | \"vanilla\",\n vercel: response.vercel as boolean,\n skipInstall: response.skipInstall as boolean,\n skipGit: response.skipGit as boolean,\n };\n}\n\n// =============================================================================\n// Main Entry Point\n// =============================================================================\n\nasync function main(): Promise<void> {\n try {\n const cliOptions = parseArgs(process.argv.slice(2));\n\n let options: CreateAppOptions;\n\n if (cliOptions.interactive) {\n options = await runInteractive();\n } else {\n if (!cliOptions.name) {\n console.error(chalk.red(\"Error: Project name is required\"));\n process.exit(1);\n }\n\n if (!validateProjectName(cliOptions.name)) {\n console.error(chalk.red(\"Error: Invalid project name. Must be a valid npm package name.\"));\n process.exit(1);\n }\n\n options = {\n name: cliOptions.name,\n template: cliOptions.template,\n directory: cliOptions.directory,\n skipInstall: cliOptions.skipInstall,\n skipGit: cliOptions.skipGit,\n vercel: cliOptions.vercel,\n };\n }\n\n console.log();\n console.log(chalk.blue(`Creating ${options.name} with ${options.template} template...`));\n if (options.vercel) {\n console.log(chalk.blue(\"Setting up for Vercel deployment...\"));\n }\n console.log();\n\n await scaffoldProject(options);\n\n const packageManager = options.vercel ? \"npm\" : \"pnpm\";\n\n console.log();\n console.log(chalk.green(\"✓ Project created successfully!\"));\n console.log();\n console.log(\"Next steps:\");\n console.log(chalk.cyan(` cd ${options.directory ?? options.name}`));\n if (!options.skipInstall) {\n console.log(chalk.cyan(` ${packageManager} run dev`));\n } else {\n console.log(chalk.cyan(` ${packageManager} install`));\n console.log(chalk.cyan(` ${packageManager} run dev`));\n }\n if (options.vercel) {\n console.log();\n console.log(\"To deploy to Vercel:\");\n console.log(chalk.cyan(\" vercel deploy\"));\n }\n console.log();\n } catch (error) {\n console.error(chalk.red(\"Error:\"), error instanceof Error ? error.message : error);\n process.exit(1);\n }\n}\n\n// Run if executed directly\nvoid main();\n"]}
{"version":3,"sources":["../src/index.ts","../src/cli.ts"],"names":[],"mappings":";;;;;;;;AAkCA,IAAI,cAAA,GAAyC,IAAA;AAK7C,SAAS,mBAAmB,WAAA,EAA6B;AACvD,EAAA,IAAI;AACF,IAAA,MAAM,MAAA,GAAS,QAAA,CAAS,CAAA,SAAA,EAAY,WAAW,CAAA,QAAA,CAAA,EAAY;AAAA,MACzD,QAAA,EAAU,OAAA;AAAA,MACV,KAAA,EAAO,CAAC,MAAA,EAAQ,MAAA,EAAQ,MAAM;AAAA,KAC/B,EAAE,IAAA,EAAK;AACR,IAAA,OAAO,IAAI,MAAM,CAAA,CAAA;AAAA,EACnB,CAAA,CAAA,MAAQ;AAEN,IAAA,OAAO,QAAA;AAAA,EACT;AACF;AAKA,SAAS,kBAAA,GAAsC;AAC7C,EAAA,IAAI,cAAA,EAAgB;AAClB,IAAA,OAAO,cAAA;AAAA,EACT;AAEA,EAAA,cAAA,GAAiB;AAAA,IACf,IAAA,EAAM,mBAAmB,oBAAoB,CAAA;AAAA,IAC7C,EAAA,EAAI,mBAAmB,kBAAkB,CAAA;AAAA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,OAAA,CAAQ,KAAA,CAAM,MAAM,GAAA,CAAI,QAAQ,GAAG,KAAA,YAAiB,KAAA,GAAQ,KAAA,CAAM,OAAA,GAAU,KAAK,CAAA;AACjF,IAAA,OAAA,CAAQ,KAAK,CAAC,CAAA;AAAA,EAChB;AACF;AAGA,KAAK,IAAA,EAAK","file":"cli.js","sourcesContent":["/**\n * @mcp-apps-kit/create-app\n *\n * Project scaffolding for MCP applications.\n */\n\nimport * as fs from \"node:fs\";\nimport * as path from \"node:path\";\nimport { execSync } from \"node:child_process\";\n\n// =============================================================================\n// Types\n// =============================================================================\n\nexport interface CreateAppOptions {\n name: string;\n template: \"react\" | \"vanilla\";\n directory?: string;\n vercel?: boolean;\n skipInstall?: boolean;\n skipGit?: boolean;\n}\n\n// =============================================================================\n// Version Detection\n// =============================================================================\n\ninterface PackageVersions {\n core: string;\n ui: string;\n uiReact: string;\n}\n\n// Cache for fetched versions\nlet cachedVersions: PackageVersions | null = null;\n\n/**\n * Fetch the latest version of a package from npm registry\n */\nfunction fetchLatestVersion(packageName: string): string {\n try {\n const result = execSync(`npm view ${packageName} version`, {\n encoding: \"utf-8\",\n stdio: [\"pipe\", \"pipe\", \"pipe\"],\n }).trim();\n return `^${result}`;\n } catch {\n // Fallback to a reasonable default if we can't fetch\n return \"^0.2.0\";\n }\n}\n\n/**\n * Get the versions of @mcp-apps-kit packages from npm registry\n */\nfunction getPackageVersions(): PackageVersions {\n if (cachedVersions) {\n return cachedVersions;\n }\n\n cachedVersions = {\n core: fetchLatestVersion(\"@mcp-apps-kit/core\"),\n ui: fetchLatestVersion(\"@mcp-apps-kit/ui\"),\n uiReact: fetchLatestVersion(\"@mcp-apps-kit/ui-react\"),\n };\n\n return cachedVersions;\n}\n\n// =============================================================================\n// Template Content\n// =============================================================================\n\nfunction getReactTemplate(name: string, vercel = false): Record<string, string> {\n const uiOutputDir = vercel ? \"public\" : \"dist\";\n const packageManager = vercel ? \"npm\" : \"pnpm\";\n const versions = getPackageVersions();\n\n const files: Record<string, string> = {\n \"package.json\": JSON.stringify(\n {\n name,\n version: \"0.1.0\",\n type: \"module\",\n scripts: {\n dev: `concurrently \"${packageManager} run dev:server\" \"${packageManager} run dev:ui\"`,\n \"dev:server\": \"tsx watch server/index.ts\",\n \"dev:ui\": \"vite --config ui/vite.config.ts\",\n build: `${packageManager} run build:ui && tsc`,\n \"build:ui\": \"vite build --config ui/vite.config.ts\",\n start: \"node dist/server/index.js\",\n },\n dependencies: {\n \"@mcp-apps-kit/core\": versions.core,\n \"@mcp-apps-kit/ui\": versions.ui,\n \"@mcp-apps-kit/ui-react\": versions.uiReact,\n react: \"^18.2.0\",\n \"react-dom\": \"^18.2.0\",\n zod: \"^3.22.0\",\n ...(vercel ? { express: \"^4.21.0\" } : {}),\n },\n devDependencies: {\n \"@types/react\": \"^18.2.0\",\n \"@types/react-dom\": \"^18.2.0\",\n \"@vitejs/plugin-react\": \"^4.2.0\",\n concurrently: \"^8.2.0\",\n tsx: \"^4.7.0\",\n typescript: \"^5.3.0\",\n vite: \"^5.0.0\",\n \"vite-plugin-singlefile\": \"^2.0.0\",\n },\n },\n null,\n 2\n ),\n \"tsconfig.json\": JSON.stringify(\n {\n compilerOptions: {\n target: \"ES2020\",\n module: \"ESNext\",\n moduleResolution: \"bundler\",\n strict: true,\n esModuleInterop: true,\n skipLibCheck: true,\n declaration: true,\n outDir: \"dist\",\n jsx: \"react-jsx\",\n },\n include: [\"server/**/*\", \"ui/src/**/*\"],\n exclude: [\"node_modules\", \"dist\"],\n },\n null,\n 2\n ),\n \"server/index.ts\": vercel\n ? `/**\n * ${name} - MCP Server\n */\n\n// Required for Vercel to detect Express\nimport \"express\";\n\nimport { createApp, defineTool, defineUI } from \"@mcp-apps-kit/core\";\nimport { z } from \"zod\";\n\n// Define the UI for displaying greetings\nconst greetingUI = defineUI({\n name: \"Greeting Widget\",\n description: \"Displays greeting messages\",\n html: \"./${uiOutputDir}/index.html\",\n prefersBorder: true,\n});\n\nconst app = createApp({\n name: \"${name}\",\n version: \"0.1.0\",\n\n tools: {\n hello: defineTool({\n title: \"Hello\",\n description: \"Say hello to someone\",\n input: z.object({\n name: z.string().describe(\"Name to greet\"),\n }),\n output: z.object({\n message: z.string(),\n timestamp: z.string(),\n }),\n handler: async ({ name }) => {\n return {\n message: \\`Hello, \\${name}!\\`,\n timestamp: new Date().toISOString(),\n };\n },\n ui: greetingUI,\n }),\n },\n});\n\n// Only start locally - Vercel uses the exported Express app\nif (!process.env.VERCEL) {\n await app.start({ port: 3000 });\n console.log(\"MCP server running on http://localhost:3000\");\n}\n\n// Export Express app for Vercel\nexport default app.expressApp;\n`\n : `/**\n * ${name} - MCP Server\n */\n\nimport { createApp, defineTool, defineUI } from \"@mcp-apps-kit/core\";\nimport { z } from \"zod\";\n\n// Define the UI for displaying greetings\nconst greetingUI = defineUI({\n name: \"Greeting Widget\",\n description: \"Displays greeting messages\",\n html: \"./ui/dist/index.html\",\n prefersBorder: true,\n});\n\nconst app = createApp({\n name: \"${name}\",\n version: \"0.1.0\",\n\n tools: {\n hello: defineTool({\n title: \"Hello\",\n description: \"Say hello to someone\",\n input: z.object({\n name: z.string().describe(\"Name to greet\"),\n }),\n output: z.object({\n message: z.string(),\n timestamp: z.string(),\n }),\n handler: async ({ name }) => {\n return {\n message: \\`Hello, \\${name}!\\`,\n timestamp: new Date().toISOString(),\n };\n },\n ui: greetingUI,\n }),\n },\n});\n\n// Start server\nawait app.start({ port: 3000 });\nconsole.log(\"MCP server running on http://localhost:3000\");\n`,\n \"ui/src/App.tsx\": `/**\n * ${name} - UI Component\n */\n\nimport {\n useAppsClient,\n useHostContext,\n useDocumentTheme,\n useHostStyleVariables,\n} from \"@mcp-apps-kit/ui-react\";\n\nexport function App() {\n const client = useAppsClient();\n const context = useHostContext();\n\n // Apply theme and host styles\n useDocumentTheme(\"light\", \"dark\");\n useHostStyleVariables();\n\n // Get tool output from client\n const output = client.toolOutput as { message?: string; timestamp?: string } | undefined;\n\n return (\n <div className=\"container\">\n {output?.message ? (\n <div className=\"greeting\">\n <h1>{output.message}</h1>\n <p className=\"timestamp\">Sent at: {output.timestamp}</p>\n </div>\n ) : (\n <p className=\"waiting\">Waiting for greeting...</p>\n )}\n\n <button\n className=\"button\"\n onClick={() => client.sendFollowUpMessage(\"Please greet me again!\")}\n >\n Request New Greeting\n </button>\n\n <footer className=\"meta\">\n Theme: {context.theme} | Locale: {context.locale}\n </footer>\n </div>\n );\n}\n`,\n \"ui/src/main.tsx\": `/**\n * ${name} - UI Entry Point\n */\n\nimport React from \"react\";\nimport { createRoot } from \"react-dom/client\";\nimport { AppsProvider } from \"@mcp-apps-kit/ui-react\";\nimport { App } from \"./App\";\nimport \"./styles.css\";\n\nconst root = document.getElementById(\"root\");\nif (!root) throw new Error(\"Root element not found\");\n\ncreateRoot(root).render(\n <React.StrictMode>\n <AppsProvider>\n <App />\n </AppsProvider>\n </React.StrictMode>\n);\n`,\n \"ui/src/styles.css\": `* {\n margin: 0;\n padding: 0;\n box-sizing: border-box;\n}\n\nbody {\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;\n padding: 16px;\n}\n\n.container {\n max-width: 400px;\n margin: 0 auto;\n}\n\n.greeting h1 {\n font-size: 1.5rem;\n margin-bottom: 8px;\n}\n\n.timestamp {\n color: #666;\n font-size: 0.875rem;\n}\n\n.waiting {\n color: #999;\n font-style: italic;\n}\n\n.button {\n margin-top: 16px;\n padding: 8px 16px;\n background: #0066cc;\n color: white;\n border: none;\n border-radius: 4px;\n cursor: pointer;\n}\n\n.button:hover {\n background: #0052a3;\n}\n\n.meta {\n margin-top: 24px;\n padding-top: 16px;\n border-top: 1px solid #eee;\n font-size: 0.75rem;\n color: #999;\n}\n\n/* Dark mode support */\n.dark body {\n background: #1a1a1a;\n color: #fff;\n}\n\n.dark .timestamp {\n color: #aaa;\n}\n\n.dark .meta {\n border-color: #333;\n color: #666;\n}\n`,\n \"ui/index.html\": `<!DOCTYPE html>\n<html lang=\"en\">\n <head>\n <meta charset=\"UTF-8\" />\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n <title>${name}</title>\n </head>\n <body>\n <div id=\"root\"></div>\n <script type=\"module\" src=\"/src/main.tsx\"></script>\n </body>\n</html>\n`,\n \"ui/vite.config.ts\": `import { defineConfig } from \"vite\";\nimport react from \"@vitejs/plugin-react\";\nimport { viteSingleFile } from \"vite-plugin-singlefile\";\n\nexport default defineConfig({\n plugins: [react(), viteSingleFile()],\n root: \"./ui\",\n build: {\n outDir: \"${uiOutputDir}\",\n emptyOutDir: true,\n },\n});\n`,\n \".gitignore\": `node_modules/\ndist/\npublic/\n*.log\n.env\n.env.local\n`,\n \"README.md\": `# ${name}\n\nAn MCP application built with @mcp-apps-kit.\n\n## Development\n\n\\`\\`\\`bash\n${packageManager} install\n${packageManager} run dev\n\\`\\`\\`\n\n## Build\n\n\\`\\`\\`bash\n${packageManager} run build\n\\`\\`\\`\n\n## Connecting to Claude Desktop\n\nAdd to your Claude Desktop config:\n\n\\`\\`\\`json\n{\n \"mcpServers\": {\n \"${name}\": {\n \"command\": \"npx\",\n \"args\": [\"tsx\", \"path/to/${name}/server/index.ts\"]\n }\n }\n}\n\\`\\`\\`\n${\n vercel\n ? `\n## Deploy to Vercel\n\nThis project is configured for Vercel deployment:\n\n\\`\\`\\`bash\nvercel deploy\n\\`\\`\\`\n\nThen use the deployed URL as your MCP server endpoint.\n`\n : \"\"\n}\n`,\n };\n\n // Add vercel.json if Vercel setup is enabled\n if (vercel) {\n files[\"vercel.json\"] = JSON.stringify(\n {\n installCommand: \"npm install\",\n buildCommand: \"npm run build:ui\",\n outputDirectory: \".\",\n functions: {\n \"server/index.ts\": {\n includeFiles: `${uiOutputDir}/**`,\n },\n },\n rewrites: [\n {\n source: \"/(.*)\",\n destination: \"/server/index.ts\",\n },\n ],\n },\n null,\n 2\n );\n }\n\n return files;\n}\n\nfunction getVanillaTemplate(name: string, vercel = false): Record<string, string> {\n const uiOutputDir = vercel ? \"public\" : \"dist\";\n const packageManager = vercel ? \"npm\" : \"pnpm\";\n const versions = getPackageVersions();\n\n const files: Record<string, string> = {\n \"package.json\": JSON.stringify(\n {\n name,\n version: \"0.1.0\",\n type: \"module\",\n scripts: {\n dev: `concurrently \"${packageManager} run dev:server\" \"${packageManager} run dev:ui\"`,\n \"dev:server\": \"tsx watch server/index.ts\",\n \"dev:ui\": \"vite --config ui/vite.config.ts\",\n build: `${packageManager} run build:ui && tsc`,\n \"build:ui\": \"vite build --config ui/vite.config.ts\",\n start: \"node dist/server/index.js\",\n },\n dependencies: {\n \"@mcp-apps-kit/core\": versions.core,\n \"@mcp-apps-kit/ui\": versions.ui,\n zod: \"^3.22.0\",\n ...(vercel ? { express: \"^4.21.0\" } : {}),\n },\n devDependencies: {\n concurrently: \"^8.2.0\",\n tsx: \"^4.7.0\",\n typescript: \"^5.3.0\",\n vite: \"^5.0.0\",\n \"vite-plugin-singlefile\": \"^2.0.0\",\n },\n },\n null,\n 2\n ),\n \"tsconfig.json\": JSON.stringify(\n {\n compilerOptions: {\n target: \"ES2020\",\n module: \"ESNext\",\n moduleResolution: \"bundler\",\n strict: true,\n esModuleInterop: true,\n skipLibCheck: true,\n declaration: true,\n outDir: \"dist\",\n },\n include: [\"server/**/*\", \"ui/src/**/*\"],\n exclude: [\"node_modules\", \"dist\"],\n },\n null,\n 2\n ),\n \"server/index.ts\": vercel\n ? `/**\n * ${name} - MCP Server\n */\n\n// Required for Vercel to detect Express\nimport \"express\";\n\nimport { createApp, defineTool, defineUI } from \"@mcp-apps-kit/core\";\nimport { z } from \"zod\";\n\n// Define the UI for displaying greetings\nconst greetingUI = defineUI({\n name: \"Greeting Widget\",\n description: \"Displays greeting messages\",\n html: \"./${uiOutputDir}/index.html\",\n prefersBorder: true,\n});\n\nconst app = createApp({\n name: \"${name}\",\n version: \"0.1.0\",\n\n tools: {\n hello: defineTool({\n title: \"Hello\",\n description: \"Say hello to someone\",\n input: z.object({\n name: z.string().describe(\"Name to greet\"),\n }),\n output: z.object({\n message: z.string(),\n timestamp: z.string(),\n }),\n handler: async ({ name }) => {\n return {\n message: \\`Hello, \\${name}!\\`,\n timestamp: new Date().toISOString(),\n };\n },\n ui: greetingUI,\n }),\n },\n});\n\n// Only start locally - Vercel uses the exported Express app\nif (!process.env.VERCEL) {\n await app.start({ port: 3000 });\n console.log(\"MCP server running on http://localhost:3000\");\n}\n\n// Export Express app for Vercel\nexport default app.expressApp;\n`\n : `/**\n * ${name} - MCP Server\n */\n\nimport { createApp, defineTool, defineUI } from \"@mcp-apps-kit/core\";\nimport { z } from \"zod\";\n\n// Define the UI for displaying greetings\nconst greetingUI = defineUI({\n name: \"Greeting Widget\",\n description: \"Displays greeting messages\",\n html: \"./ui/dist/index.html\",\n prefersBorder: true,\n});\n\nconst app = createApp({\n name: \"${name}\",\n version: \"0.1.0\",\n\n tools: {\n hello: defineTool({\n title: \"Hello\",\n description: \"Say hello to someone\",\n input: z.object({\n name: z.string().describe(\"Name to greet\"),\n }),\n output: z.object({\n message: z.string(),\n timestamp: z.string(),\n }),\n handler: async ({ name }) => {\n return {\n message: \\`Hello, \\${name}!\\`,\n timestamp: new Date().toISOString(),\n };\n },\n ui: greetingUI,\n }),\n },\n});\n\n// Start server\nawait app.start({ port: 3000 });\nconsole.log(\"MCP server running on http://localhost:3000\");\n`,\n \"ui/src/main.ts\": `/**\n * ${name} - UI Entry Point\n */\n\nimport { createClient } from \"@mcp-apps-kit/ui\";\nimport \"./styles.css\";\n\nasync function main() {\n const client = await createClient();\n\n // Get container\n const container = document.getElementById(\"app\");\n if (!container) throw new Error(\"Container not found\");\n\n // Render initial UI\n render(container, client);\n\n // Subscribe to context changes\n client.onHostContextChange((context) => {\n document.documentElement.className = context.theme;\n render(container, client);\n });\n}\n\nfunction render(container: HTMLElement, client: ReturnType<typeof createClient> extends Promise<infer T> ? T : never) {\n const output = client.toolOutput as { message?: string; timestamp?: string } | undefined;\n const context = client.hostContext;\n\n container.innerHTML = \\`\n <div class=\"container\">\n \\${output?.message ? \\`\n <div class=\"greeting\">\n <h1>\\${output.message}</h1>\n <p class=\"timestamp\">Sent at: \\${output.timestamp}</p>\n </div>\n \\` : \\`\n <p class=\"waiting\">Waiting for greeting...</p>\n \\`}\n\n <button class=\"button\" id=\"request-btn\">\n Request New Greeting\n </button>\n\n <footer class=\"meta\">\n Theme: \\${context.theme} | Locale: \\${context.locale}\n </footer>\n </div>\n \\`;\n\n // Add event listener\n const btn = document.getElementById(\"request-btn\");\n btn?.addEventListener(\"click\", () => {\n client.sendFollowUpMessage(\"Please greet me again!\");\n });\n}\n\nmain();\n`,\n \"ui/src/styles.css\": `* {\n margin: 0;\n padding: 0;\n box-sizing: border-box;\n}\n\nbody {\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;\n padding: 16px;\n}\n\n.container {\n max-width: 400px;\n margin: 0 auto;\n}\n\n.greeting h1 {\n font-size: 1.5rem;\n margin-bottom: 8px;\n}\n\n.timestamp {\n color: #666;\n font-size: 0.875rem;\n}\n\n.waiting {\n color: #999;\n font-style: italic;\n}\n\n.button {\n margin-top: 16px;\n padding: 8px 16px;\n background: #0066cc;\n color: white;\n border: none;\n border-radius: 4px;\n cursor: pointer;\n}\n\n.button:hover {\n background: #0052a3;\n}\n\n.meta {\n margin-top: 24px;\n padding-top: 16px;\n border-top: 1px solid #eee;\n font-size: 0.75rem;\n color: #999;\n}\n\n/* Dark mode support */\n.dark body {\n background: #1a1a1a;\n color: #fff;\n}\n\n.dark .timestamp {\n color: #aaa;\n}\n\n.dark .meta {\n border-color: #333;\n color: #666;\n}\n`,\n \"ui/index.html\": `<!DOCTYPE html>\n<html lang=\"en\">\n <head>\n <meta charset=\"UTF-8\" />\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n <title>${name}</title>\n </head>\n <body>\n <div id=\"app\"></div>\n <script type=\"module\" src=\"/src/main.ts\"></script>\n </body>\n</html>\n`,\n \"ui/vite.config.ts\": `import { defineConfig } from \"vite\";\nimport { viteSingleFile } from \"vite-plugin-singlefile\";\n\nexport default defineConfig({\n plugins: [viteSingleFile()],\n root: \"./ui\",\n build: {\n outDir: \"${uiOutputDir}\",\n emptyOutDir: true,\n },\n});\n`,\n \".gitignore\": `node_modules/\ndist/\npublic/\n*.log\n.env\n.env.local\n`,\n \"README.md\": `# ${name}\n\nAn MCP application built with @mcp-apps-kit.\n\n## Development\n\n\\`\\`\\`bash\n${packageManager} install\n${packageManager} run dev\n\\`\\`\\`\n\n## Build\n\n\\`\\`\\`bash\n${packageManager} run build\n\\`\\`\\`\n\n## Connecting to Claude Desktop\n\nAdd to your Claude Desktop config:\n\n\\`\\`\\`json\n{\n \"mcpServers\": {\n \"${name}\": {\n \"command\": \"npx\",\n \"args\": [\"tsx\", \"path/to/${name}/server/index.ts\"]\n }\n }\n}\n\\`\\`\\`\n${\n vercel\n ? `\n## Deploy to Vercel\n\nThis project is configured for Vercel deployment:\n\n\\`\\`\\`bash\nvercel deploy\n\\`\\`\\`\n\nThen use the deployed URL as your MCP server endpoint.\n`\n : \"\"\n}\n`,\n };\n\n // Add vercel.json if Vercel setup is enabled\n if (vercel) {\n files[\"vercel.json\"] = JSON.stringify(\n {\n installCommand: \"npm install\",\n buildCommand: \"npm run build:ui\",\n outputDirectory: \".\",\n functions: {\n \"server/index.ts\": {\n includeFiles: `${uiOutputDir}/**`,\n },\n },\n rewrites: [\n {\n source: \"/(.*)\",\n destination: \"/server/index.ts\",\n },\n ],\n },\n null,\n 2\n );\n }\n\n return files;\n}\n\n// =============================================================================\n// Scaffolding Logic\n// =============================================================================\n\n/**\n * Scaffold a new MCP application project\n */\nexport async function scaffoldProject(options: CreateAppOptions): Promise<void> {\n const {\n name,\n template,\n directory,\n vercel = false,\n skipInstall = false,\n skipGit = false,\n } = options;\n\n // Determine project directory\n const projectDir = directory ?? path.resolve(process.cwd(), name);\n\n // Check if directory exists and is not empty\n if (fs.existsSync(projectDir)) {\n const files = fs.readdirSync(projectDir);\n if (files.length > 0) {\n throw new Error(`Directory ${projectDir} is not empty. Please use an empty directory.`);\n }\n } else {\n fs.mkdirSync(projectDir, { recursive: true });\n }\n\n // Get template files\n const templateFiles =\n template === \"react\" ? getReactTemplate(name, vercel) : getVanillaTemplate(name, vercel);\n\n // Write all files\n for (const [filePath, content] of Object.entries(templateFiles)) {\n const fullPath = path.join(projectDir, filePath);\n const dir = path.dirname(fullPath);\n\n // Create directory if needed\n if (!fs.existsSync(dir)) {\n fs.mkdirSync(dir, { recursive: true });\n }\n\n // Write file\n fs.writeFileSync(fullPath, content, \"utf-8\");\n }\n\n // Initialize git repository\n if (!skipGit) {\n try {\n execSync(\"git init\", { cwd: projectDir, stdio: \"ignore\" });\n } catch {\n // Ignore git init errors (git may not be installed)\n }\n }\n\n // Install dependencies\n if (!skipInstall) {\n try {\n if (vercel) {\n // Use npm for Vercel projects (better compatibility)\n execSync(\"npm install\", { cwd: projectDir, stdio: \"inherit\" });\n } else {\n // Try pnpm first, fall back to npm\n try {\n execSync(\"pnpm install\", { cwd: projectDir, stdio: \"inherit\" });\n } catch {\n execSync(\"npm install\", { cwd: projectDir, stdio: \"inherit\" });\n }\n }\n } catch {\n // eslint-disable-next-line no-console\n console.warn(\"Warning: Could not install dependencies automatically.\");\n }\n }\n}\n","/**\n * @mcp-apps-kit/create-app CLI\n *\n * Command-line interface for scaffolding MCP applications.\n */\n/* eslint-disable no-console */\n\nimport { Command, InvalidArgumentError } from \"commander\";\nimport prompts from \"prompts\";\nimport chalk from \"chalk\";\nimport { scaffoldProject } from \"./index.js\";\nimport type { CreateAppOptions } from \"./index.js\";\n\n// =============================================================================\n// Types\n// =============================================================================\n\nexport interface CLIOptions {\n name?: string;\n template: \"react\" | \"vanilla\";\n directory?: string;\n skipInstall: boolean;\n skipGit: boolean;\n vercel: boolean;\n interactive: boolean;\n}\n\n// =============================================================================\n// Validation\n// =============================================================================\n\n/**\n * Validate a project name follows npm package naming conventions\n */\nexport function validateProjectName(name: string): boolean {\n if (!name || name.length === 0) {\n return false;\n }\n\n // Check for scoped packages\n if (name.startsWith(\"@\")) {\n const parts = name.split(\"/\");\n if (parts.length !== 2 || !parts[0] || !parts[1]) return false;\n const scope = parts[0].slice(1);\n const pkg = parts[1];\n return validateSimpleName(scope) && validateSimpleName(pkg);\n }\n\n return validateSimpleName(name);\n}\n\nfunction validateSimpleName(name: string): boolean {\n // npm package name rules:\n // - lowercase\n // - one word (no spaces)\n // - can contain hyphens, underscores, dots\n // - cannot start with dot or underscore\n const validPattern = /^[a-z][a-z0-9._-]*$/;\n return validPattern.test(name);\n}\n\n// =============================================================================\n// Argument Parsing\n// =============================================================================\n\nconst VALID_TEMPLATES = [\"react\", \"vanilla\"] as const;\ntype Template = (typeof VALID_TEMPLATES)[number];\n\n/**\n * Parse CLI arguments\n */\nexport function parseArgs(args: string[]): CLIOptions {\n let result: CLIOptions = {\n template: \"react\",\n skipInstall: false,\n skipGit: false,\n vercel: false,\n interactive: false,\n };\n\n const program = new Command()\n .name(\"create-mcp-apps-kit\")\n .description(\"Scaffold a new MCP application\")\n .version(\"0.1.0\")\n .argument(\"[name]\", \"Project name\")\n .option(\n \"-t, --template <template>\",\n \"Template to use (react, vanilla)\",\n (value) => {\n if (!VALID_TEMPLATES.includes(value as Template)) {\n throw new InvalidArgumentError(\n `Invalid template: ${value}. Must be one of: ${VALID_TEMPLATES.join(\", \")}`\n );\n }\n return value as Template;\n },\n \"react\"\n )\n .option(\"-d, --directory <path>\", \"Directory to create project in\")\n .option(\"--skip-install\", \"Skip installing dependencies\", false)\n .option(\"--skip-git\", \"Skip initializing git repository\", false)\n .option(\"--vercel\", \"Add Vercel deployment configuration\", false)\n .allowUnknownOption(false)\n .parse([\"node\", \"create-mcp-apps-kit\", ...args]);\n\n const options = program.opts<{\n template: Template;\n directory?: string;\n skipInstall: boolean;\n skipGit: boolean;\n vercel: boolean;\n }>();\n const [name] = program.args;\n\n result = {\n name,\n template: options.template,\n directory: options.directory,\n skipInstall: options.skipInstall,\n skipGit: options.skipGit,\n vercel: options.vercel,\n interactive: !name,\n };\n\n return result;\n}\n\n// =============================================================================\n// Interactive Mode\n// =============================================================================\n\nasync function runInteractive(): Promise<CreateAppOptions> {\n console.log();\n console.log(chalk.bold(\"🚀 Create a new MCP application\"));\n console.log();\n\n const response = await prompts<\"name\" | \"template\" | \"vercel\" | \"skipInstall\" | \"skipGit\">([\n {\n type: \"text\",\n name: \"name\",\n message: \"Project name:\",\n validate: (value: string) => {\n if (!validateProjectName(value)) {\n return \"Invalid project name. Must be lowercase, no spaces, valid npm package name.\";\n }\n return true;\n },\n },\n {\n type: \"select\",\n name: \"template\",\n message: \"Template:\",\n choices: [\n { title: \"React\", value: \"react\", description: \"React + TypeScript with hooks\" },\n { title: \"Vanilla\", value: \"vanilla\", description: \"Vanilla TypeScript\" },\n ],\n initial: 0,\n },\n {\n type: \"confirm\",\n name: \"vercel\",\n message: \"Add Vercel deployment setup?\",\n initial: true,\n },\n {\n type: \"confirm\",\n name: \"skipInstall\",\n message: \"Skip installing dependencies?\",\n initial: false,\n },\n {\n type: \"confirm\",\n name: \"skipGit\",\n message: \"Skip initializing git?\",\n initial: false,\n },\n ]);\n\n if (!response.name) {\n console.log(chalk.yellow(\"Cancelled.\"));\n process.exit(0);\n }\n\n return {\n name: response.name as string,\n template: response.template as \"react\" | \"vanilla\",\n vercel: response.vercel as boolean,\n skipInstall: response.skipInstall as boolean,\n skipGit: response.skipGit as boolean,\n };\n}\n\n// =============================================================================\n// Main Entry Point\n// =============================================================================\n\nasync function main(): Promise<void> {\n try {\n const cliOptions = parseArgs(process.argv.slice(2));\n\n let options: CreateAppOptions;\n\n if (cliOptions.interactive) {\n options = await runInteractive();\n } else {\n if (!cliOptions.name) {\n console.error(chalk.red(\"Error: Project name is required\"));\n process.exit(1);\n }\n\n if (!validateProjectName(cliOptions.name)) {\n console.error(chalk.red(\"Error: Invalid project name. Must be a valid npm package name.\"));\n process.exit(1);\n }\n\n options = {\n name: cliOptions.name,\n template: cliOptions.template,\n directory: cliOptions.directory,\n skipInstall: cliOptions.skipInstall,\n skipGit: cliOptions.skipGit,\n vercel: cliOptions.vercel,\n };\n }\n\n console.log();\n console.log(chalk.blue(`Creating ${options.name} with ${options.template} template...`));\n if (options.vercel) {\n console.log(chalk.blue(\"Setting up for Vercel deployment...\"));\n }\n console.log();\n\n await scaffoldProject(options);\n\n const packageManager = options.vercel ? \"npm\" : \"pnpm\";\n\n console.log();\n console.log(chalk.green(\"✓ Project created successfully!\"));\n console.log();\n console.log(\"Next steps:\");\n console.log(chalk.cyan(` cd ${options.directory ?? options.name}`));\n if (!options.skipInstall) {\n console.log(chalk.cyan(` ${packageManager} run dev`));\n } else {\n console.log(chalk.cyan(` ${packageManager} install`));\n console.log(chalk.cyan(` ${packageManager} run dev`));\n }\n if (options.vercel) {\n console.log();\n console.log(\"To deploy to Vercel:\");\n console.log(chalk.cyan(\" vercel deploy\"));\n }\n console.log();\n } catch (error) {\n console.error(chalk.red(\"Error:\"), error instanceof Error ? error.message : error);\n process.exit(1);\n }\n}\n\n// Run if executed directly\nvoid main();\n"]}

@@ -119,5 +119,13 @@ 'use strict';

import { createApp } from "@mcp-apps-kit/core";
import { createApp, defineTool, defineUI } from "@mcp-apps-kit/core";
import { z } from "zod";
// Define the UI for displaying greetings
const greetingUI = defineUI({
name: "Greeting Widget",
description: "Displays greeting messages",
html: "./${uiOutputDir}/index.html",
prefersBorder: true,
});
const app = createApp({

@@ -128,3 +136,4 @@ name: "${name}",

tools: {
hello: {
hello: defineTool({
title: "Hello",
description: "Say hello to someone",

@@ -144,13 +153,5 @@ input: z.object({

},
ui: "greeting",
},
ui: greetingUI,
}),
},
ui: {
greeting: {
html: "./${uiOutputDir}/index.html",
description: "Greeting widget",
prefersBorder: true,
},
},
});

@@ -170,5 +171,13 @@

import { createApp } from "@mcp-apps-kit/core";
import { createApp, defineTool, defineUI } from "@mcp-apps-kit/core";
import { z } from "zod";
// Define the UI for displaying greetings
const greetingUI = defineUI({
name: "Greeting Widget",
description: "Displays greeting messages",
html: "./ui/dist/index.html",
prefersBorder: true,
});
const app = createApp({

@@ -179,3 +188,4 @@ name: "${name}",

tools: {
hello: {
hello: defineTool({
title: "Hello",
description: "Say hello to someone",

@@ -195,13 +205,5 @@ input: z.object({

},
ui: "greeting",
},
ui: greetingUI,
}),
},
ui: {
greeting: {
html: "./ui/dist/index.html",
description: "Greeting widget",
prefersBorder: true,
},
},
});

@@ -510,5 +512,13 @@

import { createApp } from "@mcp-apps-kit/core";
import { createApp, defineTool, defineUI } from "@mcp-apps-kit/core";
import { z } from "zod";
// Define the UI for displaying greetings
const greetingUI = defineUI({
name: "Greeting Widget",
description: "Displays greeting messages",
html: "./${uiOutputDir}/index.html",
prefersBorder: true,
});
const app = createApp({

@@ -519,3 +529,4 @@ name: "${name}",

tools: {
hello: {
hello: defineTool({
title: "Hello",
description: "Say hello to someone",

@@ -535,13 +546,5 @@ input: z.object({

},
ui: "greeting",
},
ui: greetingUI,
}),
},
ui: {
greeting: {
html: "./${uiOutputDir}/index.html",
description: "Greeting widget",
prefersBorder: true,
},
},
});

@@ -561,5 +564,13 @@

import { createApp } from "@mcp-apps-kit/core";
import { createApp, defineTool, defineUI } from "@mcp-apps-kit/core";
import { z } from "zod";
// Define the UI for displaying greetings
const greetingUI = defineUI({
name: "Greeting Widget",
description: "Displays greeting messages",
html: "./ui/dist/index.html",
prefersBorder: true,
});
const app = createApp({

@@ -570,3 +581,4 @@ name: "${name}",

tools: {
hello: {
hello: defineTool({
title: "Hello",
description: "Say hello to someone",

@@ -586,13 +598,5 @@ input: z.object({

},
ui: "greeting",
},
ui: greetingUI,
}),
},
ui: {
greeting: {
html: "./ui/dist/index.html",
description: "Greeting widget",
prefersBorder: true,
},
},
});

@@ -599,0 +603,0 @@

@@ -1,1 +0,1 @@

{"version":3,"sources":["../src/index.ts"],"names":["execSync","path","fs"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkCA,IAAI,cAAA,GAAyC,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EAAO,WAAW,CAAA;AAAA,MAC/D,CAAA,MAAO;AAEL,QAAA,IAAI;AACF,UAAAA,sBAAA,CAAS,gBAAgB,EAAE,GAAA,EAAK,UAAA,EAAY,KAAA,EAAO,WAAW,CAAA;AAAA,QAChE,CAAA,CAAA,MAAQ;AACN,UAAAA,sBAAA,CAAS,eAAe,EAAE,GAAA,EAAK,UAAA,EAAY,KAAA,EAAO,WAAW,CAAA;AAAA,QAC/D;AAAA,MACF;AAAA,IACF,CAAA,CAAA,MAAQ;AAEN,MAAA,OAAA,CAAQ,KAAK,wDAAwD,CAAA;AAAA,IACvE;AAAA,EACF;AACF","file":"index.cjs","sourcesContent":["/**\n * @mcp-apps-kit/create-app\n *\n * Project scaffolding for MCP applications.\n */\n\nimport * as fs from \"node:fs\";\nimport * as path from \"node:path\";\nimport { execSync } from \"node:child_process\";\n\n// =============================================================================\n// Types\n// =============================================================================\n\nexport interface CreateAppOptions {\n name: string;\n template: \"react\" | \"vanilla\";\n directory?: string;\n vercel?: boolean;\n skipInstall?: boolean;\n skipGit?: boolean;\n}\n\n// =============================================================================\n// Version Detection\n// =============================================================================\n\ninterface PackageVersions {\n core: string;\n ui: string;\n uiReact: string;\n}\n\n// Cache for fetched versions\nlet cachedVersions: PackageVersions | null = null;\n\n/**\n * Fetch the latest version of a package from npm registry\n */\nfunction fetchLatestVersion(packageName: string): string {\n try {\n const result = execSync(`npm view ${packageName} version`, {\n encoding: \"utf-8\",\n stdio: [\"pipe\", \"pipe\", \"pipe\"],\n }).trim();\n return `^${result}`;\n } catch {\n // Fallback to a reasonable default if we can't fetch\n return \"^0.2.0\";\n }\n}\n\n/**\n * Get the versions of @mcp-apps-kit packages from npm registry\n */\nfunction getPackageVersions(): PackageVersions {\n if (cachedVersions) {\n return cachedVersions;\n }\n\n cachedVersions = {\n core: fetchLatestVersion(\"@mcp-apps-kit/core\"),\n ui: fetchLatestVersion(\"@mcp-apps-kit/ui\"),\n uiReact: fetchLatestVersion(\"@mcp-apps-kit/ui-react\"),\n };\n\n return cachedVersions;\n}\n\n// =============================================================================\n// Template Content\n// =============================================================================\n\nfunction getReactTemplate(name: string, vercel = false): Record<string, string> {\n const uiOutputDir = vercel ? \"public\" : \"dist\";\n const packageManager = vercel ? \"npm\" : \"pnpm\";\n const versions = getPackageVersions();\n\n const files: Record<string, string> = {\n \"package.json\": JSON.stringify(\n {\n name,\n version: \"0.1.0\",\n type: \"module\",\n scripts: {\n dev: `concurrently \"${packageManager} run dev:server\" \"${packageManager} run dev:ui\"`,\n \"dev:server\": \"tsx watch server/index.ts\",\n \"dev:ui\": \"vite --config ui/vite.config.ts\",\n build: `${packageManager} run build:ui && tsc`,\n \"build:ui\": \"vite build --config ui/vite.config.ts\",\n start: \"node dist/server/index.js\",\n },\n dependencies: {\n \"@mcp-apps-kit/core\": versions.core,\n \"@mcp-apps-kit/ui\": versions.ui,\n \"@mcp-apps-kit/ui-react\": versions.uiReact,\n react: \"^18.2.0\",\n \"react-dom\": \"^18.2.0\",\n zod: \"^3.22.0\",\n ...(vercel ? { express: \"^4.21.0\" } : {}),\n },\n devDependencies: {\n \"@types/react\": \"^18.2.0\",\n \"@types/react-dom\": \"^18.2.0\",\n \"@vitejs/plugin-react\": \"^4.2.0\",\n concurrently: \"^8.2.0\",\n tsx: \"^4.7.0\",\n typescript: \"^5.3.0\",\n vite: \"^5.0.0\",\n \"vite-plugin-singlefile\": \"^2.0.0\",\n },\n },\n null,\n 2\n ),\n \"tsconfig.json\": JSON.stringify(\n {\n compilerOptions: {\n target: \"ES2020\",\n module: \"ESNext\",\n moduleResolution: \"bundler\",\n strict: true,\n esModuleInterop: true,\n skipLibCheck: true,\n declaration: true,\n outDir: \"dist\",\n jsx: \"react-jsx\",\n },\n include: [\"server/**/*\", \"ui/src/**/*\"],\n exclude: [\"node_modules\", \"dist\"],\n },\n null,\n 2\n ),\n \"server/index.ts\": vercel\n ? `/**\n * ${name} - MCP Server\n */\n\n// Required for Vercel to detect Express\nimport \"express\";\n\nimport { createApp } from \"@mcp-apps-kit/core\";\nimport { z } from \"zod\";\n\nconst app = createApp({\n name: \"${name}\",\n version: \"0.1.0\",\n\n tools: {\n hello: {\n description: \"Say hello to someone\",\n input: z.object({\n name: z.string().describe(\"Name to greet\"),\n }),\n output: z.object({\n message: z.string(),\n timestamp: z.string(),\n }),\n handler: async ({ name }) => {\n return {\n message: \\`Hello, \\${name}!\\`,\n timestamp: new Date().toISOString(),\n };\n },\n ui: \"greeting\",\n },\n },\n\n ui: {\n greeting: {\n html: \"./${uiOutputDir}/index.html\",\n description: \"Greeting widget\",\n prefersBorder: true,\n },\n },\n});\n\n// Only start locally - Vercel uses the exported Express app\nif (!process.env.VERCEL) {\n await app.start({ port: 3000 });\n console.log(\"MCP server running on http://localhost:3000\");\n}\n\n// Export Express app for Vercel\nexport default app.expressApp;\n`\n : `/**\n * ${name} - MCP Server\n */\n\nimport { createApp } from \"@mcp-apps-kit/core\";\nimport { z } from \"zod\";\n\nconst app = createApp({\n name: \"${name}\",\n version: \"0.1.0\",\n\n tools: {\n hello: {\n description: \"Say hello to someone\",\n input: z.object({\n name: z.string().describe(\"Name to greet\"),\n }),\n output: z.object({\n message: z.string(),\n timestamp: z.string(),\n }),\n handler: async ({ name }) => {\n return {\n message: \\`Hello, \\${name}!\\`,\n timestamp: new Date().toISOString(),\n };\n },\n ui: \"greeting\",\n },\n },\n\n ui: {\n greeting: {\n html: \"./ui/dist/index.html\",\n description: \"Greeting widget\",\n prefersBorder: true,\n },\n },\n});\n\n// Start server\nawait app.start({ port: 3000 });\nconsole.log(\"MCP server running on http://localhost:3000\");\n`,\n \"ui/src/App.tsx\": `/**\n * ${name} - UI Component\n */\n\nimport {\n useAppsClient,\n useHostContext,\n useDocumentTheme,\n useHostStyleVariables,\n} from \"@mcp-apps-kit/ui-react\";\n\nexport function App() {\n const client = useAppsClient();\n const context = useHostContext();\n\n // Apply theme and host styles\n useDocumentTheme(\"light\", \"dark\");\n useHostStyleVariables();\n\n // Get tool output from client\n const output = client.toolOutput as { message?: string; timestamp?: string } | undefined;\n\n return (\n <div className=\"container\">\n {output?.message ? (\n <div className=\"greeting\">\n <h1>{output.message}</h1>\n <p className=\"timestamp\">Sent at: {output.timestamp}</p>\n </div>\n ) : (\n <p className=\"waiting\">Waiting for greeting...</p>\n )}\n\n <button\n className=\"button\"\n onClick={() => client.sendFollowUpMessage(\"Please greet me again!\")}\n >\n Request New Greeting\n </button>\n\n <footer className=\"meta\">\n Theme: {context.theme} | Locale: {context.locale}\n </footer>\n </div>\n );\n}\n`,\n \"ui/src/main.tsx\": `/**\n * ${name} - UI Entry Point\n */\n\nimport React from \"react\";\nimport { createRoot } from \"react-dom/client\";\nimport { AppsProvider } from \"@mcp-apps-kit/ui-react\";\nimport { App } from \"./App\";\nimport \"./styles.css\";\n\nconst root = document.getElementById(\"root\");\nif (!root) throw new Error(\"Root element not found\");\n\ncreateRoot(root).render(\n <React.StrictMode>\n <AppsProvider>\n <App />\n </AppsProvider>\n </React.StrictMode>\n);\n`,\n \"ui/src/styles.css\": `* {\n margin: 0;\n padding: 0;\n box-sizing: border-box;\n}\n\nbody {\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;\n padding: 16px;\n}\n\n.container {\n max-width: 400px;\n margin: 0 auto;\n}\n\n.greeting h1 {\n font-size: 1.5rem;\n margin-bottom: 8px;\n}\n\n.timestamp {\n color: #666;\n font-size: 0.875rem;\n}\n\n.waiting {\n color: #999;\n font-style: italic;\n}\n\n.button {\n margin-top: 16px;\n padding: 8px 16px;\n background: #0066cc;\n color: white;\n border: none;\n border-radius: 4px;\n cursor: pointer;\n}\n\n.button:hover {\n background: #0052a3;\n}\n\n.meta {\n margin-top: 24px;\n padding-top: 16px;\n border-top: 1px solid #eee;\n font-size: 0.75rem;\n color: #999;\n}\n\n/* Dark mode support */\n.dark body {\n background: #1a1a1a;\n color: #fff;\n}\n\n.dark .timestamp {\n color: #aaa;\n}\n\n.dark .meta {\n border-color: #333;\n color: #666;\n}\n`,\n \"ui/index.html\": `<!DOCTYPE html>\n<html lang=\"en\">\n <head>\n <meta charset=\"UTF-8\" />\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n <title>${name}</title>\n </head>\n <body>\n <div id=\"root\"></div>\n <script type=\"module\" src=\"/src/main.tsx\"></script>\n </body>\n</html>\n`,\n \"ui/vite.config.ts\": `import { defineConfig } from \"vite\";\nimport react from \"@vitejs/plugin-react\";\nimport { viteSingleFile } from \"vite-plugin-singlefile\";\n\nexport default defineConfig({\n plugins: [react(), viteSingleFile()],\n root: \"./ui\",\n build: {\n outDir: \"${uiOutputDir}\",\n emptyOutDir: true,\n },\n});\n`,\n \".gitignore\": `node_modules/\ndist/\npublic/\n*.log\n.env\n.env.local\n`,\n \"README.md\": `# ${name}\n\nAn MCP application built with @mcp-apps-kit.\n\n## Development\n\n\\`\\`\\`bash\n${packageManager} install\n${packageManager} run dev\n\\`\\`\\`\n\n## Build\n\n\\`\\`\\`bash\n${packageManager} run build\n\\`\\`\\`\n\n## Connecting to Claude Desktop\n\nAdd to your Claude Desktop config:\n\n\\`\\`\\`json\n{\n \"mcpServers\": {\n \"${name}\": {\n \"command\": \"npx\",\n \"args\": [\"tsx\", \"path/to/${name}/server/index.ts\"]\n }\n }\n}\n\\`\\`\\`\n${\n vercel\n ? `\n## Deploy to Vercel\n\nThis project is configured for Vercel deployment:\n\n\\`\\`\\`bash\nvercel deploy\n\\`\\`\\`\n\nThen use the deployed URL as your MCP server endpoint.\n`\n : \"\"\n}\n`,\n };\n\n // Add vercel.json if Vercel setup is enabled\n if (vercel) {\n files[\"vercel.json\"] = JSON.stringify(\n {\n installCommand: \"npm install\",\n buildCommand: \"npm run build:ui\",\n outputDirectory: \".\",\n functions: {\n \"server/index.ts\": {\n includeFiles: `${uiOutputDir}/**`,\n },\n },\n rewrites: [\n {\n source: \"/(.*)\",\n destination: \"/server/index.ts\",\n },\n ],\n },\n null,\n 2\n );\n }\n\n return files;\n}\n\nfunction getVanillaTemplate(name: string, vercel = false): Record<string, string> {\n const uiOutputDir = vercel ? \"public\" : \"dist\";\n const packageManager = vercel ? \"npm\" : \"pnpm\";\n const versions = getPackageVersions();\n\n const files: Record<string, string> = {\n \"package.json\": JSON.stringify(\n {\n name,\n version: \"0.1.0\",\n type: \"module\",\n scripts: {\n dev: `concurrently \"${packageManager} run dev:server\" \"${packageManager} run dev:ui\"`,\n \"dev:server\": \"tsx watch server/index.ts\",\n \"dev:ui\": \"vite --config ui/vite.config.ts\",\n build: `${packageManager} run build:ui && tsc`,\n \"build:ui\": \"vite build --config ui/vite.config.ts\",\n start: \"node dist/server/index.js\",\n },\n dependencies: {\n \"@mcp-apps-kit/core\": versions.core,\n \"@mcp-apps-kit/ui\": versions.ui,\n zod: \"^3.22.0\",\n ...(vercel ? { express: \"^4.21.0\" } : {}),\n },\n devDependencies: {\n concurrently: \"^8.2.0\",\n tsx: \"^4.7.0\",\n typescript: \"^5.3.0\",\n vite: \"^5.0.0\",\n \"vite-plugin-singlefile\": \"^2.0.0\",\n },\n },\n null,\n 2\n ),\n \"tsconfig.json\": JSON.stringify(\n {\n compilerOptions: {\n target: \"ES2020\",\n module: \"ESNext\",\n moduleResolution: \"bundler\",\n strict: true,\n esModuleInterop: true,\n skipLibCheck: true,\n declaration: true,\n outDir: \"dist\",\n },\n include: [\"server/**/*\", \"ui/src/**/*\"],\n exclude: [\"node_modules\", \"dist\"],\n },\n null,\n 2\n ),\n \"server/index.ts\": vercel\n ? `/**\n * ${name} - MCP Server\n */\n\n// Required for Vercel to detect Express\nimport \"express\";\n\nimport { createApp } from \"@mcp-apps-kit/core\";\nimport { z } from \"zod\";\n\nconst app = createApp({\n name: \"${name}\",\n version: \"0.1.0\",\n\n tools: {\n hello: {\n description: \"Say hello to someone\",\n input: z.object({\n name: z.string().describe(\"Name to greet\"),\n }),\n output: z.object({\n message: z.string(),\n timestamp: z.string(),\n }),\n handler: async ({ name }) => {\n return {\n message: \\`Hello, \\${name}!\\`,\n timestamp: new Date().toISOString(),\n };\n },\n ui: \"greeting\",\n },\n },\n\n ui: {\n greeting: {\n html: \"./${uiOutputDir}/index.html\",\n description: \"Greeting widget\",\n prefersBorder: true,\n },\n },\n});\n\n// Only start locally - Vercel uses the exported Express app\nif (!process.env.VERCEL) {\n await app.start({ port: 3000 });\n console.log(\"MCP server running on http://localhost:3000\");\n}\n\n// Export Express app for Vercel\nexport default app.expressApp;\n`\n : `/**\n * ${name} - MCP Server\n */\n\nimport { createApp } from \"@mcp-apps-kit/core\";\nimport { z } from \"zod\";\n\nconst app = createApp({\n name: \"${name}\",\n version: \"0.1.0\",\n\n tools: {\n hello: {\n description: \"Say hello to someone\",\n input: z.object({\n name: z.string().describe(\"Name to greet\"),\n }),\n output: z.object({\n message: z.string(),\n timestamp: z.string(),\n }),\n handler: async ({ name }) => {\n return {\n message: \\`Hello, \\${name}!\\`,\n timestamp: new Date().toISOString(),\n };\n },\n ui: \"greeting\",\n },\n },\n\n ui: {\n greeting: {\n html: \"./ui/dist/index.html\",\n description: \"Greeting widget\",\n prefersBorder: true,\n },\n },\n});\n\n// Start server\nawait app.start({ port: 3000 });\nconsole.log(\"MCP server running on http://localhost:3000\");\n`,\n \"ui/src/main.ts\": `/**\n * ${name} - UI Entry Point\n */\n\nimport { createClient } from \"@mcp-apps-kit/ui\";\nimport \"./styles.css\";\n\nasync function main() {\n const client = await createClient();\n\n // Get container\n const container = document.getElementById(\"app\");\n if (!container) throw new Error(\"Container not found\");\n\n // Render initial UI\n render(container, client);\n\n // Subscribe to context changes\n client.onHostContextChange((context) => {\n document.documentElement.className = context.theme;\n render(container, client);\n });\n}\n\nfunction render(container: HTMLElement, client: ReturnType<typeof createClient> extends Promise<infer T> ? T : never) {\n const output = client.toolOutput as { message?: string; timestamp?: string } | undefined;\n const context = client.hostContext;\n\n container.innerHTML = \\`\n <div class=\"container\">\n \\${output?.message ? \\`\n <div class=\"greeting\">\n <h1>\\${output.message}</h1>\n <p class=\"timestamp\">Sent at: \\${output.timestamp}</p>\n </div>\n \\` : \\`\n <p class=\"waiting\">Waiting for greeting...</p>\n \\`}\n\n <button class=\"button\" id=\"request-btn\">\n Request New Greeting\n </button>\n\n <footer class=\"meta\">\n Theme: \\${context.theme} | Locale: \\${context.locale}\n </footer>\n </div>\n \\`;\n\n // Add event listener\n const btn = document.getElementById(\"request-btn\");\n btn?.addEventListener(\"click\", () => {\n client.sendFollowUpMessage(\"Please greet me again!\");\n });\n}\n\nmain();\n`,\n \"ui/src/styles.css\": `* {\n margin: 0;\n padding: 0;\n box-sizing: border-box;\n}\n\nbody {\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;\n padding: 16px;\n}\n\n.container {\n max-width: 400px;\n margin: 0 auto;\n}\n\n.greeting h1 {\n font-size: 1.5rem;\n margin-bottom: 8px;\n}\n\n.timestamp {\n color: #666;\n font-size: 0.875rem;\n}\n\n.waiting {\n color: #999;\n font-style: italic;\n}\n\n.button {\n margin-top: 16px;\n padding: 8px 16px;\n background: #0066cc;\n color: white;\n border: none;\n border-radius: 4px;\n cursor: pointer;\n}\n\n.button:hover {\n background: #0052a3;\n}\n\n.meta {\n margin-top: 24px;\n padding-top: 16px;\n border-top: 1px solid #eee;\n font-size: 0.75rem;\n color: #999;\n}\n\n/* Dark mode support */\n.dark body {\n background: #1a1a1a;\n color: #fff;\n}\n\n.dark .timestamp {\n color: #aaa;\n}\n\n.dark .meta {\n border-color: #333;\n color: #666;\n}\n`,\n \"ui/index.html\": `<!DOCTYPE html>\n<html lang=\"en\">\n <head>\n <meta charset=\"UTF-8\" />\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n <title>${name}</title>\n </head>\n <body>\n <div id=\"app\"></div>\n <script type=\"module\" src=\"/src/main.ts\"></script>\n </body>\n</html>\n`,\n \"ui/vite.config.ts\": `import { defineConfig } from \"vite\";\nimport { viteSingleFile } from \"vite-plugin-singlefile\";\n\nexport default defineConfig({\n plugins: [viteSingleFile()],\n root: \"./ui\",\n build: {\n outDir: \"${uiOutputDir}\",\n emptyOutDir: true,\n },\n});\n`,\n \".gitignore\": `node_modules/\ndist/\npublic/\n*.log\n.env\n.env.local\n`,\n \"README.md\": `# ${name}\n\nAn MCP application built with @mcp-apps-kit.\n\n## Development\n\n\\`\\`\\`bash\n${packageManager} install\n${packageManager} run dev\n\\`\\`\\`\n\n## Build\n\n\\`\\`\\`bash\n${packageManager} run build\n\\`\\`\\`\n\n## Connecting to Claude Desktop\n\nAdd to your Claude Desktop config:\n\n\\`\\`\\`json\n{\n \"mcpServers\": {\n \"${name}\": {\n \"command\": \"npx\",\n \"args\": [\"tsx\", \"path/to/${name}/server/index.ts\"]\n }\n }\n}\n\\`\\`\\`\n${\n vercel\n ? `\n## Deploy to Vercel\n\nThis project is configured for Vercel deployment:\n\n\\`\\`\\`bash\nvercel deploy\n\\`\\`\\`\n\nThen use the deployed URL as your MCP server endpoint.\n`\n : \"\"\n}\n`,\n };\n\n // Add vercel.json if Vercel setup is enabled\n if (vercel) {\n files[\"vercel.json\"] = JSON.stringify(\n {\n installCommand: \"npm install\",\n buildCommand: \"npm run build:ui\",\n outputDirectory: \".\",\n functions: {\n \"server/index.ts\": {\n includeFiles: `${uiOutputDir}/**`,\n },\n },\n rewrites: [\n {\n source: \"/(.*)\",\n destination: \"/server/index.ts\",\n },\n ],\n },\n null,\n 2\n );\n }\n\n return files;\n}\n\n// =============================================================================\n// Scaffolding Logic\n// =============================================================================\n\n/**\n * Scaffold a new MCP application project\n */\nexport async function scaffoldProject(options: CreateAppOptions): Promise<void> {\n const {\n name,\n template,\n directory,\n vercel = false,\n skipInstall = false,\n skipGit = false,\n } = options;\n\n // Determine project directory\n const projectDir = directory ?? path.resolve(process.cwd(), name);\n\n // Check if directory exists and is not empty\n if (fs.existsSync(projectDir)) {\n const files = fs.readdirSync(projectDir);\n if (files.length > 0) {\n throw new Error(`Directory ${projectDir} is not empty. Please use an empty directory.`);\n }\n } else {\n fs.mkdirSync(projectDir, { recursive: true });\n }\n\n // Get template files\n const templateFiles =\n template === \"react\" ? getReactTemplate(name, vercel) : getVanillaTemplate(name, vercel);\n\n // Write all files\n for (const [filePath, content] of Object.entries(templateFiles)) {\n const fullPath = path.join(projectDir, filePath);\n const dir = path.dirname(fullPath);\n\n // Create directory if needed\n if (!fs.existsSync(dir)) {\n fs.mkdirSync(dir, { recursive: true });\n }\n\n // Write file\n fs.writeFileSync(fullPath, content, \"utf-8\");\n }\n\n // Initialize git repository\n if (!skipGit) {\n try {\n execSync(\"git init\", { cwd: projectDir, stdio: \"ignore\" });\n } catch {\n // Ignore git init errors (git may not be installed)\n }\n }\n\n // Install dependencies\n if (!skipInstall) {\n try {\n if (vercel) {\n // Use npm for Vercel projects (better compatibility)\n execSync(\"npm install\", { cwd: projectDir, stdio: \"inherit\" });\n } else {\n // Try pnpm first, fall back to npm\n try {\n execSync(\"pnpm install\", { cwd: projectDir, stdio: \"inherit\" });\n } catch {\n execSync(\"npm install\", { cwd: projectDir, stdio: \"inherit\" });\n }\n }\n } catch {\n // eslint-disable-next-line no-console\n console.warn(\"Warning: Could not install dependencies automatically.\");\n }\n }\n}\n"]}
{"version":3,"sources":["../src/index.ts"],"names":["execSync","path","fs"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkCA,IAAI,cAAA,GAAyC,IAAA;AAK7C,SAAS,mBAAmB,WAAA,EAA6B;AACvD,EAAA,IAAI;AACF,IAAA,MAAM,MAAA,GAASA,sBAAA,CAAS,CAAA,SAAA,EAAY,WAAW,CAAA,QAAA,CAAA,EAAY;AAAA,MACzD,QAAA,EAAU,OAAA;AAAA,MACV,KAAA,EAAO,CAAC,MAAA,EAAQ,MAAA,EAAQ,MAAM;AAAA,KAC/B,EAAE,IAAA,EAAK;AACR,IAAA,OAAO,IAAI,MAAM,CAAA,CAAA;AAAA,EACnB,CAAA,CAAA,MAAQ;AAEN,IAAA,OAAO,QAAA;AAAA,EACT;AACF;AAKA,SAAS,kBAAA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,EACF;AACF","file":"index.cjs","sourcesContent":["/**\n * @mcp-apps-kit/create-app\n *\n * Project scaffolding for MCP applications.\n */\n\nimport * as fs from \"node:fs\";\nimport * as path from \"node:path\";\nimport { execSync } from \"node:child_process\";\n\n// =============================================================================\n// Types\n// =============================================================================\n\nexport interface CreateAppOptions {\n name: string;\n template: \"react\" | \"vanilla\";\n directory?: string;\n vercel?: boolean;\n skipInstall?: boolean;\n skipGit?: boolean;\n}\n\n// =============================================================================\n// Version Detection\n// =============================================================================\n\ninterface PackageVersions {\n core: string;\n ui: string;\n uiReact: string;\n}\n\n// Cache for fetched versions\nlet cachedVersions: PackageVersions | null = null;\n\n/**\n * Fetch the latest version of a package from npm registry\n */\nfunction fetchLatestVersion(packageName: string): string {\n try {\n const result = execSync(`npm view ${packageName} version`, {\n encoding: \"utf-8\",\n stdio: [\"pipe\", \"pipe\", \"pipe\"],\n }).trim();\n return `^${result}`;\n } catch {\n // Fallback to a reasonable default if we can't fetch\n return \"^0.2.0\";\n }\n}\n\n/**\n * Get the versions of @mcp-apps-kit packages from npm registry\n */\nfunction getPackageVersions(): PackageVersions {\n if (cachedVersions) {\n return cachedVersions;\n }\n\n cachedVersions = {\n core: fetchLatestVersion(\"@mcp-apps-kit/core\"),\n ui: fetchLatestVersion(\"@mcp-apps-kit/ui\"),\n uiReact: fetchLatestVersion(\"@mcp-apps-kit/ui-react\"),\n };\n\n return cachedVersions;\n}\n\n// =============================================================================\n// Template Content\n// =============================================================================\n\nfunction getReactTemplate(name: string, vercel = false): Record<string, string> {\n const uiOutputDir = vercel ? \"public\" : \"dist\";\n const packageManager = vercel ? \"npm\" : \"pnpm\";\n const versions = getPackageVersions();\n\n const files: Record<string, string> = {\n \"package.json\": JSON.stringify(\n {\n name,\n version: \"0.1.0\",\n type: \"module\",\n scripts: {\n dev: `concurrently \"${packageManager} run dev:server\" \"${packageManager} run dev:ui\"`,\n \"dev:server\": \"tsx watch server/index.ts\",\n \"dev:ui\": \"vite --config ui/vite.config.ts\",\n build: `${packageManager} run build:ui && tsc`,\n \"build:ui\": \"vite build --config ui/vite.config.ts\",\n start: \"node dist/server/index.js\",\n },\n dependencies: {\n \"@mcp-apps-kit/core\": versions.core,\n \"@mcp-apps-kit/ui\": versions.ui,\n \"@mcp-apps-kit/ui-react\": versions.uiReact,\n react: \"^18.2.0\",\n \"react-dom\": \"^18.2.0\",\n zod: \"^3.22.0\",\n ...(vercel ? { express: \"^4.21.0\" } : {}),\n },\n devDependencies: {\n \"@types/react\": \"^18.2.0\",\n \"@types/react-dom\": \"^18.2.0\",\n \"@vitejs/plugin-react\": \"^4.2.0\",\n concurrently: \"^8.2.0\",\n tsx: \"^4.7.0\",\n typescript: \"^5.3.0\",\n vite: \"^5.0.0\",\n \"vite-plugin-singlefile\": \"^2.0.0\",\n },\n },\n null,\n 2\n ),\n \"tsconfig.json\": JSON.stringify(\n {\n compilerOptions: {\n target: \"ES2020\",\n module: \"ESNext\",\n moduleResolution: \"bundler\",\n strict: true,\n esModuleInterop: true,\n skipLibCheck: true,\n declaration: true,\n outDir: \"dist\",\n jsx: \"react-jsx\",\n },\n include: [\"server/**/*\", \"ui/src/**/*\"],\n exclude: [\"node_modules\", \"dist\"],\n },\n null,\n 2\n ),\n \"server/index.ts\": vercel\n ? `/**\n * ${name} - MCP Server\n */\n\n// Required for Vercel to detect Express\nimport \"express\";\n\nimport { createApp, defineTool, defineUI } from \"@mcp-apps-kit/core\";\nimport { z } from \"zod\";\n\n// Define the UI for displaying greetings\nconst greetingUI = defineUI({\n name: \"Greeting Widget\",\n description: \"Displays greeting messages\",\n html: \"./${uiOutputDir}/index.html\",\n prefersBorder: true,\n});\n\nconst app = createApp({\n name: \"${name}\",\n version: \"0.1.0\",\n\n tools: {\n hello: defineTool({\n title: \"Hello\",\n description: \"Say hello to someone\",\n input: z.object({\n name: z.string().describe(\"Name to greet\"),\n }),\n output: z.object({\n message: z.string(),\n timestamp: z.string(),\n }),\n handler: async ({ name }) => {\n return {\n message: \\`Hello, \\${name}!\\`,\n timestamp: new Date().toISOString(),\n };\n },\n ui: greetingUI,\n }),\n },\n});\n\n// Only start locally - Vercel uses the exported Express app\nif (!process.env.VERCEL) {\n await app.start({ port: 3000 });\n console.log(\"MCP server running on http://localhost:3000\");\n}\n\n// Export Express app for Vercel\nexport default app.expressApp;\n`\n : `/**\n * ${name} - MCP Server\n */\n\nimport { createApp, defineTool, defineUI } from \"@mcp-apps-kit/core\";\nimport { z } from \"zod\";\n\n// Define the UI for displaying greetings\nconst greetingUI = defineUI({\n name: \"Greeting Widget\",\n description: \"Displays greeting messages\",\n html: \"./ui/dist/index.html\",\n prefersBorder: true,\n});\n\nconst app = createApp({\n name: \"${name}\",\n version: \"0.1.0\",\n\n tools: {\n hello: defineTool({\n title: \"Hello\",\n description: \"Say hello to someone\",\n input: z.object({\n name: z.string().describe(\"Name to greet\"),\n }),\n output: z.object({\n message: z.string(),\n timestamp: z.string(),\n }),\n handler: async ({ name }) => {\n return {\n message: \\`Hello, \\${name}!\\`,\n timestamp: new Date().toISOString(),\n };\n },\n ui: greetingUI,\n }),\n },\n});\n\n// Start server\nawait app.start({ port: 3000 });\nconsole.log(\"MCP server running on http://localhost:3000\");\n`,\n \"ui/src/App.tsx\": `/**\n * ${name} - UI Component\n */\n\nimport {\n useAppsClient,\n useHostContext,\n useDocumentTheme,\n useHostStyleVariables,\n} from \"@mcp-apps-kit/ui-react\";\n\nexport function App() {\n const client = useAppsClient();\n const context = useHostContext();\n\n // Apply theme and host styles\n useDocumentTheme(\"light\", \"dark\");\n useHostStyleVariables();\n\n // Get tool output from client\n const output = client.toolOutput as { message?: string; timestamp?: string } | undefined;\n\n return (\n <div className=\"container\">\n {output?.message ? (\n <div className=\"greeting\">\n <h1>{output.message}</h1>\n <p className=\"timestamp\">Sent at: {output.timestamp}</p>\n </div>\n ) : (\n <p className=\"waiting\">Waiting for greeting...</p>\n )}\n\n <button\n className=\"button\"\n onClick={() => client.sendFollowUpMessage(\"Please greet me again!\")}\n >\n Request New Greeting\n </button>\n\n <footer className=\"meta\">\n Theme: {context.theme} | Locale: {context.locale}\n </footer>\n </div>\n );\n}\n`,\n \"ui/src/main.tsx\": `/**\n * ${name} - UI Entry Point\n */\n\nimport React from \"react\";\nimport { createRoot } from \"react-dom/client\";\nimport { AppsProvider } from \"@mcp-apps-kit/ui-react\";\nimport { App } from \"./App\";\nimport \"./styles.css\";\n\nconst root = document.getElementById(\"root\");\nif (!root) throw new Error(\"Root element not found\");\n\ncreateRoot(root).render(\n <React.StrictMode>\n <AppsProvider>\n <App />\n </AppsProvider>\n </React.StrictMode>\n);\n`,\n \"ui/src/styles.css\": `* {\n margin: 0;\n padding: 0;\n box-sizing: border-box;\n}\n\nbody {\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;\n padding: 16px;\n}\n\n.container {\n max-width: 400px;\n margin: 0 auto;\n}\n\n.greeting h1 {\n font-size: 1.5rem;\n margin-bottom: 8px;\n}\n\n.timestamp {\n color: #666;\n font-size: 0.875rem;\n}\n\n.waiting {\n color: #999;\n font-style: italic;\n}\n\n.button {\n margin-top: 16px;\n padding: 8px 16px;\n background: #0066cc;\n color: white;\n border: none;\n border-radius: 4px;\n cursor: pointer;\n}\n\n.button:hover {\n background: #0052a3;\n}\n\n.meta {\n margin-top: 24px;\n padding-top: 16px;\n border-top: 1px solid #eee;\n font-size: 0.75rem;\n color: #999;\n}\n\n/* Dark mode support */\n.dark body {\n background: #1a1a1a;\n color: #fff;\n}\n\n.dark .timestamp {\n color: #aaa;\n}\n\n.dark .meta {\n border-color: #333;\n color: #666;\n}\n`,\n \"ui/index.html\": `<!DOCTYPE html>\n<html lang=\"en\">\n <head>\n <meta charset=\"UTF-8\" />\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n <title>${name}</title>\n </head>\n <body>\n <div id=\"root\"></div>\n <script type=\"module\" src=\"/src/main.tsx\"></script>\n </body>\n</html>\n`,\n \"ui/vite.config.ts\": `import { defineConfig } from \"vite\";\nimport react from \"@vitejs/plugin-react\";\nimport { viteSingleFile } from \"vite-plugin-singlefile\";\n\nexport default defineConfig({\n plugins: [react(), viteSingleFile()],\n root: \"./ui\",\n build: {\n outDir: \"${uiOutputDir}\",\n emptyOutDir: true,\n },\n});\n`,\n \".gitignore\": `node_modules/\ndist/\npublic/\n*.log\n.env\n.env.local\n`,\n \"README.md\": `# ${name}\n\nAn MCP application built with @mcp-apps-kit.\n\n## Development\n\n\\`\\`\\`bash\n${packageManager} install\n${packageManager} run dev\n\\`\\`\\`\n\n## Build\n\n\\`\\`\\`bash\n${packageManager} run build\n\\`\\`\\`\n\n## Connecting to Claude Desktop\n\nAdd to your Claude Desktop config:\n\n\\`\\`\\`json\n{\n \"mcpServers\": {\n \"${name}\": {\n \"command\": \"npx\",\n \"args\": [\"tsx\", \"path/to/${name}/server/index.ts\"]\n }\n }\n}\n\\`\\`\\`\n${\n vercel\n ? `\n## Deploy to Vercel\n\nThis project is configured for Vercel deployment:\n\n\\`\\`\\`bash\nvercel deploy\n\\`\\`\\`\n\nThen use the deployed URL as your MCP server endpoint.\n`\n : \"\"\n}\n`,\n };\n\n // Add vercel.json if Vercel setup is enabled\n if (vercel) {\n files[\"vercel.json\"] = JSON.stringify(\n {\n installCommand: \"npm install\",\n buildCommand: \"npm run build:ui\",\n outputDirectory: \".\",\n functions: {\n \"server/index.ts\": {\n includeFiles: `${uiOutputDir}/**`,\n },\n },\n rewrites: [\n {\n source: \"/(.*)\",\n destination: \"/server/index.ts\",\n },\n ],\n },\n null,\n 2\n );\n }\n\n return files;\n}\n\nfunction getVanillaTemplate(name: string, vercel = false): Record<string, string> {\n const uiOutputDir = vercel ? \"public\" : \"dist\";\n const packageManager = vercel ? \"npm\" : \"pnpm\";\n const versions = getPackageVersions();\n\n const files: Record<string, string> = {\n \"package.json\": JSON.stringify(\n {\n name,\n version: \"0.1.0\",\n type: \"module\",\n scripts: {\n dev: `concurrently \"${packageManager} run dev:server\" \"${packageManager} run dev:ui\"`,\n \"dev:server\": \"tsx watch server/index.ts\",\n \"dev:ui\": \"vite --config ui/vite.config.ts\",\n build: `${packageManager} run build:ui && tsc`,\n \"build:ui\": \"vite build --config ui/vite.config.ts\",\n start: \"node dist/server/index.js\",\n },\n dependencies: {\n \"@mcp-apps-kit/core\": versions.core,\n \"@mcp-apps-kit/ui\": versions.ui,\n zod: \"^3.22.0\",\n ...(vercel ? { express: \"^4.21.0\" } : {}),\n },\n devDependencies: {\n concurrently: \"^8.2.0\",\n tsx: \"^4.7.0\",\n typescript: \"^5.3.0\",\n vite: \"^5.0.0\",\n \"vite-plugin-singlefile\": \"^2.0.0\",\n },\n },\n null,\n 2\n ),\n \"tsconfig.json\": JSON.stringify(\n {\n compilerOptions: {\n target: \"ES2020\",\n module: \"ESNext\",\n moduleResolution: \"bundler\",\n strict: true,\n esModuleInterop: true,\n skipLibCheck: true,\n declaration: true,\n outDir: \"dist\",\n },\n include: [\"server/**/*\", \"ui/src/**/*\"],\n exclude: [\"node_modules\", \"dist\"],\n },\n null,\n 2\n ),\n \"server/index.ts\": vercel\n ? `/**\n * ${name} - MCP Server\n */\n\n// Required for Vercel to detect Express\nimport \"express\";\n\nimport { createApp, defineTool, defineUI } from \"@mcp-apps-kit/core\";\nimport { z } from \"zod\";\n\n// Define the UI for displaying greetings\nconst greetingUI = defineUI({\n name: \"Greeting Widget\",\n description: \"Displays greeting messages\",\n html: \"./${uiOutputDir}/index.html\",\n prefersBorder: true,\n});\n\nconst app = createApp({\n name: \"${name}\",\n version: \"0.1.0\",\n\n tools: {\n hello: defineTool({\n title: \"Hello\",\n description: \"Say hello to someone\",\n input: z.object({\n name: z.string().describe(\"Name to greet\"),\n }),\n output: z.object({\n message: z.string(),\n timestamp: z.string(),\n }),\n handler: async ({ name }) => {\n return {\n message: \\`Hello, \\${name}!\\`,\n timestamp: new Date().toISOString(),\n };\n },\n ui: greetingUI,\n }),\n },\n});\n\n// Only start locally - Vercel uses the exported Express app\nif (!process.env.VERCEL) {\n await app.start({ port: 3000 });\n console.log(\"MCP server running on http://localhost:3000\");\n}\n\n// Export Express app for Vercel\nexport default app.expressApp;\n`\n : `/**\n * ${name} - MCP Server\n */\n\nimport { createApp, defineTool, defineUI } from \"@mcp-apps-kit/core\";\nimport { z } from \"zod\";\n\n// Define the UI for displaying greetings\nconst greetingUI = defineUI({\n name: \"Greeting Widget\",\n description: \"Displays greeting messages\",\n html: \"./ui/dist/index.html\",\n prefersBorder: true,\n});\n\nconst app = createApp({\n name: \"${name}\",\n version: \"0.1.0\",\n\n tools: {\n hello: defineTool({\n title: \"Hello\",\n description: \"Say hello to someone\",\n input: z.object({\n name: z.string().describe(\"Name to greet\"),\n }),\n output: z.object({\n message: z.string(),\n timestamp: z.string(),\n }),\n handler: async ({ name }) => {\n return {\n message: \\`Hello, \\${name}!\\`,\n timestamp: new Date().toISOString(),\n };\n },\n ui: greetingUI,\n }),\n },\n});\n\n// Start server\nawait app.start({ port: 3000 });\nconsole.log(\"MCP server running on http://localhost:3000\");\n`,\n \"ui/src/main.ts\": `/**\n * ${name} - UI Entry Point\n */\n\nimport { createClient } from \"@mcp-apps-kit/ui\";\nimport \"./styles.css\";\n\nasync function main() {\n const client = await createClient();\n\n // Get container\n const container = document.getElementById(\"app\");\n if (!container) throw new Error(\"Container not found\");\n\n // Render initial UI\n render(container, client);\n\n // Subscribe to context changes\n client.onHostContextChange((context) => {\n document.documentElement.className = context.theme;\n render(container, client);\n });\n}\n\nfunction render(container: HTMLElement, client: ReturnType<typeof createClient> extends Promise<infer T> ? T : never) {\n const output = client.toolOutput as { message?: string; timestamp?: string } | undefined;\n const context = client.hostContext;\n\n container.innerHTML = \\`\n <div class=\"container\">\n \\${output?.message ? \\`\n <div class=\"greeting\">\n <h1>\\${output.message}</h1>\n <p class=\"timestamp\">Sent at: \\${output.timestamp}</p>\n </div>\n \\` : \\`\n <p class=\"waiting\">Waiting for greeting...</p>\n \\`}\n\n <button class=\"button\" id=\"request-btn\">\n Request New Greeting\n </button>\n\n <footer class=\"meta\">\n Theme: \\${context.theme} | Locale: \\${context.locale}\n </footer>\n </div>\n \\`;\n\n // Add event listener\n const btn = document.getElementById(\"request-btn\");\n btn?.addEventListener(\"click\", () => {\n client.sendFollowUpMessage(\"Please greet me again!\");\n });\n}\n\nmain();\n`,\n \"ui/src/styles.css\": `* {\n margin: 0;\n padding: 0;\n box-sizing: border-box;\n}\n\nbody {\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;\n padding: 16px;\n}\n\n.container {\n max-width: 400px;\n margin: 0 auto;\n}\n\n.greeting h1 {\n font-size: 1.5rem;\n margin-bottom: 8px;\n}\n\n.timestamp {\n color: #666;\n font-size: 0.875rem;\n}\n\n.waiting {\n color: #999;\n font-style: italic;\n}\n\n.button {\n margin-top: 16px;\n padding: 8px 16px;\n background: #0066cc;\n color: white;\n border: none;\n border-radius: 4px;\n cursor: pointer;\n}\n\n.button:hover {\n background: #0052a3;\n}\n\n.meta {\n margin-top: 24px;\n padding-top: 16px;\n border-top: 1px solid #eee;\n font-size: 0.75rem;\n color: #999;\n}\n\n/* Dark mode support */\n.dark body {\n background: #1a1a1a;\n color: #fff;\n}\n\n.dark .timestamp {\n color: #aaa;\n}\n\n.dark .meta {\n border-color: #333;\n color: #666;\n}\n`,\n \"ui/index.html\": `<!DOCTYPE html>\n<html lang=\"en\">\n <head>\n <meta charset=\"UTF-8\" />\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n <title>${name}</title>\n </head>\n <body>\n <div id=\"app\"></div>\n <script type=\"module\" src=\"/src/main.ts\"></script>\n </body>\n</html>\n`,\n \"ui/vite.config.ts\": `import { defineConfig } from \"vite\";\nimport { viteSingleFile } from \"vite-plugin-singlefile\";\n\nexport default defineConfig({\n plugins: [viteSingleFile()],\n root: \"./ui\",\n build: {\n outDir: \"${uiOutputDir}\",\n emptyOutDir: true,\n },\n});\n`,\n \".gitignore\": `node_modules/\ndist/\npublic/\n*.log\n.env\n.env.local\n`,\n \"README.md\": `# ${name}\n\nAn MCP application built with @mcp-apps-kit.\n\n## Development\n\n\\`\\`\\`bash\n${packageManager} install\n${packageManager} run dev\n\\`\\`\\`\n\n## Build\n\n\\`\\`\\`bash\n${packageManager} run build\n\\`\\`\\`\n\n## Connecting to Claude Desktop\n\nAdd to your Claude Desktop config:\n\n\\`\\`\\`json\n{\n \"mcpServers\": {\n \"${name}\": {\n \"command\": \"npx\",\n \"args\": [\"tsx\", \"path/to/${name}/server/index.ts\"]\n }\n }\n}\n\\`\\`\\`\n${\n vercel\n ? `\n## Deploy to Vercel\n\nThis project is configured for Vercel deployment:\n\n\\`\\`\\`bash\nvercel deploy\n\\`\\`\\`\n\nThen use the deployed URL as your MCP server endpoint.\n`\n : \"\"\n}\n`,\n };\n\n // Add vercel.json if Vercel setup is enabled\n if (vercel) {\n files[\"vercel.json\"] = JSON.stringify(\n {\n installCommand: \"npm install\",\n buildCommand: \"npm run build:ui\",\n outputDirectory: \".\",\n functions: {\n \"server/index.ts\": {\n includeFiles: `${uiOutputDir}/**`,\n },\n },\n rewrites: [\n {\n source: \"/(.*)\",\n destination: \"/server/index.ts\",\n },\n ],\n },\n null,\n 2\n );\n }\n\n return files;\n}\n\n// =============================================================================\n// Scaffolding Logic\n// =============================================================================\n\n/**\n * Scaffold a new MCP application project\n */\nexport async function scaffoldProject(options: CreateAppOptions): Promise<void> {\n const {\n name,\n template,\n directory,\n vercel = false,\n skipInstall = false,\n skipGit = false,\n } = options;\n\n // Determine project directory\n const projectDir = directory ?? path.resolve(process.cwd(), name);\n\n // Check if directory exists and is not empty\n if (fs.existsSync(projectDir)) {\n const files = fs.readdirSync(projectDir);\n if (files.length > 0) {\n throw new Error(`Directory ${projectDir} is not empty. Please use an empty directory.`);\n }\n } else {\n fs.mkdirSync(projectDir, { recursive: true });\n }\n\n // Get template files\n const templateFiles =\n template === \"react\" ? getReactTemplate(name, vercel) : getVanillaTemplate(name, vercel);\n\n // Write all files\n for (const [filePath, content] of Object.entries(templateFiles)) {\n const fullPath = path.join(projectDir, filePath);\n const dir = path.dirname(fullPath);\n\n // Create directory if needed\n if (!fs.existsSync(dir)) {\n fs.mkdirSync(dir, { recursive: true });\n }\n\n // Write file\n fs.writeFileSync(fullPath, content, \"utf-8\");\n }\n\n // Initialize git repository\n if (!skipGit) {\n try {\n execSync(\"git init\", { cwd: projectDir, stdio: \"ignore\" });\n } catch {\n // Ignore git init errors (git may not be installed)\n }\n }\n\n // Install dependencies\n if (!skipInstall) {\n try {\n if (vercel) {\n // Use npm for Vercel projects (better compatibility)\n execSync(\"npm install\", { cwd: projectDir, stdio: \"inherit\" });\n } else {\n // Try pnpm first, fall back to npm\n try {\n execSync(\"pnpm install\", { cwd: projectDir, stdio: \"inherit\" });\n } catch {\n execSync(\"npm install\", { cwd: projectDir, stdio: \"inherit\" });\n }\n }\n } catch {\n // eslint-disable-next-line no-console\n console.warn(\"Warning: Could not install dependencies automatically.\");\n }\n }\n}\n"]}

@@ -96,5 +96,13 @@ import * as fs from 'fs';

import { createApp } from "@mcp-apps-kit/core";
import { createApp, defineTool, defineUI } from "@mcp-apps-kit/core";
import { z } from "zod";
// Define the UI for displaying greetings
const greetingUI = defineUI({
name: "Greeting Widget",
description: "Displays greeting messages",
html: "./${uiOutputDir}/index.html",
prefersBorder: true,
});
const app = createApp({

@@ -105,3 +113,4 @@ name: "${name}",

tools: {
hello: {
hello: defineTool({
title: "Hello",
description: "Say hello to someone",

@@ -121,13 +130,5 @@ input: z.object({

},
ui: "greeting",
},
ui: greetingUI,
}),
},
ui: {
greeting: {
html: "./${uiOutputDir}/index.html",
description: "Greeting widget",
prefersBorder: true,
},
},
});

@@ -147,5 +148,13 @@

import { createApp } from "@mcp-apps-kit/core";
import { createApp, defineTool, defineUI } from "@mcp-apps-kit/core";
import { z } from "zod";
// Define the UI for displaying greetings
const greetingUI = defineUI({
name: "Greeting Widget",
description: "Displays greeting messages",
html: "./ui/dist/index.html",
prefersBorder: true,
});
const app = createApp({

@@ -156,3 +165,4 @@ name: "${name}",

tools: {
hello: {
hello: defineTool({
title: "Hello",
description: "Say hello to someone",

@@ -172,13 +182,5 @@ input: z.object({

},
ui: "greeting",
},
ui: greetingUI,
}),
},
ui: {
greeting: {
html: "./ui/dist/index.html",
description: "Greeting widget",
prefersBorder: true,
},
},
});

@@ -487,5 +489,13 @@

import { createApp } from "@mcp-apps-kit/core";
import { createApp, defineTool, defineUI } from "@mcp-apps-kit/core";
import { z } from "zod";
// Define the UI for displaying greetings
const greetingUI = defineUI({
name: "Greeting Widget",
description: "Displays greeting messages",
html: "./${uiOutputDir}/index.html",
prefersBorder: true,
});
const app = createApp({

@@ -496,3 +506,4 @@ name: "${name}",

tools: {
hello: {
hello: defineTool({
title: "Hello",
description: "Say hello to someone",

@@ -512,13 +523,5 @@ input: z.object({

},
ui: "greeting",
},
ui: greetingUI,
}),
},
ui: {
greeting: {
html: "./${uiOutputDir}/index.html",
description: "Greeting widget",
prefersBorder: true,
},
},
});

@@ -538,5 +541,13 @@

import { createApp } from "@mcp-apps-kit/core";
import { createApp, defineTool, defineUI } from "@mcp-apps-kit/core";
import { z } from "zod";
// Define the UI for displaying greetings
const greetingUI = defineUI({
name: "Greeting Widget",
description: "Displays greeting messages",
html: "./ui/dist/index.html",
prefersBorder: true,
});
const app = createApp({

@@ -547,3 +558,4 @@ name: "${name}",

tools: {
hello: {
hello: defineTool({
title: "Hello",
description: "Say hello to someone",

@@ -563,13 +575,5 @@ input: z.object({

},
ui: "greeting",
},
ui: greetingUI,
}),
},
ui: {
greeting: {
html: "./ui/dist/index.html",
description: "Greeting widget",
prefersBorder: true,
},
},
});

@@ -576,0 +580,0 @@

@@ -1,1 +0,1 @@

{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;AAkCA,IAAI,cAAA,GAAyC,IAAA;AAK7C,SAAS,mBAAmB,WAAA,EAA6B;AACvD,EAAA,IAAI;AACF,IAAA,MAAM,MAAA,GAAS,QAAA,CAAS,CAAA,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AA,EAAO,WAAW,CAAA;AAAA,QAChE,CAAA,CAAA,MAAQ;AACN,UAAA,QAAA,CAAS,eAAe,EAAE,GAAA,EAAK,UAAA,EAAY,KAAA,EAAO,WAAW,CAAA;AAAA,QAC/D;AAAA,MACF;AAAA,IACF,CAAA,CAAA,MAAQ;AAEN,MAAA,OAAA,CAAQ,KAAK,wDAAwD,CAAA;AAAA,IACvE;AAAA,EACF;AACF","file":"index.js","sourcesContent":["/**\n * @mcp-apps-kit/create-app\n *\n * Project scaffolding for MCP applications.\n */\n\nimport * as fs from \"node:fs\";\nimport * as path from \"node:path\";\nimport { execSync } from \"node:child_process\";\n\n// =============================================================================\n// Types\n// =============================================================================\n\nexport interface CreateAppOptions {\n name: string;\n template: \"react\" | \"vanilla\";\n directory?: string;\n vercel?: boolean;\n skipInstall?: boolean;\n skipGit?: boolean;\n}\n\n// =============================================================================\n// Version Detection\n// =============================================================================\n\ninterface PackageVersions {\n core: string;\n ui: string;\n uiReact: string;\n}\n\n// Cache for fetched versions\nlet cachedVersions: PackageVersions | null = null;\n\n/**\n * Fetch the latest version of a package from npm registry\n */\nfunction fetchLatestVersion(packageName: string): string {\n try {\n const result = execSync(`npm view ${packageName} version`, {\n encoding: \"utf-8\",\n stdio: [\"pipe\", \"pipe\", \"pipe\"],\n }).trim();\n return `^${result}`;\n } catch {\n // Fallback to a reasonable default if we can't fetch\n return \"^0.2.0\";\n }\n}\n\n/**\n * Get the versions of @mcp-apps-kit packages from npm registry\n */\nfunction getPackageVersions(): PackageVersions {\n if (cachedVersions) {\n return cachedVersions;\n }\n\n cachedVersions = {\n core: fetchLatestVersion(\"@mcp-apps-kit/core\"),\n ui: fetchLatestVersion(\"@mcp-apps-kit/ui\"),\n uiReact: fetchLatestVersion(\"@mcp-apps-kit/ui-react\"),\n };\n\n return cachedVersions;\n}\n\n// =============================================================================\n// Template Content\n// =============================================================================\n\nfunction getReactTemplate(name: string, vercel = false): Record<string, string> {\n const uiOutputDir = vercel ? \"public\" : \"dist\";\n const packageManager = vercel ? \"npm\" : \"pnpm\";\n const versions = getPackageVersions();\n\n const files: Record<string, string> = {\n \"package.json\": JSON.stringify(\n {\n name,\n version: \"0.1.0\",\n type: \"module\",\n scripts: {\n dev: `concurrently \"${packageManager} run dev:server\" \"${packageManager} run dev:ui\"`,\n \"dev:server\": \"tsx watch server/index.ts\",\n \"dev:ui\": \"vite --config ui/vite.config.ts\",\n build: `${packageManager} run build:ui && tsc`,\n \"build:ui\": \"vite build --config ui/vite.config.ts\",\n start: \"node dist/server/index.js\",\n },\n dependencies: {\n \"@mcp-apps-kit/core\": versions.core,\n \"@mcp-apps-kit/ui\": versions.ui,\n \"@mcp-apps-kit/ui-react\": versions.uiReact,\n react: \"^18.2.0\",\n \"react-dom\": \"^18.2.0\",\n zod: \"^3.22.0\",\n ...(vercel ? { express: \"^4.21.0\" } : {}),\n },\n devDependencies: {\n \"@types/react\": \"^18.2.0\",\n \"@types/react-dom\": \"^18.2.0\",\n \"@vitejs/plugin-react\": \"^4.2.0\",\n concurrently: \"^8.2.0\",\n tsx: \"^4.7.0\",\n typescript: \"^5.3.0\",\n vite: \"^5.0.0\",\n \"vite-plugin-singlefile\": \"^2.0.0\",\n },\n },\n null,\n 2\n ),\n \"tsconfig.json\": JSON.stringify(\n {\n compilerOptions: {\n target: \"ES2020\",\n module: \"ESNext\",\n moduleResolution: \"bundler\",\n strict: true,\n esModuleInterop: true,\n skipLibCheck: true,\n declaration: true,\n outDir: \"dist\",\n jsx: \"react-jsx\",\n },\n include: [\"server/**/*\", \"ui/src/**/*\"],\n exclude: [\"node_modules\", \"dist\"],\n },\n null,\n 2\n ),\n \"server/index.ts\": vercel\n ? `/**\n * ${name} - MCP Server\n */\n\n// Required for Vercel to detect Express\nimport \"express\";\n\nimport { createApp } from \"@mcp-apps-kit/core\";\nimport { z } from \"zod\";\n\nconst app = createApp({\n name: \"${name}\",\n version: \"0.1.0\",\n\n tools: {\n hello: {\n description: \"Say hello to someone\",\n input: z.object({\n name: z.string().describe(\"Name to greet\"),\n }),\n output: z.object({\n message: z.string(),\n timestamp: z.string(),\n }),\n handler: async ({ name }) => {\n return {\n message: \\`Hello, \\${name}!\\`,\n timestamp: new Date().toISOString(),\n };\n },\n ui: \"greeting\",\n },\n },\n\n ui: {\n greeting: {\n html: \"./${uiOutputDir}/index.html\",\n description: \"Greeting widget\",\n prefersBorder: true,\n },\n },\n});\n\n// Only start locally - Vercel uses the exported Express app\nif (!process.env.VERCEL) {\n await app.start({ port: 3000 });\n console.log(\"MCP server running on http://localhost:3000\");\n}\n\n// Export Express app for Vercel\nexport default app.expressApp;\n`\n : `/**\n * ${name} - MCP Server\n */\n\nimport { createApp } from \"@mcp-apps-kit/core\";\nimport { z } from \"zod\";\n\nconst app = createApp({\n name: \"${name}\",\n version: \"0.1.0\",\n\n tools: {\n hello: {\n description: \"Say hello to someone\",\n input: z.object({\n name: z.string().describe(\"Name to greet\"),\n }),\n output: z.object({\n message: z.string(),\n timestamp: z.string(),\n }),\n handler: async ({ name }) => {\n return {\n message: \\`Hello, \\${name}!\\`,\n timestamp: new Date().toISOString(),\n };\n },\n ui: \"greeting\",\n },\n },\n\n ui: {\n greeting: {\n html: \"./ui/dist/index.html\",\n description: \"Greeting widget\",\n prefersBorder: true,\n },\n },\n});\n\n// Start server\nawait app.start({ port: 3000 });\nconsole.log(\"MCP server running on http://localhost:3000\");\n`,\n \"ui/src/App.tsx\": `/**\n * ${name} - UI Component\n */\n\nimport {\n useAppsClient,\n useHostContext,\n useDocumentTheme,\n useHostStyleVariables,\n} from \"@mcp-apps-kit/ui-react\";\n\nexport function App() {\n const client = useAppsClient();\n const context = useHostContext();\n\n // Apply theme and host styles\n useDocumentTheme(\"light\", \"dark\");\n useHostStyleVariables();\n\n // Get tool output from client\n const output = client.toolOutput as { message?: string; timestamp?: string } | undefined;\n\n return (\n <div className=\"container\">\n {output?.message ? (\n <div className=\"greeting\">\n <h1>{output.message}</h1>\n <p className=\"timestamp\">Sent at: {output.timestamp}</p>\n </div>\n ) : (\n <p className=\"waiting\">Waiting for greeting...</p>\n )}\n\n <button\n className=\"button\"\n onClick={() => client.sendFollowUpMessage(\"Please greet me again!\")}\n >\n Request New Greeting\n </button>\n\n <footer className=\"meta\">\n Theme: {context.theme} | Locale: {context.locale}\n </footer>\n </div>\n );\n}\n`,\n \"ui/src/main.tsx\": `/**\n * ${name} - UI Entry Point\n */\n\nimport React from \"react\";\nimport { createRoot } from \"react-dom/client\";\nimport { AppsProvider } from \"@mcp-apps-kit/ui-react\";\nimport { App } from \"./App\";\nimport \"./styles.css\";\n\nconst root = document.getElementById(\"root\");\nif (!root) throw new Error(\"Root element not found\");\n\ncreateRoot(root).render(\n <React.StrictMode>\n <AppsProvider>\n <App />\n </AppsProvider>\n </React.StrictMode>\n);\n`,\n \"ui/src/styles.css\": `* {\n margin: 0;\n padding: 0;\n box-sizing: border-box;\n}\n\nbody {\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;\n padding: 16px;\n}\n\n.container {\n max-width: 400px;\n margin: 0 auto;\n}\n\n.greeting h1 {\n font-size: 1.5rem;\n margin-bottom: 8px;\n}\n\n.timestamp {\n color: #666;\n font-size: 0.875rem;\n}\n\n.waiting {\n color: #999;\n font-style: italic;\n}\n\n.button {\n margin-top: 16px;\n padding: 8px 16px;\n background: #0066cc;\n color: white;\n border: none;\n border-radius: 4px;\n cursor: pointer;\n}\n\n.button:hover {\n background: #0052a3;\n}\n\n.meta {\n margin-top: 24px;\n padding-top: 16px;\n border-top: 1px solid #eee;\n font-size: 0.75rem;\n color: #999;\n}\n\n/* Dark mode support */\n.dark body {\n background: #1a1a1a;\n color: #fff;\n}\n\n.dark .timestamp {\n color: #aaa;\n}\n\n.dark .meta {\n border-color: #333;\n color: #666;\n}\n`,\n \"ui/index.html\": `<!DOCTYPE html>\n<html lang=\"en\">\n <head>\n <meta charset=\"UTF-8\" />\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n <title>${name}</title>\n </head>\n <body>\n <div id=\"root\"></div>\n <script type=\"module\" src=\"/src/main.tsx\"></script>\n </body>\n</html>\n`,\n \"ui/vite.config.ts\": `import { defineConfig } from \"vite\";\nimport react from \"@vitejs/plugin-react\";\nimport { viteSingleFile } from \"vite-plugin-singlefile\";\n\nexport default defineConfig({\n plugins: [react(), viteSingleFile()],\n root: \"./ui\",\n build: {\n outDir: \"${uiOutputDir}\",\n emptyOutDir: true,\n },\n});\n`,\n \".gitignore\": `node_modules/\ndist/\npublic/\n*.log\n.env\n.env.local\n`,\n \"README.md\": `# ${name}\n\nAn MCP application built with @mcp-apps-kit.\n\n## Development\n\n\\`\\`\\`bash\n${packageManager} install\n${packageManager} run dev\n\\`\\`\\`\n\n## Build\n\n\\`\\`\\`bash\n${packageManager} run build\n\\`\\`\\`\n\n## Connecting to Claude Desktop\n\nAdd to your Claude Desktop config:\n\n\\`\\`\\`json\n{\n \"mcpServers\": {\n \"${name}\": {\n \"command\": \"npx\",\n \"args\": [\"tsx\", \"path/to/${name}/server/index.ts\"]\n }\n }\n}\n\\`\\`\\`\n${\n vercel\n ? `\n## Deploy to Vercel\n\nThis project is configured for Vercel deployment:\n\n\\`\\`\\`bash\nvercel deploy\n\\`\\`\\`\n\nThen use the deployed URL as your MCP server endpoint.\n`\n : \"\"\n}\n`,\n };\n\n // Add vercel.json if Vercel setup is enabled\n if (vercel) {\n files[\"vercel.json\"] = JSON.stringify(\n {\n installCommand: \"npm install\",\n buildCommand: \"npm run build:ui\",\n outputDirectory: \".\",\n functions: {\n \"server/index.ts\": {\n includeFiles: `${uiOutputDir}/**`,\n },\n },\n rewrites: [\n {\n source: \"/(.*)\",\n destination: \"/server/index.ts\",\n },\n ],\n },\n null,\n 2\n );\n }\n\n return files;\n}\n\nfunction getVanillaTemplate(name: string, vercel = false): Record<string, string> {\n const uiOutputDir = vercel ? \"public\" : \"dist\";\n const packageManager = vercel ? \"npm\" : \"pnpm\";\n const versions = getPackageVersions();\n\n const files: Record<string, string> = {\n \"package.json\": JSON.stringify(\n {\n name,\n version: \"0.1.0\",\n type: \"module\",\n scripts: {\n dev: `concurrently \"${packageManager} run dev:server\" \"${packageManager} run dev:ui\"`,\n \"dev:server\": \"tsx watch server/index.ts\",\n \"dev:ui\": \"vite --config ui/vite.config.ts\",\n build: `${packageManager} run build:ui && tsc`,\n \"build:ui\": \"vite build --config ui/vite.config.ts\",\n start: \"node dist/server/index.js\",\n },\n dependencies: {\n \"@mcp-apps-kit/core\": versions.core,\n \"@mcp-apps-kit/ui\": versions.ui,\n zod: \"^3.22.0\",\n ...(vercel ? { express: \"^4.21.0\" } : {}),\n },\n devDependencies: {\n concurrently: \"^8.2.0\",\n tsx: \"^4.7.0\",\n typescript: \"^5.3.0\",\n vite: \"^5.0.0\",\n \"vite-plugin-singlefile\": \"^2.0.0\",\n },\n },\n null,\n 2\n ),\n \"tsconfig.json\": JSON.stringify(\n {\n compilerOptions: {\n target: \"ES2020\",\n module: \"ESNext\",\n moduleResolution: \"bundler\",\n strict: true,\n esModuleInterop: true,\n skipLibCheck: true,\n declaration: true,\n outDir: \"dist\",\n },\n include: [\"server/**/*\", \"ui/src/**/*\"],\n exclude: [\"node_modules\", \"dist\"],\n },\n null,\n 2\n ),\n \"server/index.ts\": vercel\n ? `/**\n * ${name} - MCP Server\n */\n\n// Required for Vercel to detect Express\nimport \"express\";\n\nimport { createApp } from \"@mcp-apps-kit/core\";\nimport { z } from \"zod\";\n\nconst app = createApp({\n name: \"${name}\",\n version: \"0.1.0\",\n\n tools: {\n hello: {\n description: \"Say hello to someone\",\n input: z.object({\n name: z.string().describe(\"Name to greet\"),\n }),\n output: z.object({\n message: z.string(),\n timestamp: z.string(),\n }),\n handler: async ({ name }) => {\n return {\n message: \\`Hello, \\${name}!\\`,\n timestamp: new Date().toISOString(),\n };\n },\n ui: \"greeting\",\n },\n },\n\n ui: {\n greeting: {\n html: \"./${uiOutputDir}/index.html\",\n description: \"Greeting widget\",\n prefersBorder: true,\n },\n },\n});\n\n// Only start locally - Vercel uses the exported Express app\nif (!process.env.VERCEL) {\n await app.start({ port: 3000 });\n console.log(\"MCP server running on http://localhost:3000\");\n}\n\n// Export Express app for Vercel\nexport default app.expressApp;\n`\n : `/**\n * ${name} - MCP Server\n */\n\nimport { createApp } from \"@mcp-apps-kit/core\";\nimport { z } from \"zod\";\n\nconst app = createApp({\n name: \"${name}\",\n version: \"0.1.0\",\n\n tools: {\n hello: {\n description: \"Say hello to someone\",\n input: z.object({\n name: z.string().describe(\"Name to greet\"),\n }),\n output: z.object({\n message: z.string(),\n timestamp: z.string(),\n }),\n handler: async ({ name }) => {\n return {\n message: \\`Hello, \\${name}!\\`,\n timestamp: new Date().toISOString(),\n };\n },\n ui: \"greeting\",\n },\n },\n\n ui: {\n greeting: {\n html: \"./ui/dist/index.html\",\n description: \"Greeting widget\",\n prefersBorder: true,\n },\n },\n});\n\n// Start server\nawait app.start({ port: 3000 });\nconsole.log(\"MCP server running on http://localhost:3000\");\n`,\n \"ui/src/main.ts\": `/**\n * ${name} - UI Entry Point\n */\n\nimport { createClient } from \"@mcp-apps-kit/ui\";\nimport \"./styles.css\";\n\nasync function main() {\n const client = await createClient();\n\n // Get container\n const container = document.getElementById(\"app\");\n if (!container) throw new Error(\"Container not found\");\n\n // Render initial UI\n render(container, client);\n\n // Subscribe to context changes\n client.onHostContextChange((context) => {\n document.documentElement.className = context.theme;\n render(container, client);\n });\n}\n\nfunction render(container: HTMLElement, client: ReturnType<typeof createClient> extends Promise<infer T> ? T : never) {\n const output = client.toolOutput as { message?: string; timestamp?: string } | undefined;\n const context = client.hostContext;\n\n container.innerHTML = \\`\n <div class=\"container\">\n \\${output?.message ? \\`\n <div class=\"greeting\">\n <h1>\\${output.message}</h1>\n <p class=\"timestamp\">Sent at: \\${output.timestamp}</p>\n </div>\n \\` : \\`\n <p class=\"waiting\">Waiting for greeting...</p>\n \\`}\n\n <button class=\"button\" id=\"request-btn\">\n Request New Greeting\n </button>\n\n <footer class=\"meta\">\n Theme: \\${context.theme} | Locale: \\${context.locale}\n </footer>\n </div>\n \\`;\n\n // Add event listener\n const btn = document.getElementById(\"request-btn\");\n btn?.addEventListener(\"click\", () => {\n client.sendFollowUpMessage(\"Please greet me again!\");\n });\n}\n\nmain();\n`,\n \"ui/src/styles.css\": `* {\n margin: 0;\n padding: 0;\n box-sizing: border-box;\n}\n\nbody {\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;\n padding: 16px;\n}\n\n.container {\n max-width: 400px;\n margin: 0 auto;\n}\n\n.greeting h1 {\n font-size: 1.5rem;\n margin-bottom: 8px;\n}\n\n.timestamp {\n color: #666;\n font-size: 0.875rem;\n}\n\n.waiting {\n color: #999;\n font-style: italic;\n}\n\n.button {\n margin-top: 16px;\n padding: 8px 16px;\n background: #0066cc;\n color: white;\n border: none;\n border-radius: 4px;\n cursor: pointer;\n}\n\n.button:hover {\n background: #0052a3;\n}\n\n.meta {\n margin-top: 24px;\n padding-top: 16px;\n border-top: 1px solid #eee;\n font-size: 0.75rem;\n color: #999;\n}\n\n/* Dark mode support */\n.dark body {\n background: #1a1a1a;\n color: #fff;\n}\n\n.dark .timestamp {\n color: #aaa;\n}\n\n.dark .meta {\n border-color: #333;\n color: #666;\n}\n`,\n \"ui/index.html\": `<!DOCTYPE html>\n<html lang=\"en\">\n <head>\n <meta charset=\"UTF-8\" />\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n <title>${name}</title>\n </head>\n <body>\n <div id=\"app\"></div>\n <script type=\"module\" src=\"/src/main.ts\"></script>\n </body>\n</html>\n`,\n \"ui/vite.config.ts\": `import { defineConfig } from \"vite\";\nimport { viteSingleFile } from \"vite-plugin-singlefile\";\n\nexport default defineConfig({\n plugins: [viteSingleFile()],\n root: \"./ui\",\n build: {\n outDir: \"${uiOutputDir}\",\n emptyOutDir: true,\n },\n});\n`,\n \".gitignore\": `node_modules/\ndist/\npublic/\n*.log\n.env\n.env.local\n`,\n \"README.md\": `# ${name}\n\nAn MCP application built with @mcp-apps-kit.\n\n## Development\n\n\\`\\`\\`bash\n${packageManager} install\n${packageManager} run dev\n\\`\\`\\`\n\n## Build\n\n\\`\\`\\`bash\n${packageManager} run build\n\\`\\`\\`\n\n## Connecting to Claude Desktop\n\nAdd to your Claude Desktop config:\n\n\\`\\`\\`json\n{\n \"mcpServers\": {\n \"${name}\": {\n \"command\": \"npx\",\n \"args\": [\"tsx\", \"path/to/${name}/server/index.ts\"]\n }\n }\n}\n\\`\\`\\`\n${\n vercel\n ? `\n## Deploy to Vercel\n\nThis project is configured for Vercel deployment:\n\n\\`\\`\\`bash\nvercel deploy\n\\`\\`\\`\n\nThen use the deployed URL as your MCP server endpoint.\n`\n : \"\"\n}\n`,\n };\n\n // Add vercel.json if Vercel setup is enabled\n if (vercel) {\n files[\"vercel.json\"] = JSON.stringify(\n {\n installCommand: \"npm install\",\n buildCommand: \"npm run build:ui\",\n outputDirectory: \".\",\n functions: {\n \"server/index.ts\": {\n includeFiles: `${uiOutputDir}/**`,\n },\n },\n rewrites: [\n {\n source: \"/(.*)\",\n destination: \"/server/index.ts\",\n },\n ],\n },\n null,\n 2\n );\n }\n\n return files;\n}\n\n// =============================================================================\n// Scaffolding Logic\n// =============================================================================\n\n/**\n * Scaffold a new MCP application project\n */\nexport async function scaffoldProject(options: CreateAppOptions): Promise<void> {\n const {\n name,\n template,\n directory,\n vercel = false,\n skipInstall = false,\n skipGit = false,\n } = options;\n\n // Determine project directory\n const projectDir = directory ?? path.resolve(process.cwd(), name);\n\n // Check if directory exists and is not empty\n if (fs.existsSync(projectDir)) {\n const files = fs.readdirSync(projectDir);\n if (files.length > 0) {\n throw new Error(`Directory ${projectDir} is not empty. Please use an empty directory.`);\n }\n } else {\n fs.mkdirSync(projectDir, { recursive: true });\n }\n\n // Get template files\n const templateFiles =\n template === \"react\" ? getReactTemplate(name, vercel) : getVanillaTemplate(name, vercel);\n\n // Write all files\n for (const [filePath, content] of Object.entries(templateFiles)) {\n const fullPath = path.join(projectDir, filePath);\n const dir = path.dirname(fullPath);\n\n // Create directory if needed\n if (!fs.existsSync(dir)) {\n fs.mkdirSync(dir, { recursive: true });\n }\n\n // Write file\n fs.writeFileSync(fullPath, content, \"utf-8\");\n }\n\n // Initialize git repository\n if (!skipGit) {\n try {\n execSync(\"git init\", { cwd: projectDir, stdio: \"ignore\" });\n } catch {\n // Ignore git init errors (git may not be installed)\n }\n }\n\n // Install dependencies\n if (!skipInstall) {\n try {\n if (vercel) {\n // Use npm for Vercel projects (better compatibility)\n execSync(\"npm install\", { cwd: projectDir, stdio: \"inherit\" });\n } else {\n // Try pnpm first, fall back to npm\n try {\n execSync(\"pnpm install\", { cwd: projectDir, stdio: \"inherit\" });\n } catch {\n execSync(\"npm install\", { cwd: projectDir, stdio: \"inherit\" });\n }\n }\n } catch {\n // eslint-disable-next-line no-console\n console.warn(\"Warning: Could not install dependencies automatically.\");\n }\n }\n}\n"]}
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;AAkCA,IAAI,cAAA,GAAyC,IAAA;AAK7C,SAAS,mBAAmB,WAAA,EAA6B;AACvD,EAAA,IAAI;AACF,IAAA,MAAM,MAAA,GAAS,QAAA,CAAS,CAAA,SAAA,EAAY,WAAW,CAAA,QAAA,CAAA,EAAY;AAAA,MACzD,QAAA,EAAU,OAAA;AAAA,MACV,KAAA,EAAO,CAAC,MAAA,EAAQ,MAAA,EAAQ,MAAM;AAAA,KAC/B,EAAE,IAAA,EAAK;AACR,IAAA,OAAO,IAAI,MAAM,CAAA,CAAA;AAAA,EACnB,CAAA,CAAA,MAAQ;AAEN,IAAA,OAAO,QAAA;AAAA,EACT;AACF;AAKA,SAAS,kBAAA,GAAsC;AAC7C,EAAA,IAAI,cAAA,EAAgB;AAClB,IAAA,OAAO,cAAA;AAAA,EACT;AAEA,EAAA,cAAA,GAAiB;AAAA,IACf,IAAA,EAAM,mBAAmB,oBAAoB,CAAA;AAAA,IAC7C,EAAA,EAAI,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AA,EAAY,QAAQ,CAAA;AAC/C,IAAA,MAAM,GAAA,GAAW,aAAQ,QAAQ,CAAA;AAGjC,IAAA,IAAI,CAAI,EAAA,CAAA,UAAA,CAAW,GAAG,CAAA,EAAG;AACvB,MAAG,EAAA,CAAA,SAAA,CAAU,GAAA,EAAK,EAAE,SAAA,EAAW,MAAM,CAAA;AAAA,IACvC;AAGA,IAAG,EAAA,CAAA,aAAA,CAAc,QAAA,EAAU,OAAA,EAAS,OAAO,CAAA;AAAA,EAC7C;AAGA,EAAA,IAAI,CAAC,OAAA,EAAS;AACZ,IAAA,IAAI;AACF,MAAA,QAAA,CAAS,YAAY,EAAE,GAAA,EAAK,UAAA,EAAY,KAAA,EAAO,UAAU,CAAA;AAAA,IAC3D,CAAA,CAAA,MAAQ;AAAA,IAER;AAAA,EACF;AAGA,EAAA,IAAI,CAAC,WAAA,EAAa;AAChB,IAAA,IAAI;AACF,MAAA,IAAI,MAAA,EAAQ;AAEV,QAAA,QAAA,CAAS,eAAe,EAAE,GAAA,EAAK,UAAA,EAAY,KAAA,EAAO,WAAW,CAAA;AAAA,MAC/D,CAAA,MAAO;AAEL,QAAA,IAAI;AACF,UAAA,QAAA,CAAS,gBAAgB,EAAE,GAAA,EAAK,UAAA,EAAY,KAAA,EAAO,WAAW,CAAA;AAAA,QAChE,CAAA,CAAA,MAAQ;AACN,UAAA,QAAA,CAAS,eAAe,EAAE,GAAA,EAAK,UAAA,EAAY,KAAA,EAAO,WAAW,CAAA;AAAA,QAC/D;AAAA,MACF;AAAA,IACF,CAAA,CAAA,MAAQ;AAEN,MAAA,OAAA,CAAQ,KAAK,wDAAwD,CAAA;AAAA,IACvE;AAAA,EACF;AACF","file":"index.js","sourcesContent":["/**\n * @mcp-apps-kit/create-app\n *\n * Project scaffolding for MCP applications.\n */\n\nimport * as fs from \"node:fs\";\nimport * as path from \"node:path\";\nimport { execSync } from \"node:child_process\";\n\n// =============================================================================\n// Types\n// =============================================================================\n\nexport interface CreateAppOptions {\n name: string;\n template: \"react\" | \"vanilla\";\n directory?: string;\n vercel?: boolean;\n skipInstall?: boolean;\n skipGit?: boolean;\n}\n\n// =============================================================================\n// Version Detection\n// =============================================================================\n\ninterface PackageVersions {\n core: string;\n ui: string;\n uiReact: string;\n}\n\n// Cache for fetched versions\nlet cachedVersions: PackageVersions | null = null;\n\n/**\n * Fetch the latest version of a package from npm registry\n */\nfunction fetchLatestVersion(packageName: string): string {\n try {\n const result = execSync(`npm view ${packageName} version`, {\n encoding: \"utf-8\",\n stdio: [\"pipe\", \"pipe\", \"pipe\"],\n }).trim();\n return `^${result}`;\n } catch {\n // Fallback to a reasonable default if we can't fetch\n return \"^0.2.0\";\n }\n}\n\n/**\n * Get the versions of @mcp-apps-kit packages from npm registry\n */\nfunction getPackageVersions(): PackageVersions {\n if (cachedVersions) {\n return cachedVersions;\n }\n\n cachedVersions = {\n core: fetchLatestVersion(\"@mcp-apps-kit/core\"),\n ui: fetchLatestVersion(\"@mcp-apps-kit/ui\"),\n uiReact: fetchLatestVersion(\"@mcp-apps-kit/ui-react\"),\n };\n\n return cachedVersions;\n}\n\n// =============================================================================\n// Template Content\n// =============================================================================\n\nfunction getReactTemplate(name: string, vercel = false): Record<string, string> {\n const uiOutputDir = vercel ? \"public\" : \"dist\";\n const packageManager = vercel ? \"npm\" : \"pnpm\";\n const versions = getPackageVersions();\n\n const files: Record<string, string> = {\n \"package.json\": JSON.stringify(\n {\n name,\n version: \"0.1.0\",\n type: \"module\",\n scripts: {\n dev: `concurrently \"${packageManager} run dev:server\" \"${packageManager} run dev:ui\"`,\n \"dev:server\": \"tsx watch server/index.ts\",\n \"dev:ui\": \"vite --config ui/vite.config.ts\",\n build: `${packageManager} run build:ui && tsc`,\n \"build:ui\": \"vite build --config ui/vite.config.ts\",\n start: \"node dist/server/index.js\",\n },\n dependencies: {\n \"@mcp-apps-kit/core\": versions.core,\n \"@mcp-apps-kit/ui\": versions.ui,\n \"@mcp-apps-kit/ui-react\": versions.uiReact,\n react: \"^18.2.0\",\n \"react-dom\": \"^18.2.0\",\n zod: \"^3.22.0\",\n ...(vercel ? { express: \"^4.21.0\" } : {}),\n },\n devDependencies: {\n \"@types/react\": \"^18.2.0\",\n \"@types/react-dom\": \"^18.2.0\",\n \"@vitejs/plugin-react\": \"^4.2.0\",\n concurrently: \"^8.2.0\",\n tsx: \"^4.7.0\",\n typescript: \"^5.3.0\",\n vite: \"^5.0.0\",\n \"vite-plugin-singlefile\": \"^2.0.0\",\n },\n },\n null,\n 2\n ),\n \"tsconfig.json\": JSON.stringify(\n {\n compilerOptions: {\n target: \"ES2020\",\n module: \"ESNext\",\n moduleResolution: \"bundler\",\n strict: true,\n esModuleInterop: true,\n skipLibCheck: true,\n declaration: true,\n outDir: \"dist\",\n jsx: \"react-jsx\",\n },\n include: [\"server/**/*\", \"ui/src/**/*\"],\n exclude: [\"node_modules\", \"dist\"],\n },\n null,\n 2\n ),\n \"server/index.ts\": vercel\n ? `/**\n * ${name} - MCP Server\n */\n\n// Required for Vercel to detect Express\nimport \"express\";\n\nimport { createApp, defineTool, defineUI } from \"@mcp-apps-kit/core\";\nimport { z } from \"zod\";\n\n// Define the UI for displaying greetings\nconst greetingUI = defineUI({\n name: \"Greeting Widget\",\n description: \"Displays greeting messages\",\n html: \"./${uiOutputDir}/index.html\",\n prefersBorder: true,\n});\n\nconst app = createApp({\n name: \"${name}\",\n version: \"0.1.0\",\n\n tools: {\n hello: defineTool({\n title: \"Hello\",\n description: \"Say hello to someone\",\n input: z.object({\n name: z.string().describe(\"Name to greet\"),\n }),\n output: z.object({\n message: z.string(),\n timestamp: z.string(),\n }),\n handler: async ({ name }) => {\n return {\n message: \\`Hello, \\${name}!\\`,\n timestamp: new Date().toISOString(),\n };\n },\n ui: greetingUI,\n }),\n },\n});\n\n// Only start locally - Vercel uses the exported Express app\nif (!process.env.VERCEL) {\n await app.start({ port: 3000 });\n console.log(\"MCP server running on http://localhost:3000\");\n}\n\n// Export Express app for Vercel\nexport default app.expressApp;\n`\n : `/**\n * ${name} - MCP Server\n */\n\nimport { createApp, defineTool, defineUI } from \"@mcp-apps-kit/core\";\nimport { z } from \"zod\";\n\n// Define the UI for displaying greetings\nconst greetingUI = defineUI({\n name: \"Greeting Widget\",\n description: \"Displays greeting messages\",\n html: \"./ui/dist/index.html\",\n prefersBorder: true,\n});\n\nconst app = createApp({\n name: \"${name}\",\n version: \"0.1.0\",\n\n tools: {\n hello: defineTool({\n title: \"Hello\",\n description: \"Say hello to someone\",\n input: z.object({\n name: z.string().describe(\"Name to greet\"),\n }),\n output: z.object({\n message: z.string(),\n timestamp: z.string(),\n }),\n handler: async ({ name }) => {\n return {\n message: \\`Hello, \\${name}!\\`,\n timestamp: new Date().toISOString(),\n };\n },\n ui: greetingUI,\n }),\n },\n});\n\n// Start server\nawait app.start({ port: 3000 });\nconsole.log(\"MCP server running on http://localhost:3000\");\n`,\n \"ui/src/App.tsx\": `/**\n * ${name} - UI Component\n */\n\nimport {\n useAppsClient,\n useHostContext,\n useDocumentTheme,\n useHostStyleVariables,\n} from \"@mcp-apps-kit/ui-react\";\n\nexport function App() {\n const client = useAppsClient();\n const context = useHostContext();\n\n // Apply theme and host styles\n useDocumentTheme(\"light\", \"dark\");\n useHostStyleVariables();\n\n // Get tool output from client\n const output = client.toolOutput as { message?: string; timestamp?: string } | undefined;\n\n return (\n <div className=\"container\">\n {output?.message ? (\n <div className=\"greeting\">\n <h1>{output.message}</h1>\n <p className=\"timestamp\">Sent at: {output.timestamp}</p>\n </div>\n ) : (\n <p className=\"waiting\">Waiting for greeting...</p>\n )}\n\n <button\n className=\"button\"\n onClick={() => client.sendFollowUpMessage(\"Please greet me again!\")}\n >\n Request New Greeting\n </button>\n\n <footer className=\"meta\">\n Theme: {context.theme} | Locale: {context.locale}\n </footer>\n </div>\n );\n}\n`,\n \"ui/src/main.tsx\": `/**\n * ${name} - UI Entry Point\n */\n\nimport React from \"react\";\nimport { createRoot } from \"react-dom/client\";\nimport { AppsProvider } from \"@mcp-apps-kit/ui-react\";\nimport { App } from \"./App\";\nimport \"./styles.css\";\n\nconst root = document.getElementById(\"root\");\nif (!root) throw new Error(\"Root element not found\");\n\ncreateRoot(root).render(\n <React.StrictMode>\n <AppsProvider>\n <App />\n </AppsProvider>\n </React.StrictMode>\n);\n`,\n \"ui/src/styles.css\": `* {\n margin: 0;\n padding: 0;\n box-sizing: border-box;\n}\n\nbody {\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;\n padding: 16px;\n}\n\n.container {\n max-width: 400px;\n margin: 0 auto;\n}\n\n.greeting h1 {\n font-size: 1.5rem;\n margin-bottom: 8px;\n}\n\n.timestamp {\n color: #666;\n font-size: 0.875rem;\n}\n\n.waiting {\n color: #999;\n font-style: italic;\n}\n\n.button {\n margin-top: 16px;\n padding: 8px 16px;\n background: #0066cc;\n color: white;\n border: none;\n border-radius: 4px;\n cursor: pointer;\n}\n\n.button:hover {\n background: #0052a3;\n}\n\n.meta {\n margin-top: 24px;\n padding-top: 16px;\n border-top: 1px solid #eee;\n font-size: 0.75rem;\n color: #999;\n}\n\n/* Dark mode support */\n.dark body {\n background: #1a1a1a;\n color: #fff;\n}\n\n.dark .timestamp {\n color: #aaa;\n}\n\n.dark .meta {\n border-color: #333;\n color: #666;\n}\n`,\n \"ui/index.html\": `<!DOCTYPE html>\n<html lang=\"en\">\n <head>\n <meta charset=\"UTF-8\" />\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n <title>${name}</title>\n </head>\n <body>\n <div id=\"root\"></div>\n <script type=\"module\" src=\"/src/main.tsx\"></script>\n </body>\n</html>\n`,\n \"ui/vite.config.ts\": `import { defineConfig } from \"vite\";\nimport react from \"@vitejs/plugin-react\";\nimport { viteSingleFile } from \"vite-plugin-singlefile\";\n\nexport default defineConfig({\n plugins: [react(), viteSingleFile()],\n root: \"./ui\",\n build: {\n outDir: \"${uiOutputDir}\",\n emptyOutDir: true,\n },\n});\n`,\n \".gitignore\": `node_modules/\ndist/\npublic/\n*.log\n.env\n.env.local\n`,\n \"README.md\": `# ${name}\n\nAn MCP application built with @mcp-apps-kit.\n\n## Development\n\n\\`\\`\\`bash\n${packageManager} install\n${packageManager} run dev\n\\`\\`\\`\n\n## Build\n\n\\`\\`\\`bash\n${packageManager} run build\n\\`\\`\\`\n\n## Connecting to Claude Desktop\n\nAdd to your Claude Desktop config:\n\n\\`\\`\\`json\n{\n \"mcpServers\": {\n \"${name}\": {\n \"command\": \"npx\",\n \"args\": [\"tsx\", \"path/to/${name}/server/index.ts\"]\n }\n }\n}\n\\`\\`\\`\n${\n vercel\n ? `\n## Deploy to Vercel\n\nThis project is configured for Vercel deployment:\n\n\\`\\`\\`bash\nvercel deploy\n\\`\\`\\`\n\nThen use the deployed URL as your MCP server endpoint.\n`\n : \"\"\n}\n`,\n };\n\n // Add vercel.json if Vercel setup is enabled\n if (vercel) {\n files[\"vercel.json\"] = JSON.stringify(\n {\n installCommand: \"npm install\",\n buildCommand: \"npm run build:ui\",\n outputDirectory: \".\",\n functions: {\n \"server/index.ts\": {\n includeFiles: `${uiOutputDir}/**`,\n },\n },\n rewrites: [\n {\n source: \"/(.*)\",\n destination: \"/server/index.ts\",\n },\n ],\n },\n null,\n 2\n );\n }\n\n return files;\n}\n\nfunction getVanillaTemplate(name: string, vercel = false): Record<string, string> {\n const uiOutputDir = vercel ? \"public\" : \"dist\";\n const packageManager = vercel ? \"npm\" : \"pnpm\";\n const versions = getPackageVersions();\n\n const files: Record<string, string> = {\n \"package.json\": JSON.stringify(\n {\n name,\n version: \"0.1.0\",\n type: \"module\",\n scripts: {\n dev: `concurrently \"${packageManager} run dev:server\" \"${packageManager} run dev:ui\"`,\n \"dev:server\": \"tsx watch server/index.ts\",\n \"dev:ui\": \"vite --config ui/vite.config.ts\",\n build: `${packageManager} run build:ui && tsc`,\n \"build:ui\": \"vite build --config ui/vite.config.ts\",\n start: \"node dist/server/index.js\",\n },\n dependencies: {\n \"@mcp-apps-kit/core\": versions.core,\n \"@mcp-apps-kit/ui\": versions.ui,\n zod: \"^3.22.0\",\n ...(vercel ? { express: \"^4.21.0\" } : {}),\n },\n devDependencies: {\n concurrently: \"^8.2.0\",\n tsx: \"^4.7.0\",\n typescript: \"^5.3.0\",\n vite: \"^5.0.0\",\n \"vite-plugin-singlefile\": \"^2.0.0\",\n },\n },\n null,\n 2\n ),\n \"tsconfig.json\": JSON.stringify(\n {\n compilerOptions: {\n target: \"ES2020\",\n module: \"ESNext\",\n moduleResolution: \"bundler\",\n strict: true,\n esModuleInterop: true,\n skipLibCheck: true,\n declaration: true,\n outDir: \"dist\",\n },\n include: [\"server/**/*\", \"ui/src/**/*\"],\n exclude: [\"node_modules\", \"dist\"],\n },\n null,\n 2\n ),\n \"server/index.ts\": vercel\n ? `/**\n * ${name} - MCP Server\n */\n\n// Required for Vercel to detect Express\nimport \"express\";\n\nimport { createApp, defineTool, defineUI } from \"@mcp-apps-kit/core\";\nimport { z } from \"zod\";\n\n// Define the UI for displaying greetings\nconst greetingUI = defineUI({\n name: \"Greeting Widget\",\n description: \"Displays greeting messages\",\n html: \"./${uiOutputDir}/index.html\",\n prefersBorder: true,\n});\n\nconst app = createApp({\n name: \"${name}\",\n version: \"0.1.0\",\n\n tools: {\n hello: defineTool({\n title: \"Hello\",\n description: \"Say hello to someone\",\n input: z.object({\n name: z.string().describe(\"Name to greet\"),\n }),\n output: z.object({\n message: z.string(),\n timestamp: z.string(),\n }),\n handler: async ({ name }) => {\n return {\n message: \\`Hello, \\${name}!\\`,\n timestamp: new Date().toISOString(),\n };\n },\n ui: greetingUI,\n }),\n },\n});\n\n// Only start locally - Vercel uses the exported Express app\nif (!process.env.VERCEL) {\n await app.start({ port: 3000 });\n console.log(\"MCP server running on http://localhost:3000\");\n}\n\n// Export Express app for Vercel\nexport default app.expressApp;\n`\n : `/**\n * ${name} - MCP Server\n */\n\nimport { createApp, defineTool, defineUI } from \"@mcp-apps-kit/core\";\nimport { z } from \"zod\";\n\n// Define the UI for displaying greetings\nconst greetingUI = defineUI({\n name: \"Greeting Widget\",\n description: \"Displays greeting messages\",\n html: \"./ui/dist/index.html\",\n prefersBorder: true,\n});\n\nconst app = createApp({\n name: \"${name}\",\n version: \"0.1.0\",\n\n tools: {\n hello: defineTool({\n title: \"Hello\",\n description: \"Say hello to someone\",\n input: z.object({\n name: z.string().describe(\"Name to greet\"),\n }),\n output: z.object({\n message: z.string(),\n timestamp: z.string(),\n }),\n handler: async ({ name }) => {\n return {\n message: \\`Hello, \\${name}!\\`,\n timestamp: new Date().toISOString(),\n };\n },\n ui: greetingUI,\n }),\n },\n});\n\n// Start server\nawait app.start({ port: 3000 });\nconsole.log(\"MCP server running on http://localhost:3000\");\n`,\n \"ui/src/main.ts\": `/**\n * ${name} - UI Entry Point\n */\n\nimport { createClient } from \"@mcp-apps-kit/ui\";\nimport \"./styles.css\";\n\nasync function main() {\n const client = await createClient();\n\n // Get container\n const container = document.getElementById(\"app\");\n if (!container) throw new Error(\"Container not found\");\n\n // Render initial UI\n render(container, client);\n\n // Subscribe to context changes\n client.onHostContextChange((context) => {\n document.documentElement.className = context.theme;\n render(container, client);\n });\n}\n\nfunction render(container: HTMLElement, client: ReturnType<typeof createClient> extends Promise<infer T> ? T : never) {\n const output = client.toolOutput as { message?: string; timestamp?: string } | undefined;\n const context = client.hostContext;\n\n container.innerHTML = \\`\n <div class=\"container\">\n \\${output?.message ? \\`\n <div class=\"greeting\">\n <h1>\\${output.message}</h1>\n <p class=\"timestamp\">Sent at: \\${output.timestamp}</p>\n </div>\n \\` : \\`\n <p class=\"waiting\">Waiting for greeting...</p>\n \\`}\n\n <button class=\"button\" id=\"request-btn\">\n Request New Greeting\n </button>\n\n <footer class=\"meta\">\n Theme: \\${context.theme} | Locale: \\${context.locale}\n </footer>\n </div>\n \\`;\n\n // Add event listener\n const btn = document.getElementById(\"request-btn\");\n btn?.addEventListener(\"click\", () => {\n client.sendFollowUpMessage(\"Please greet me again!\");\n });\n}\n\nmain();\n`,\n \"ui/src/styles.css\": `* {\n margin: 0;\n padding: 0;\n box-sizing: border-box;\n}\n\nbody {\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;\n padding: 16px;\n}\n\n.container {\n max-width: 400px;\n margin: 0 auto;\n}\n\n.greeting h1 {\n font-size: 1.5rem;\n margin-bottom: 8px;\n}\n\n.timestamp {\n color: #666;\n font-size: 0.875rem;\n}\n\n.waiting {\n color: #999;\n font-style: italic;\n}\n\n.button {\n margin-top: 16px;\n padding: 8px 16px;\n background: #0066cc;\n color: white;\n border: none;\n border-radius: 4px;\n cursor: pointer;\n}\n\n.button:hover {\n background: #0052a3;\n}\n\n.meta {\n margin-top: 24px;\n padding-top: 16px;\n border-top: 1px solid #eee;\n font-size: 0.75rem;\n color: #999;\n}\n\n/* Dark mode support */\n.dark body {\n background: #1a1a1a;\n color: #fff;\n}\n\n.dark .timestamp {\n color: #aaa;\n}\n\n.dark .meta {\n border-color: #333;\n color: #666;\n}\n`,\n \"ui/index.html\": `<!DOCTYPE html>\n<html lang=\"en\">\n <head>\n <meta charset=\"UTF-8\" />\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n <title>${name}</title>\n </head>\n <body>\n <div id=\"app\"></div>\n <script type=\"module\" src=\"/src/main.ts\"></script>\n </body>\n</html>\n`,\n \"ui/vite.config.ts\": `import { defineConfig } from \"vite\";\nimport { viteSingleFile } from \"vite-plugin-singlefile\";\n\nexport default defineConfig({\n plugins: [viteSingleFile()],\n root: \"./ui\",\n build: {\n outDir: \"${uiOutputDir}\",\n emptyOutDir: true,\n },\n});\n`,\n \".gitignore\": `node_modules/\ndist/\npublic/\n*.log\n.env\n.env.local\n`,\n \"README.md\": `# ${name}\n\nAn MCP application built with @mcp-apps-kit.\n\n## Development\n\n\\`\\`\\`bash\n${packageManager} install\n${packageManager} run dev\n\\`\\`\\`\n\n## Build\n\n\\`\\`\\`bash\n${packageManager} run build\n\\`\\`\\`\n\n## Connecting to Claude Desktop\n\nAdd to your Claude Desktop config:\n\n\\`\\`\\`json\n{\n \"mcpServers\": {\n \"${name}\": {\n \"command\": \"npx\",\n \"args\": [\"tsx\", \"path/to/${name}/server/index.ts\"]\n }\n }\n}\n\\`\\`\\`\n${\n vercel\n ? `\n## Deploy to Vercel\n\nThis project is configured for Vercel deployment:\n\n\\`\\`\\`bash\nvercel deploy\n\\`\\`\\`\n\nThen use the deployed URL as your MCP server endpoint.\n`\n : \"\"\n}\n`,\n };\n\n // Add vercel.json if Vercel setup is enabled\n if (vercel) {\n files[\"vercel.json\"] = JSON.stringify(\n {\n installCommand: \"npm install\",\n buildCommand: \"npm run build:ui\",\n outputDirectory: \".\",\n functions: {\n \"server/index.ts\": {\n includeFiles: `${uiOutputDir}/**`,\n },\n },\n rewrites: [\n {\n source: \"/(.*)\",\n destination: \"/server/index.ts\",\n },\n ],\n },\n null,\n 2\n );\n }\n\n return files;\n}\n\n// =============================================================================\n// Scaffolding Logic\n// =============================================================================\n\n/**\n * Scaffold a new MCP application project\n */\nexport async function scaffoldProject(options: CreateAppOptions): Promise<void> {\n const {\n name,\n template,\n directory,\n vercel = false,\n skipInstall = false,\n skipGit = false,\n } = options;\n\n // Determine project directory\n const projectDir = directory ?? path.resolve(process.cwd(), name);\n\n // Check if directory exists and is not empty\n if (fs.existsSync(projectDir)) {\n const files = fs.readdirSync(projectDir);\n if (files.length > 0) {\n throw new Error(`Directory ${projectDir} is not empty. Please use an empty directory.`);\n }\n } else {\n fs.mkdirSync(projectDir, { recursive: true });\n }\n\n // Get template files\n const templateFiles =\n template === \"react\" ? getReactTemplate(name, vercel) : getVanillaTemplate(name, vercel);\n\n // Write all files\n for (const [filePath, content] of Object.entries(templateFiles)) {\n const fullPath = path.join(projectDir, filePath);\n const dir = path.dirname(fullPath);\n\n // Create directory if needed\n if (!fs.existsSync(dir)) {\n fs.mkdirSync(dir, { recursive: true });\n }\n\n // Write file\n fs.writeFileSync(fullPath, content, \"utf-8\");\n }\n\n // Initialize git repository\n if (!skipGit) {\n try {\n execSync(\"git init\", { cwd: projectDir, stdio: \"ignore\" });\n } catch {\n // Ignore git init errors (git may not be installed)\n }\n }\n\n // Install dependencies\n if (!skipInstall) {\n try {\n if (vercel) {\n // Use npm for Vercel projects (better compatibility)\n execSync(\"npm install\", { cwd: projectDir, stdio: \"inherit\" });\n } else {\n // Try pnpm first, fall back to npm\n try {\n execSync(\"pnpm install\", { cwd: projectDir, stdio: \"inherit\" });\n } catch {\n execSync(\"npm install\", { cwd: projectDir, stdio: \"inherit\" });\n }\n }\n } catch {\n // eslint-disable-next-line no-console\n console.warn(\"Warning: Could not install dependencies automatically.\");\n }\n }\n}\n"]}
{
"name": "@mcp-apps-kit/create-app",
"version": "0.2.4",
"version": "0.2.5",
"description": "CLI tool for scaffolding MCP applications",

@@ -5,0 +5,0 @@ "type": "module",