@primeuicom/mcp 0.1.8 → 0.1.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +56 -21
- package/dist/service.js +723 -17
- package/dist/service.js.map +1 -1
- package/package.json +5 -2
- package/dist/instructions.d.ts +0 -173
- package/dist/instructions.js +0 -252
- package/dist/instructions.js.map +0 -1
- package/dist/lib/fs.d.ts +0 -4
- package/dist/lib/fs.js +0 -25
- package/dist/lib/fs.js.map +0 -1
- package/dist/server.d.ts +0 -3
- package/dist/server.js +0 -70
- package/dist/server.js.map +0 -1
- package/dist/service.d.ts +0 -2
- package/dist/services/project-sync-service.d.ts +0 -22
- package/dist/services/project-sync-service.js +0 -60
- package/dist/services/project-sync-service.js.map +0 -1
- package/dist/sources/api-provider.d.ts +0 -25
- package/dist/sources/api-provider.js +0 -238
- package/dist/sources/api-provider.js.map +0 -1
- package/dist/sources/project-data-provider.d.ts +0 -7
- package/dist/sources/project-data-provider.js +0 -2
- package/dist/sources/project-data-provider.js.map +0 -1
- package/dist/sources/project-sync-source.d.ts +0 -8
- package/dist/sources/project-sync-source.js +0 -2
- package/dist/sources/project-sync-source.js.map +0 -1
- package/dist/types.d.ts +0 -33
- package/dist/types.js +0 -2
- package/dist/types.js.map +0 -1
package/dist/service.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service.js","sourceRoot":"","sources":["../src/service.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAA;AAEhF,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAA;AACpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAA;AACvE,OAAO,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAA;AAElE,KAAK,UAAU,IAAI;IACjB,MAAM,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC,oBAAoB,IAAI,OAAO,CAAC,GAAG,EAAE,CAAA;IACrE,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,eAAe,CAAA;IAE1C,MAAM,QAAQ,GAAG,IAAI,sBAAsB,CAAC;QAC1C,MAAM;QACN,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,oBAAoB;KAC1C,CAAC,CAAA;IAEF,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,OAAO,CAAC,KAAK,CACX,uGAAuG,CACxG,CAAA;IACH,CAAC;IAED,MAAM,WAAW,GAAG,IAAI,kBAAkB,CAAC,EAAE,WAAW,EAAE,QAAQ,EAAE,CAAC,CAAA;IACrE,MAAM,MAAM,GAAG,sBAAsB,CAAC,WAAW,CAAC,CAAA;IAElD,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAA;IAC5C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAA;IAE/B,OAAO,CAAC,KAAK,CAAC,mCAAmC,WAAW,EAAE,CAAC,CAAA;AACjE,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IACrB,OAAO,CAAC,KAAK,CAAC,+BAA+B,EAAE,KAAK,CAAC,CAAA;IACrD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;AACjB,CAAC,CAAC,CAAA"}
|
|
1
|
+
{"version":3,"sources":["../src/service.ts","../src/server.ts","../src/instructions.ts","../src/services/project-sync-service.ts","../src/lib/fs.ts","../src/sources/api-provider.ts"],"sourcesContent":["import { StdioServerTransport } from \"@modelcontextprotocol/sdk/server/stdio.js\";\n\nimport { createPrimeUiMcpServer } from \"./server.js\";\nimport { ProjectSyncService } from \"./services/project-sync-service.js\";\nimport { ApiProjectDataProvider } from \"./sources/api-provider.js\";\n\nasync function main(): Promise<void> {\n const projectRoot = process.env.PRIMEUI_PROJECT_ROOT || process.cwd();\n const apiKey = process.env.PRIMEUI_API_KEY;\n\n const provider = new ApiProjectDataProvider({\n apiKey,\n baseUrl: process.env.PRIMEUI_API_BASE_URL,\n });\n\n if (!apiKey) {\n console.error(\n \"[primeui-mcp] warning: PRIMEUI_API_KEY is not set; API-backed tools will fail until it is configured.\",\n );\n }\n\n const syncService = new ProjectSyncService({ projectRoot, provider });\n const server = createPrimeUiMcpServer(syncService);\n\n const transport = new StdioServerTransport();\n await server.connect(transport);\n\n console.error(`[primeui-mcp] running for root: ${projectRoot}`);\n}\n\nmain().catch((error) => {\n console.error(\"[primeui-mcp] failed to start\", error);\n process.exit(1);\n});\n","import { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\";\nimport type { CallToolResult } from \"@modelcontextprotocol/sdk/types.js\";\n\nimport {\n initialInstructions,\n toolClearTemp,\n toolCreateExport,\n toolDownloadExport,\n toolGetProjectInfo,\n toolListExports,\n} from \"./instructions.js\";\nimport type { ProjectSyncSource } from \"./sources/project-sync-source.js\";\nimport type {\n PrimeUiCreateExportResult,\n PrimeUiDownloadResult,\n PrimeUiExport,\n PrimeUiProjectInfo,\n} from \"./types.js\";\n\nfunction okResult<T>(title: string, data: T): CallToolResult {\n return {\n content: [{ type: \"text\", text: `${title} completed` }],\n structuredContent: data as Record<string, unknown>,\n };\n}\n\nfunction errorResult(error: unknown): CallToolResult {\n const message = error instanceof Error ? error.message : String(error);\n return {\n isError: true,\n content: [{ type: \"text\", text: `primeui mcp error: ${message}` }],\n };\n}\n\nexport function createPrimeUiMcpServer(source: ProjectSyncSource): McpServer {\n const server = new McpServer(\n {\n name: \"primeui-mcp-server\",\n version: \"0.1.0\",\n },\n {\n instructions: initialInstructions,\n },\n );\n\n server.registerTool(\n \"primeui_get_project_info\",\n toolGetProjectInfo,\n async (): Promise<CallToolResult> => {\n try {\n const info: PrimeUiProjectInfo = await source.getProjectInfo();\n return okResult(\"primeui_get_project_info\", info);\n } catch (error) {\n return errorResult(error);\n }\n },\n );\n\n server.registerTool(\n \"primeui_list_exports\",\n toolListExports,\n async (): Promise<CallToolResult> => {\n try {\n const exportsList: PrimeUiExport[] = await source.listExports();\n return okResult(\"primeui_list_exports\", { exports: exportsList });\n } catch (error) {\n return errorResult(error);\n }\n },\n );\n\n server.registerTool(\n \"primeui_create_export\",\n toolCreateExport,\n async (): Promise<CallToolResult> => {\n try {\n const result: PrimeUiCreateExportResult = await source.createExport();\n return okResult(\"primeui_create_export\", result);\n } catch (error) {\n return errorResult(error);\n }\n },\n );\n\n server.registerTool(\n \"primeui_download_export\",\n toolDownloadExport,\n async ({ id }): Promise<CallToolResult> => {\n try {\n const result: PrimeUiDownloadResult =\n await source.downloadExportById(id);\n return okResult(\"primeui_download_export\", result);\n } catch (error) {\n return errorResult(error);\n }\n },\n );\n\n server.registerTool(\n \"primeui_clear_temp\",\n toolClearTemp,\n async (): Promise<CallToolResult> => {\n try {\n await source.clearTemp();\n return okResult(\"primeui_clear_temp\", { success: true });\n } catch (error) {\n return errorResult(error);\n }\n },\n );\n\n return server;\n}\n","import { z } from \"zod/v3\";\n\nconst pageSchema = z\n .object({\n id: z\n .string()\n .describe(\n \"Stable PrimeUI page identifier. Use this to match the same page across tool responses.\",\n ),\n title: z\n .string()\n .describe(\n \"Human-readable page title. Show this to the user when confirming which pages to import.\",\n ),\n slug: z\n .string()\n .describe(\n \"PrimeUI route slug, for example '/', '/pricing', '/docs/getting-started'. Use to match user intent.\",\n ),\n pageType: z\n .string()\n .describe(\n \"PrimeUI page type classification (for example landing, docs, pricing, blogIndex, legal).\",\n ),\n isReadyToExport: z\n .boolean()\n .describe(\n \"True when this page has an active export-ready variant. Only ready pages are expected in export output.\",\n ),\n pagePath: z\n .string()\n .describe(\n \"Relative file path to the page source inside downloaded export root. Copy page code from this exact path.\",\n ),\n componentsPath: z\n .string()\n .describe(\n \"Relative directory path inside downloaded export root where page-level components live. Use as dependency copy start.\",\n ),\n })\n .describe(\n \"PrimeUI page descriptor used by project and export tools. Paths are always relative to export project root.\",\n );\n\nconst exportStatusSchema = z\n .enum([\"in_progress\", \"completed\", \"failed\"])\n .describe(\n \"Export lifecycle state. Use 'completed' before calling primeui_download_export.\",\n );\n\nconst exportItemSchema = z\n .object({\n id: z\n .string()\n .describe(\n \"Export identifier. Pass this value to primeui_download_export input.id.\",\n ),\n status: exportStatusSchema,\n createdAt: z\n .string()\n .describe(\"Export creation timestamp in ISO-8601 UTC format.\"),\n })\n .describe(\"Single export record from PrimeUI export history.\");\n\n// ============================================================\n// Shared constants\n// ============================================================\n\nconst TRIGGER_PHRASES = [\n \"import page from PrimeUI\",\n \"add page from PrimeUI\",\n \"sync pages\",\n \"pull page\",\n \"transfer page\",\n \"get page from PrimeUI\",\n \"bring page from PrimeUI\",\n \"export from PrimeUI\",\n].join(\", \");\n\nconst WORKFLOW_SUMMARY = `\nWORKFLOW ORDER (always follow this sequence):\n1. primeui_get_project_info -> discover PrimeUI pages\n2. Reconcile PrimeUI pages with local project pages/routes/paths, then confirm target pages with user\n3. primeui_create_export -> generate export snapshot for agreed pages/analysis scope\n4. primeui_download_export -> download to temp directory\n5. Reconcile downloaded export pages with local files, resolve ambiguities\n6. Move agreed page code + dependencies into user's project and apply integration updates where appropriate\n7. primeui_clear_temp -> cleanup temp files\n`.trim();\n\n// ============================================================\n// Server Instructions (initialInstructions)\n// ============================================================\n\nexport const initialInstructions = `\nPrimeUI MCP enables importing pages from PrimeUI Studio into your local project.\n\nTRIGGER EXAMPLES (semantic intent, not exact phrase matching): ${TRIGGER_PHRASES}\n\n${WORKFLOW_SUMMARY}\n\nCRITICAL RULES FOR PAGE IMPORT:\n- Import is PAGE-BY-PAGE only. Never import the entire project at once.\n- After primeui_get_project_info, always compare PrimeUI pages against the user's existing local project pages before proposing imports.\n- Reconciliation report MUST include: page presence match, slug/pagePath/componentsPath path match, and proposed action per page.\n- Decision matrix:\n - PrimeUI + local page exists -> candidate for update/review.\n - PrimeUI exists, local missing -> import candidate.\n - Local exists, PrimeUI missing -> custom local page, no action unless user asks.\n - Both exist but path mismatch -> ambiguous, export + compare before deciding.\n- Before creating export, ask user which pages to add/update (specific pages or all missing pages) and keep that choice in thread context.\n- The downloaded export in .primeui/temp/ contains a full standalone Next.js project.\n Do NOT copy it wholesale.\n- Copy ONLY the target page file and its direct component dependencies.\n- Always use pagePath and componentsPath from tool responses as source of truth for file locations.\n- Trace each page's imports to identify which component folders are needed.\n- Check if components already exist in user's project - merge carefully, don't blindly overwrite.\n- Adjust import paths to match user's project structure.\n- After download/import work, inspect integration points (navigation configs, link menus, route registries, page indexes).\n- If integration pattern is obvious, apply it and explicitly mark it in the report with \"⚠ integration update\".\n- If integration pattern is unclear, ask the user before editing integration files.\n- Do NOT copy: package.json, next.config, tailwind.config, layout files, or any project-level config.\n- If merge conflicts arise and cannot be resolved unambiguously, STOP and ask the user to decide.\n`.trim();\n\n// ============================================================\n// Tool: primeui_get_project_info\n// ============================================================\n\nexport const toolGetProjectInfo = {\n title: \"PrimeUI Project Info\",\n description: `ENTRY POINT for all PrimeUI import operations. Always start here. Returns project metadata and the full list of available pages.\n\nWHEN TO USE: Call this FIRST when user wants to import, add, sync, pull, or transfer a page from PrimeUI. Intent examples (semantic intent, not exact phrase matching): ${TRIGGER_PHRASES}.\n\nAFTER CALLING:\n- Scan the user's local project to discover existing pages/routes and related page component folders.\n- Build a reconciliation report between PrimeUI and local project with action labels:\n - Page exists in both PrimeUI and local project.\n - Page exists in PrimeUI but not in local project -> import candidate.\n - Page exists in local project but not in PrimeUI -> custom local page, no action by default.\n - Page exists in both but slug/pagePath/componentsPath mapping does not match -> ambiguous, requires export-based comparison before decision.\n- If user already requested specific pages, first verify those pages exist in PrimeUI and are isReadyToExport: true.\n- If any requested page is not found or not ready, report this immediately and ask for replacement page choices.\n- Ask the user which pages to add or update now (specific page list or all missing pages) and keep this decision in thread context.\n- Import works per page. Multiple pages are allowed, but each page transfer is handled explicitly.\n- Only after user decision is clear, proceed to primeui_create_export.\n\n${WORKFLOW_SUMMARY}`,\n inputSchema: {},\n outputSchema: {\n projectId: z\n .string()\n .describe(\n \"PrimeUI project identifier associated with the API key and current import session context.\",\n ),\n projectName: z\n .string()\n .describe(\n \"Human-readable PrimeUI project name for confirmations in chat.\",\n ),\n metadata: z\n .record(z.unknown())\n .describe(\n \"Additional project metadata from PrimeUI. May include project-description and other context fields.\",\n ),\n pages: z\n .array(pageSchema)\n .describe(\n \"All pages visible for this project context. Filter by user request and isReadyToExport before creating export.\",\n ),\n },\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n idempotentHint: true,\n openWorldHint: true,\n },\n};\n\n// ============================================================\n// Tool: primeui_list_exports\n// ============================================================\n\nexport const toolListExports = {\n title: \"PrimeUI Export List\",\n description: `Auxiliary tool to list previously created exports with their IDs, statuses, and creation dates. This is NOT the starting point for page import - start with primeui_get_project_info instead.\n\nWHEN TO USE: This is an OPTIONAL helper tool, NOT part of the main import flow. Use it only when:\n- Something went wrong with an export and you need to check its status.\n- The user explicitly references a previous export by date or context.\n- You need to verify whether an export initiated via PrimeUI Studio UI has completed.\n\nNote: exports can be created both through primeui_create_export AND by the user directly in PrimeUI Studio UI. This tool shows all of them.\n\nDo NOT use this tool as a substitute for primeui_create_export. Always create a fresh export unless the user explicitly asks to use a previous one.\n\n${WORKFLOW_SUMMARY}`,\n inputSchema: {},\n outputSchema: {\n exports: z\n .array(exportItemSchema)\n .describe(\n \"Available exports sorted by API policy. Use item.id to download a specific prior export if user asks.\",\n ),\n },\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n idempotentHint: true,\n openWorldHint: true,\n },\n};\n\n// ============================================================\n// Tool: primeui_create_export\n// ============================================================\n\nexport const toolCreateExport = {\n title: \"PrimeUI Create Export\",\n description: `Create a new export snapshot from the current PrimeUI project state and wait for completion. Returns export ID and the list of pages included in the export.\n\nWHEN TO USE: Call this AFTER the user has confirmed which pages they want to import via primeui_get_project_info. This tool is REQUIRED before primeui_download_export, unless the user explicitly and directly asked to download a specific previous export.\n\nAFTER CALLING:\n- Verify that all user-selected pages are present in the export result AND have isReadyToExport: true.\n- If path mismatch pages were flagged during project-info reconciliation, ensure they are included for deeper comparison after download.\n- If any required page is missing or not ready, report and pause for user decision before proceeding.\n- Use the returned export ID to call primeui_download_export.\n\n${WORKFLOW_SUMMARY}`,\n inputSchema: {},\n outputSchema: {\n export: z\n .object({\n id: z\n .string()\n .describe(\n \"Freshly created export identifier. Use this as primeui_download_export input.id.\",\n ),\n status: exportStatusSchema,\n })\n .describe(\"Created export summary.\"),\n pages: z\n .array(pageSchema)\n .describe(\n \"Page snapshot associated with this export operation. Validate requested pages here before download/import.\",\n ),\n },\n annotations: {\n readOnlyHint: false,\n destructiveHint: false,\n idempotentHint: false,\n openWorldHint: true,\n },\n};\n\n// ============================================================\n// Tool: primeui_download_export\n// ============================================================\n\nexport const toolDownloadExport = {\n title: \"PrimeUI Download Export\",\n description: `Download a completed export into .primeui/temp/exports/[exportId]. Downloads and extracts the full export as a standalone Next.js project into the temp directory. This does NOT modify the user's project - files land only in .primeui/temp/.\n\nDo NOT call this as the first step. Requires export ID from primeui_create_export. Start with primeui_get_project_info instead.\n\nWHEN TO USE: Call this AFTER primeui_create_export has returned a completed export. Requires the export ID returned by primeui_create_export (or from primeui_list_exports if the user explicitly requested a previous export).\n\nAFTER DOWNLOAD:\n- Reconcile downloaded export pages with the current local project state again.\n- If thread context already defines which pages to add/update and there is no ambiguity, complete the transfer without extra confirmation.\n- If ambiguity remains (especially page/path mismatches), analyze differences in detail and ask direct clarification questions before editing.\n- The response includes pagePath and componentsPath fields. Use these as direct pointers to locate page code and dependencies in export files.\n\nMANUAL IMPORT STEPS per page (do not skip):\n1. Read the page file at the pagePath from the response.\n2. Read the component files at the componentsPath from the response. Trace the page's imports to identify which specific component folders are needed.\n3. Copy ONLY the page file and its component dependencies into the user's project.\n4. Adjust all import paths to match the user's project structure.\n5. Check for existing components in user's project:\n - If code overlaps or was modified on the user's side, carefully determine the nature of changes on both sides.\n - If the merge conflict can be resolved unambiguously - resolve it.\n - If NOT - STOP, explain the conflict to the user, and ask for their decision before continuing.\n6. Inspect integration points used by existing pages (navigation configs, route registries, link components, page indexes).\n7. If integration pattern is obvious and consistent with project conventions, apply integration updates and mark them in the report as \"⚠ integration update\".\n8. If integration pattern is not obvious, provide concrete integration suggestions and ask user confirmation before changing integration files.\n9. Do NOT copy project config files (package.json, next.config, tailwind.config, layout, etc.).\n10. REPEAT steps 1-9 for each page the user wants to import.\n11. Report exactly which files/areas were changed and which items require user follow-up.\n12. Only after ALL pages are successfully imported, call primeui_clear_temp to clean up.\n\n ${WORKFLOW_SUMMARY}`,\n inputSchema: {\n id: z\n .string()\n .describe(\n \"Export identifier to download. Prefer export.id from primeui_create_export; use primeui_list_exports only on explicit user request.\",\n ),\n },\n outputSchema: {\n exportId: z\n .string()\n .describe(\n \"Downloaded export identifier. Should match the requested input.id for traceability.\",\n ),\n projectPath: z\n .string()\n .describe(\n \"Absolute local path to extracted export root in .primeui/temp/exports/[exportId]. Read files from here only.\",\n ),\n pages: z\n .array(pageSchema)\n .describe(\n \"Page descriptors for import decisions. Use pagePath/componentsPath from each item when copying code into user project.\",\n ),\n },\n annotations: {\n readOnlyHint: false,\n destructiveHint: false,\n idempotentHint: true,\n openWorldHint: true,\n },\n};\n\n// ============================================================\n// Tool: primeui_clear_temp\n// ============================================================\n\nexport const toolClearTemp = {\n title: \"PrimeUI Clear Temp\",\n description: `Delete all files in .primeui/temp/ and recreate empty temp structure.\n\nDo NOT call this unless ALL requested pages have been successfully imported into the user's project.\n\nWHEN TO USE: Call this as the FINAL step after ALL requested pages have been successfully imported into the user's project. Do not call this between page imports - wait until all pages are done.\n\nSafe to call multiple times. Only affects .primeui/temp/ directory - never touches the user's project files.\n\n${WORKFLOW_SUMMARY}`,\n inputSchema: {},\n outputSchema: {\n success: z\n .boolean()\n .describe(\n \"True when temp cleanup completed and baseline temp structure was recreated.\",\n ),\n },\n annotations: {\n readOnlyHint: false,\n destructiveHint: false,\n idempotentHint: true,\n openWorldHint: false,\n },\n};\n","import path from \"node:path\";\n\nimport { ensureDir, extractZip, resetDir, writeUtf8 } from \"../lib/fs.js\";\nimport type { ProjectDataProvider } from \"../sources/project-data-provider.js\";\nimport type { ProjectSyncSource } from \"../sources/project-sync-source.js\";\nimport type {\n PrimeUiCreateExportResult,\n PrimeUiDownloadResult,\n PrimeUiExport,\n PrimeUiProjectInfo,\n} from \"../types.js\";\n\ntype ProjectSyncServiceOptions = {\n projectRoot: string;\n provider: ProjectDataProvider;\n};\n\nexport class ProjectSyncService implements ProjectSyncSource {\n private readonly provider: ProjectDataProvider;\n private readonly projectRoot: string;\n private readonly primeUiRoot: string;\n private readonly tempRoot: string;\n private readonly exportsRoot: string;\n\n constructor(options: ProjectSyncServiceOptions) {\n this.projectRoot = options.projectRoot;\n this.provider = options.provider;\n this.primeUiRoot = path.join(this.projectRoot, \".primeui\");\n this.tempRoot = path.join(this.primeUiRoot, \"temp\");\n this.exportsRoot = path.join(this.tempRoot, \"exports\");\n }\n\n async getProjectInfo(): Promise<PrimeUiProjectInfo> {\n await this.ensureTempLayout();\n return this.provider.getProjectInfo();\n }\n\n async listExports(): Promise<PrimeUiExport[]> {\n await this.ensureTempLayout();\n return this.provider.listExports();\n }\n\n async createExport(): Promise<PrimeUiCreateExportResult> {\n await this.ensureTempLayout();\n return this.provider.createExport();\n }\n\n async downloadExportById(id: string): Promise<PrimeUiDownloadResult> {\n await this.ensureTempLayout();\n\n const exportsList = await this.provider.listExports();\n const selected = exportsList.find((item) => item.id === id);\n\n if (!selected) {\n throw new Error(`Export not found: ${id}`);\n }\n\n const targetZipPath = path.join(this.exportsRoot, `${id}.zip`);\n const targetProjectPath = path.join(this.exportsRoot, id);\n\n await ensureDir(this.exportsRoot);\n await this.provider.downloadExportArchive(id, targetZipPath);\n\n await resetDir(targetProjectPath);\n await extractZip(targetZipPath, targetProjectPath);\n const { pages } = await this.provider.getProjectInfo();\n\n return {\n exportId: id,\n projectPath: targetProjectPath,\n pages,\n };\n }\n\n async clearTemp(): Promise<void> {\n await resetDir(this.tempRoot);\n await writeUtf8(path.join(this.tempRoot, \".gitkeep\"), \"\");\n await ensureDir(this.exportsRoot);\n }\n\n private async ensureTempLayout(): Promise<void> {\n await ensureDir(this.primeUiRoot);\n await ensureDir(this.tempRoot);\n await ensureDir(this.exportsRoot);\n await writeUtf8(path.join(this.tempRoot, \".gitkeep\"), \"\");\n }\n}\n","import { mkdir, rm, writeFile } from \"node:fs/promises\";\nimport path from \"node:path\";\nimport extractZipArchive from \"extract-zip\";\n\nexport async function ensureDir(dirPath: string): Promise<void> {\n await mkdir(dirPath, { recursive: true });\n}\n\nexport async function resetDir(dirPath: string): Promise<void> {\n await rm(dirPath, { recursive: true, force: true });\n await mkdir(dirPath, { recursive: true });\n}\n\nexport async function writeUtf8(\n filePath: string,\n content: string,\n): Promise<void> {\n await ensureDir(path.dirname(filePath));\n await writeFile(filePath, content, \"utf-8\");\n}\n\nexport async function extractZip(\n zipPath: string,\n targetDir: string,\n): Promise<void> {\n await ensureDir(targetDir);\n\n try {\n await extractZipArchive(zipPath, { dir: targetDir });\n } catch (error) {\n const details = error instanceof Error ? error.message : String(error);\n throw new Error(`Failed to extract zip at \"${zipPath}\". ${details}`);\n }\n}\n","import { createWriteStream } from \"node:fs\";\nimport { unlink } from \"node:fs/promises\";\nimport path from \"node:path\";\nimport { Readable, Transform } from \"node:stream\";\nimport { pipeline } from \"node:stream/promises\";\nimport type { ReadableStream as NodeReadableStream } from \"node:stream/web\";\nimport { z } from \"zod\";\n\nimport { ensureDir } from \"../lib/fs.js\";\nimport type {\n PrimeUiCreateExportResult,\n PrimeUiExport,\n PrimeUiProjectInfo,\n PrimeUiProjectPage,\n} from \"../types.js\";\nimport type { ProjectDataProvider } from \"./project-data-provider.js\";\n\ntype ApiProjectDataProviderOptions = {\n apiKey?: string;\n baseUrl?: string;\n};\n\nconst DEFAULT_API_BASE_URL = \"https://app.primeui.com/\";\nconst ZIP_CONTENT_TYPES = [\n \"application/zip\",\n \"application/octet-stream\",\n \"application/x-zip-compressed\",\n];\nconst exportStatusSchema = z.enum([\"in_progress\", \"completed\", \"failed\"]);\nconst projectPageSchema: z.ZodType<PrimeUiProjectPage> = z.object({\n id: z.string(),\n title: z.string(),\n slug: z.string(),\n pageType: z.string(),\n isReadyToExport: z.boolean(),\n pagePath: z.string(),\n componentsPath: z.string(),\n});\n\n/**\n * Consumer-side runtime contract for GET /api/v1/project.\n * Producer source of truth: apps/studio/src/app/api/v1/project/route.ts\n * Keep this schema synchronized with the producer payload.\n */\nconst projectInfoSchema: z.ZodType<PrimeUiProjectInfo> = z.object({\n projectId: z.string(),\n projectName: z.string(),\n metadata: z.record(z.unknown()),\n pages: z.array(projectPageSchema),\n});\n\n/**\n * Consumer-side runtime contract for GET /api/v1/project/exports.\n * Producer source of truth: apps/studio/src/app/api/v1/project/exports/route.ts\n * Keep this schema synchronized with the producer payload.\n */\nconst exportsResponseSchema = z.object({\n exports: z.array(\n z.object({\n id: z.string(),\n status: exportStatusSchema,\n createdAt: z.string().datetime({ offset: true }),\n }),\n ),\n});\n\n/**\n * Consumer-side runtime contract for POST /api/v1/project/exports.\n * Producer source of truth: apps/studio/src/app/api/v1/project/exports/route.ts\n * Keep this schema synchronized with the producer payload.\n */\nconst createExportResponseSchema: z.ZodType<PrimeUiCreateExportResult> =\n z.object({\n export: z.object({\n id: z.string(),\n status: exportStatusSchema,\n }),\n pages: z.array(projectPageSchema),\n });\n\nclass PrimeUiApiContractError extends Error {\n constructor(endpoint: string, details: string) {\n super(`PrimeUI API contract mismatch for \"${endpoint}\": ${details}`);\n this.name = \"PrimeUiApiContractError\";\n }\n}\n\nconst normalizeApiRoot = (rawBaseUrl: string): string => {\n const normalizedBase = rawBaseUrl.trim() || DEFAULT_API_BASE_URL;\n const parsed = new URL(normalizedBase);\n const normalizedPath = parsed.pathname.replace(/\\/+$/, \"\");\n\n if (normalizedPath.endsWith(\"/api/v1\")) {\n parsed.pathname = `${normalizedPath}/`;\n return parsed.toString();\n }\n\n parsed.pathname = `${normalizedPath}/api/v1/`.replace(\n \"//api/v1/\",\n \"/api/v1/\",\n );\n return parsed.toString();\n};\n\nconst isJsonContentType = (contentType: string): boolean =>\n contentType.includes(\"application/json\") || contentType.includes(\"+json\");\n\nconst isZipContentType = (contentType: string): boolean =>\n ZIP_CONTENT_TYPES.some((allowedType) => contentType.includes(allowedType));\n\nconst looksLikeZipArchive = (buffer: Buffer): boolean => {\n if (buffer.length < 4) {\n return false;\n }\n\n if (buffer[0] !== 0x50 || buffer[1] !== 0x4b) {\n return false;\n }\n\n const signature = `${buffer[2]}:${buffer[3]}`;\n return signature === \"3:4\" || signature === \"5:6\" || signature === \"7:8\";\n};\n\nconst createZipSignatureGuard = (endpoint: string): Transform => {\n let signature = Buffer.alloc(0);\n let validated = false;\n\n return new Transform({\n transform(chunk, _encoding, callback) {\n const chunkBuffer = Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk);\n\n if (!validated) {\n const requiredBytes = Math.max(0, 4 - signature.length);\n if (requiredBytes > 0) {\n signature = Buffer.concat([\n signature,\n chunkBuffer.subarray(0, requiredBytes),\n ]);\n }\n\n if (signature.length >= 4) {\n if (!looksLikeZipArchive(signature)) {\n callback(\n new PrimeUiApiContractError(\n endpoint,\n \"response body is not a valid zip archive\",\n ),\n );\n return;\n }\n\n validated = true;\n }\n }\n\n callback(null, chunkBuffer);\n },\n flush(callback) {\n if (!validated) {\n callback(\n new PrimeUiApiContractError(\n endpoint,\n \"response body is not a valid zip archive\",\n ),\n );\n return;\n }\n\n callback();\n },\n });\n};\n\nexport class ApiProjectDataProvider implements ProjectDataProvider {\n private readonly apiKey?: string;\n private readonly apiRoot: string;\n\n constructor(options: ApiProjectDataProviderOptions) {\n this.apiKey = options.apiKey;\n this.apiRoot = normalizeApiRoot(options.baseUrl ?? DEFAULT_API_BASE_URL);\n }\n\n async getProjectInfo(): Promise<PrimeUiProjectInfo> {\n return this.requestJson(\"project\", projectInfoSchema);\n }\n\n async listExports(): Promise<PrimeUiExport[]> {\n const response = await this.requestJson(\n \"project/exports\",\n exportsResponseSchema,\n );\n return response.exports;\n }\n\n async createExport(): Promise<PrimeUiCreateExportResult> {\n return this.requestJson(\"project/exports\", createExportResponseSchema, {\n method: \"POST\",\n });\n }\n\n /**\n * Consumer-side runtime contract for GET /api/v1/project/exports/:exportId/download.\n * Producer source of truth: apps/studio/src/app/api/v1/project/exports/[exportId]/download/route.ts\n * Keep content-type and archive format checks synchronized with the producer response.\n */\n async downloadExportArchive(\n exportId: string,\n destinationPath: string,\n ): Promise<void> {\n const endpoint = `project/exports/${encodeURIComponent(exportId)}/download`;\n const apiKey = this.requireApiKey();\n const response = await fetch(this.buildUrl(endpoint), {\n method: \"GET\",\n headers: {\n Authorization: `Bearer ${apiKey}`,\n },\n });\n\n if (!response.ok) {\n const details = await this.readError(response);\n throw new Error(\n `PrimeUI API request failed (${response.status}) while downloading export \"${exportId}\": ${details}`,\n );\n }\n\n const contentType = response.headers.get(\"content-type\") ?? \"\";\n if (!isZipContentType(contentType)) {\n throw new PrimeUiApiContractError(\n endpoint,\n `expected zip content-type but got \"${contentType || \"unknown\"}\"`,\n );\n }\n\n if (!response.body) {\n throw new PrimeUiApiContractError(endpoint, \"response body is empty\");\n }\n\n await ensureDir(path.dirname(destinationPath));\n\n const zipStream = Readable.fromWeb(\n response.body as unknown as NodeReadableStream,\n );\n const signatureGuard = createZipSignatureGuard(endpoint);\n const fileStream = createWriteStream(destinationPath);\n\n try {\n await pipeline(zipStream, signatureGuard, fileStream);\n } catch (error) {\n await unlink(destinationPath).catch(() => undefined);\n throw error;\n }\n }\n\n private buildUrl(endpoint: string): string {\n return new URL(endpoint, this.apiRoot).toString();\n }\n\n private async requestJson<T>(\n endpoint: string,\n schema: z.ZodType<T>,\n requestInit: RequestInit = {},\n ): Promise<T> {\n const apiKey = this.requireApiKey();\n const method = requestInit.method ?? \"GET\";\n const response = await fetch(this.buildUrl(endpoint), {\n ...requestInit,\n method,\n headers: {\n ...(requestInit.headers ?? {}),\n Authorization: `Bearer ${apiKey}`,\n },\n });\n\n if (!response.ok) {\n const details = await this.readError(response);\n throw new Error(\n `PrimeUI API request failed (${response.status}) for \"${endpoint}\": ${details}`,\n );\n }\n\n const contentType = response.headers.get(\"content-type\") ?? \"\";\n if (!isJsonContentType(contentType)) {\n throw new PrimeUiApiContractError(\n endpoint,\n `expected JSON content-type but got \"${contentType || \"unknown\"}\"`,\n );\n }\n\n let payload: unknown;\n try {\n payload = await response.json();\n } catch {\n throw new PrimeUiApiContractError(\n endpoint,\n \"response body is not valid JSON\",\n );\n }\n\n const parsed = schema.safeParse(payload);\n if (!parsed.success) {\n const details = parsed.error.issues\n .map((issue) => `${issue.path.join(\".\") || \"<root>\"}: ${issue.message}`)\n .join(\"; \");\n throw new PrimeUiApiContractError(endpoint, details);\n }\n\n return parsed.data;\n }\n\n private async readError(response: Response): Promise<string> {\n const contentType = response.headers.get(\"content-type\") ?? \"\";\n\n try {\n if (isJsonContentType(contentType)) {\n const body = (await response.json()) as {\n message?: string;\n code?: string;\n };\n if (body?.message && body?.code) {\n return `${body.code}: ${body.message}`;\n }\n if (body?.message) {\n return body.message;\n }\n } else {\n const bodyText = await response.text();\n if (bodyText.trim()) {\n return bodyText.trim();\n }\n }\n } catch {\n // No-op: fall through to generic status text.\n }\n\n return response.statusText || \"Unknown error\";\n }\n\n private requireApiKey(): string {\n const apiKey = this.apiKey?.trim();\n if (!apiKey) {\n throw new Error(\"PRIMEUI_API_KEY is required to call PrimeUI API tools.\");\n }\n\n return apiKey;\n }\n}\n"],"mappings":";;;AAAA,SAAS,4BAA4B;;;ACArC,SAAS,iBAAiB;;;ACA1B,SAAS,SAAS;AAElB,IAAM,aAAa,EAChB,OAAO;AAAA,EACN,IAAI,EACD,OAAO,EACP;AAAA,IACC;AAAA,EACF;AAAA,EACF,OAAO,EACJ,OAAO,EACP;AAAA,IACC;AAAA,EACF;AAAA,EACF,MAAM,EACH,OAAO,EACP;AAAA,IACC;AAAA,EACF;AAAA,EACF,UAAU,EACP,OAAO,EACP;AAAA,IACC;AAAA,EACF;AAAA,E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AAQ;AACX,YAAM,IAAI,MAAM,wDAAwD;AAAA,IAC1E;AAEA,WAAO;AAAA,EACT;AACF;;;ALnVA,eAAe,OAAsB;AACnC,QAAM,cAAc,QAAQ,IAAI,wBAAwB,QAAQ,IAAI;AACpE,QAAM,SAAS,QAAQ,IAAI;AAE3B,QAAM,WAAW,IAAI,uBAAuB;AAAA,IAC1C;AAAA,IACA,SAAS,QAAQ,IAAI;AAAA,EACvB,CAAC;AAED,MAAI,CAAC,QAAQ;AACX,YAAQ;AAAA,MACN;AAAA,IACF;AAAA,EACF;AAEA,QAAM,cAAc,IAAI,mBAAmB,EAAE,aAAa,SAAS,CAAC;AACpE,QAAM,SAAS,uBAAuB,WAAW;AAEjD,QAAM,YAAY,IAAI,qBAAqB;AAC3C,QAAM,OAAO,QAAQ,SAAS;AAE9B,UAAQ,MAAM,mCAAmC,WAAW,EAAE;AAChE;AAEA,KAAK,EAAE,MAAM,CAAC,UAAU;AACtB,UAAQ,MAAM,iCAAiC,KAAK;AACpD,UAAQ,KAAK,CAAC;AAChB,CAAC;","names":["path","path","path","z","exportStatusSchema","z","path"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@primeuicom/mcp",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.10",
|
|
4
4
|
"description": "MCP server that connects AI agents with PrimeUI project",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"mcp",
|
|
@@ -38,7 +38,9 @@
|
|
|
38
38
|
],
|
|
39
39
|
"scripts": {
|
|
40
40
|
"clean": "rm -rf dist",
|
|
41
|
-
"build": "pnpm run clean &&
|
|
41
|
+
"build": "pnpm run clean && tsup --config tsup.config.ts && chmod 755 dist/service.js",
|
|
42
|
+
"format": "prettier --write ./src",
|
|
43
|
+
"format:check": "prettier --check ./src",
|
|
42
44
|
"typecheck": "tsc --noEmit",
|
|
43
45
|
"dev": "tsx src/service.ts",
|
|
44
46
|
"test": "vitest run",
|
|
@@ -52,6 +54,7 @@
|
|
|
52
54
|
},
|
|
53
55
|
"devDependencies": {
|
|
54
56
|
"@types/node": "^24.0.0",
|
|
57
|
+
"tsup": "^8.5.0",
|
|
55
58
|
"tsx": "^4.21.0",
|
|
56
59
|
"typescript": "5.8.2",
|
|
57
60
|
"vitest": "^3.2.3"
|
package/dist/instructions.d.ts
DELETED
|
@@ -1,173 +0,0 @@
|
|
|
1
|
-
import { z } from "zod/v3";
|
|
2
|
-
export declare const initialInstructions: string;
|
|
3
|
-
export declare const toolGetProjectInfo: {
|
|
4
|
-
title: string;
|
|
5
|
-
description: string;
|
|
6
|
-
inputSchema: {};
|
|
7
|
-
outputSchema: {
|
|
8
|
-
projectId: z.ZodString;
|
|
9
|
-
projectName: z.ZodString;
|
|
10
|
-
metadata: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
11
|
-
pages: z.ZodArray<z.ZodObject<{
|
|
12
|
-
id: z.ZodString;
|
|
13
|
-
title: z.ZodString;
|
|
14
|
-
slug: z.ZodString;
|
|
15
|
-
pageType: z.ZodString;
|
|
16
|
-
isReadyToExport: z.ZodBoolean;
|
|
17
|
-
pagePath: z.ZodString;
|
|
18
|
-
componentsPath: z.ZodString;
|
|
19
|
-
}, "strip", z.ZodTypeAny, {
|
|
20
|
-
id: string;
|
|
21
|
-
title: string;
|
|
22
|
-
slug: string;
|
|
23
|
-
pageType: string;
|
|
24
|
-
isReadyToExport: boolean;
|
|
25
|
-
pagePath: string;
|
|
26
|
-
componentsPath: string;
|
|
27
|
-
}, {
|
|
28
|
-
id: string;
|
|
29
|
-
title: string;
|
|
30
|
-
slug: string;
|
|
31
|
-
pageType: string;
|
|
32
|
-
isReadyToExport: boolean;
|
|
33
|
-
pagePath: string;
|
|
34
|
-
componentsPath: string;
|
|
35
|
-
}>, "many">;
|
|
36
|
-
};
|
|
37
|
-
annotations: {
|
|
38
|
-
readOnlyHint: boolean;
|
|
39
|
-
destructiveHint: boolean;
|
|
40
|
-
idempotentHint: boolean;
|
|
41
|
-
openWorldHint: boolean;
|
|
42
|
-
};
|
|
43
|
-
};
|
|
44
|
-
export declare const toolListExports: {
|
|
45
|
-
title: string;
|
|
46
|
-
description: string;
|
|
47
|
-
inputSchema: {};
|
|
48
|
-
outputSchema: {
|
|
49
|
-
exports: z.ZodArray<z.ZodObject<{
|
|
50
|
-
id: z.ZodString;
|
|
51
|
-
status: z.ZodEnum<["in_progress", "completed", "failed"]>;
|
|
52
|
-
createdAt: z.ZodString;
|
|
53
|
-
}, "strip", z.ZodTypeAny, {
|
|
54
|
-
id: string;
|
|
55
|
-
status: "in_progress" | "completed" | "failed";
|
|
56
|
-
createdAt: string;
|
|
57
|
-
}, {
|
|
58
|
-
id: string;
|
|
59
|
-
status: "in_progress" | "completed" | "failed";
|
|
60
|
-
createdAt: string;
|
|
61
|
-
}>, "many">;
|
|
62
|
-
};
|
|
63
|
-
annotations: {
|
|
64
|
-
readOnlyHint: boolean;
|
|
65
|
-
destructiveHint: boolean;
|
|
66
|
-
idempotentHint: boolean;
|
|
67
|
-
openWorldHint: boolean;
|
|
68
|
-
};
|
|
69
|
-
};
|
|
70
|
-
export declare const toolCreateExport: {
|
|
71
|
-
title: string;
|
|
72
|
-
description: string;
|
|
73
|
-
inputSchema: {};
|
|
74
|
-
outputSchema: {
|
|
75
|
-
export: z.ZodObject<{
|
|
76
|
-
id: z.ZodString;
|
|
77
|
-
status: z.ZodEnum<["in_progress", "completed", "failed"]>;
|
|
78
|
-
}, "strip", z.ZodTypeAny, {
|
|
79
|
-
id: string;
|
|
80
|
-
status: "in_progress" | "completed" | "failed";
|
|
81
|
-
}, {
|
|
82
|
-
id: string;
|
|
83
|
-
status: "in_progress" | "completed" | "failed";
|
|
84
|
-
}>;
|
|
85
|
-
pages: z.ZodArray<z.ZodObject<{
|
|
86
|
-
id: z.ZodString;
|
|
87
|
-
title: z.ZodString;
|
|
88
|
-
slug: z.ZodString;
|
|
89
|
-
pageType: z.ZodString;
|
|
90
|
-
isReadyToExport: z.ZodBoolean;
|
|
91
|
-
pagePath: z.ZodString;
|
|
92
|
-
componentsPath: z.ZodString;
|
|
93
|
-
}, "strip", z.ZodTypeAny, {
|
|
94
|
-
id: string;
|
|
95
|
-
title: string;
|
|
96
|
-
slug: string;
|
|
97
|
-
pageType: string;
|
|
98
|
-
isReadyToExport: boolean;
|
|
99
|
-
pagePath: string;
|
|
100
|
-
componentsPath: string;
|
|
101
|
-
}, {
|
|
102
|
-
id: string;
|
|
103
|
-
title: string;
|
|
104
|
-
slug: string;
|
|
105
|
-
pageType: string;
|
|
106
|
-
isReadyToExport: boolean;
|
|
107
|
-
pagePath: string;
|
|
108
|
-
componentsPath: string;
|
|
109
|
-
}>, "many">;
|
|
110
|
-
};
|
|
111
|
-
annotations: {
|
|
112
|
-
readOnlyHint: boolean;
|
|
113
|
-
destructiveHint: boolean;
|
|
114
|
-
idempotentHint: boolean;
|
|
115
|
-
openWorldHint: boolean;
|
|
116
|
-
};
|
|
117
|
-
};
|
|
118
|
-
export declare const toolDownloadExport: {
|
|
119
|
-
title: string;
|
|
120
|
-
description: string;
|
|
121
|
-
inputSchema: {
|
|
122
|
-
id: z.ZodString;
|
|
123
|
-
};
|
|
124
|
-
outputSchema: {
|
|
125
|
-
exportId: z.ZodString;
|
|
126
|
-
projectPath: z.ZodString;
|
|
127
|
-
pages: z.ZodArray<z.ZodObject<{
|
|
128
|
-
id: z.ZodString;
|
|
129
|
-
title: z.ZodString;
|
|
130
|
-
slug: z.ZodString;
|
|
131
|
-
pageType: z.ZodString;
|
|
132
|
-
isReadyToExport: z.ZodBoolean;
|
|
133
|
-
pagePath: z.ZodString;
|
|
134
|
-
componentsPath: z.ZodString;
|
|
135
|
-
}, "strip", z.ZodTypeAny, {
|
|
136
|
-
id: string;
|
|
137
|
-
title: string;
|
|
138
|
-
slug: string;
|
|
139
|
-
pageType: string;
|
|
140
|
-
isReadyToExport: boolean;
|
|
141
|
-
pagePath: string;
|
|
142
|
-
componentsPath: string;
|
|
143
|
-
}, {
|
|
144
|
-
id: string;
|
|
145
|
-
title: string;
|
|
146
|
-
slug: string;
|
|
147
|
-
pageType: string;
|
|
148
|
-
isReadyToExport: boolean;
|
|
149
|
-
pagePath: string;
|
|
150
|
-
componentsPath: string;
|
|
151
|
-
}>, "many">;
|
|
152
|
-
};
|
|
153
|
-
annotations: {
|
|
154
|
-
readOnlyHint: boolean;
|
|
155
|
-
destructiveHint: boolean;
|
|
156
|
-
idempotentHint: boolean;
|
|
157
|
-
openWorldHint: boolean;
|
|
158
|
-
};
|
|
159
|
-
};
|
|
160
|
-
export declare const toolClearTemp: {
|
|
161
|
-
title: string;
|
|
162
|
-
description: string;
|
|
163
|
-
inputSchema: {};
|
|
164
|
-
outputSchema: {
|
|
165
|
-
success: z.ZodBoolean;
|
|
166
|
-
};
|
|
167
|
-
annotations: {
|
|
168
|
-
readOnlyHint: boolean;
|
|
169
|
-
destructiveHint: boolean;
|
|
170
|
-
idempotentHint: boolean;
|
|
171
|
-
openWorldHint: boolean;
|
|
172
|
-
};
|
|
173
|
-
};
|
package/dist/instructions.js
DELETED
|
@@ -1,252 +0,0 @@
|
|
|
1
|
-
import { z } from "zod/v3";
|
|
2
|
-
const pageSchema = z.object({
|
|
3
|
-
id: z.string().describe("Stable PrimeUI page identifier. Use this to match the same page across tool responses."),
|
|
4
|
-
title: z.string().describe("Human-readable page title. Show this to the user when confirming which pages to import."),
|
|
5
|
-
slug: z
|
|
6
|
-
.string()
|
|
7
|
-
.describe("PrimeUI route slug, for example '/', '/pricing', '/docs/getting-started'. Use to match user intent."),
|
|
8
|
-
pageType: z
|
|
9
|
-
.string()
|
|
10
|
-
.describe("PrimeUI page type classification (for example landing, docs, pricing, blogIndex, legal)."),
|
|
11
|
-
isReadyToExport: z
|
|
12
|
-
.boolean()
|
|
13
|
-
.describe("True when this page has an active export-ready variant. Only ready pages are expected in export output."),
|
|
14
|
-
pagePath: z
|
|
15
|
-
.string()
|
|
16
|
-
.describe("Relative file path to the page source inside downloaded export root. Copy page code from this exact path."),
|
|
17
|
-
componentsPath: z
|
|
18
|
-
.string()
|
|
19
|
-
.describe("Relative directory path inside downloaded export root where page-level components live. Use as dependency copy start."),
|
|
20
|
-
}).describe("PrimeUI page descriptor used by project and export tools. Paths are always relative to export project root.");
|
|
21
|
-
const exportStatusSchema = z
|
|
22
|
-
.enum(["in_progress", "completed", "failed"])
|
|
23
|
-
.describe("Export lifecycle state. Use 'completed' before calling primeui_download_export.");
|
|
24
|
-
const exportItemSchema = z
|
|
25
|
-
.object({
|
|
26
|
-
id: z.string().describe("Export identifier. Pass this value to primeui_download_export input.id."),
|
|
27
|
-
status: exportStatusSchema,
|
|
28
|
-
createdAt: z.string().describe("Export creation timestamp in ISO-8601 UTC format."),
|
|
29
|
-
})
|
|
30
|
-
.describe("Single export record from PrimeUI export history.");
|
|
31
|
-
// ============================================================
|
|
32
|
-
// Shared constants
|
|
33
|
-
// ============================================================
|
|
34
|
-
const TRIGGER_PHRASES = [
|
|
35
|
-
"import page from PrimeUI",
|
|
36
|
-
"add page from PrimeUI",
|
|
37
|
-
"sync pages",
|
|
38
|
-
"pull page",
|
|
39
|
-
"transfer page",
|
|
40
|
-
"get page from PrimeUI",
|
|
41
|
-
"bring page from PrimeUI",
|
|
42
|
-
"export from PrimeUI",
|
|
43
|
-
].join(", ");
|
|
44
|
-
const WORKFLOW_SUMMARY = `
|
|
45
|
-
WORKFLOW ORDER (always follow this sequence):
|
|
46
|
-
1. primeui_get_project_info -> discover pages, confirm with user
|
|
47
|
-
2. primeui_create_export -> generate export snapshot
|
|
48
|
-
3. primeui_download_export -> download to temp directory
|
|
49
|
-
4. Manually move page code + dependencies into user's project (per page)
|
|
50
|
-
5. Repeat step 4 for each page user wants
|
|
51
|
-
6. primeui_clear_temp -> cleanup temp files
|
|
52
|
-
`.trim();
|
|
53
|
-
// ============================================================
|
|
54
|
-
// Server Instructions (initialInstructions)
|
|
55
|
-
// ============================================================
|
|
56
|
-
export const initialInstructions = `
|
|
57
|
-
PrimeUI MCP enables importing pages from PrimeUI Studio into your local project.
|
|
58
|
-
|
|
59
|
-
TRIGGER EXAMPLES (semantic intent, not exact phrase matching): ${TRIGGER_PHRASES}
|
|
60
|
-
|
|
61
|
-
${WORKFLOW_SUMMARY}
|
|
62
|
-
|
|
63
|
-
CRITICAL RULES FOR PAGE IMPORT:
|
|
64
|
-
- Import is PAGE-BY-PAGE only. Never import the entire project at once.
|
|
65
|
-
- The downloaded export in .primeui/temp/ contains a full standalone Next.js project.
|
|
66
|
-
Do NOT copy it wholesale.
|
|
67
|
-
- Copy ONLY the target page file and its direct component dependencies.
|
|
68
|
-
- Always use pagePath and componentsPath from tool responses as source of truth for file locations.
|
|
69
|
-
- Trace each page's imports to identify which component folders are needed.
|
|
70
|
-
- Check if components already exist in user's project - merge carefully, don't blindly overwrite.
|
|
71
|
-
- Adjust import paths to match user's project structure.
|
|
72
|
-
- Do NOT copy: package.json, next.config, tailwind.config, layout files, or any project-level config.
|
|
73
|
-
- If merge conflicts arise and cannot be resolved unambiguously, STOP and ask the user to decide.
|
|
74
|
-
`.trim();
|
|
75
|
-
// ============================================================
|
|
76
|
-
// Tool: primeui_get_project_info
|
|
77
|
-
// ============================================================
|
|
78
|
-
export const toolGetProjectInfo = {
|
|
79
|
-
title: "PrimeUI Project Info",
|
|
80
|
-
description: `ENTRY POINT for all PrimeUI import operations. Always start here. Returns project metadata and the full list of available pages.
|
|
81
|
-
|
|
82
|
-
WHEN TO USE: Call this FIRST when user wants to import, add, sync, pull, or transfer a page from PrimeUI. Intent examples (semantic intent, not exact phrase matching): ${TRIGGER_PHRASES}.
|
|
83
|
-
|
|
84
|
-
AFTER CALLING:
|
|
85
|
-
- If the user already specified which pages they need - verify those pages exist in the project and have isReadyToExport: true. If any requested page is not found or not ready, inform the user immediately.
|
|
86
|
-
- If the user did NOT specify pages - show the available pages list with titles and slugs, and ask which ones they want to import.
|
|
87
|
-
- Import works on a per-page basis, not the entire project at once. The user can request multiple pages, but each will be transferred individually.
|
|
88
|
-
- Only pages with isReadyToExport: true will be included in the export archive. If the user wants a page that is NOT ready, tell them to select an export-ready page variant in PrimeUI Studio first.
|
|
89
|
-
- Once target pages are confirmed, proceed to primeui_create_export.
|
|
90
|
-
|
|
91
|
-
${WORKFLOW_SUMMARY}`,
|
|
92
|
-
inputSchema: {},
|
|
93
|
-
outputSchema: {
|
|
94
|
-
projectId: z
|
|
95
|
-
.string()
|
|
96
|
-
.describe("PrimeUI project identifier associated with the API key and current import session context."),
|
|
97
|
-
projectName: z.string().describe("Human-readable PrimeUI project name for confirmations in chat."),
|
|
98
|
-
metadata: z
|
|
99
|
-
.record(z.unknown())
|
|
100
|
-
.describe("Additional project metadata from PrimeUI. May include project-description and other context fields."),
|
|
101
|
-
pages: z
|
|
102
|
-
.array(pageSchema)
|
|
103
|
-
.describe("All pages visible for this project context. Filter by user request and isReadyToExport before creating export."),
|
|
104
|
-
},
|
|
105
|
-
annotations: {
|
|
106
|
-
readOnlyHint: true,
|
|
107
|
-
destructiveHint: false,
|
|
108
|
-
idempotentHint: true,
|
|
109
|
-
openWorldHint: true,
|
|
110
|
-
},
|
|
111
|
-
};
|
|
112
|
-
// ============================================================
|
|
113
|
-
// Tool: primeui_list_exports
|
|
114
|
-
// ============================================================
|
|
115
|
-
export const toolListExports = {
|
|
116
|
-
title: "PrimeUI Export List",
|
|
117
|
-
description: `Auxiliary tool to list previously created exports with their IDs, statuses, and creation dates. This is NOT the starting point for page import - start with primeui_get_project_info instead.
|
|
118
|
-
|
|
119
|
-
WHEN TO USE: This is an OPTIONAL helper tool, NOT part of the main import flow. Use it only when:
|
|
120
|
-
- Something went wrong with an export and you need to check its status.
|
|
121
|
-
- The user explicitly references a previous export by date or context.
|
|
122
|
-
- You need to verify whether an export initiated via PrimeUI Studio UI has completed.
|
|
123
|
-
|
|
124
|
-
Note: exports can be created both through primeui_create_export AND by the user directly in PrimeUI Studio UI. This tool shows all of them.
|
|
125
|
-
|
|
126
|
-
Do NOT use this tool as a substitute for primeui_create_export. Always create a fresh export unless the user explicitly asks to use a previous one.
|
|
127
|
-
|
|
128
|
-
${WORKFLOW_SUMMARY}`,
|
|
129
|
-
inputSchema: {},
|
|
130
|
-
outputSchema: {
|
|
131
|
-
exports: z
|
|
132
|
-
.array(exportItemSchema)
|
|
133
|
-
.describe("Available exports sorted by API policy. Use item.id to download a specific prior export if user asks."),
|
|
134
|
-
},
|
|
135
|
-
annotations: {
|
|
136
|
-
readOnlyHint: true,
|
|
137
|
-
destructiveHint: false,
|
|
138
|
-
idempotentHint: true,
|
|
139
|
-
openWorldHint: true,
|
|
140
|
-
},
|
|
141
|
-
};
|
|
142
|
-
// ============================================================
|
|
143
|
-
// Tool: primeui_create_export
|
|
144
|
-
// ============================================================
|
|
145
|
-
export const toolCreateExport = {
|
|
146
|
-
title: "PrimeUI Create Export",
|
|
147
|
-
description: `Create a new export snapshot from the current PrimeUI project state and wait for completion. Returns export ID and the list of pages included in the export.
|
|
148
|
-
|
|
149
|
-
WHEN TO USE: Call this AFTER the user has confirmed which pages they want to import via primeui_get_project_info. This tool is REQUIRED before primeui_download_export, unless the user explicitly and directly asked to download a specific previous export.
|
|
150
|
-
|
|
151
|
-
AFTER CALLING:
|
|
152
|
-
- Verify that the pages the user wants are present in the export result AND have isReadyToExport: true. If a requested page is missing or not ready, inform the user before proceeding.
|
|
153
|
-
- Use the returned export ID to call primeui_download_export.
|
|
154
|
-
|
|
155
|
-
${WORKFLOW_SUMMARY}`,
|
|
156
|
-
inputSchema: {},
|
|
157
|
-
outputSchema: {
|
|
158
|
-
export: z
|
|
159
|
-
.object({
|
|
160
|
-
id: z.string().describe("Freshly created export identifier. Use this as primeui_download_export input.id."),
|
|
161
|
-
status: exportStatusSchema,
|
|
162
|
-
})
|
|
163
|
-
.describe("Created export summary."),
|
|
164
|
-
pages: z
|
|
165
|
-
.array(pageSchema)
|
|
166
|
-
.describe("Page snapshot associated with this export operation. Validate requested pages here before download/import."),
|
|
167
|
-
},
|
|
168
|
-
annotations: {
|
|
169
|
-
readOnlyHint: false,
|
|
170
|
-
destructiveHint: false,
|
|
171
|
-
idempotentHint: false,
|
|
172
|
-
openWorldHint: true,
|
|
173
|
-
},
|
|
174
|
-
};
|
|
175
|
-
// ============================================================
|
|
176
|
-
// Tool: primeui_download_export
|
|
177
|
-
// ============================================================
|
|
178
|
-
export const toolDownloadExport = {
|
|
179
|
-
title: "PrimeUI Download Export",
|
|
180
|
-
description: `Download a completed export into .primeui/temp/exports/[exportId]. Downloads and extracts the full export as a standalone Next.js project into the temp directory. This does NOT modify the user's project - files land only in .primeui/temp/.
|
|
181
|
-
|
|
182
|
-
Do NOT call this as the first step. Requires export ID from primeui_create_export. Start with primeui_get_project_info instead.
|
|
183
|
-
|
|
184
|
-
WHEN TO USE: Call this AFTER primeui_create_export has returned a completed export. Requires the export ID returned by primeui_create_export (or from primeui_list_exports if the user explicitly requested a previous export).
|
|
185
|
-
|
|
186
|
-
AFTER DOWNLOAD:
|
|
187
|
-
- The response includes a pages array. Verify the page the user wants is present and was exported successfully.
|
|
188
|
-
- Each page in the response has pagePath and componentsPath fields - use these as direct pointers to locate the page source code and its component dependencies in the downloaded export. No need to search manually.
|
|
189
|
-
|
|
190
|
-
MANUAL IMPORT STEPS per page (do not skip):
|
|
191
|
-
1. Read the page file at the pagePath from the response.
|
|
192
|
-
2. Read the component files at the componentsPath from the response. Trace the page's imports to identify which specific component folders are needed.
|
|
193
|
-
3. Copy ONLY the page file and its component dependencies into the user's project.
|
|
194
|
-
4. Adjust all import paths to match the user's project structure.
|
|
195
|
-
5. Check for existing components in user's project:
|
|
196
|
-
- If code overlaps or was modified on the user's side, carefully determine the nature of changes on both sides.
|
|
197
|
-
- If the merge conflict can be resolved unambiguously - resolve it.
|
|
198
|
-
- If NOT - STOP, explain the conflict to the user, and ask for their decision before continuing.
|
|
199
|
-
6. Do NOT copy project config files (package.json, next.config, tailwind.config, layout, etc.).
|
|
200
|
-
7. REPEAT steps 1-6 for each page the user wants to import.
|
|
201
|
-
8. Only after ALL pages are successfully imported, call primeui_clear_temp to clean up.
|
|
202
|
-
|
|
203
|
-
${WORKFLOW_SUMMARY}`,
|
|
204
|
-
inputSchema: {
|
|
205
|
-
id: z
|
|
206
|
-
.string()
|
|
207
|
-
.describe("Export identifier to download. Prefer export.id from primeui_create_export; use primeui_list_exports only on explicit user request."),
|
|
208
|
-
},
|
|
209
|
-
outputSchema: {
|
|
210
|
-
exportId: z
|
|
211
|
-
.string()
|
|
212
|
-
.describe("Downloaded export identifier. Should match the requested input.id for traceability."),
|
|
213
|
-
projectPath: z
|
|
214
|
-
.string()
|
|
215
|
-
.describe("Absolute local path to extracted export root in .primeui/temp/exports/[exportId]. Read files from here only."),
|
|
216
|
-
pages: z
|
|
217
|
-
.array(pageSchema)
|
|
218
|
-
.describe("Page descriptors for import decisions. Use pagePath/componentsPath from each item when copying code into user project."),
|
|
219
|
-
},
|
|
220
|
-
annotations: {
|
|
221
|
-
readOnlyHint: false,
|
|
222
|
-
destructiveHint: false,
|
|
223
|
-
idempotentHint: true,
|
|
224
|
-
openWorldHint: true,
|
|
225
|
-
},
|
|
226
|
-
};
|
|
227
|
-
// ============================================================
|
|
228
|
-
// Tool: primeui_clear_temp
|
|
229
|
-
// ============================================================
|
|
230
|
-
export const toolClearTemp = {
|
|
231
|
-
title: "PrimeUI Clear Temp",
|
|
232
|
-
description: `Delete all files in .primeui/temp/ and recreate empty temp structure.
|
|
233
|
-
|
|
234
|
-
Do NOT call this unless ALL requested pages have been successfully imported into the user's project.
|
|
235
|
-
|
|
236
|
-
WHEN TO USE: Call this as the FINAL step after ALL requested pages have been successfully imported into the user's project. Do not call this between page imports - wait until all pages are done.
|
|
237
|
-
|
|
238
|
-
Safe to call multiple times. Only affects .primeui/temp/ directory - never touches the user's project files.
|
|
239
|
-
|
|
240
|
-
${WORKFLOW_SUMMARY}`,
|
|
241
|
-
inputSchema: {},
|
|
242
|
-
outputSchema: {
|
|
243
|
-
success: z.boolean().describe("True when temp cleanup completed and baseline temp structure was recreated."),
|
|
244
|
-
},
|
|
245
|
-
annotations: {
|
|
246
|
-
readOnlyHint: false,
|
|
247
|
-
destructiveHint: false,
|
|
248
|
-
idempotentHint: true,
|
|
249
|
-
openWorldHint: false,
|
|
250
|
-
},
|
|
251
|
-
};
|
|
252
|
-
//# sourceMappingURL=instructions.js.map
|
package/dist/instructions.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"instructions.js","sourceRoot":"","sources":["../src/instructions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAA;AAE1B,MAAM,UAAU,GAAG,CAAC,CAAC,MAAM,CAAC;IAC1B,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,wFAAwF,CAAC;IACjH,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,yFAAyF,CAAC;IACrH,IAAI,EAAE,CAAC;SACJ,MAAM,EAAE;SACR,QAAQ,CAAC,qGAAqG,CAAC;IAClH,QAAQ,EAAE,CAAC;SACR,MAAM,EAAE;SACR,QAAQ,CAAC,0FAA0F,CAAC;IACvG,eAAe,EAAE,CAAC;SACf,OAAO,EAAE;SACT,QAAQ,CAAC,yGAAyG,CAAC;IACtH,QAAQ,EAAE,CAAC;SACR,MAAM,EAAE;SACR,QAAQ,CAAC,2GAA2G,CAAC;IACxH,cAAc,EAAE,CAAC;SACd,MAAM,EAAE;SACR,QAAQ,CACP,uHAAuH,CACxH;CACJ,CAAC,CAAC,QAAQ,CAAC,6GAA6G,CAAC,CAAA;AAE1H,MAAM,kBAAkB,GAAG,CAAC;KACzB,IAAI,CAAC,CAAC,aAAa,EAAE,WAAW,EAAE,QAAQ,CAAC,CAAC;KAC5C,QAAQ,CAAC,iFAAiF,CAAC,CAAA;AAE9F,MAAM,gBAAgB,GAAG,CAAC;KACvB,MAAM,CAAC;IACN,EAAE,EAAE,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B,GAAG;IAChC,KAAK,EAAE,yBAAyB;IAChC,WAAW,EAAE;;;;;;;;;;;;;;;;;;;;;;;IAuBX,gBAAgB,EAAE;IACpB,WAAW,EAAE;QACX,EAAE,EAAE,CAAC;aACF,MAAM,EAAE;aACR,QAAQ,CACP,qIAAqI,CACtI;KACJ;IACD,YAAY,EAAE;QACZ,QAAQ,EAAE,CAAC;aACR,MAAM,EAAE;aACR,QAAQ,CAAC,qFAAqF,CAAC;QAClG,WAAW,EAAE,CAAC;aACX,MAAM,EAAE;aACR,QAAQ,CACP,8GAA8G,CAC/G;QACH,KAAK,EAAE,CAAC;aACL,KAAK,CAAC,UAAU,CAAC;aACjB,QAAQ,CACP,wHAAwH,CACzH;KACJ;IACD,WAAW,EAAE;QACX,YAAY,EAAE,KAAK;QACnB,eAAe,EAAE,KAAK;QACtB,cAAc,EAAE,IAAI;QACpB,aAAa,EAAE,IAAI;KACpB;CACF,CAAA;AAED,+DAA+D;AAC/D,2BAA2B;AAC3B,+DAA+D;AAE/D,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,KAAK,EAAE,oBAAoB;IAC3B,WAAW,EAAE;;;;;;;;EAQb,gBAAgB,EAAE;IAClB,WAAW,EAAE,EAAE;IACf,YAAY,EAAE;QACZ,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,CAAC,6EAA6E,CAAC;KAC7G;IACD,WAAW,EAAE;QACX,YAAY,EAAE,KAAK;QACnB,eAAe,EAAE,KAAK;QACtB,cAAc,EAAE,IAAI;QACpB,aAAa,EAAE,KAAK;KACrB;CACF,CAAA"}
|
package/dist/lib/fs.d.ts
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
export declare function ensureDir(dirPath: string): Promise<void>;
|
|
2
|
-
export declare function resetDir(dirPath: string): Promise<void>;
|
|
3
|
-
export declare function writeUtf8(filePath: string, content: string): Promise<void>;
|
|
4
|
-
export declare function extractZip(zipPath: string, targetDir: string): Promise<void>;
|
package/dist/lib/fs.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { mkdir, rm, writeFile } from "node:fs/promises";
|
|
2
|
-
import path from "node:path";
|
|
3
|
-
import extractZipArchive from "extract-zip";
|
|
4
|
-
export async function ensureDir(dirPath) {
|
|
5
|
-
await mkdir(dirPath, { recursive: true });
|
|
6
|
-
}
|
|
7
|
-
export async function resetDir(dirPath) {
|
|
8
|
-
await rm(dirPath, { recursive: true, force: true });
|
|
9
|
-
await mkdir(dirPath, { recursive: true });
|
|
10
|
-
}
|
|
11
|
-
export async function writeUtf8(filePath, content) {
|
|
12
|
-
await ensureDir(path.dirname(filePath));
|
|
13
|
-
await writeFile(filePath, content, "utf-8");
|
|
14
|
-
}
|
|
15
|
-
export async function extractZip(zipPath, targetDir) {
|
|
16
|
-
await ensureDir(targetDir);
|
|
17
|
-
try {
|
|
18
|
-
await extractZipArchive(zipPath, { dir: targetDir });
|
|
19
|
-
}
|
|
20
|
-
catch (error) {
|
|
21
|
-
const details = error instanceof Error ? error.message : String(error);
|
|
22
|
-
throw new Error(`Failed to extract zip at "${zipPath}". ${details}`);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
//# sourceMappingURL=fs.js.map
|
package/dist/lib/fs.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fs.js","sourceRoot":"","sources":["../../src/lib/fs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AACvD,OAAO,IAAI,MAAM,WAAW,CAAA;AAC5B,OAAO,iBAAiB,MAAM,aAAa,CAAA;AAE3C,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,OAAe;IAC7C,MAAM,KAAK,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAA;AAC3C,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,QAAQ,CAAC,OAAe;IAC5C,MAA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