@primeuicom/mcp 0.1.6 → 0.1.7

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 CHANGED
@@ -1,22 +1,94 @@
1
- # @primeui/mcp
1
+ # @primeuicom/mcp
2
2
 
3
- PrimeUI MCP server package.
3
+ PrimeUI MCP connects AI agents to PrimeUI so they can discover project pages, create exports, download export artifacts, and automate PrimeUI-powered workflows directly from your coding environment.
4
4
 
5
- ## Runtime
5
+ ## Purpose and goals
6
6
 
7
- The package uses Studio API v1 with bearer authentication.
7
+ PrimeUI MCP is the integration layer between PrimeUI and MCP-compatible agents.
8
8
 
9
- Required env:
10
- - `PRIMEUI_API_KEY`
9
+ Core goals:
11
10
 
12
- Optional env:
13
- - `PRIMEUI_API_BASE_URL`
14
- - if set: MCP calls this base URL,
15
- - if not set: MCP defaults to `https://app.primeui.com/`.
11
+ - Give agents a reliable way to read PrimeUI project metadata and page inventory.
12
+ - Let agents trigger and monitor PrimeUI exports.
13
+ - Let agents download export bundles into a local workspace for code-level operations.
14
+ - Provide a stable MCP tool contract for PrimeUI workflows.
16
15
 
17
- The API root is normalized to `/api/v1`.
16
+ ## Requirements
18
17
 
19
- Example `.mcp.json`:
18
+ - An MCP client that supports `stdio` servers.
19
+ - A working Node.js runtime (the server is launched via `npx`).
20
+ - A valid PrimeUI API key (`PRIMEUI_API_KEY`).
21
+
22
+ ## PrimeUI API KEY
23
+
24
+ - PrimeUI provides this key together with the exported project.
25
+ - In practice, it is preconfigured in the exported project's `.mcp.json` for the `primeui` server entry.
26
+
27
+ ## Getting started
28
+
29
+ The setup below works in any MCP client that supports `.mcp.json` with `stdio` command servers (for example: Codex CLI, Cursor, Cline, and other compatible clients).
30
+
31
+ Create or update `.mcp.json`:
32
+
33
+ ```json
34
+ {
35
+ "mcpServers": {
36
+ "primeui": {
37
+ "type": "stdio",
38
+ "command": "npx",
39
+ "args": ["-y", "@primeuicom/mcp@latest"],
40
+ "env": {
41
+ "PRIMEUI_API_KEY": "your-primeui-api-key"
42
+ }
43
+ }
44
+ }
45
+ }
46
+ ```
47
+
48
+ Optional environment variables:
49
+
50
+ - `PRIMEUI_API_BASE_URL`: custom PrimeUI app base URL (default: `https://app.primeui.com/`).
51
+ - `PRIMEUI_PROJECT_ROOT`: absolute path to the target local project root. If omitted, current working directory is used.
52
+
53
+ Notes:
54
+
55
+ - API root is normalized to `/api/v1`.
56
+ - Temporary export files are written under `.primeui/temp/`.
57
+
58
+ ## Install in common MCP clients
59
+
60
+ If your CLI command syntax differs by client version, use the JSON config from Getting started with the same `primeui` server block.
61
+
62
+ <details>
63
+ <summary>Codex CLI</summary>
64
+
65
+ Use the Codex MCP add command:
66
+
67
+ ```bash
68
+ codex mcp add primeui -- npx -y @primeuicom/mcp@latest
69
+ ```
70
+
71
+ Then set `PRIMEUI_API_KEY` in the MCP server env for `primeui`.
72
+
73
+ </details>
74
+
75
+ <details>
76
+ <summary>Claude Code</summary>
77
+
78
+ Add the server:
79
+
80
+ ```bash
81
+ claude mcp add primeui -- npx -y @primeuicom/mcp@latest
82
+ ```
83
+
84
+ Then configure server environment variables (at minimum `PRIMEUI_API_KEY`).
85
+
86
+ </details>
87
+
88
+ <details>
89
+ <summary>Cursor</summary>
90
+
91
+ Add the same server config to your Cursor MCP configuration:
20
92
 
21
93
  ```json
22
94
  {
@@ -26,24 +98,104 @@ Example `.mcp.json`:
26
98
  "command": "npx",
27
99
  "args": ["-y", "@primeuicom/mcp@latest"],
28
100
  "env": {
29
- "PRIMEUI_API_KEY": "<issued-api-key>"
101
+ "PRIMEUI_API_KEY": "your-primeui-api-key"
30
102
  }
31
103
  }
32
104
  }
33
105
  }
34
106
  ```
35
107
 
36
- ## Token revocation note
108
+ </details>
37
109
 
38
- API keys embed `ver` (token version). Future revocation/rotation is implemented by incrementing `project_api_access.token_version`.
110
+ <details>
111
+ <summary>VS Code MCP-compatible setup</summary>
39
112
 
40
- ## Local dev
113
+ If your setup supports VS Code MCP server registration via CLI:
41
114
 
42
115
  ```bash
43
- pnpm --filter @primeui/mcp dev
116
+ code --add-mcp '{"name":"primeui","command":"npx","args":["-y","@primeuicom/mcp@latest"],"env":{"PRIMEUI_API_KEY":"your-primeui-api-key"}}'
44
117
  ```
45
118
 
119
+ If your setup uses JSON config instead, use the same `.mcp.json` example from Getting started.
120
+
121
+ </details>
122
+
123
+ <details>
124
+ <summary>Cline / other JSON-config clients</summary>
125
+
126
+ Use the same `.mcp.json` server block from Getting started and provide `PRIMEUI_API_KEY`.
127
+
128
+ </details>
129
+
130
+ <details>
131
+ <summary>Gemini CLI</summary>
132
+
133
+ Add PrimeUI MCP:
134
+
46
135
  ```bash
47
- pnpm inspect
136
+ gemini mcp add primeui npx -y @primeuicom/mcp@latest
137
+ ```
138
+
139
+ Then configure `PRIMEUI_API_KEY` for that server entry.
140
+
141
+ </details>
142
+
143
+ <details>
144
+ <summary>Windsurf</summary>
145
+
146
+ Use the same JSON server configuration shown in Getting started:
147
+
148
+ ```json
149
+ {
150
+ "mcpServers": {
151
+ "primeui": {
152
+ "type": "stdio",
153
+ "command": "npx",
154
+ "args": ["-y", "@primeuicom/mcp@latest"],
155
+ "env": {
156
+ "PRIMEUI_API_KEY": "your-primeui-api-key"
157
+ }
158
+ }
159
+ }
160
+ }
161
+ ```
162
+
163
+ </details>
164
+
165
+ ## Tools
166
+
167
+ Available tools:
48
168
 
169
+ | Tool | What it does | Input |
170
+ | --- | --- | --- |
171
+ | `primeui_get_project_info` | Returns project metadata and page list, including export readiness and source paths. | none |
172
+ | `primeui_list_exports` | Lists existing exports with ID, status, and creation time. | none |
173
+ | `primeui_create_export` | Starts a new export and returns created export info plus page snapshot. | none |
174
+ | `primeui_download_export` | Downloads and extracts a completed export into `.primeui/temp/exports/<exportId>/`. | `id` (export ID) |
175
+ | `primeui_clear_temp` | Clears `.primeui/temp/` and recreates baseline temp layout. | none |
176
+
177
+ ## Your first prompt
178
+
179
+ Try this in your MCP-enabled agent:
180
+
181
+ ```text
182
+ Use PrimeUI MCP to get my project info, list pages that are ready to export, then create a new export and tell me which export ID was created.
183
+ ```
184
+
185
+ Next step:
186
+
187
+ ```text
188
+ Download that export with PrimeUI MCP and show me the local extracted projectPath and pagePath for the /pricing page.
49
189
  ```
190
+
191
+ ## Runtime behavior
192
+
193
+ - PrimeUI MCP uses bearer authentication with `PRIMEUI_API_KEY`.
194
+ - If `PRIMEUI_API_BASE_URL` is not set, it uses `https://app.primeui.com/`.
195
+ - Downloaded archives are validated as ZIP payloads before extraction.
196
+
197
+ ## Troubleshooting
198
+
199
+ - `PRIMEUI_API_KEY is required`: add or fix `PRIMEUI_API_KEY` in MCP server env.
200
+ - `Failed to extract zip`: verify local file permissions and retry.
201
+ - API contract mismatch errors: your client/server versions may be out of sync; update to latest package and verify PrimeUI backend version.
package/dist/lib/fs.js CHANGED
@@ -1,8 +1,6 @@
1
- import { execFile } from "node:child_process";
2
1
  import { mkdir, rm, writeFile } from "node:fs/promises";
3
2
  import path from "node:path";
4
- import { promisify } from "node:util";
5
- const execFileAsync = promisify(execFile);
3
+ import extractZipArchive from "extract-zip";
6
4
  export async function ensureDir(dirPath) {
7
5
  await mkdir(dirPath, { recursive: true });
8
6
  }
@@ -17,11 +15,11 @@ export async function writeUtf8(filePath, content) {
17
15
  export async function extractZip(zipPath, targetDir) {
18
16
  await ensureDir(targetDir);
19
17
  try {
20
- await execFileAsync("unzip", ["-o", zipPath, "-d", targetDir]);
18
+ await extractZipArchive(zipPath, { dir: targetDir });
21
19
  }
22
20
  catch (error) {
23
21
  const details = error instanceof Error ? error.message : String(error);
24
- throw new Error(`Failed to extract zip at "${zipPath}". Ensure "unzip" is installed. ${details}`);
22
+ throw new Error(`Failed to extract zip at "${zipPath}". ${details}`);
25
23
  }
26
24
  }
27
25
  //# sourceMappingURL=fs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"fs.js","sourceRoot":"","sources":["../../src/lib/fs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE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,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;QACtE,MAAM,IAAI,KAAK,CAAC,6BAA6B,OAAO,MAAM,OAAO,EAAE,CAAC,CAAA;IACtE,CAAC;AACH,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@primeuicom/mcp",
3
- "version": "0.1.6",
3
+ "version": "0.1.7",
4
4
  "type": "module",
5
5
  "main": "dist/service.js",
6
6
  "bin": {
@@ -20,6 +20,7 @@
20
20
  },
21
21
  "dependencies": {
22
22
  "@modelcontextprotocol/sdk": "^1.25.3",
23
+ "extract-zip": "^2.0.1",
23
24
  "zod": "^3.25.76"
24
25
  },
25
26
  "devDependencies": {