@scayver/specshot-mcp-server 0.11.0 → 0.14.0
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 +118 -4
- package/dist/build-standard.js +5284 -17
- package/dist/index.js +45 -13
- package/dist/skills.js +502 -0
- package/dist/tool-descriptions.js +99 -0
- package/dist/tools/agent-loop.js +81 -0
- package/dist/tools/brand.js +2 -1
- package/dist/tools/canvas.js +5 -4
- package/dist/tools/concepts.js +63 -5
- package/dist/tools/etch-audit.js +30 -0
- package/dist/tools/images.js +67 -0
- package/dist/tools/inspiration.js +2 -1
- package/dist/tools/messages.js +12 -6
- package/dist/tools/prototype.js +27 -0
- package/dist/tools/render.js +53 -0
- package/dist/tools/review.js +27 -0
- package/dist/tools/seo.js +56 -0
- package/dist/tools/site.js +78 -0
- package/dist/tools/skills.js +20 -0
- package/dist/tools/state.js +33 -0
- package/dist/tools/tasks.js +60 -0
- package/dist/tools/wireframe.js +41 -21
- package/dist/tools/wordpress.js +24 -0
- package/dist/tools/workspace.js +26 -22
- package/package.json +2 -2
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { toolDescription } from "../tool-descriptions.js";
|
|
3
|
+
function ok(data) {
|
|
4
|
+
return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] };
|
|
5
|
+
}
|
|
6
|
+
function fail(message) {
|
|
7
|
+
return { content: [{ type: "text", text: `Error: ${message}` }], isError: true };
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Owned by slice 3, click through the site (docs/CANVAS-DOOP-PLAN.md, section 4.4). index.ts calls
|
|
11
|
+
* this once. get_prototype reads the project as a click-through prototype over the REST route
|
|
12
|
+
* /api/mcp/projects/[id]/prototype. The hosted twin is apps/web/src/lib/mcp/tools-prototype.ts,
|
|
13
|
+
* the parity test holds the two to the same tool names, and the description comes from the
|
|
14
|
+
* generated tool-descriptions.ts, so the two transports cannot drift.
|
|
15
|
+
*/
|
|
16
|
+
export function registerPrototypeTools(server, client) {
|
|
17
|
+
server.tool("get_prototype", toolDescription("get_prototype"), { projectId: z.string(), approved: z.boolean().optional() }, async ({ projectId, approved }) => {
|
|
18
|
+
try {
|
|
19
|
+
return ok(await client.get(`/api/mcp/projects/${encodeURIComponent(projectId)}/prototype`, {
|
|
20
|
+
approved: approved ? "1" : undefined,
|
|
21
|
+
}));
|
|
22
|
+
}
|
|
23
|
+
catch (e) {
|
|
24
|
+
return fail(e instanceof Error ? e.message : "Failed to read the project's prototype.");
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { toolDescription } from "../tool-descriptions.js";
|
|
3
|
+
function ok(data) {
|
|
4
|
+
return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] };
|
|
5
|
+
}
|
|
6
|
+
function fail(message) {
|
|
7
|
+
return { content: [{ type: "text", text: `Error: ${message}` }], isError: true };
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Owned by slice 4, export and render (docs/CANVAS-DOOP-PLAN.md, section 4.5). index.ts calls this
|
|
11
|
+
* once. The hosted twin is apps/web/src/lib/mcp/tools-render.ts, and the parity test holds the two
|
|
12
|
+
* to the same tool names. Each tool calls a REST route under /api/mcp through `client` and takes its
|
|
13
|
+
* description from toolDescription(name).
|
|
14
|
+
*
|
|
15
|
+
* get_design_screenshot renders a design in SpecShot's server browser and returns a signed link to
|
|
16
|
+
* the PNG, valid for an hour, over the REST route /api/mcp/render/screenshot.
|
|
17
|
+
*
|
|
18
|
+
* check_built_page compares the page built on the client's WordPress site with the approved design,
|
|
19
|
+
* over the REST route /api/mcp/render/built-check. It opens only the address a connected site
|
|
20
|
+
* reported, so it takes a design id and never an address.
|
|
21
|
+
*/
|
|
22
|
+
export function registerRenderTools(server, client) {
|
|
23
|
+
server.tool("get_design_screenshot", toolDescription("get_design_screenshot"), {
|
|
24
|
+
designId: z.string(),
|
|
25
|
+
width: z.number().optional(),
|
|
26
|
+
section: z.string().optional(),
|
|
27
|
+
}, async ({ designId, width, section }) => {
|
|
28
|
+
try {
|
|
29
|
+
return ok(await client.get("/api/mcp/render/screenshot", {
|
|
30
|
+
designId,
|
|
31
|
+
width: width === undefined ? undefined : String(width),
|
|
32
|
+
section,
|
|
33
|
+
}));
|
|
34
|
+
}
|
|
35
|
+
catch (e) {
|
|
36
|
+
return fail(e instanceof Error ? e.message : "Failed to render the design.");
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
server.tool("check_built_page", toolDescription("check_built_page"), {
|
|
40
|
+
designId: z.string(),
|
|
41
|
+
refresh: z.boolean().optional(),
|
|
42
|
+
}, async ({ designId, refresh }) => {
|
|
43
|
+
try {
|
|
44
|
+
return ok(await client.get("/api/mcp/render/built-check", {
|
|
45
|
+
designId,
|
|
46
|
+
refresh: refresh === undefined ? undefined : String(refresh),
|
|
47
|
+
}));
|
|
48
|
+
}
|
|
49
|
+
catch (e) {
|
|
50
|
+
return fail(e instanceof Error ? e.message : "Failed to check the built page.");
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { toolDescription } from "../tool-descriptions.js";
|
|
3
|
+
function ok(data) {
|
|
4
|
+
return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] };
|
|
5
|
+
}
|
|
6
|
+
function fail(message) {
|
|
7
|
+
return { content: [{ type: "text", text: `Error: ${message}` }], isError: true };
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Owned by slice 2, review anywhere (docs/CANVAS-DOOP-PLAN.md, section 4.3). index.ts calls this
|
|
11
|
+
* once, so the slice registers its stdio tools here without editing index.ts. The hosted twin is
|
|
12
|
+
* apps/web/src/lib/mcp/tools-review.ts, and the parity test holds the two to the same tool names.
|
|
13
|
+
* Each tool calls a REST route under /api/mcp through `client` and takes its description from
|
|
14
|
+
* toolDescription(name), so the two transports say the same thing.
|
|
15
|
+
*
|
|
16
|
+
* reply_to_comment: POST /api/mcp/comments/[commentId]/replies. Requires a read/write token.
|
|
17
|
+
*/
|
|
18
|
+
export function registerReviewTools(server, client) {
|
|
19
|
+
server.tool("reply_to_comment", toolDescription("reply_to_comment"), { commentId: z.string().uuid(), comment: z.string().min(1).max(8000) }, async ({ commentId, comment }) => {
|
|
20
|
+
try {
|
|
21
|
+
return ok(await client.post(`/api/mcp/comments/${encodeURIComponent(commentId)}/replies`, { comment }));
|
|
22
|
+
}
|
|
23
|
+
catch (e) {
|
|
24
|
+
return fail(e instanceof Error ? e.message : "Failed to reply to the comment.");
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { toolDescription } from "../tool-descriptions.js";
|
|
3
|
+
function ok(data) {
|
|
4
|
+
return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] };
|
|
5
|
+
}
|
|
6
|
+
function fail(message) {
|
|
7
|
+
return { content: [{ type: "text", text: `Error: ${message}` }], isError: true };
|
|
8
|
+
}
|
|
9
|
+
const num = (v) => (v === undefined ? undefined : String(v));
|
|
10
|
+
/**
|
|
11
|
+
* SEO fixes for agents (docs/SEO-PORTAL-PLAN.md, phase 5): the workspace's SEO audits, their plan to
|
|
12
|
+
* 100, the open checklist items with each one's exact instruction, and marking an item done, over
|
|
13
|
+
* the REST routes under /api/mcp/seo. The hosted endpoint registers the same tools from
|
|
14
|
+
* apps/web/src/lib/mcp/tools-seo.ts, and the descriptions come from the generated
|
|
15
|
+
* tool-descriptions.ts, so the two transports cannot drift.
|
|
16
|
+
*/
|
|
17
|
+
export function registerSeoTools(server, client) {
|
|
18
|
+
server.tool("list_seo_audits", toolDescription("list_seo_audits"), { projectId: z.string().optional(), limit: z.number().optional(), offset: z.number().optional() }, async ({ projectId, limit, offset }) => {
|
|
19
|
+
try {
|
|
20
|
+
return ok(await client.get("/api/mcp/seo/audits", { projectId, limit: num(limit), offset: num(offset) }));
|
|
21
|
+
}
|
|
22
|
+
catch (e) {
|
|
23
|
+
return fail(e instanceof Error ? e.message : "Failed to list the SEO audits.");
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
server.tool("get_seo_audit", toolDescription("get_seo_audit"), { auditId: z.string() }, async ({ auditId }) => {
|
|
27
|
+
try {
|
|
28
|
+
return ok(await client.get(`/api/mcp/seo/audits/${encodeURIComponent(auditId)}`));
|
|
29
|
+
}
|
|
30
|
+
catch (e) {
|
|
31
|
+
return fail(e instanceof Error ? e.message : "Failed to read the SEO audit.");
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
server.tool("list_seo_fixes", toolDescription("list_seo_fixes"), {
|
|
35
|
+
auditId: z.string(),
|
|
36
|
+
status: z.enum(["open", "fixed", "ignored", "verified", "all"]).optional(),
|
|
37
|
+
page: z.string().optional(),
|
|
38
|
+
limit: z.number().optional(),
|
|
39
|
+
offset: z.number().optional(),
|
|
40
|
+
}, async ({ auditId, status, page, limit, offset }) => {
|
|
41
|
+
try {
|
|
42
|
+
return ok(await client.get(`/api/mcp/seo/audits/${encodeURIComponent(auditId)}/fixes`, { status, page, limit: num(limit), offset: num(offset) }));
|
|
43
|
+
}
|
|
44
|
+
catch (e) {
|
|
45
|
+
return fail(e instanceof Error ? e.message : "Failed to read the SEO checklist.");
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
server.tool("update_seo_fix", toolDescription("update_seo_fix"), { auditId: z.string(), fixId: z.string(), status: z.enum(["fixed", "ignored", "open"]), note: z.string().optional() }, async ({ auditId, fixId, status, note }) => {
|
|
49
|
+
try {
|
|
50
|
+
return ok(await client.patch(`/api/mcp/seo/audits/${encodeURIComponent(auditId)}/fixes/${encodeURIComponent(fixId)}`, { status, ...(note !== undefined ? { note } : {}) }));
|
|
51
|
+
}
|
|
52
|
+
catch (e) {
|
|
53
|
+
return fail(e instanceof Error ? e.message : "Failed to update the SEO checklist item.");
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { toolDescription } from "../tool-descriptions.js";
|
|
3
|
+
function ok(data) {
|
|
4
|
+
return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] };
|
|
5
|
+
}
|
|
6
|
+
function fail(message) {
|
|
7
|
+
return { content: [{ type: "text", text: `Error: ${message}` }], isError: true };
|
|
8
|
+
}
|
|
9
|
+
const path = (projectId, rest) => `/api/mcp/projects/${encodeURIComponent(projectId)}/site/${rest}`;
|
|
10
|
+
/**
|
|
11
|
+
* Whole-site generation for agents (docs/WHOLE-SITE-GENERATION-PLAN.md, "Agents over MCP"), over the
|
|
12
|
+
* REST routes under /api/mcp/projects/[id]/site. The hosted twin is
|
|
13
|
+
* apps/web/src/lib/mcp/tools-site.ts; the parity test holds the two to the same names, and each
|
|
14
|
+
* description comes from the generated tool-descriptions.ts, so the two transports cannot drift.
|
|
15
|
+
* The server checks every argument. publish_page_version's site mode is registered with
|
|
16
|
+
* publish_page_version in wireframe.ts.
|
|
17
|
+
*/
|
|
18
|
+
export function registerSiteTools(server, client) {
|
|
19
|
+
server.tool("get_site_plan", toolDescription("get_site_plan"), { projectId: z.string() }, async ({ projectId }) => {
|
|
20
|
+
try {
|
|
21
|
+
return ok(await client.get(path(projectId, "plan")));
|
|
22
|
+
}
|
|
23
|
+
catch (e) {
|
|
24
|
+
return fail(e instanceof Error ? e.message : "Failed to read the site plan.");
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
server.tool("get_site_kit", toolDescription("get_site_kit"), { projectId: z.string(), detail: z.enum(["summary", "full"]).optional() }, async ({ projectId, detail }) => {
|
|
28
|
+
try {
|
|
29
|
+
return ok(await client.get(path(projectId, "kit"), { detail }));
|
|
30
|
+
}
|
|
31
|
+
catch (e) {
|
|
32
|
+
return fail(e instanceof Error ? e.message : "Failed to read the site system.");
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
server.tool("save_site_kit", toolDescription("save_site_kit"), {
|
|
36
|
+
projectId: z.string(),
|
|
37
|
+
html: z.string(),
|
|
38
|
+
css: z.string().optional(),
|
|
39
|
+
direction: z.record(z.unknown()).optional(),
|
|
40
|
+
itemId: z.string().optional(),
|
|
41
|
+
allowShrink: z.boolean().optional(),
|
|
42
|
+
}, async ({ projectId, ...rest }) => {
|
|
43
|
+
try {
|
|
44
|
+
return ok(await client.post(path(projectId, "kit"), rest));
|
|
45
|
+
}
|
|
46
|
+
catch (e) {
|
|
47
|
+
return fail(e instanceof Error ? e.message : "Failed to save the site system.");
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
server.tool("set_page_families", toolDescription("set_page_families"), {
|
|
51
|
+
projectId: z.string(),
|
|
52
|
+
groupByCode: z.boolean().optional(),
|
|
53
|
+
families: z.array(z.record(z.unknown())).optional(),
|
|
54
|
+
order: z.array(z.string()).optional(),
|
|
55
|
+
}, async ({ projectId, ...rest }) => {
|
|
56
|
+
try {
|
|
57
|
+
return ok(await client.post(path(projectId, "families"), rest));
|
|
58
|
+
}
|
|
59
|
+
catch (e) {
|
|
60
|
+
return fail(e instanceof Error ? e.message : "Failed to change the page families.");
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
server.tool("next_site_page", toolDescription("next_site_page"), {
|
|
64
|
+
projectId: z.string(),
|
|
65
|
+
start: z.boolean().optional(),
|
|
66
|
+
pageIds: z.array(z.string()).optional(),
|
|
67
|
+
concurrency: z.number().optional(),
|
|
68
|
+
another: z.boolean().optional(),
|
|
69
|
+
known: z.array(z.string()).optional(),
|
|
70
|
+
}, async ({ projectId, ...rest }) => {
|
|
71
|
+
try {
|
|
72
|
+
return ok(await client.post(path(projectId, "next"), rest));
|
|
73
|
+
}
|
|
74
|
+
catch (e) {
|
|
75
|
+
return fail(e instanceof Error ? e.message : "Failed to take the next page of the site.");
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { toolDescription } from "../tool-descriptions.js";
|
|
3
|
+
import { SKILL_BODIES, SKILL_LIST } from "../skills.js";
|
|
4
|
+
function ok(data) {
|
|
5
|
+
return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] };
|
|
6
|
+
}
|
|
7
|
+
function fail(message) {
|
|
8
|
+
return { content: [{ type: "text", text: `Error: ${message}` }], isError: true };
|
|
9
|
+
}
|
|
10
|
+
export function registerSkillTools(server) {
|
|
11
|
+
server.tool("list_skills", toolDescription("list_skills"), {}, async () => ok(SKILL_LIST));
|
|
12
|
+
server.tool("get_skill", toolDescription("get_skill"), {
|
|
13
|
+
id: z.string().min(1).max(80),
|
|
14
|
+
}, async ({ id }) => {
|
|
15
|
+
const skill = SKILL_BODIES[id.trim().toLowerCase()];
|
|
16
|
+
if (!skill)
|
|
17
|
+
return fail(`No skill "${id}". Skills: ${Object.keys(SKILL_BODIES).join(", ")}.`);
|
|
18
|
+
return ok(skill);
|
|
19
|
+
});
|
|
20
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { toolDescription } from "../tool-descriptions.js";
|
|
3
|
+
function ok(data) {
|
|
4
|
+
return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] };
|
|
5
|
+
}
|
|
6
|
+
function fail(message) {
|
|
7
|
+
return { content: [{ type: "text", text: `Error: ${message}` }], isError: true };
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* The project as people see it: stage, every page's state, whose turn it is, and the next call.
|
|
11
|
+
* Both tools read the same state the SpecShot project home and the client portal render, through
|
|
12
|
+
* the same server handler as the hosted endpoint, so the two transports cannot disagree.
|
|
13
|
+
*/
|
|
14
|
+
export function registerStateTools(server, client) {
|
|
15
|
+
server.tool("get_project_state", toolDescription("get_project_state"), { projectId: z.string() }, async ({ projectId }) => {
|
|
16
|
+
try {
|
|
17
|
+
const data = await client.get(`/api/mcp/projects/${encodeURIComponent(projectId)}/state`);
|
|
18
|
+
return ok(data);
|
|
19
|
+
}
|
|
20
|
+
catch (e) {
|
|
21
|
+
return fail(e instanceof Error ? e.message : "Failed to read the project state.");
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
server.tool("get_next_action", toolDescription("get_next_action"), { projectId: z.string() }, async ({ projectId }) => {
|
|
25
|
+
try {
|
|
26
|
+
const data = await client.get(`/api/mcp/projects/${encodeURIComponent(projectId)}/next`);
|
|
27
|
+
return ok(data);
|
|
28
|
+
}
|
|
29
|
+
catch (e) {
|
|
30
|
+
return fail(e instanceof Error ? e.message : "Failed to read the next action.");
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { toolDescription } from "../tool-descriptions.js";
|
|
3
|
+
function ok(data) {
|
|
4
|
+
return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] };
|
|
5
|
+
}
|
|
6
|
+
function fail(message) {
|
|
7
|
+
return { content: [{ type: "text", text: `Error: ${message}` }], isError: true };
|
|
8
|
+
}
|
|
9
|
+
const num = (v) => (v === undefined ? undefined : String(v));
|
|
10
|
+
const path = (projectId, rest) => `/api/mcp/projects/${encodeURIComponent(projectId)}/${rest}`;
|
|
11
|
+
async function run(work, label) {
|
|
12
|
+
try {
|
|
13
|
+
return ok(await work());
|
|
14
|
+
}
|
|
15
|
+
catch (e) {
|
|
16
|
+
return fail(e instanceof Error ? e.message : label);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Project tasks for agents (docs/PROJECT-FLOW-PLAN.md, Phase 4): read a project's tasks for people,
|
|
21
|
+
* add, change and close them, and set the dates beside them (a page's due date and owner, an open
|
|
22
|
+
* round's answer-by date, the target launch), over the REST routes under /api/mcp/projects/[id]/tasks
|
|
23
|
+
* and /schedule. The hosted endpoint registers the same tools from
|
|
24
|
+
* apps/web/src/lib/mcp/tools-tasks.ts, and the descriptions come from the generated
|
|
25
|
+
* tool-descriptions.ts, so the two transports cannot drift. The server checks every argument.
|
|
26
|
+
*/
|
|
27
|
+
export function registerTaskTools(server, client) {
|
|
28
|
+
server.tool("list_project_tasks", toolDescription("list_project_tasks"), {
|
|
29
|
+
projectId: z.string(),
|
|
30
|
+
filter: z.enum(["open", "mine", "done", "all"]).optional(),
|
|
31
|
+
pageId: z.string().optional(),
|
|
32
|
+
limit: z.number().optional(),
|
|
33
|
+
offset: z.number().optional(),
|
|
34
|
+
}, async ({ projectId, filter, pageId, limit, offset }) => run(() => client.get(path(projectId, "tasks"), { filter, pageId, limit: num(limit), offset: num(offset) }), "Failed to list the project's tasks."));
|
|
35
|
+
server.tool("create_project_task", toolDescription("create_project_task"), {
|
|
36
|
+
projectId: z.string(),
|
|
37
|
+
title: z.string(),
|
|
38
|
+
notes: z.string().optional(),
|
|
39
|
+
pageId: z.string().optional(),
|
|
40
|
+
assignee: z.string().optional(),
|
|
41
|
+
contactId: z.string().optional(),
|
|
42
|
+
dueOn: z.string().optional(),
|
|
43
|
+
status: z.enum(["todo", "doing"]).optional(),
|
|
44
|
+
}, async ({ projectId, ...rest }) => run(() => client.post(path(projectId, "tasks"), rest), "Failed to add the task."));
|
|
45
|
+
server.tool("update_project_task", toolDescription("update_project_task"), {
|
|
46
|
+
projectId: z.string(),
|
|
47
|
+
taskId: z.string(),
|
|
48
|
+
title: z.string().optional(),
|
|
49
|
+
notes: z.string().optional(),
|
|
50
|
+
status: z.enum(["todo", "doing", "done", "canceled"]).optional(),
|
|
51
|
+
assignee: z.string().optional(),
|
|
52
|
+
contactId: z.string().optional(),
|
|
53
|
+
dueOn: z.string().optional(),
|
|
54
|
+
pageId: z.string().optional(),
|
|
55
|
+
}, async ({ projectId, taskId, ...rest }) => run(() => client.patch(path(projectId, `tasks/${encodeURIComponent(taskId)}`), rest), "Failed to change the task."));
|
|
56
|
+
server.tool("complete_project_task", toolDescription("complete_project_task"), { projectId: z.string(), taskId: z.string() }, async ({ projectId, taskId }) => run(() => client.post(path(projectId, `tasks/${encodeURIComponent(taskId)}/complete`), {}), "Failed to mark the task done."));
|
|
57
|
+
server.tool("set_page_schedule", toolDescription("set_page_schedule"), { projectId: z.string(), pageId: z.string(), dueOn: z.string().optional(), ownerUserId: z.string().optional() }, async ({ projectId, ...rest }) => run(() => client.patch(path(projectId, "schedule/page"), rest), "Failed to set the page's date or owner."));
|
|
58
|
+
server.tool("set_round_due_date", toolDescription("set_round_due_date"), { projectId: z.string(), roundId: z.string().optional(), dueOn: z.string() }, async ({ projectId, ...rest }) => run(() => client.patch(path(projectId, "schedule/round"), rest), "Failed to set the round's date."));
|
|
59
|
+
server.tool("set_target_launch", toolDescription("set_target_launch"), { projectId: z.string(), targetLaunchOn: z.string() }, async ({ projectId, ...rest }) => run(() => client.patch(path(projectId, "schedule/launch"), rest), "Failed to set the target launch."));
|
|
60
|
+
}
|
package/dist/tools/wireframe.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
import { toolDescription } from "../tool-descriptions.js";
|
|
2
3
|
function ok(data) {
|
|
3
4
|
return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] };
|
|
4
5
|
}
|
|
@@ -13,7 +14,7 @@ function fail(message) {
|
|
|
13
14
|
* structural wireframe itself, and save_wireframe stores the result back.
|
|
14
15
|
*/
|
|
15
16
|
export function registerWireframeTools(server, client) {
|
|
16
|
-
server.tool("list_projects", "
|
|
17
|
+
server.tool("list_projects", toolDescription("list_projects"), {}, async () => {
|
|
17
18
|
try {
|
|
18
19
|
return ok(await client.get("/api/mcp/projects"));
|
|
19
20
|
}
|
|
@@ -21,7 +22,7 @@ export function registerWireframeTools(server, client) {
|
|
|
21
22
|
return fail(e instanceof Error ? e.message : "Failed to list projects.");
|
|
22
23
|
}
|
|
23
24
|
});
|
|
24
|
-
server.tool("get_project_intelligence", "
|
|
25
|
+
server.tool("get_project_intelligence", toolDescription("get_project_intelligence"), { projectId: z.string() }, async ({ projectId }) => {
|
|
25
26
|
try {
|
|
26
27
|
return ok(await client.get(`/api/mcp/projects/${projectId}/intelligence`));
|
|
27
28
|
}
|
|
@@ -29,7 +30,7 @@ export function registerWireframeTools(server, client) {
|
|
|
29
30
|
return fail(e instanceof Error ? e.message : "Failed to get project intelligence.");
|
|
30
31
|
}
|
|
31
32
|
});
|
|
32
|
-
server.tool("set_project_intelligence", "
|
|
33
|
+
server.tool("set_project_intelligence", toolDescription("set_project_intelligence"), {
|
|
33
34
|
projectId: z.string(),
|
|
34
35
|
businessGoals: z.string().optional(),
|
|
35
36
|
pageGoals: z.string().optional(),
|
|
@@ -51,7 +52,7 @@ export function registerWireframeTools(server, client) {
|
|
|
51
52
|
return fail(e instanceof Error ? e.message : "Failed to update the brief.");
|
|
52
53
|
}
|
|
53
54
|
});
|
|
54
|
-
server.tool("create_page", "
|
|
55
|
+
server.tool("create_page", toolDescription("create_page"), {
|
|
55
56
|
projectId: z.string(),
|
|
56
57
|
name: z.string(),
|
|
57
58
|
slug: z.string().optional(),
|
|
@@ -59,15 +60,19 @@ export function registerWireframeTools(server, client) {
|
|
|
59
60
|
// Was MISSING on stdio while lib/mcp/pages.ts already accepted it, so a
|
|
60
61
|
// foundations or components page could not be created over this transport.
|
|
61
62
|
kind: z.enum(["screens", "foundations", "components"]).optional(),
|
|
62
|
-
|
|
63
|
+
// The page's intent: hosted had both and stdio had neither, while the shared
|
|
64
|
+
// description tells the agent to record them.
|
|
65
|
+
goal: z.string().max(2000).optional(),
|
|
66
|
+
requiredSections: z.array(z.string().max(200)).max(60).optional(),
|
|
67
|
+
}, async ({ projectId, name, slug, position, kind, goal, requiredSections }) => {
|
|
63
68
|
try {
|
|
64
|
-
return ok(await client.post(`/api/mcp/projects/${projectId}/pages`, { name, slug, position, kind }));
|
|
69
|
+
return ok(await client.post(`/api/mcp/projects/${projectId}/pages`, { name, slug, position, kind, goal, requiredSections }));
|
|
65
70
|
}
|
|
66
71
|
catch (e) {
|
|
67
72
|
return fail(e instanceof Error ? e.message : "Failed to create the page.");
|
|
68
73
|
}
|
|
69
74
|
});
|
|
70
|
-
server.tool("get_wireframe_context", "
|
|
75
|
+
server.tool("get_wireframe_context", toolDescription("get_wireframe_context"), { projectId: z.string() }, async ({ projectId }) => {
|
|
71
76
|
try {
|
|
72
77
|
return ok(await client.get(`/api/mcp/projects/${projectId}/wireframe-context`));
|
|
73
78
|
}
|
|
@@ -75,14 +80,17 @@ export function registerWireframeTools(server, client) {
|
|
|
75
80
|
return fail(e instanceof Error ? e.message : "Failed to get wireframe context.");
|
|
76
81
|
}
|
|
77
82
|
});
|
|
78
|
-
server.tool("save_wireframe",
|
|
83
|
+
server.tool("save_wireframe", toolDescription("save_wireframe"), {
|
|
79
84
|
projectId: z.string(),
|
|
80
85
|
name: z.string(),
|
|
81
86
|
html: z.string(),
|
|
82
87
|
css: z.string().optional(),
|
|
83
88
|
pageType: z.string().optional(),
|
|
84
89
|
goal: z.string().optional(),
|
|
85
|
-
|
|
90
|
+
// A name, or {name, html, css}: the object form stores that section's own markup.
|
|
91
|
+
sections: z
|
|
92
|
+
.array(z.union([z.string().max(120), z.object({ name: z.string().min(1).max(120), html: z.string().optional(), css: z.string().optional() })]))
|
|
93
|
+
.optional(),
|
|
86
94
|
builderTarget: z.string().optional(),
|
|
87
95
|
// Was MISSING on stdio, so component-drift tracking was hosted-only.
|
|
88
96
|
components: z.array(z.record(z.unknown())).optional(),
|
|
@@ -109,24 +117,36 @@ export function registerWireframeTools(server, client) {
|
|
|
109
117
|
return fail(e instanceof Error ? e.message : "Failed to save wireframe.");
|
|
110
118
|
}
|
|
111
119
|
});
|
|
112
|
-
// Description
|
|
113
|
-
//
|
|
114
|
-
//
|
|
115
|
-
//
|
|
116
|
-
//
|
|
117
|
-
server.tool("publish_page_version", "
|
|
120
|
+
// Description generated from the hosted registry (tool-descriptions.ts). The description
|
|
121
|
+
// is the only thing an agent reads to decide whether to call a tool, so drift here makes
|
|
122
|
+
// the same agent behave differently on stdio than over the hosted endpoint, and this tool
|
|
123
|
+
// existed on hosted ONLY for its whole life, so a stdio agent was never told the
|
|
124
|
+
// save-and-place path exists.
|
|
125
|
+
server.tool("publish_page_version", toolDescription("publish_page_version"), {
|
|
118
126
|
projectId: z.string(),
|
|
119
|
-
|
|
120
|
-
|
|
127
|
+
// Required for a whole page; in site mode (itemId) the server builds the page and names it.
|
|
128
|
+
// The hosted handler says which is missing in a plain sentence.
|
|
129
|
+
name: z.string().optional(),
|
|
130
|
+
html: z.string().optional(),
|
|
121
131
|
css: z.string().optional(),
|
|
122
132
|
pageType: z.string().optional(),
|
|
123
133
|
goal: z.string().optional(),
|
|
124
|
-
sections: z
|
|
134
|
+
sections: z
|
|
135
|
+
.array(z.union([z.string().max(120), z.object({ name: z.string().min(1).max(120), html: z.string().optional(), css: z.string().optional() })]))
|
|
136
|
+
.optional(),
|
|
125
137
|
builderTarget: z.string().optional(),
|
|
126
138
|
components: z.array(z.record(z.unknown())).optional(),
|
|
127
139
|
pageSlug: z.string().optional(),
|
|
128
140
|
pageId: z.string().optional(),
|
|
129
141
|
viewport: z.enum(["mobile", "tablet", "desktop"]).optional(),
|
|
142
|
+
// The owner asked for a shorter page; without it a publish over the draft that would
|
|
143
|
+
// replace the page with a fragment is refused by the hosted handler.
|
|
144
|
+
allowShrink: z.boolean().optional(),
|
|
145
|
+
// Site mode: a page of an agent-driven site run (next_site_page), composed from the site kit.
|
|
146
|
+
itemId: z.string().optional(),
|
|
147
|
+
mainHtml: z.string().optional(),
|
|
148
|
+
pageCss: z.string().optional(),
|
|
149
|
+
finish: z.boolean().optional(),
|
|
130
150
|
}, async (args) => {
|
|
131
151
|
try {
|
|
132
152
|
return ok(await client.post("/api/mcp/concepts/publish", args));
|
|
@@ -135,8 +155,8 @@ export function registerWireframeTools(server, client) {
|
|
|
135
155
|
return fail(e instanceof Error ? e.message : "Failed to publish the page version.");
|
|
136
156
|
}
|
|
137
157
|
});
|
|
138
|
-
// Description
|
|
139
|
-
server.tool("list_components", "
|
|
158
|
+
// Description generated from the hosted registry (list_components).
|
|
159
|
+
server.tool("list_components", toolDescription("list_components"), { projectId: z.string() }, async ({ projectId }) => {
|
|
140
160
|
try {
|
|
141
161
|
return ok(await client.get(`/api/mcp/projects/${projectId}/components`));
|
|
142
162
|
}
|
|
@@ -144,7 +164,7 @@ export function registerWireframeTools(server, client) {
|
|
|
144
164
|
return fail(e instanceof Error ? e.message : "Failed to list components.");
|
|
145
165
|
}
|
|
146
166
|
});
|
|
147
|
-
server.tool("link_concept_page", "
|
|
167
|
+
server.tool("link_concept_page", toolDescription("link_concept_page"), {
|
|
148
168
|
conceptId: z.string(),
|
|
149
169
|
pageSlug: z.string().optional(),
|
|
150
170
|
pageId: z.string().nullable().optional(),
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { toolDescription } from "../tool-descriptions.js";
|
|
3
|
+
function ok(data) {
|
|
4
|
+
return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] };
|
|
5
|
+
}
|
|
6
|
+
function fail(message) {
|
|
7
|
+
return { content: [{ type: "text", text: `Error: ${message}` }], isError: true };
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* SpecShot for WordPress: the sites connected to a project through the SpecShot plugin, with
|
|
11
|
+
* whether each runs Automatic.css, over the REST route /api/mcp/projects/[id]/wordpress. The hosted
|
|
12
|
+
* endpoint registers the same tool from apps/web/src/lib/mcp/wordpress.ts, and the description
|
|
13
|
+
* comes from the generated tool-descriptions.ts, so the two transports cannot drift.
|
|
14
|
+
*/
|
|
15
|
+
export function registerWordPressTools(server, client) {
|
|
16
|
+
server.tool("list_wordpress_sites", toolDescription("list_wordpress_sites"), { projectId: z.string() }, async ({ projectId }) => {
|
|
17
|
+
try {
|
|
18
|
+
return ok(await client.get(`/api/mcp/projects/${encodeURIComponent(projectId)}/wordpress`));
|
|
19
|
+
}
|
|
20
|
+
catch (e) {
|
|
21
|
+
return fail(e instanceof Error ? e.message : "Failed to list the project's WordPress sites.");
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
}
|