@scayver/specshot-mcp-server 0.14.0 → 0.22.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 +53 -10
- package/dist/build-standard.js +135 -58
- package/dist/client.js +53 -3
- package/dist/index.js +28 -3
- package/dist/skills.js +156 -43
- package/dist/tool-descriptions.js +62 -13
- package/dist/tools/agent-loop.js +5 -0
- package/dist/tools/brand.js +64 -0
- package/dist/tools/canvas.js +2 -2
- package/dist/tools/concepts.js +23 -1
- package/dist/tools/etch-ai.js +37 -0
- package/dist/tools/knowledge.js +60 -0
- package/dist/tools/library.js +71 -0
- package/dist/tools/live.js +94 -0
- package/dist/tools/offline.js +16 -0
- package/dist/tools/project-edit.js +55 -0
- package/dist/tools/references.js +106 -0
- package/dist/tools/review.js +10 -0
- package/dist/tools/search-console.js +25 -0
- package/dist/tools/seo.js +30 -4
- package/dist/tools/site.js +23 -0
- package/dist/tools/skills.js +25 -7
- package/dist/tools/wireframe.js +27 -0
- package/dist/tools/wordpress.js +33 -3
- package/package.json +1 -1
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { toolDescription } from "../tool-descriptions.js";
|
|
3
|
+
import { SKILL_BODIES } from "../skills.js";
|
|
4
|
+
import { serverAnswered } from "./offline.js";
|
|
5
|
+
/** What every agent reads first, as far as this package carries it: the process and the clean Etch build. */
|
|
6
|
+
const OFFLINE_FIRST = ["agency-process", "etch-acss-build", "etch-clean-build"];
|
|
7
|
+
function ok(data) {
|
|
8
|
+
return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] };
|
|
9
|
+
}
|
|
10
|
+
function fail(message) {
|
|
11
|
+
return { content: [{ type: "text", text: `Error: ${message}` }], isError: true };
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* The briefing every agent reads first, and the super admin's publish, over the REST routes /api/mcp/briefing and
|
|
15
|
+
* /api/mcp/knowledge. The hosted endpoint registers the same tools from apps/web/src/lib/mcp/tools-knowledge.ts, and the
|
|
16
|
+
* descriptions come from the generated tool-descriptions.ts, so the two transports cannot drift.
|
|
17
|
+
*/
|
|
18
|
+
export function registerKnowledgeTools(server, client) {
|
|
19
|
+
server.tool("get_agent_briefing", toolDescription("get_agent_briefing"), {
|
|
20
|
+
projectId: z.string().uuid().optional(),
|
|
21
|
+
stage: z.enum(["discovery", "scope", "design", "review", "build", "live"]).optional(),
|
|
22
|
+
}, async ({ projectId, stage }) => {
|
|
23
|
+
try {
|
|
24
|
+
return ok(await client.get("/api/mcp/briefing", { projectId, stage }));
|
|
25
|
+
}
|
|
26
|
+
catch (e) {
|
|
27
|
+
if (serverAnswered(e))
|
|
28
|
+
return fail(e instanceof Error ? e.message : "SpecShot refused the request.");
|
|
29
|
+
const bodies = SKILL_BODIES;
|
|
30
|
+
return ok({
|
|
31
|
+
offline: "SpecShot could not be reached, so this is the briefing this package carries. Before any work, read each entry in `read` with get_skill, and the design law in the design_law prompt. Ask for the briefing again once SpecShot answers: it lists more, and what the owner published since this package was released.",
|
|
32
|
+
read: OFFLINE_FIRST.filter((id) => bodies[id]).map((id) => ({ id, title: bodies[id].title, why: bodies[id].when ?? "" })),
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
server.tool("save_knowledge", toolDescription("save_knowledge"), {
|
|
37
|
+
id: z.string().optional(),
|
|
38
|
+
status: z.enum(["draft", "published", "retired"]).optional(),
|
|
39
|
+
title: z.string().optional(),
|
|
40
|
+
kind: z.enum(["skill", "law", "workflow", "reference"]).optional(),
|
|
41
|
+
whenToLoad: z.string().optional(),
|
|
42
|
+
digest: z.string().optional(),
|
|
43
|
+
body: z.string().optional(),
|
|
44
|
+
source: z.enum(["owner", "specshot", "docs", "licensed"]).optional(),
|
|
45
|
+
stacks: z.array(z.string()).optional(),
|
|
46
|
+
stages: z.array(z.string()).optional(),
|
|
47
|
+
required: z.boolean().optional(),
|
|
48
|
+
sourceUrl: z.string().optional(),
|
|
49
|
+
restoreVersion: z.number().int().optional(),
|
|
50
|
+
reviewed: z.boolean().optional(),
|
|
51
|
+
reviewedSource: z.string().optional(),
|
|
52
|
+
}, async (args) => {
|
|
53
|
+
try {
|
|
54
|
+
return ok(await client.post("/api/mcp/knowledge", args));
|
|
55
|
+
}
|
|
56
|
+
catch (e) {
|
|
57
|
+
return fail(e instanceof Error ? e.message : "Failed to save the entry.");
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
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 CATEGORIES = ["hero", "navigation", "features", "cards", "pricing", "testimonials", "faq", "gallery", "slider", "logos", "stats", "cta", "contact", "footer", "showpiece", "store"];
|
|
10
|
+
const KINDS = ["section", "block", "blueprint", "pattern"];
|
|
11
|
+
/**
|
|
12
|
+
* The agency library for agents: SpecShot's approved patterns and the agency's kits and blueprints,
|
|
13
|
+
* over the REST routes /api/mcp/library and /api/mcp/library/[kind]/[id]. The hosted endpoint
|
|
14
|
+
* registers the same tools from apps/web/src/lib/mcp/tools-library.ts, and the descriptions come
|
|
15
|
+
* from the generated tool-descriptions.ts, so the two transports cannot drift. search_library and
|
|
16
|
+
* get_library_item read; place_library_item (POST /api/mcp/library/place) puts a piece into a SpecShot
|
|
17
|
+
* design as its next version and needs a read/write token. None of them touches a live site.
|
|
18
|
+
*/
|
|
19
|
+
export function registerLibraryTools(server, client) {
|
|
20
|
+
server.tool("search_library", toolDescription("search_library"), {
|
|
21
|
+
q: z.string().optional(),
|
|
22
|
+
category: z.enum(CATEGORIES).optional(),
|
|
23
|
+
kind: z.enum(KINDS).optional(),
|
|
24
|
+
source: z.enum(["specshot", "agency"]).optional(),
|
|
25
|
+
clientId: z.string().optional(),
|
|
26
|
+
favoritesOnly: z.boolean().optional(),
|
|
27
|
+
limit: z.number().optional(),
|
|
28
|
+
}, async ({ q, category, kind, source, clientId, favoritesOnly, limit }) => {
|
|
29
|
+
try {
|
|
30
|
+
return ok(await client.get("/api/mcp/library", {
|
|
31
|
+
q,
|
|
32
|
+
category,
|
|
33
|
+
kind,
|
|
34
|
+
source,
|
|
35
|
+
clientId,
|
|
36
|
+
favoritesOnly: favoritesOnly === undefined ? undefined : String(favoritesOnly),
|
|
37
|
+
limit: limit === undefined ? undefined : String(limit),
|
|
38
|
+
}));
|
|
39
|
+
}
|
|
40
|
+
catch (e) {
|
|
41
|
+
return fail(e instanceof Error ? e.message : "Failed to search the library.");
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
server.tool("get_library_item", toolDescription("get_library_item"), { ref: z.string() }, async ({ ref }) => {
|
|
45
|
+
const m = /^(kit|pattern):([0-9a-fA-F-]{36})$/.exec(ref.trim());
|
|
46
|
+
if (!m)
|
|
47
|
+
return fail("Pass a ref from search_library: kit:<id> or pattern:<id>.");
|
|
48
|
+
try {
|
|
49
|
+
return ok(await client.get(`/api/mcp/library/${m[1].toLowerCase()}/${encodeURIComponent(m[2].toLowerCase())}`));
|
|
50
|
+
}
|
|
51
|
+
catch (e) {
|
|
52
|
+
return fail(e instanceof Error ? e.message : "Failed to read the library item.");
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
server.tool("place_library_item", toolDescription("place_library_item"), {
|
|
56
|
+
projectId: z.string(),
|
|
57
|
+
designId: z.string(),
|
|
58
|
+
ref: z.string(),
|
|
59
|
+
at: z.union([z.enum(["top", "end"]), z.number().int().min(0)]).optional(),
|
|
60
|
+
baseVersion: z.number().int().min(0).optional(),
|
|
61
|
+
}, async ({ projectId, designId, ref, at, baseVersion }) => {
|
|
62
|
+
if (!/^(kit|pattern):[0-9a-fA-F-]{36}$/.test(ref.trim()))
|
|
63
|
+
return fail("Pass a ref from search_library: kit:<id> or pattern:<id>.");
|
|
64
|
+
try {
|
|
65
|
+
return ok(await client.post("/api/mcp/library/place", { projectId, designId, ref: ref.trim(), at, baseVersion }));
|
|
66
|
+
}
|
|
67
|
+
catch (e) {
|
|
68
|
+
return fail(e instanceof Error ? e.message : "Failed to place the library item.");
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
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)}/${rest}`;
|
|
10
|
+
/**
|
|
11
|
+
* Live collaboration for agents (docs/LIVE-REVIEW-PLAN.md part B), over the REST routes under
|
|
12
|
+
* /api/mcp/projects/[id]. The hosted twin is apps/web/src/lib/mcp/tools-live.ts; the parity test holds
|
|
13
|
+
* the two to the same names, and each description comes from the generated tool-descriptions.ts. The
|
|
14
|
+
* server checks every argument and holds wait_for_events for at most 25 seconds.
|
|
15
|
+
*/
|
|
16
|
+
export function registerLiveTools(server, client) {
|
|
17
|
+
server.tool("get_collaborators", toolDescription("get_collaborators"), { projectId: z.string() }, async ({ projectId }) => {
|
|
18
|
+
try {
|
|
19
|
+
return ok(await client.get(path(projectId, "collaborators")));
|
|
20
|
+
}
|
|
21
|
+
catch (e) {
|
|
22
|
+
return fail(e instanceof Error ? e.message : "Failed to read who is on the project.");
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
server.tool("wait_for_events", toolDescription("wait_for_events"), { projectId: z.string(), since: z.string().optional(), waitSeconds: z.number().optional() }, async ({ projectId, since, waitSeconds }) => {
|
|
26
|
+
try {
|
|
27
|
+
return ok(await client.get(path(projectId, "events"), {
|
|
28
|
+
since,
|
|
29
|
+
waitSeconds: waitSeconds === undefined ? undefined : String(waitSeconds),
|
|
30
|
+
}));
|
|
31
|
+
}
|
|
32
|
+
catch (e) {
|
|
33
|
+
return fail(e instanceof Error ? e.message : "Failed to wait for events.");
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
server.tool("update_design_element", toolDescription("update_design_element"), {
|
|
37
|
+
projectId: z.string(),
|
|
38
|
+
conceptId: z.string(),
|
|
39
|
+
elementPath: z.string(),
|
|
40
|
+
html: z.string(),
|
|
41
|
+
baseVersion: z.number().optional(),
|
|
42
|
+
changeSummary: z.string().optional(),
|
|
43
|
+
}, async ({ projectId, conceptId, ...rest }) => {
|
|
44
|
+
try {
|
|
45
|
+
return ok(await client.post(path(projectId, `concepts/${encodeURIComponent(conceptId)}/element`), rest));
|
|
46
|
+
}
|
|
47
|
+
catch (e) {
|
|
48
|
+
return fail(e instanceof Error ? e.message : "Failed to change the element.");
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
server.tool("edit_design", toolDescription("edit_design"), {
|
|
52
|
+
projectId: z.string(),
|
|
53
|
+
conceptId: z.string(),
|
|
54
|
+
edits: z
|
|
55
|
+
.array(z.object({
|
|
56
|
+
kind: z.string(),
|
|
57
|
+
path: z.string(),
|
|
58
|
+
prop: z.string().optional(),
|
|
59
|
+
value: z.string().optional(),
|
|
60
|
+
text: z.string().optional(),
|
|
61
|
+
src: z.string().optional(),
|
|
62
|
+
alt: z.string().optional(),
|
|
63
|
+
href: z.string().optional(),
|
|
64
|
+
direction: z.string().optional(),
|
|
65
|
+
when: z.string().optional(),
|
|
66
|
+
what: z.string().optional(),
|
|
67
|
+
where: z.string().optional(),
|
|
68
|
+
target: z.string().optional(),
|
|
69
|
+
}))
|
|
70
|
+
.min(1),
|
|
71
|
+
baseVersion: z.number().optional(),
|
|
72
|
+
changeSummary: z.string().optional(),
|
|
73
|
+
}, async ({ projectId, conceptId, ...rest }) => {
|
|
74
|
+
try {
|
|
75
|
+
return ok(await client.post(path(projectId, `concepts/${encodeURIComponent(conceptId)}/edit`), rest));
|
|
76
|
+
}
|
|
77
|
+
catch (e) {
|
|
78
|
+
return fail(e instanceof Error ? e.message : "Failed to edit the design.");
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
server.tool("design_page", toolDescription("design_page"), {
|
|
82
|
+
projectId: z.string(),
|
|
83
|
+
pageId: z.string(),
|
|
84
|
+
instructions: z.string().optional(),
|
|
85
|
+
captureIds: z.array(z.string()).optional(),
|
|
86
|
+
}, async ({ projectId, pageId, ...rest }) => {
|
|
87
|
+
try {
|
|
88
|
+
return ok(await client.post(path(projectId, `pages/${encodeURIComponent(pageId)}/design`), rest));
|
|
89
|
+
}
|
|
90
|
+
catch (e) {
|
|
91
|
+
return fail(e instanceof Error ? e.message : "Failed to start the design.");
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether SpecShot itself answered a request that failed, or could not be asked (docs/AGENT-KNOWLEDGE-PLAN.md,
|
|
3
|
+
* decision 3: the package asks the server and falls back to its own copy only when the server cannot answer).
|
|
4
|
+
*
|
|
5
|
+
* Not answered, so the package's copy serves: fetch could not reach the server (a TypeError), or the server has no
|
|
6
|
+
* such route or failed before it could answer (an older SpecShot without the knowledge routes answers 404 with a page,
|
|
7
|
+
* not JSON, and a proxy in front of a restarting server answers 502 or 503). The client then throws "HTTP <status>".
|
|
8
|
+
*
|
|
9
|
+
* Answered, so its word stands: a JSON error from SpecShot (an unknown id, a refused token, a read-only token, a
|
|
10
|
+
* missing permission), which the client throws as the server's own message.
|
|
11
|
+
*/
|
|
12
|
+
export function serverAnswered(e) {
|
|
13
|
+
if (!(e instanceof Error) || e instanceof TypeError)
|
|
14
|
+
return false;
|
|
15
|
+
return !/^HTTP (?:404|5\d\d)$/.test(e.message);
|
|
16
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
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 project = (projectId, rest = "") => `/api/mcp/projects/${encodeURIComponent(projectId)}${rest ? `/${rest}` : ""}`;
|
|
10
|
+
const page = (projectId, pageId, rest = "") => project(projectId, `pages/${encodeURIComponent(pageId)}${rest ? `/${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 and page edits for agents (the owner, 2026-11-05): change a project (name, client, website,
|
|
21
|
+
* brief, builder, category, status), archive and restore it, change a page (name, address, goal,
|
|
22
|
+
* required sections, kind), move it in the site map, and archive and restore it, over the REST routes
|
|
23
|
+
* under /api/mcp/projects/[id]. The hosted endpoint registers the same tools from
|
|
24
|
+
* apps/web/src/lib/mcp/tools-project-edit.ts, and the descriptions come from the generated
|
|
25
|
+
* tool-descriptions.ts, so the two transports cannot drift. The server runs the portal's own rules and
|
|
26
|
+
* checks every argument.
|
|
27
|
+
*/
|
|
28
|
+
export function registerProjectEditTools(server, client) {
|
|
29
|
+
server.tool("update_project", toolDescription("update_project"), {
|
|
30
|
+
projectId: z.string(),
|
|
31
|
+
name: z.string().optional(),
|
|
32
|
+
clientName: z.string().optional(),
|
|
33
|
+
websiteUrl: z.string().optional(),
|
|
34
|
+
brief: z.string().optional(),
|
|
35
|
+
builderPreference: z.string().optional(),
|
|
36
|
+
category: z.string().optional(),
|
|
37
|
+
clientFolderId: z.string().optional(),
|
|
38
|
+
status: z.string().optional(),
|
|
39
|
+
}, async ({ projectId, ...rest }) => run(() => client.patch(project(projectId), rest), "Failed to change the project."));
|
|
40
|
+
server.tool("archive_project", toolDescription("archive_project"), { projectId: z.string() }, async ({ projectId }) => run(() => client.post(project(projectId, "archive"), {}), "Failed to archive the project."));
|
|
41
|
+
server.tool("restore_project", toolDescription("restore_project"), { projectId: z.string() }, async ({ projectId }) => run(() => client.post(project(projectId, "unarchive"), {}), "Failed to bring the project back."));
|
|
42
|
+
server.tool("update_page", toolDescription("update_page"), {
|
|
43
|
+
projectId: z.string(),
|
|
44
|
+
pageId: z.string(),
|
|
45
|
+
name: z.string().optional(),
|
|
46
|
+
slug: z.string().optional(),
|
|
47
|
+
path: z.string().optional(),
|
|
48
|
+
goal: z.string().optional(),
|
|
49
|
+
requiredSections: z.array(z.string()).optional(),
|
|
50
|
+
kind: z.enum(["screens", "foundations", "components"]).optional(),
|
|
51
|
+
}, async ({ projectId, pageId, ...rest }) => run(() => client.patch(page(projectId, pageId), rest), "Failed to change the page."));
|
|
52
|
+
server.tool("move_page", toolDescription("move_page"), { projectId: z.string(), pageId: z.string(), place: z.number() }, async ({ projectId, pageId, place }) => run(() => client.post(page(projectId, pageId, "move"), { place }), "Failed to move the page."));
|
|
53
|
+
server.tool("archive_page", toolDescription("archive_page"), { projectId: z.string(), pageId: z.string() }, async ({ projectId, pageId }) => run(() => client.post(page(projectId, pageId, "archive"), {}), "Failed to archive the page."));
|
|
54
|
+
server.tool("restore_page", toolDescription("restore_page"), { projectId: z.string(), pageId: z.string() }, async ({ projectId, pageId }) => run(() => client.post(page(projectId, pageId, "unarchive"), {}), "Failed to restore the page."));
|
|
55
|
+
}
|
|
@@ -0,0 +1,106 @@
|
|
|
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 id = (v) => encodeURIComponent(v);
|
|
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
|
+
/** A contact's fields, as add_client_contact and update_client_contact send them. */
|
|
20
|
+
const CONTACT = {
|
|
21
|
+
name: z.string().max(200).optional(),
|
|
22
|
+
role: z.string().max(40).optional(),
|
|
23
|
+
roleOther: z.string().max(100).optional(),
|
|
24
|
+
email: z.string().max(320).optional(),
|
|
25
|
+
phone: z.string().max(50).optional(),
|
|
26
|
+
approvesDesigns: z.boolean().optional(),
|
|
27
|
+
notes: z.string().max(5000).optional(),
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* References, captures, search and clients for agents: create and change clients and their
|
|
31
|
+
* contacts, list and open captures, save a link as a reference, note it and file it, and search the
|
|
32
|
+
* workspace, over the REST routes under /api/mcp/clients, /api/mcp/captures, /api/mcp/inspiration
|
|
33
|
+
* and /api/mcp/search. The hosted endpoint registers the same tools from
|
|
34
|
+
* apps/web/src/lib/mcp/tools-references.ts, and the descriptions come from the generated
|
|
35
|
+
* tool-descriptions.ts, so the two transports cannot drift. The server checks every argument and
|
|
36
|
+
* every rule; these schemas are loose on purpose.
|
|
37
|
+
*/
|
|
38
|
+
export function registerReferenceTools(server, client) {
|
|
39
|
+
// ------------------------------------------------------------------------------ clients
|
|
40
|
+
server.tool("create_client", toolDescription("create_client"), {
|
|
41
|
+
name: z.string().min(1).max(200),
|
|
42
|
+
websiteUrl: z.string().max(2048).optional(),
|
|
43
|
+
notes: z.string().max(5000).optional(),
|
|
44
|
+
contactName: z.string().max(200).optional(),
|
|
45
|
+
contactEmail: z.string().max(320).optional(),
|
|
46
|
+
}, async (args) => run(() => client.post("/api/mcp/clients", args), "Failed to create the client."));
|
|
47
|
+
server.tool("update_client", toolDescription("update_client"), {
|
|
48
|
+
clientId: z.string(),
|
|
49
|
+
name: z.string().max(200).optional(),
|
|
50
|
+
websiteUrl: z.string().max(2048).optional(),
|
|
51
|
+
notes: z.string().max(5000).optional(),
|
|
52
|
+
archived: z.boolean().optional(),
|
|
53
|
+
legalName: z.string().max(400).optional(),
|
|
54
|
+
addressStreet: z.string().max(400).optional(),
|
|
55
|
+
addressCity: z.string().max(400).optional(),
|
|
56
|
+
addressRegion: z.string().max(400).optional(),
|
|
57
|
+
addressPostalCode: z.string().max(400).optional(),
|
|
58
|
+
addressCountry: z.string().max(400).optional(),
|
|
59
|
+
phone: z.string().max(400).optional(),
|
|
60
|
+
industry: z.string().max(400).optional(),
|
|
61
|
+
businessHours: z.string().max(1000).optional(),
|
|
62
|
+
timeZone: z.string().max(100).optional(),
|
|
63
|
+
socialLinks: z.array(z.string()).max(10).optional(),
|
|
64
|
+
brandColors: z.array(z.object({ name: z.string(), value: z.string() })).max(12).optional(),
|
|
65
|
+
brandFonts: z.array(z.object({ name: z.string(), use: z.string() })).max(6).optional(),
|
|
66
|
+
libraryBrandId: z.string().optional(),
|
|
67
|
+
}, async ({ clientId, ...rest }) => run(() => client.patch(`/api/mcp/clients/${id(clientId)}`, rest), "Failed to change the client."));
|
|
68
|
+
server.tool("list_client_contacts", toolDescription("list_client_contacts"), { clientId: z.string() }, async ({ clientId }) => run(() => client.get(`/api/mcp/clients/${id(clientId)}/contacts`), "Failed to list the client's contacts."));
|
|
69
|
+
server.tool("add_client_contact", toolDescription("add_client_contact"), { clientId: z.string(), ...CONTACT, isPrimary: z.boolean().optional() }, async ({ clientId, ...rest }) => run(() => client.post(`/api/mcp/clients/${id(clientId)}/contacts`, rest), "Failed to add the contact."));
|
|
70
|
+
server.tool("update_client_contact", toolDescription("update_client_contact"), { clientId: z.string(), contactId: z.string(), ...CONTACT, isPrimary: z.boolean().optional() }, async ({ clientId, contactId, ...rest }) => run(() => client.patch(`/api/mcp/clients/${id(clientId)}/contacts/${id(contactId)}`, rest), "Failed to change the contact."));
|
|
71
|
+
// ------------------------------------------------------------------------------ captures
|
|
72
|
+
server.tool("list_captures", toolDescription("list_captures"), { projectId: z.string().optional(), limit: z.number().optional(), offset: z.number().optional() }, async ({ projectId, limit, offset }) => run(() => client.get("/api/mcp/captures", { projectId, limit: num(limit), offset: num(offset) }), "Failed to list the captures."));
|
|
73
|
+
server.tool("get_capture", toolDescription("get_capture"), { captureId: z.string(), includeDom: z.boolean().optional() }, async ({ captureId, includeDom }) => run(() => client.get(`/api/mcp/captures/${id(captureId)}`, { includeDom: includeDom === undefined ? undefined : String(includeDom) }), "Failed to open the capture."));
|
|
74
|
+
// ------------------------------------------------------------------------------ references
|
|
75
|
+
server.tool("add_inspiration_from_url", toolDescription("add_inspiration_from_url"), {
|
|
76
|
+
projectId: z.string(),
|
|
77
|
+
folderId: z.string(),
|
|
78
|
+
url: z.string().max(2048),
|
|
79
|
+
title: z.string().max(220).optional(),
|
|
80
|
+
notes: z.string().max(3000).optional(),
|
|
81
|
+
tags: z.array(z.string()).max(20).optional(),
|
|
82
|
+
}, async (args) => run(() => client.post("/api/mcp/inspiration/url", args), "Failed to save the link."));
|
|
83
|
+
server.tool("update_inspiration", toolDescription("update_inspiration"), {
|
|
84
|
+
inspirationId: z.string(),
|
|
85
|
+
notes: z.string().max(3000).optional(),
|
|
86
|
+
title: z.string().max(220).optional(),
|
|
87
|
+
tags: z.array(z.string()).max(20).optional(),
|
|
88
|
+
favorite: z.boolean().optional(),
|
|
89
|
+
folderId: z.string().optional(),
|
|
90
|
+
sectionType: z.string().max(80).optional(),
|
|
91
|
+
sourceUrl: z.string().max(2048).optional(),
|
|
92
|
+
sourcePageTitle: z.string().max(300).optional(),
|
|
93
|
+
sortOrder: z.number().optional(),
|
|
94
|
+
}, async ({ inspirationId, ...rest }) => run(() => client.patch(`/api/mcp/inspiration/${id(inspirationId)}`, rest), "Failed to change the reference."));
|
|
95
|
+
server.tool("list_inspiration_folders", toolDescription("list_inspiration_folders"), { projectId: z.string() }, async ({ projectId }) => run(() => client.get("/api/mcp/inspiration/folders", { projectId }), "Failed to list the folders."));
|
|
96
|
+
server.tool("create_inspiration_folder", toolDescription("create_inspiration_folder"), {
|
|
97
|
+
projectId: z.string(),
|
|
98
|
+
name: z.string().min(1).max(160),
|
|
99
|
+
folderType: z.string().max(40).optional(),
|
|
100
|
+
description: z.string().max(1000).optional(),
|
|
101
|
+
parentFolderId: z.string().optional(),
|
|
102
|
+
tags: z.array(z.string()).max(20).optional(),
|
|
103
|
+
}, async (args) => run(() => client.post("/api/mcp/inspiration/folders", args), "Failed to create the folder."));
|
|
104
|
+
// ------------------------------------------------------------------------------ search
|
|
105
|
+
server.tool("search_workspace", toolDescription("search_workspace"), { q: z.string().max(200) }, async ({ q }) => run(() => client.get("/api/mcp/search", { q }), "Failed to search the workspace."));
|
|
106
|
+
}
|
package/dist/tools/review.js
CHANGED
|
@@ -24,4 +24,14 @@ export function registerReviewTools(server, client) {
|
|
|
24
24
|
return fail(e instanceof Error ? e.message : "Failed to reply to the comment.");
|
|
25
25
|
}
|
|
26
26
|
});
|
|
27
|
+
// accept_text_suggestion: POST /api/mcp/comments/[commentId]/suggestion. Suggested words as a new
|
|
28
|
+
// version of the design, never on approved work. Requires a read/write token.
|
|
29
|
+
server.tool("accept_text_suggestion", toolDescription("accept_text_suggestion"), { commentId: z.string().uuid(), baseVersion: z.number().int().min(0).optional() }, async ({ commentId, baseVersion }) => {
|
|
30
|
+
try {
|
|
31
|
+
return ok(await client.post(`/api/mcp/comments/${encodeURIComponent(commentId)}/suggestion`, baseVersion === undefined ? {} : { baseVersion }));
|
|
32
|
+
}
|
|
33
|
+
catch (e) {
|
|
34
|
+
return fail(e instanceof Error ? e.message : "Failed to accept the suggestion.");
|
|
35
|
+
}
|
|
36
|
+
});
|
|
27
37
|
}
|
|
@@ -0,0 +1,25 @@
|
|
|
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
|
+
* Google Search Console for agents: an SEO audit's site, its totals for the last 28 days with the 28
|
|
12
|
+
* before, the deltas, and its top queries and pages, over the REST route /api/mcp/search-console. The
|
|
13
|
+
* hosted endpoint registers the same tool from apps/web/src/lib/mcp/tools-search-console.ts, and the
|
|
14
|
+
* description comes from the generated tool-descriptions.ts, so the two transports cannot drift.
|
|
15
|
+
*/
|
|
16
|
+
export function registerSearchConsoleTools(server, client) {
|
|
17
|
+
server.tool("get_search_console", toolDescription("get_search_console"), { auditId: z.string(), queries: z.number().optional(), pages: z.number().optional() }, async ({ auditId, queries, pages }) => {
|
|
18
|
+
try {
|
|
19
|
+
return ok(await client.get(`/api/mcp/search-console/${encodeURIComponent(auditId)}`, { queries: num(queries), pages: num(pages) }));
|
|
20
|
+
}
|
|
21
|
+
catch (e) {
|
|
22
|
+
return fail(e instanceof Error ? e.message : "Failed to read Search Console for the audit's site.");
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
}
|
package/dist/tools/seo.js
CHANGED
|
@@ -23,9 +23,9 @@ export function registerSeoTools(server, client) {
|
|
|
23
23
|
return fail(e instanceof Error ? e.message : "Failed to list the SEO audits.");
|
|
24
24
|
}
|
|
25
25
|
});
|
|
26
|
-
server.tool("get_seo_audit", toolDescription("get_seo_audit"), { auditId: z.string() }, async ({ auditId }) => {
|
|
26
|
+
server.tool("get_seo_audit", toolDescription("get_seo_audit"), { auditId: z.string(), page: z.string().optional() }, async ({ auditId, page }) => {
|
|
27
27
|
try {
|
|
28
|
-
return ok(await client.get(`/api/mcp/seo/audits/${encodeURIComponent(auditId)}
|
|
28
|
+
return ok(await client.get(`/api/mcp/seo/audits/${encodeURIComponent(auditId)}`, { page }));
|
|
29
29
|
}
|
|
30
30
|
catch (e) {
|
|
31
31
|
return fail(e instanceof Error ? e.message : "Failed to read the SEO audit.");
|
|
@@ -37,9 +37,10 @@ export function registerSeoTools(server, client) {
|
|
|
37
37
|
page: z.string().optional(),
|
|
38
38
|
limit: z.number().optional(),
|
|
39
39
|
offset: z.number().optional(),
|
|
40
|
-
|
|
40
|
+
batch: z.number().optional(),
|
|
41
|
+
}, async ({ auditId, status, page, limit, offset, batch }) => {
|
|
41
42
|
try {
|
|
42
|
-
return ok(await client.get(`/api/mcp/seo/audits/${encodeURIComponent(auditId)}/fixes`, { status, page, limit: num(limit), offset: num(offset) }));
|
|
43
|
+
return ok(await client.get(`/api/mcp/seo/audits/${encodeURIComponent(auditId)}/fixes`, { status, page, limit: num(limit), offset: num(offset), batch: num(batch) }));
|
|
43
44
|
}
|
|
44
45
|
catch (e) {
|
|
45
46
|
return fail(e instanceof Error ? e.message : "Failed to read the SEO checklist.");
|
|
@@ -53,4 +54,29 @@ export function registerSeoTools(server, client) {
|
|
|
53
54
|
return fail(e instanceof Error ? e.message : "Failed to update the SEO checklist item.");
|
|
54
55
|
}
|
|
55
56
|
});
|
|
57
|
+
// Starting, rechecking and stopping an audit, by the portal's own rules on the server.
|
|
58
|
+
server.tool("start_seo_audit", toolDescription("start_seo_audit"), { url: z.string(), scope: z.enum(["page", "site"]), cap: z.number().optional(), projectId: z.string().optional() }, async ({ url, scope, cap, projectId }) => {
|
|
59
|
+
try {
|
|
60
|
+
return ok(await client.post("/api/mcp/seo/audits", { url, scope, ...(cap !== undefined ? { cap } : {}), ...(projectId !== undefined ? { projectId } : {}) }));
|
|
61
|
+
}
|
|
62
|
+
catch (e) {
|
|
63
|
+
return fail(e instanceof Error ? e.message : "Failed to start the SEO audit.");
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
server.tool("recheck_seo_audit", toolDescription("recheck_seo_audit"), { auditId: z.string() }, async ({ auditId }) => {
|
|
67
|
+
try {
|
|
68
|
+
return ok(await client.post(`/api/mcp/seo/audits/${encodeURIComponent(auditId)}/recheck`, {}));
|
|
69
|
+
}
|
|
70
|
+
catch (e) {
|
|
71
|
+
return fail(e instanceof Error ? e.message : "Failed to recheck the SEO audit.");
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
server.tool("cancel_seo_audit", toolDescription("cancel_seo_audit"), { auditId: z.string() }, async ({ auditId }) => {
|
|
75
|
+
try {
|
|
76
|
+
return ok(await client.post(`/api/mcp/seo/audits/${encodeURIComponent(auditId)}/cancel`, {}));
|
|
77
|
+
}
|
|
78
|
+
catch (e) {
|
|
79
|
+
return fail(e instanceof Error ? e.message : "Failed to stop the SEO audit.");
|
|
80
|
+
}
|
|
81
|
+
});
|
|
56
82
|
}
|
package/dist/tools/site.js
CHANGED
|
@@ -67,6 +67,7 @@ export function registerSiteTools(server, client) {
|
|
|
67
67
|
concurrency: z.number().optional(),
|
|
68
68
|
another: z.boolean().optional(),
|
|
69
69
|
known: z.array(z.string()).optional(),
|
|
70
|
+
redesign: z.boolean().optional(),
|
|
70
71
|
}, async ({ projectId, ...rest }) => {
|
|
71
72
|
try {
|
|
72
73
|
return ok(await client.post(path(projectId, "next"), rest));
|
|
@@ -75,4 +76,26 @@ export function registerSiteTools(server, client) {
|
|
|
75
76
|
return fail(e instanceof Error ? e.message : "Failed to take the next page of the site.");
|
|
76
77
|
}
|
|
77
78
|
});
|
|
79
|
+
// The site structure (docs/ETCH-SITE-STRUCTURE.md): which pages become post types and which stay Pages.
|
|
80
|
+
server.tool("get_site_structure", toolDescription("get_site_structure"), { projectId: z.string(), target: z.enum(["wordpress", "studio"]).optional() }, async ({ projectId, target }) => {
|
|
81
|
+
try {
|
|
82
|
+
return ok(await client.get(path(projectId, "structure"), { target }));
|
|
83
|
+
}
|
|
84
|
+
catch (e) {
|
|
85
|
+
return fail(e instanceof Error ? e.message : "Failed to read the site structure.");
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
server.tool("set_site_structure", toolDescription("set_site_structure"), {
|
|
89
|
+
projectId: z.string(),
|
|
90
|
+
moves: z.array(z.object({ page: z.string(), to: z.string() })).optional(),
|
|
91
|
+
structure: z.record(z.unknown()).optional(),
|
|
92
|
+
redetect: z.boolean().optional(),
|
|
93
|
+
}, async ({ projectId, ...rest }) => {
|
|
94
|
+
try {
|
|
95
|
+
return ok(await client.post(path(projectId, "structure"), rest));
|
|
96
|
+
}
|
|
97
|
+
catch (e) {
|
|
98
|
+
return fail(e instanceof Error ? e.message : "Failed to change the site structure.");
|
|
99
|
+
}
|
|
100
|
+
});
|
|
78
101
|
}
|
package/dist/tools/skills.js
CHANGED
|
@@ -1,20 +1,38 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { toolDescription } from "../tool-descriptions.js";
|
|
3
3
|
import { SKILL_BODIES, SKILL_LIST } from "../skills.js";
|
|
4
|
+
import { serverAnswered as answered } from "./offline.js";
|
|
4
5
|
function ok(data) {
|
|
5
6
|
return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] };
|
|
6
7
|
}
|
|
7
8
|
function fail(message) {
|
|
8
9
|
return { content: [{ type: "text", text: `Error: ${message}` }], isError: true };
|
|
9
10
|
}
|
|
10
|
-
export function registerSkillTools(server) {
|
|
11
|
-
server.tool("list_skills", toolDescription("list_skills"), {}, async () =>
|
|
11
|
+
export function registerSkillTools(server, client) {
|
|
12
|
+
server.tool("list_skills", toolDescription("list_skills"), {}, async () => {
|
|
13
|
+
try {
|
|
14
|
+
return ok(await client.get("/api/mcp/skills"));
|
|
15
|
+
}
|
|
16
|
+
catch (e) {
|
|
17
|
+
if (answered(e))
|
|
18
|
+
return fail(e instanceof Error ? e.message : "SpecShot refused the request.");
|
|
19
|
+
return ok({ ...SKILL_LIST, offline: "SpecShot could not be reached, so this is the list this package carries. Entries published since it was released are left out." });
|
|
20
|
+
}
|
|
21
|
+
});
|
|
12
22
|
server.tool("get_skill", toolDescription("get_skill"), {
|
|
13
23
|
id: z.string().min(1).max(80),
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
return
|
|
18
|
-
|
|
24
|
+
part: z.number().int().min(1).max(100).optional(),
|
|
25
|
+
}, async ({ id, part }) => {
|
|
26
|
+
try {
|
|
27
|
+
return ok(await client.get(`/api/mcp/skills/${encodeURIComponent(id.trim().toLowerCase())}`, { part: part === undefined ? undefined : String(part) }));
|
|
28
|
+
}
|
|
29
|
+
catch (e) {
|
|
30
|
+
if (answered(e))
|
|
31
|
+
return fail(e instanceof Error ? e.message : "SpecShot refused the request.");
|
|
32
|
+
const skill = SKILL_BODIES[id.trim().toLowerCase()];
|
|
33
|
+
if (!skill || (part ?? 1) > 1)
|
|
34
|
+
return fail(`SpecShot could not be reached, and this package does not carry "${id}"${part && part > 1 ? ` part ${part}` : ""}. Try again in a moment.`);
|
|
35
|
+
return ok(skill);
|
|
36
|
+
}
|
|
19
37
|
});
|
|
20
38
|
}
|
package/dist/tools/wireframe.js
CHANGED
|
@@ -22,6 +22,33 @@ export function registerWireframeTools(server, client) {
|
|
|
22
22
|
return fail(e instanceof Error ? e.message : "Failed to list projects.");
|
|
23
23
|
}
|
|
24
24
|
});
|
|
25
|
+
server.tool("list_clients", toolDescription("list_clients"), { limit: z.number().int().min(1).max(200).optional(), offset: z.number().int().min(0).optional() }, async ({ limit, offset }) => {
|
|
26
|
+
try {
|
|
27
|
+
return ok(await client.get("/api/mcp/clients", { limit: limit?.toString(), offset: offset?.toString() }));
|
|
28
|
+
}
|
|
29
|
+
catch (e) {
|
|
30
|
+
return fail(e instanceof Error ? e.message : "Failed to list clients.");
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
// The server checks everything the portal's New project checks (lib/projects/create.ts): the
|
|
34
|
+
// plan's cap, the builder and starting point lists, and that a client id is this workspace's.
|
|
35
|
+
server.tool("create_project", toolDescription("create_project"), {
|
|
36
|
+
name: z.string().min(1).max(255),
|
|
37
|
+
clientName: z.string().max(255).optional(),
|
|
38
|
+
websiteUrl: z.string().max(2048).optional(),
|
|
39
|
+
brief: z.string().max(20000).optional(),
|
|
40
|
+
builderPreference: z.string().max(60).optional(),
|
|
41
|
+
category: z.string().max(80).optional(),
|
|
42
|
+
clientFolderId: z.string().optional(),
|
|
43
|
+
startingPoint: z.string().max(60).optional(),
|
|
44
|
+
}, async ({ name, clientName, websiteUrl, brief, builderPreference, category, clientFolderId, startingPoint }) => {
|
|
45
|
+
try {
|
|
46
|
+
return ok(await client.post("/api/mcp/projects", { name, clientName, websiteUrl, brief, builderPreference, category, clientFolderId, startingPoint }));
|
|
47
|
+
}
|
|
48
|
+
catch (e) {
|
|
49
|
+
return fail(e instanceof Error ? e.message : "Failed to create the project.");
|
|
50
|
+
}
|
|
51
|
+
});
|
|
25
52
|
server.tool("get_project_intelligence", toolDescription("get_project_intelligence"), { projectId: z.string() }, async ({ projectId }) => {
|
|
26
53
|
try {
|
|
27
54
|
return ok(await client.get(`/api/mcp/projects/${projectId}/intelligence`));
|