@thedesignagent/mcp 0.2.1 → 0.2.3
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/LICENSE +21 -0
- package/README.md +50 -18
- package/dist/index.d.ts +18 -15
- package/dist/index.js +113 -110
- package/package.json +4 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 TheDesignAgent
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -10,21 +10,31 @@ Works with any MCP client: Claude Code, Codex, Cursor, Grok Build, Claude Deskto
|
|
|
10
10
|
|
|
11
11
|
| Tool | When | What it returns |
|
|
12
12
|
| --- | --- | --- |
|
|
13
|
-
| `
|
|
14
|
-
| `
|
|
15
|
-
| `
|
|
13
|
+
| `Discover` | Before building a screen | A ~600-token build brief: the user's job, heuristics to apply, patterns, design tokens |
|
|
14
|
+
| `Ux` | After building | 0–10 score for heuristics, cognitive load, pattern conformance and job fit, with findings and fixes |
|
|
15
|
+
| `Visual` | After building | 0–10 score for brand compliance, visual hierarchy and aesthetics, from a screenshot when you pass `render_url` |
|
|
16
16
|
|
|
17
17
|
Project context is stored server-side and improves with every call: anti-patterns found in one review shape the next brief.
|
|
18
18
|
|
|
19
|
-
##
|
|
19
|
+
## Hosted or local?
|
|
20
|
+
|
|
21
|
+
TheDesignAgent runs in two places. The same API key works in both.
|
|
22
|
+
|
|
23
|
+
| | Hosted: `https://www.thedesignagent.ai/mcp` | Local: this package |
|
|
24
|
+
| --- | --- | --- |
|
|
25
|
+
| Tools | `Discover`, `Ux` | `Discover`, `Ux`, `Visual` |
|
|
26
|
+
| Install | Nothing to install | Node.js 20+, runs through `npx` |
|
|
27
|
+
| Screenshots | No: it can't reach `localhost` | Yes, with your local browser |
|
|
28
|
+
|
|
29
|
+
Use the hosted server if you only need briefs and UX reviews. Use this package when you want `Visual` reviews of pages running on your machine.
|
|
20
30
|
|
|
21
|
-
|
|
31
|
+
## Setup
|
|
22
32
|
|
|
23
|
-
|
|
33
|
+
Get an API key (it starts with `tda_`) at [thedesignagent.ai/dashboard/api-keys](https://thedesignagent.ai/dashboard/api-keys).
|
|
24
34
|
|
|
25
35
|
### Claude Code (recommended: the plugin)
|
|
26
36
|
|
|
27
|
-
The plugin
|
|
37
|
+
The plugin includes this server, plus skills that teach the agent the brief → build → review loop and `/thedesignagent:brief` and `/thedesignagent:review` commands:
|
|
28
38
|
|
|
29
39
|
```
|
|
30
40
|
/plugin marketplace add CMBurnett/the-design-agent-plugin
|
|
@@ -34,7 +44,13 @@ The plugin adds skills that teach the agent the brief → build → review loop,
|
|
|
34
44
|
Or add the server on its own:
|
|
35
45
|
|
|
36
46
|
```
|
|
37
|
-
claude mcp add thedesignagent -e THEDESIGNAGENT_API_KEY=
|
|
47
|
+
claude mcp add thedesignagent -e THEDESIGNAGENT_API_KEY=tda_... -- npx -y --package=@thedesignagent/mcp thedesignagent-mcp
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Or the hosted server, with no install:
|
|
51
|
+
|
|
52
|
+
```
|
|
53
|
+
claude mcp add --transport http thedesignagent https://www.thedesignagent.ai/mcp --header "Authorization: Bearer tda_..."
|
|
38
54
|
```
|
|
39
55
|
|
|
40
56
|
### Codex
|
|
@@ -45,18 +61,33 @@ In `~/.codex/config.toml`:
|
|
|
45
61
|
[mcp_servers.thedesignagent]
|
|
46
62
|
command = "npx"
|
|
47
63
|
args = ["-y", "--package=@thedesignagent/mcp", "thedesignagent-mcp"]
|
|
48
|
-
env = { THEDESIGNAGENT_API_KEY = "
|
|
64
|
+
env = { THEDESIGNAGENT_API_KEY = "tda_..." }
|
|
49
65
|
```
|
|
50
66
|
|
|
51
67
|
### Cursor, Claude Desktop and other JSON-configured clients
|
|
52
68
|
|
|
69
|
+
Local:
|
|
70
|
+
|
|
53
71
|
```json
|
|
54
72
|
{
|
|
55
73
|
"mcpServers": {
|
|
56
74
|
"thedesignagent": {
|
|
57
75
|
"command": "npx",
|
|
58
76
|
"args": ["-y", "--package=@thedesignagent/mcp", "thedesignagent-mcp"],
|
|
59
|
-
"env": { "THEDESIGNAGENT_API_KEY": "
|
|
77
|
+
"env": { "THEDESIGNAGENT_API_KEY": "tda_..." }
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
Hosted:
|
|
84
|
+
|
|
85
|
+
```json
|
|
86
|
+
{
|
|
87
|
+
"mcpServers": {
|
|
88
|
+
"thedesignagent": {
|
|
89
|
+
"url": "https://www.thedesignagent.ai/mcp",
|
|
90
|
+
"headers": { "Authorization": "Bearer tda_..." }
|
|
60
91
|
}
|
|
61
92
|
}
|
|
62
93
|
}
|
|
@@ -67,16 +98,16 @@ The package has two commands, so pass `--package` and name `thedesignagent-mcp`
|
|
|
67
98
|
## How agents use it
|
|
68
99
|
|
|
69
100
|
1. **Identify the project.** Pass `project_id` from a `.thedesignagent` file in the repo root, or `repo_hash` (SHA-256 of the git remote URL) if there isn't one yet.
|
|
70
|
-
2. **Call `
|
|
101
|
+
2. **Call `Discover`** with the screen you're about to build. On a project's first call it returns `needs_setup` with an extraction task: the agent scans the repo, builds a project model and calls again. After that, briefs come back immediately.
|
|
71
102
|
3. **Build** following the brief.
|
|
72
|
-
4. **Call `
|
|
103
|
+
4. **Call `Ux` and `Visual`** with the built code as `artifact`. Pass `render_url` (for example `http://localhost:3000/checkout`) to `Visual` for a screenshot-based review.
|
|
73
104
|
5. **Fix** critical and high findings, then re-check once.
|
|
74
105
|
|
|
75
|
-
After the first successful `
|
|
106
|
+
After the first successful `Discover`, write `{ "project_id": "<id>" }` to `.thedesignagent` and commit it, so every agent on the repo shares the same project context.
|
|
76
107
|
|
|
77
108
|
## Screenshots
|
|
78
109
|
|
|
79
|
-
`
|
|
110
|
+
`Visual` screenshots `render_url` with your local Chrome, Edge, Brave or Chromium. If it can't find one, set `CHROME_PATH` to the browser binary.
|
|
80
111
|
|
|
81
112
|
Screenshots are saved to `~/.thedesignagent/screenshots/` for 24 hours, so you can see exactly what was reviewed.
|
|
82
113
|
|
|
@@ -88,20 +119,21 @@ Capture a logged-in session once per app:
|
|
|
88
119
|
npx -y --package=@thedesignagent/mcp thedesignagent-auth capture http://localhost:3000
|
|
89
120
|
```
|
|
90
121
|
|
|
91
|
-
A browser opens; log in, then press Enter (or close the browser). The session is saved under `~/.thedesignagent/auth/` and reused for that origin. When `
|
|
122
|
+
A browser opens; log in, then press Enter (or close the browser). The session is saved under `~/.thedesignagent/auth/` and reused for that origin. When `Visual` hits a login redirect, it tells the agent to ask you to run this command.
|
|
92
123
|
|
|
93
124
|
## Environment variables
|
|
94
125
|
|
|
95
126
|
| Variable | Required | Purpose |
|
|
96
127
|
| --- | --- | --- |
|
|
97
|
-
| `THEDESIGNAGENT_API_KEY` | Yes | Your `
|
|
128
|
+
| `THEDESIGNAGENT_API_KEY` | Yes | Your `tda_` API key |
|
|
98
129
|
| `CHROME_PATH` | No | Browser binary for screenshots, if it isn't found automatically |
|
|
99
130
|
| `ANTHROPIC_API_KEY` | No | Enables a fallback review through Claude when TheDesignAgent's API is unreachable |
|
|
100
131
|
|
|
101
|
-
##
|
|
132
|
+
## Errors
|
|
102
133
|
|
|
103
|
-
- Each plan has a monthly call limit. When you reach it, calls return a limit message; upgrade at [thedesignagent.ai](https://thedesignagent.ai) or wait for the monthly reset.
|
|
104
134
|
- An authentication error means the API key is missing, wrong or revoked.
|
|
135
|
+
- A rate-limit message means wait briefly and retry.
|
|
136
|
+
- Account errors are returned as tool errors; the message says what to do.
|
|
105
137
|
|
|
106
138
|
## Links
|
|
107
139
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,20 +1,23 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/**
|
|
3
|
-
* TheDesignAgent MCP Server
|
|
4
|
-
* Exposes three tools — discover, ux, visual — discoverable by Claude Code, Cursor, etc.
|
|
3
|
+
* TheDesignAgent MCP Server — local stdio variant
|
|
5
4
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
5
|
+
* Most users do NOT need this. The hosted MCP at https://www.thedesignagent.ai/mcp
|
|
6
|
+
* covers `discover` and `ux`. Install it with:
|
|
7
|
+
*
|
|
8
|
+
* claude mcp add --transport http --scope user TheDesignAgent \
|
|
9
|
+
* https://www.thedesignagent.ai/mcp \
|
|
10
|
+
* --header "Authorization: Bearer tda_..."
|
|
11
|
+
*
|
|
12
|
+
* This local server is only needed for the `visual` tool, which screenshots
|
|
13
|
+
* http://localhost (unreachable from the hosted gateway). Install it from npm
|
|
14
|
+
* and register alongside the hosted MCP. The package has two bins, so name
|
|
15
|
+
* the command explicitly:
|
|
16
|
+
*
|
|
17
|
+
* claude mcp add TheDesignAgent-local --scope user \
|
|
18
|
+
* --env THEDESIGNAGENT_API_KEY=tda_... \
|
|
19
|
+
* -- npx -y --package=@thedesignagent/mcp thedesignagent-mcp
|
|
20
|
+
*
|
|
21
|
+
* Same API key works in both places.
|
|
19
22
|
*/
|
|
20
23
|
export {};
|
package/dist/index.js
CHANGED
|
@@ -1,21 +1,24 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/**
|
|
3
|
-
* TheDesignAgent MCP Server
|
|
4
|
-
* Exposes three tools — discover, ux, visual — discoverable by Claude Code, Cursor, etc.
|
|
3
|
+
* TheDesignAgent MCP Server — local stdio variant
|
|
5
4
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
5
|
+
* Most users do NOT need this. The hosted MCP at https://www.thedesignagent.ai/mcp
|
|
6
|
+
* covers `discover` and `ux`. Install it with:
|
|
7
|
+
*
|
|
8
|
+
* claude mcp add --transport http --scope user TheDesignAgent \
|
|
9
|
+
* https://www.thedesignagent.ai/mcp \
|
|
10
|
+
* --header "Authorization: Bearer tda_..."
|
|
11
|
+
*
|
|
12
|
+
* This local server is only needed for the `visual` tool, which screenshots
|
|
13
|
+
* http://localhost (unreachable from the hosted gateway). Install it from npm
|
|
14
|
+
* and register alongside the hosted MCP. The package has two bins, so name
|
|
15
|
+
* the command explicitly:
|
|
16
|
+
*
|
|
17
|
+
* claude mcp add TheDesignAgent-local --scope user \
|
|
18
|
+
* --env THEDESIGNAGENT_API_KEY=tda_... \
|
|
19
|
+
* -- npx -y --package=@thedesignagent/mcp thedesignagent-mcp
|
|
20
|
+
*
|
|
21
|
+
* Same API key works in both places.
|
|
19
22
|
*/
|
|
20
23
|
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
21
24
|
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
@@ -26,7 +29,50 @@ import { captureScreenshot } from './screenshot.js';
|
|
|
26
29
|
import { loadStoredAuth } from './auth-store.js';
|
|
27
30
|
const API_KEY = process.env.THEDESIGNAGENT_API_KEY;
|
|
28
31
|
const API_BASE = process.env.THEDESIGNAGENT_API_BASE ?? 'https://bxqifcmkydlsgwgcpqda.supabase.co/functions/v1';
|
|
32
|
+
// Discover/Ux route through the hosted gateway so mcp_call_logs telemetry
|
|
33
|
+
// captures local-stdio calls too. Visual stays direct because it needs local
|
|
34
|
+
// screenshot capability that the gateway can't provide.
|
|
35
|
+
const GATEWAY_BASE = process.env.THEDESIGNAGENT_GATEWAY ?? 'https://www.thedesignagent.ai';
|
|
29
36
|
const ANTHROPIC_API_KEY = process.env.ANTHROPIC_API_KEY;
|
|
37
|
+
async function callGatewayTool(name, args) {
|
|
38
|
+
let response;
|
|
39
|
+
try {
|
|
40
|
+
response = await fetch(`${GATEWAY_BASE}/mcp`, {
|
|
41
|
+
method: 'POST',
|
|
42
|
+
headers: {
|
|
43
|
+
Authorization: `Bearer ${API_KEY}`,
|
|
44
|
+
'Content-Type': 'application/json',
|
|
45
|
+
'Accept': 'application/json',
|
|
46
|
+
},
|
|
47
|
+
body: JSON.stringify({
|
|
48
|
+
jsonrpc: '2.0',
|
|
49
|
+
id: Date.now(),
|
|
50
|
+
method: 'tools/call',
|
|
51
|
+
params: { name, arguments: args },
|
|
52
|
+
}),
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
catch (e) {
|
|
56
|
+
return { ok: false, status: 0, message: e instanceof Error ? e.message : String(e) };
|
|
57
|
+
}
|
|
58
|
+
if (!response.ok) {
|
|
59
|
+
return { ok: false, status: response.status, message: `Gateway HTTP ${response.status}` };
|
|
60
|
+
}
|
|
61
|
+
let envelope;
|
|
62
|
+
try {
|
|
63
|
+
envelope = await response.json();
|
|
64
|
+
}
|
|
65
|
+
catch (e) {
|
|
66
|
+
return { ok: false, status: response.status, message: `Gateway parse error: ${e instanceof Error ? e.message : String(e)}` };
|
|
67
|
+
}
|
|
68
|
+
if (envelope.error) {
|
|
69
|
+
return { ok: false, status: response.status, message: envelope.error.message };
|
|
70
|
+
}
|
|
71
|
+
if (!envelope.result) {
|
|
72
|
+
return { ok: false, status: response.status, message: 'Gateway returned no result' };
|
|
73
|
+
}
|
|
74
|
+
return { ok: true, result: envelope.result };
|
|
75
|
+
}
|
|
30
76
|
// ---- Logging --------------------------------------------------------------
|
|
31
77
|
function log(level, step, detail) {
|
|
32
78
|
const ts = new Date().toISOString();
|
|
@@ -289,57 +335,38 @@ async function handleUxCall(args) {
|
|
|
289
335
|
isError: true,
|
|
290
336
|
};
|
|
291
337
|
}
|
|
292
|
-
log('info', 'pipeline_call', `tool=ux project_id=${args.project_id ?? 'none'} task_len=${args.task.length}`);
|
|
338
|
+
log('info', 'pipeline_call', `tool=ux project_id=${args.project_id ?? 'none'} task_len=${args.task.length} via=gateway`);
|
|
293
339
|
let pipelineStatus = 0;
|
|
294
340
|
let pipelineErrorType = 'unknown';
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
if (response.ok) {
|
|
310
|
-
const result = await response.json();
|
|
311
|
-
log('info', 'pipeline_ok', `ux_score=${result.ux_score}`);
|
|
312
|
-
return { content: [{ type: 'text', text: formatUxEval(result, false) }] };
|
|
313
|
-
}
|
|
314
|
-
const err = await response.json();
|
|
315
|
-
pipelineErrorType = err.error;
|
|
316
|
-
if (response.status === 401 || response.status === 403) {
|
|
317
|
-
log('error', 'pipeline_auth_failed', `${response.status} ${err.message}`);
|
|
318
|
-
return {
|
|
319
|
-
content: [{ type: 'text', text: `Authentication failed (${response.status}): ${err.message}\nCheck your THEDESIGNAGENT_API_KEY.` }],
|
|
320
|
-
isError: true,
|
|
321
|
-
};
|
|
322
|
-
}
|
|
323
|
-
if (response.status === 429) {
|
|
324
|
-
log('warn', 'pipeline_rate_limited', err.message);
|
|
325
|
-
return {
|
|
326
|
-
content: [{ type: 'text', text: `Rate limit reached: ${err.message}\nUpgrade your plan or wait until your monthly counter resets.` }],
|
|
327
|
-
isError: true,
|
|
328
|
-
};
|
|
341
|
+
// Route through hosted gateway so mcp_call_logs telemetry captures this call.
|
|
342
|
+
const gw = await callGatewayTool('Ux', {
|
|
343
|
+
task: args.task,
|
|
344
|
+
artifact: args.artifact,
|
|
345
|
+
project_id: args.project_id,
|
|
346
|
+
repo_hash: args.repo_hash,
|
|
347
|
+
codebaseContext: args.codebase_context,
|
|
348
|
+
...(args.stages?.length && { stages: args.stages }),
|
|
349
|
+
});
|
|
350
|
+
if (gw.ok) {
|
|
351
|
+
const status = gw.result._meta?.tda_status;
|
|
352
|
+
if (!gw.result.isError) {
|
|
353
|
+
log('info', 'pipeline_ok', `via=gateway status=${status ?? 'healthy'}`);
|
|
354
|
+
return { content: gw.result.content };
|
|
329
355
|
}
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
};
|
|
356
|
+
// Tool reported an error inside a 200 envelope. Auth + rate-limit are
|
|
357
|
+
// user-facing — return as-is, no fallback. pipeline_error falls through.
|
|
358
|
+
if (status === 'auth_failed' || status === 'rate_limited' || status === 'insufficient_credits') {
|
|
359
|
+
log('warn', 'pipeline_user_error', `status=${status}`);
|
|
360
|
+
return { content: gw.result.content, isError: true };
|
|
336
361
|
}
|
|
337
|
-
|
|
362
|
+
pipelineStatus = 500;
|
|
363
|
+
pipelineErrorType = status ?? 'pipeline_error';
|
|
364
|
+
log('warn', 'pipeline_server_error', `via=gateway status=${status}`);
|
|
338
365
|
}
|
|
339
|
-
|
|
340
|
-
pipelineStatus =
|
|
341
|
-
pipelineErrorType = 'network_error';
|
|
342
|
-
log('warn', 'pipeline_network_error',
|
|
366
|
+
else {
|
|
367
|
+
pipelineStatus = gw.status;
|
|
368
|
+
pipelineErrorType = gw.status === 0 ? 'network_error' : 'gateway_error';
|
|
369
|
+
log('warn', 'pipeline_network_error', gw.message);
|
|
343
370
|
}
|
|
344
371
|
// Prompted fallback
|
|
345
372
|
if (!ANTHROPIC_API_KEY) {
|
|
@@ -453,54 +480,30 @@ async function handleDiscoverCall(args) {
|
|
|
453
480
|
isError: true,
|
|
454
481
|
};
|
|
455
482
|
}
|
|
456
|
-
log('info', 'pipeline_call', `tool=discover project_id=${args.project_id ?? 'none'} task_len=${args.task.length}`);
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
});
|
|
471
|
-
if (response.ok) {
|
|
472
|
-
const result = await response.json();
|
|
473
|
-
log('info', 'pipeline_ok', `status=${result.status} project_id=${result.project_id}`);
|
|
474
|
-
return { content: [{ type: 'text', text: formatDiscoveryResult(result) }] };
|
|
475
|
-
}
|
|
476
|
-
const err = await response.json();
|
|
477
|
-
if (response.status === 401 || response.status === 403) {
|
|
478
|
-
return {
|
|
479
|
-
content: [{ type: 'text', text: `Authentication failed (${response.status}): ${err.message}\nCheck your THEDESIGNAGENT_API_KEY.` }],
|
|
480
|
-
isError: true,
|
|
481
|
-
};
|
|
482
|
-
}
|
|
483
|
-
if (response.status === 429) {
|
|
484
|
-
return {
|
|
485
|
-
content: [{ type: 'text', text: `Rate limit reached: ${err.message}` }],
|
|
486
|
-
isError: true,
|
|
487
|
-
};
|
|
488
|
-
}
|
|
489
|
-
log('warn', 'pipeline_server_error', `status=${response.status} error=${err.error} detail=${err.detail ?? 'none'}`);
|
|
490
|
-
const detailLine = err.detail ? `\nDetail: ${err.detail}` : '';
|
|
491
|
-
return {
|
|
492
|
-
content: [{ type: 'text', text: `Pipeline error (${response.status}): ${err.message}${detailLine}` }],
|
|
493
|
-
isError: true,
|
|
494
|
-
};
|
|
495
|
-
}
|
|
496
|
-
catch (networkErr) {
|
|
497
|
-
const msg = networkErr instanceof Error ? networkErr.message : String(networkErr);
|
|
498
|
-
log('warn', 'pipeline_network_error', msg);
|
|
483
|
+
log('info', 'pipeline_call', `tool=discover project_id=${args.project_id ?? 'none'} task_len=${args.task.length} via=gateway`);
|
|
484
|
+
// Route through hosted gateway so mcp_call_logs telemetry captures this call.
|
|
485
|
+
const gw = await callGatewayTool('Discover', {
|
|
486
|
+
task: args.task,
|
|
487
|
+
project_id: args.project_id,
|
|
488
|
+
repo_hash: args.repo_hash,
|
|
489
|
+
codebaseContext: args.codebase_context,
|
|
490
|
+
schemaHash: args.schema_hash,
|
|
491
|
+
...(args.project_model && { projectModel: args.project_model }),
|
|
492
|
+
...(args.skills?.length && { skills: args.skills }),
|
|
493
|
+
});
|
|
494
|
+
if (gw.ok) {
|
|
495
|
+
const status = gw.result._meta?.tda_status ?? 'unknown';
|
|
496
|
+
log('info', gw.result.isError ? 'pipeline_returned_error' : 'pipeline_ok', `via=gateway status=${status} project_id=${gw.result._meta?.tda_project_id ?? 'none'}`);
|
|
499
497
|
return {
|
|
500
|
-
content:
|
|
501
|
-
isError: true,
|
|
498
|
+
content: gw.result.content,
|
|
499
|
+
...(gw.result.isError && { isError: true }),
|
|
502
500
|
};
|
|
503
501
|
}
|
|
502
|
+
log('warn', 'pipeline_network_error', gw.message);
|
|
503
|
+
return {
|
|
504
|
+
content: [{ type: 'text', text: `Network error reaching pipeline: ${gw.message}` }],
|
|
505
|
+
isError: true,
|
|
506
|
+
};
|
|
504
507
|
}
|
|
505
508
|
// ---- MCP server -----------------------------------------------------------
|
|
506
509
|
const evalInputSchema = {
|
|
@@ -510,8 +513,8 @@ const evalInputSchema = {
|
|
|
510
513
|
repo_hash: z.string().optional().describe('SHA256 of git remote origin URL (fallback if no .thedesignagent)'),
|
|
511
514
|
codebase_context: z.string().optional().describe('Optional surrounding code context'),
|
|
512
515
|
};
|
|
513
|
-
const server = new McpServer({ name: 'TheDesignAgent', version: '0.2.
|
|
514
|
-
server.registerTool('
|
|
516
|
+
const server = new McpServer({ name: 'TheDesignAgent', version: '0.2.3' });
|
|
517
|
+
server.registerTool('Discover', {
|
|
515
518
|
description: `Get a build brief calibrated to your project, persona, and the specific screen you're building.
|
|
516
519
|
|
|
517
520
|
Call this BEFORE building any screen. TheDesignAgent:
|
|
@@ -533,7 +536,7 @@ Use project_id from .thedesignagent if available; otherwise pass repo_hash (SHA2
|
|
|
533
536
|
skills: z.array(z.string()).optional().describe('Per-call skill selection (overrides project defaults)'),
|
|
534
537
|
},
|
|
535
538
|
}, async (args) => handleDiscoverCall(args));
|
|
536
|
-
server.registerTool('
|
|
539
|
+
server.registerTool('Ux', {
|
|
537
540
|
description: `Evaluate a built UI artifact for JTBD fit, heuristic compliance, cognitive load, and pattern conformance.
|
|
538
541
|
|
|
539
542
|
Call this AFTER building a screen. TheDesignAgent scores:
|
|
@@ -551,7 +554,7 @@ Stores new anti-patterns to project context — future builds benefit automatica
|
|
|
551
554
|
.describe('Run only named stages (omit to run all)'),
|
|
552
555
|
},
|
|
553
556
|
}, async (args) => handleUxCall(args));
|
|
554
|
-
server.registerTool('
|
|
557
|
+
server.registerTool('Visual', {
|
|
555
558
|
description: `Evaluate a built UI artifact for visual design quality — brand compliance, visual cognitive load, and aesthetic quality.
|
|
556
559
|
|
|
557
560
|
Call for visual design review after building. TheDesignAgent scores across three tracks:
|
package/package.json
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thedesignagent/mcp",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3",
|
|
4
4
|
"description": "MCP server for TheDesignAgent — UX and visual judgment layer for agent-generated UI",
|
|
5
|
+
"license": "MIT",
|
|
5
6
|
"type": "module",
|
|
6
7
|
"homepage": "https://thedesignagent.ai",
|
|
7
8
|
"keywords": [
|
|
@@ -16,8 +17,8 @@
|
|
|
16
17
|
"ai-agents"
|
|
17
18
|
],
|
|
18
19
|
"bin": {
|
|
19
|
-
"thedesignagent-mcp": "
|
|
20
|
-
"thedesignagent-auth": "
|
|
20
|
+
"thedesignagent-mcp": "dist/index.js",
|
|
21
|
+
"thedesignagent-auth": "dist/auth-capture.js"
|
|
21
22
|
},
|
|
22
23
|
"files": [
|
|
23
24
|
"dist"
|