@zaai-dev/mcp 0.3.0 → 0.6.1

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,156 +1,171 @@
1
- # Zaai Dev MCP
2
-
3
- Model Context Protocol server for the [Zaai Dev](https://www.zaaistudio.com) platform. Exposes your captured design references to MCP-compatible AI tools — Claude Code, Claude Desktop, Cursor, Continue, Cline, anything else that speaks MCP.
4
-
5
- After a one-time token paste, prompts like *"list my last 5 captures tagged hero and show me their palettes"* call the workspace directly and pull back real data.
6
-
7
- ## Install
8
-
9
- You need:
10
-
11
- - **Node 20 or newer** (`node --version`)
12
- - A **Zaai Dev workspace account** at https://www.zaaistudio.com
13
- - An **MCP token** — mint one at https://www.zaaistudio.com/dev/settings/tokens (pick "mcp" as the kind). The token-mint screen also shows the config snippets below pre-filled with your secret.
14
-
15
- ### Claude Desktop
16
-
17
- Add to `claude_desktop_config.json` — merge into the existing `mcpServers` block, don't replace the whole file.
18
-
19
- - **macOS:** `~/Library/Application Support/Claude/claude_desktop_config.json`
20
- - **Windows:** `%APPDATA%\Claude\claude_desktop_config.json`
21
- - **Linux:** `~/.config/Claude/claude_desktop_config.json`
22
-
23
- ```json
24
- {
25
- "mcpServers": {
26
- "zaai-dev": {
27
- "command": "npx",
28
- "args": ["-y", "@zaai-dev/mcp"],
29
- "env": {
30
- "ZAAI_API_TOKEN": "zaai_mcp_YOUR_SECRET_HERE"
31
- }
32
- }
33
- }
34
- }
35
- ```
36
-
37
- Restart Claude Desktop. The 17 tools below appear in the slash-command picker.
38
-
39
- ### Cursor
40
-
41
- Add to `~/.cursor/mcp.json` — same JSON shape as Claude Desktop.
42
-
43
- ```json
44
- {
45
- "mcpServers": {
46
- "zaai-dev": {
47
- "command": "npx",
48
- "args": ["-y", "@zaai-dev/mcp"],
49
- "env": {
50
- "ZAAI_API_TOKEN": "zaai_mcp_YOUR_SECRET_HERE"
51
- }
52
- }
53
- }
54
- }
55
- ```
56
-
57
- Restart Cursor.
58
-
59
- ### Claude Code (CLI)
60
-
61
- One-liner — updates `~/.claude/mcp_servers.json` automatically:
62
-
63
- ```sh
64
- claude mcp add zaai-dev -e ZAAI_API_TOKEN=zaai_mcp_YOUR_SECRET_HERE -- npx -y @zaai-dev/mcp
65
- ```
66
-
67
- ### Streamable HTTP (v0.3.0+, hosted-agent use cases)
68
-
69
- If you want to run Zaai Dev MCP as a network service — e.g. behind a reverse proxy on Fly / Cloudflare / Render so hosted agents (Claude.ai web, OpenAI Assistants, custom frameworks) can reach it — use the `zaai-dev-mcp-http` binary instead of the stdio one:
70
-
71
- ```sh
72
- ZAAI_API_TOKEN=zaai_mcp_... \
73
- ZAAI_HTTP_PORT=3001 \
74
- npx -y --package=@zaai-dev/mcp zaai-dev-mcp-http
75
- # POST /mcp for MCP traffic, GET /healthz for liveness
76
- ```
77
-
78
- **Single-tenant in v1.5** — one process serves one workspace token. Run one process per token if you need multi-tenant, or wait for v2 which adds per-request token binding. Most "I want HTTP" use cases are single-tenant anyway.
79
-
80
- ## Tools
81
-
82
- All tools except `health` need a valid token. All tools except `health` and `whoami` charge credits per successful call (your workspace plan determines the monthly grant — see [pricing](https://www.zaaistudio.com/dev/pricing)).
83
-
84
- ### Captures (org-wide)
85
-
86
- | Tool | What it does | Cost |
87
- |---|---|---|
88
- | `health` | Server status + version + uptime. No auth. | 0 |
89
- | `whoami` | Your userId, orgId, project scope, credit balance. | 0 |
90
- | `list_captures` | Paginated list of your captures (newest first). Args: `q`, `cursor`, `limit`. | 1 |
91
- | `search_captures` | Same as list but with `q` required. Tuned description for targeted retrieval. | 1 |
92
- | `get_capture` | Full payload + signed screenshot URLs for one capture id. | 1 |
93
- | `get_palette` | Just the palette slice (page) or eyedropper picks (element/composite). | 1 |
94
- | `get_html` | Just the HTML. Page → full HTML; element → outerHTML; composite → concat with markers. | 1 |
95
- | `get_animation` | Just the animation data — CSS transitions, keyframes, library hints. | 1 |
96
- | `get_media` | Just the media inventory — videos, images, backgrounds, carousels. | 1 |
97
-
98
- ### Brand brief + references (project-scoped, v0.2.0+)
99
-
100
- These tools each take a `project_id` arg (find via the workspace at `zaaistudio.com/dev/projects/<id>` — the UUID is in the URL).
101
-
102
- | Tool | What it does | Cost |
103
- |---|---|---|
104
- | `get_brand_brief` | Full published brief: positioning, values, voice, audience, design intent, decisions. | 1 |
105
- | `get_voice` | Voice slice onlyone-liner, tone descriptors, do/don't say, example phrases. | 1 |
106
- | `get_audience` | Primary + secondary segments, needs, channels. | 1 |
107
- | `get_design_intent` | Descriptors + anti-descriptors + inspiration summary. | 1 |
108
- | `get_brand_tokens` | Colors, fonts, radius, shadow scales. | 1 |
109
- | `get_decisions` | Paginated decisions log with attribution + brief_field links. | 1 |
110
- | `get_references` | Paginated project-scoped reference list. | 1 |
111
- | `search_references` | Keyword search within a project's references. | 1 |
112
-
113
- Plus the `zaai-capture://{id}` resource template attach individual captures to a conversation via the resource picker.
114
-
115
- ## Errors
116
-
117
- | Error class | Meaning | Action |
118
- |---|---|---|
119
- | `Unauthorized` | Token invalid, revoked, or wrong kind | Mint a fresh `mcp` token, update your config, restart |
120
- | `InsufficientCredits` | Out of credits for the month | [Top up](https://www.zaaistudio.com/dev/settings/billing) or wait for the monthly grant |
121
- | `CaptureNotFound` | id doesn't exist OR is in a project the token can't see | `list_captures` to find valid ids |
122
- | `InvalidCaptureId` / `InvalidProjectId` | id isn't a UUID | Pass a UUID from `list_captures` / the workspace URL |
123
- | `ProjectNotFound` | project_id isn't in your org | Check the id, or that the token's project scope allows this project |
124
- | `ProjectArchived` | Project exists but is archived | Unarchive in the workspace or use a different project |
125
- | `OutOfScope` | Token is scoped to specific projects + this isn't one of them | Mint a token without project scope, or add this project to the existing token |
126
- | `UnknownCaptureField` | Hit a focused-getter route with an unknown field | Use one of: `palette`, `html`, `animation`, `media` |
127
-
128
- Errors return as `isError: true` in the tool result so the LLM can read and act on them.
129
-
130
- Transient failures (network errors, 502/503/504, 429 rate-limits) retry automatically with exponential backoff (250ms → 500ms → 1000ms, 3 attempts). Retries are transparent — you only see the final outcome — and don't double-charge because the workspace only bills on requests that actually executed.
131
-
132
- ## Troubleshooting
133
-
134
- See [TROUBLESHOOTING.md](./TROUBLESHOOTING.md) for a checklist of common first-install issues and their fixes.
135
-
136
- ## Privacy + scoping
137
-
138
- The server holds **only your MCP token** it never sees your password, your Supabase service-role key, or other users' data. The workspace's `verifyToken` derives `userId` + `orgId` from your token on every request; queries are scoped to that user + the token's project allowlist (which you set at mint time). A revoked token causes the next tool call to fail with `Unauthorized`.
139
-
140
- The server itself runs entirely on your machine `npx -y @zaai-dev/mcp` downloads the package once, then your AI tool launches it as a subprocess. No telemetry, no analytics SDK.
141
-
142
- ## Building locally
143
-
144
- ```sh
145
- git clone https://github.com/POLONIBOI/ZAAI_dev_mcp.git
146
- cd ZAAI_dev_mcp
147
- pnpm install
148
- pnpm build
149
- pnpm inspector # MCP Inspector for interactive testing
150
- ```
151
-
152
- You'll need `ZAAI_API_TOKEN` set as an env var (or pasted into the Inspector's Environment Variables panel before clicking Connect).
153
-
154
- ## License
155
-
156
- [MIT](LICENSE).
1
+ # Zaai Dev MCP
2
+
3
+ Model Context Protocol server for the [Zaai Dev](https://zaaidev.com) platform. Exposes your captured design references to MCP-compatible AI tools — Claude Code, Claude Desktop, Cursor, Continue, Cline, anything else that speaks MCP.
4
+
5
+ After a one-time token paste, prompts like *"list my last 5 captures tagged hero and show me their palettes"* call the workspace directly and pull back real data.
6
+
7
+ ## Install
8
+
9
+ You need:
10
+
11
+ - **Node 20 or newer** (`node --version`)
12
+ - A **Zaai Dev workspace account** at https://zaaidev.com
13
+ - An **MCP token** — mint one at https://zaaidev.com/dev/settings/tokens (pick "mcp" as the kind). The token-mint screen also shows the config snippets below pre-filled with your secret.
14
+
15
+ ### Claude Desktop
16
+
17
+ Add to `claude_desktop_config.json` — merge into the existing `mcpServers` block, don't replace the whole file.
18
+
19
+ - **macOS:** `~/Library/Application Support/Claude/claude_desktop_config.json`
20
+ - **Windows:** `%APPDATA%\Claude\claude_desktop_config.json`
21
+ - **Linux:** `~/.config/Claude/claude_desktop_config.json`
22
+
23
+ ```json
24
+ {
25
+ "mcpServers": {
26
+ "zaai-dev": {
27
+ "command": "npx",
28
+ "args": ["-y", "@zaai-dev/mcp"],
29
+ "env": {
30
+ "ZAAI_API_TOKEN": "zaai_mcp_YOUR_SECRET_HERE"
31
+ }
32
+ }
33
+ }
34
+ }
35
+ ```
36
+
37
+ Restart Claude Desktop. The 23 tools below appear in the slash-command picker.
38
+
39
+ ### Cursor
40
+
41
+ Add to `~/.cursor/mcp.json` — same JSON shape as Claude Desktop.
42
+
43
+ ```json
44
+ {
45
+ "mcpServers": {
46
+ "zaai-dev": {
47
+ "command": "npx",
48
+ "args": ["-y", "@zaai-dev/mcp"],
49
+ "env": {
50
+ "ZAAI_API_TOKEN": "zaai_mcp_YOUR_SECRET_HERE"
51
+ }
52
+ }
53
+ }
54
+ }
55
+ ```
56
+
57
+ Restart Cursor.
58
+
59
+ ### Claude Code (CLI)
60
+
61
+ One-liner — updates `~/.claude/mcp_servers.json` automatically:
62
+
63
+ ```sh
64
+ claude mcp add zaai-dev -e ZAAI_API_TOKEN=zaai_mcp_YOUR_SECRET_HERE -- npx -y @zaai-dev/mcp
65
+ ```
66
+
67
+ ### Streamable HTTP (v0.3.0+, hosted-agent use cases)
68
+
69
+ If you want to run Zaai Dev MCP as a network service — e.g. behind a reverse proxy on Fly / Cloudflare / Render so hosted agents (Claude.ai web, OpenAI Assistants, custom frameworks) can reach it — use the `zaai-dev-mcp-http` binary instead of the stdio one:
70
+
71
+ ```sh
72
+ ZAAI_API_TOKEN=zaai_mcp_... \
73
+ ZAAI_HTTP_PORT=3001 \
74
+ npx -y --package=@zaai-dev/mcp zaai-dev-mcp-http
75
+ # POST /mcp for MCP traffic, GET /healthz for liveness
76
+ ```
77
+
78
+ **Single-tenant in v1.5** — one process serves one workspace token. Run one process per token if you need multi-tenant, or wait for v2 which adds per-request token binding. Most "I want HTTP" use cases are single-tenant anyway.
79
+
80
+ ## Tools
81
+
82
+ All tools except `health` need a valid token. All tools except `health` and `whoami` charge credits per successful call (your workspace plan determines the monthly grant — see [pricing](https://zaaidev.com/dev/pricing)).
83
+
84
+ ### Captures (org-wide)
85
+
86
+ | Tool | What it does | Cost |
87
+ |---|---|---|
88
+ | `health` | Server status + version + uptime. No auth. | 0 |
89
+ | `whoami` | Your userId, orgId, project scope, credit balance. | 0 |
90
+ | `list_captures` | Paginated list of your captures (newest first). Args: `q`, `cursor`, `limit`. | 1 |
91
+ | `search_captures` | Same as list but with `q` required. Tuned description for targeted retrieval. | 1 |
92
+ | `get_capture` | Full payload + signed screenshot URLs for one capture id. | 1 |
93
+ | `get_palette` | Just the palette slice (page) or eyedropper picks (element/composite). | 1 |
94
+ | `get_html` | Just the HTML. Page → full HTML; element → outerHTML; composite → concat with markers. | 1 |
95
+ | `get_animation` | Just the animation data — CSS transitions, keyframes, library hints. | 1 |
96
+ | `get_media` | Just the media inventory — videos, images, backgrounds, carousels. | 1 |
97
+ | `get_structure` | Just the Layer-Explorer teardown — the structure map (nodes w/ depth, rects, selectors, components, flags). Page/element → one map; composite → per-element. | 1 |
98
+
99
+ ### Brand brief + references (project-scoped, v0.2.0+)
100
+
101
+ These tools each take a `project_id` arg (find via the workspace at `zaaidev.com/dev/projects/<id>` — the UUID is in the URL). The five brief-read tools also accept an optional `brief_id` to target a specific brief on projects that have more than one; omit it for the project's default brand-identity brief.
102
+
103
+ | Tool | What it does | Cost |
104
+ |---|---|---|
105
+ | `list_briefs` | Every brief on a project id, type, name, status, current-version metadata. Call first, then pass `brief_id`. | 1 |
106
+ | `get_brand_brief` | Full published brief: positioning, values, voice, audience, design intent, decisions. Optional `brief_id`. | 1 |
107
+ | `get_voice` | Voice slice only — one-liner, tone descriptors, do/don't say, example phrases. Optional `brief_id`. | 1 |
108
+ | `get_audience` | Primary + secondary segments, needs, channels. Optional `brief_id`. | 1 |
109
+ | `get_design_intent` | Descriptors + anti-descriptors + inspiration summary. Optional `brief_id`. | 1 |
110
+ | `get_brand_tokens` | Colors, fonts, radius, shadow scales. Optional `brief_id`. | 1 |
111
+ | `get_decisions` | Paginated decisions log with attribution + brief_field links. | 1 |
112
+ | `log_decision` | Record a brand/design decision (what, why, optional brief_field). Write tool. | 1 |
113
+ | `get_references` | Paginated project-scoped reference list. | 1 |
114
+ | `search_references` | Keyword search within a project's references. | 1 |
115
+ | `add_reference` | Create a URL-only reference capture from a link. Write tool. | 5 |
116
+
117
+ ### Docs / block-docs (project-scoped, v0.3.0+)
118
+
119
+ | Tool | What it does | Cost |
120
+ |---|---|---|
121
+ | `list_docs` | Every doc on a project id, type, name, status, current-version metadata. Friendly alias of `list_briefs`. | 1 |
122
+ | `get_doc` | A doc as an agent-ready block list — text + capture references with role/treatment, the captured **`code`** (element outerHTML + computed CSS + build tokens, or page HTML) to build from real values, and the sign-off (approval) signal. Omit `doc_id` for the brand-identity doc. | 1 |
123
+ | `get_project_bundle` | The whole project in one call project meta, all docs (as above), and capture summaries. Can be large. | 1 |
124
+
125
+ Plus the `zaai-capture://{id}` resource template attach individual captures to a conversation via the resource picker.
126
+
127
+ ## Errors
128
+
129
+ | Error class | Meaning | Action |
130
+ |---|---|---|
131
+ | `Unauthorized` | Token invalid, revoked, or wrong kind | Mint a fresh `mcp` token, update your config, restart |
132
+ | `InsufficientCredits` | Out of credits for the month | [Top up](https://zaaidev.com/dev/settings/billing) or wait for the monthly grant |
133
+ | `CaptureNotFound` | id doesn't exist OR is in a project the token can't see | `list_captures` to find valid ids |
134
+ | `InvalidCaptureId` / `InvalidProjectId` | id isn't a UUID | Pass a UUID from `list_captures` / the workspace URL |
135
+ | `ProjectNotFound` | project_id isn't in your org | Check the id, or that the token's project scope allows this project |
136
+ | `ProjectArchived` | Project exists but is archived | Unarchive in the workspace or use a different project |
137
+ | `OutOfScope` | Token is scoped to specific projects + this isn't one of them | Mint a token without project scope, or add this project to the existing token |
138
+ | `wrong_brief_type` | A brief tool was called against a brief of the wrong type | Use `list_briefs` to find a brief of the expected type, pass its `brief_id` |
139
+ | `InvalidDocId` | `get_doc` was passed a malformed doc id | Use `list_docs` for valid ids, or omit `doc_id` for the default doc |
140
+ | `RateLimited` | Exceeded ~60 calls/min for this token | The server already retried with backoff wait a moment before retrying |
141
+ | `UnknownCaptureField` | Hit a focused-getter route with an unknown field | Use one of: `palette`, `html`, `animation`, `media`, `structure` |
142
+
143
+ Errors return as `isError: true` in the tool result so the LLM can read and act on them.
144
+
145
+ Transient failures (network errors, 502/503/504, 429 rate-limits) retry automatically with exponential backoff (250ms → 500ms → 1000ms, 3 attempts). Retries are transparent — you only see the final outcome — and don't double-charge because the workspace only bills on requests that actually executed.
146
+
147
+ ## Troubleshooting
148
+
149
+ See [TROUBLESHOOTING.md](./TROUBLESHOOTING.md) for a checklist of common first-install issues and their fixes.
150
+
151
+ ## Privacy + scoping
152
+
153
+ The server holds **only your MCP token** — it never sees your password, your Supabase service-role key, or other users' data. The workspace's `verifyToken` derives `userId` + `orgId` from your token on every request; queries are scoped to that user + the token's project allowlist (which you set at mint time). A revoked token causes the next tool call to fail with `Unauthorized`.
154
+
155
+ The server itself runs entirely on your machine — `npx -y @zaai-dev/mcp` downloads the package once, then your AI tool launches it as a subprocess. No telemetry, no analytics SDK.
156
+
157
+ ## Building locally
158
+
159
+ ```sh
160
+ git clone https://github.com/POLONIBOI/ZAAI_dev_mcp.git
161
+ cd ZAAI_dev_mcp
162
+ pnpm install
163
+ pnpm build
164
+ pnpm inspector # MCP Inspector for interactive testing
165
+ ```
166
+
167
+ You'll need `ZAAI_API_TOKEN` set as an env var (or pasted into the Inspector's Environment Variables panel before clicking Connect).
168
+
169
+ ## License
170
+
171
+ [MIT](LICENSE).