sbuilder-mcp 0.113.0 → 0.113.2
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/CHANGELOG.md +17 -0
- package/CHANGELOG.vi.md +17 -0
- package/dist/domains/site/findings.js +31 -0
- package/dist/domains/site/review.js +27 -2
- package/dist/mcp/strict.js +28 -0
- package/dist/server.js +2 -1
- package/dist/tools/page.js +53 -35
- package/dist/tools/session.js +28 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,23 @@ All notable changes to this project are documented in this file.
|
|
|
6
6
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
7
7
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
8
8
|
|
|
9
|
+
## [0.113.2] - 2026-11-25
|
|
10
|
+
|
|
11
|
+
### Fixed
|
|
12
|
+
- `sb_duplicate` reconciles a cross-site paste with the account session instead of an API key, so a key for the target site no longer borrows its creator's standing on the source site.
|
|
13
|
+
|
|
14
|
+
## [0.113.1] - 2026-11-24
|
|
15
|
+
|
|
16
|
+
### Changed
|
|
17
|
+
- `sb_site_list` returns a much smaller result by dropping the repeated `effectivePermissions` of an owner's sites, timestamps, redirect settings and screenshots, while a non-owner keeps its permissions and a true template, maintenance or building flag stays.
|
|
18
|
+
- `sb_page_list` says the page-type table and its notes once per process, and keeps `pages` and `usually_also` on every call.
|
|
19
|
+
- Review findings state a problem sentence shared by every finding of the same code once under `problems[code]` instead of repeating it on each finding.
|
|
20
|
+
- The `tools/list` response is smaller because the per-tool `$schema` and default `execution` stamps are no longer sent.
|
|
21
|
+
|
|
22
|
+
### Fixed
|
|
23
|
+
- `sb_review` no longer reports a picture layer (an empty absolute block that paints its own photo or fill) as `empty_container`, so its fix no longer suggests removing the banner photo.
|
|
24
|
+
- `sb_review` no longer reports copy placed over an absolute picture child as `invisible_text` against the section's background.
|
|
25
|
+
|
|
9
26
|
## [0.113.0] - 2026-11-23
|
|
10
27
|
|
|
11
28
|
### Added
|
package/CHANGELOG.vi.md
CHANGED
|
@@ -6,6 +6,23 @@ Mọi thay đổi đáng chú ý của dự án được ghi lại trong file n
|
|
|
6
6
|
Định dạng dựa trên [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
7
7
|
và dự án tuân theo [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
8
8
|
|
|
9
|
+
## [0.113.2] - 2026-11-25
|
|
10
|
+
|
|
11
|
+
### Fixed
|
|
12
|
+
- `sb_duplicate` đối chiếu thao tác dán giữa các site bằng phiên tài khoản thay vì khóa API, nên khóa của site đích không còn mượn quyền của người tạo nó trên site nguồn.
|
|
13
|
+
|
|
14
|
+
## [0.113.1] - 2026-11-24
|
|
15
|
+
|
|
16
|
+
### Changed
|
|
17
|
+
- `sb_site_list` trả về kết quả nhỏ hơn nhiều nhờ bỏ `effectivePermissions` lặp lại của các site thuộc chủ sở hữu, mốc thời gian, cài đặt chuyển hướng và ảnh chụp màn hình, trong khi người không phải chủ sở hữu vẫn giữ quyền của mình và cờ template, maintenance hoặc building đúng vẫn được giữ.
|
|
18
|
+
- `sb_page_list` chỉ nói bảng loại trang và các ghi chú của nó một lần cho mỗi tiến trình, và vẫn giữ `pages` và `usually_also` ở mọi lần gọi.
|
|
19
|
+
- Các phát hiện của review nêu câu mô tả vấn đề chung của mọi phát hiện cùng mã một lần dưới `problems[code]` thay vì lặp lại trên từng phát hiện.
|
|
20
|
+
- Phản hồi `tools/list` nhỏ hơn vì không còn gửi `$schema` theo từng tool và dấu `execution` mặc định.
|
|
21
|
+
|
|
22
|
+
### Fixed
|
|
23
|
+
- `sb_review` không còn báo lớp ảnh (khối tuyệt đối rỗng tự vẽ ảnh hoặc màu nền) là `empty_container`, nên cách sửa không còn gợi ý xóa ảnh banner.
|
|
24
|
+
- `sb_review` không còn báo phần chữ đặt trên một phần tử ảnh tuyệt đối là `invisible_text` so với nền của section.
|
|
25
|
+
|
|
9
26
|
## [0.113.0] - 2026-11-23
|
|
10
27
|
|
|
11
28
|
### Added
|
|
@@ -230,6 +230,37 @@ export function compactFindings(items) {
|
|
|
230
230
|
});
|
|
231
231
|
return { findings, fixes };
|
|
232
232
|
}
|
|
233
|
+
/**
|
|
234
|
+
* A `problem` sentence every finding of its code repeats is said ONCE, under
|
|
235
|
+
* `problems[code]` — the same move `fixes` made for the fix. Measured
|
|
236
|
+
* 2026-11-24 on a real home page: twelve empty_container findings carried the
|
|
237
|
+
* same sentence twelve times, seven handbuilt_menu ones a 300-char paragraph
|
|
238
|
+
* each. A finding whose sentence DIFFERS from its code's first one keeps it
|
|
239
|
+
* (it carries a count, a contrast, a key), so nothing a finding says is lost.
|
|
240
|
+
*/
|
|
241
|
+
export function shareProblems(items) {
|
|
242
|
+
const first = {};
|
|
243
|
+
const seen = {};
|
|
244
|
+
for (const it of items) {
|
|
245
|
+
if (typeof it.problem !== 'string')
|
|
246
|
+
continue;
|
|
247
|
+
first[it.code] ??= it.problem;
|
|
248
|
+
if (it.problem === first[it.code])
|
|
249
|
+
seen[it.code] = (seen[it.code] ?? 0) + 1;
|
|
250
|
+
}
|
|
251
|
+
const problems = {};
|
|
252
|
+
for (const [code, n] of Object.entries(seen))
|
|
253
|
+
if (n > 1)
|
|
254
|
+
problems[code] = first[code];
|
|
255
|
+
const findings = items.map((it) => {
|
|
256
|
+
if (problems[it.code] === undefined || it.problem !== problems[it.code])
|
|
257
|
+
return it;
|
|
258
|
+
const { problem, ...rest } = it;
|
|
259
|
+
void problem;
|
|
260
|
+
return rest;
|
|
261
|
+
});
|
|
262
|
+
return { findings, problems };
|
|
263
|
+
}
|
|
233
264
|
/**
|
|
234
265
|
* What a COMPOSE WARNING means for the document now in hand.
|
|
235
266
|
*
|
|
@@ -16,6 +16,20 @@ import { deadNavigation, hasPurchaseBinding, liveEventTable, PAYLOAD_NEEDS, PROD
|
|
|
16
16
|
import { unknownValueNote, unknownWriteNote, vocabularyFor, vocabularyForWrite } from './vocabulary.js';
|
|
17
17
|
import { iconNote } from './icons.js';
|
|
18
18
|
import { LINK_COLOUR, LINK_INHERITS, unstyledLinks } from './writecheck.js';
|
|
19
|
+
/** Whether `containerId` holds an absolutely-positioned child that paints a picture over it. */
|
|
20
|
+
function coveredByPicture(d, containerId) {
|
|
21
|
+
for (const k of d.nodes[containerId]?.data.nodes ?? []) {
|
|
22
|
+
const c = d.nodes[k];
|
|
23
|
+
if (!c || c.style?.position !== 'absolute')
|
|
24
|
+
continue;
|
|
25
|
+
if (c.data.type === 'image' || c.data.type === 'video')
|
|
26
|
+
return true;
|
|
27
|
+
const g = groundOf(c);
|
|
28
|
+
if (g && 'picture' in g)
|
|
29
|
+
return true;
|
|
30
|
+
}
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
19
33
|
/**
|
|
20
34
|
* A defect somebody looking at the page would see.
|
|
21
35
|
*
|
|
@@ -46,7 +60,8 @@ export const REVIEW_NOTICE = 'FIX THESE. Each one is a defect a visitor will see
|
|
|
46
60
|
'while findings stand; if you believe one is a false positive, say which and why. ' +
|
|
47
61
|
'A finding marked overlay:true is in the cart drawer or a pop-up — fix it the same way ' +
|
|
48
62
|
'(sb_set lands there), but it is SITE-WIDE, so fix it once rather than once per page. ' +
|
|
49
|
-
'`advice` lists what works but is hard to edit — never a blocker.'
|
|
63
|
+
'`advice` lists what works but is hard to edit — never a blocker. A finding with no ' +
|
|
64
|
+
'`problem` shares its code\'s sentence under `problems`; its fix is under `fixes`.';
|
|
50
65
|
/** The specials keys an element seeds that hold its visible content. */
|
|
51
66
|
function contentKeys(type) {
|
|
52
67
|
const seeded = ELEMENTS[type]?.defaults.specials ?? {};
|
|
@@ -598,7 +613,11 @@ opts = {}) {
|
|
|
598
613
|
const fg = rgbOf(ownFg ? (opts.theme ? resolveVars(opts.theme, own) : own) : presetFg);
|
|
599
614
|
let ground = null;
|
|
600
615
|
for (let x = id; x && d.nodes[x] && !ground; x = d.nodes[x].data.parent) {
|
|
601
|
-
ground
|
|
616
|
+
// A PICTURE LAYER LAID OVER THE ANCESTOR is the ground too, not only the ancestor's own
|
|
617
|
+
// fill: the banner pattern is an empty absolutely-positioned block carrying the photo,
|
|
618
|
+
// with the copy in a sibling above it. Measured 2026-11-24 on a live home page: white
|
|
619
|
+
// headings over that photo read "1.00:1" against the section's white, eight times.
|
|
620
|
+
ground = (x !== id && coveredByPicture(d, x) ? { picture: true } : null) ?? groundOf(d.nodes[x], opts.theme);
|
|
602
621
|
}
|
|
603
622
|
const bg = ground && 'color' in ground ? rgbOf(ground.color) : null;
|
|
604
623
|
const authored = (ownFg && !String(own).includes('var(')) || (!!ground && 'literal' in ground && ground.literal);
|
|
@@ -1396,8 +1415,14 @@ opts = {}) {
|
|
|
1396
1415
|
const drawsOwnControl = type === 'search-input' || filledByHost;
|
|
1397
1416
|
const isReference = (n.specials ?? {})[SPEC_GLOBAL_REF] !== undefined ||
|
|
1398
1417
|
(n.specials ?? {})[SPEC_APP_BLOCK_REF] !== undefined;
|
|
1418
|
+
// OR IT IS ITSELF THE PICTURE (or a fill): an empty block painting a photo, a gradient
|
|
1419
|
+
// scrim or a colour is a layer, not an empty band — the banner pattern above. Its fix
|
|
1420
|
+
// ("remove it with sb_remove") deleted the photo. Own paint only: a theme preset's
|
|
1421
|
+
// ground on an empty section is still an empty band.
|
|
1422
|
+
const paints = groundOf(n) !== null;
|
|
1399
1423
|
if (meta.isContainer &&
|
|
1400
1424
|
childrenOf(d, id).length === 0 &&
|
|
1425
|
+
!paints &&
|
|
1401
1426
|
!isReference &&
|
|
1402
1427
|
!drawsOwnControl &&
|
|
1403
1428
|
!(bindings.length > 0 && drawsItsOwnContent(type))) {
|
package/dist/mcp/strict.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import { ListToolsRequestSchema } from '@modelcontextprotocol/sdk/types.js';
|
|
2
3
|
/**
|
|
3
4
|
* AN ARGUMENT A TOOL DOES NOT TAKE IS REFUSED, NOT DROPPED.
|
|
4
5
|
*
|
|
@@ -17,3 +18,30 @@ export function refuseUnknownArgs(server) {
|
|
|
17
18
|
return register(name, { ...config, inputSchema: strict }, cb);
|
|
18
19
|
});
|
|
19
20
|
}
|
|
21
|
+
/**
|
|
22
|
+
* TOOLS/LIST CARRIES NOTHING THE SPEC ALREADY SAYS BY DEFAULT.
|
|
23
|
+
*
|
|
24
|
+
* The SDK stamps every inputSchema with `"$schema":"…draft-07…"` and every tool
|
|
25
|
+
* with `execution:{taskSupport:"forbidden"}` — the spec's own default when the
|
|
26
|
+
* key is absent. 42 tools × both was ~3,900 characters of every session's
|
|
27
|
+
* context buying nothing. Call before the first `registerTool`, which is when
|
|
28
|
+
* McpServer installs its `tools/list` handler.
|
|
29
|
+
*/
|
|
30
|
+
export function compactToolList(server) {
|
|
31
|
+
const inner = server.server;
|
|
32
|
+
const set = inner.setRequestHandler.bind(inner);
|
|
33
|
+
inner.setRequestHandler = ((schema, handler) => {
|
|
34
|
+
if (schema !== ListToolsRequestSchema)
|
|
35
|
+
return set(schema, handler);
|
|
36
|
+
return set(schema, (async (...a) => {
|
|
37
|
+
const res = (await handler(...a));
|
|
38
|
+
for (const t of res.tools) {
|
|
39
|
+
delete t.inputSchema?.$schema;
|
|
40
|
+
const ex = t.execution;
|
|
41
|
+
if (ex && (ex.taskSupport ?? 'forbidden') === 'forbidden' && Object.keys(ex).length <= 1)
|
|
42
|
+
delete t.execution;
|
|
43
|
+
}
|
|
44
|
+
return res;
|
|
45
|
+
}));
|
|
46
|
+
});
|
|
47
|
+
}
|
package/dist/server.js
CHANGED
|
@@ -24,7 +24,7 @@ import { registerUndoTools } from './tools/undo.js';
|
|
|
24
24
|
import { registerThemeTools } from './tools/theme.js';
|
|
25
25
|
import { registerTranslateTools } from './tools/translate.js';
|
|
26
26
|
import { serializeToolCalls } from './mcp/serial.js';
|
|
27
|
-
import { refuseUnknownArgs } from './mcp/strict.js';
|
|
27
|
+
import { compactToolList, refuseUnknownArgs } from './mcp/strict.js';
|
|
28
28
|
/**
|
|
29
29
|
* Sent on every handshake, so it is short, and says nothing a tool description
|
|
30
30
|
* already says. Counts come from the generated source records, never literals.
|
|
@@ -115,6 +115,7 @@ export function createServer(ctx = buildContext()) {
|
|
|
115
115
|
// mcp/serial.ts. Before the first registerTool, which installs tools/call.
|
|
116
116
|
serializeToolCalls(server, (name) => SESSION_FREE.has(name));
|
|
117
117
|
refuseUnknownArgs(server);
|
|
118
|
+
compactToolList(server);
|
|
118
119
|
registerSessionTools(server, ctx);
|
|
119
120
|
registerLoginTools(server, ctx, pkgVersion());
|
|
120
121
|
registerApiTools(server, ctx);
|
package/dist/tools/page.js
CHANGED
|
@@ -27,7 +27,7 @@ import { validateForSave } from '../domains/site/validate.js';
|
|
|
27
27
|
import { fallUp, formDocChecks, hiddenBand, sayChecks, specCheck, writeCheck } from '../domains/site/writecheck.js';
|
|
28
28
|
import { reviewDesign, REVIEW_NOTICE } from '../domains/site/review.js';
|
|
29
29
|
import { exampleCopy } from '../domains/site/examplecopy.js';
|
|
30
|
-
import { compactFindings } from '../domains/site/findings.js';
|
|
30
|
+
import { compactFindings, shareProblems } from '../domains/site/findings.js';
|
|
31
31
|
import { readinessGaps, READINESS_NOTICE, siteLanguage } from '../domains/site/readiness.js';
|
|
32
32
|
import { gatherReadiness } from '../domains/site/readiness-fetch.js';
|
|
33
33
|
import { globalWarning, restampPatches, RESPONSIVE_NOTICE, sharedWriteNotes } from '../domains/site/traps.js';
|
|
@@ -62,13 +62,17 @@ export function reviewField(ctx, doc, formTypes, pageType, formDocType, formRedi
|
|
|
62
62
|
// MAINTENANCE IS ADVICE, kept out of `findings`: it works for a visitor, so
|
|
63
63
|
// it must not stand between a page and its clean verdict. One `fixes` map
|
|
64
64
|
// serves both lists.
|
|
65
|
-
const
|
|
66
|
-
const
|
|
65
|
+
const compact = compactFindings(all.filter((f) => f.severity !== 'maintenance'));
|
|
66
|
+
const advised = compactFindings(all.filter((f) => f.severity === 'maintenance'));
|
|
67
|
+
const { findings, problems } = shareProblems(compact.findings);
|
|
68
|
+
const advice = shareProblems(advised.findings);
|
|
67
69
|
const notice = findings.length ? ctx.notices.once('review', REVIEW_NOTICE) : undefined;
|
|
70
|
+
const shared = { ...problems, ...advice.problems };
|
|
68
71
|
return {
|
|
69
72
|
...(findings.length ? { findings } : {}),
|
|
70
73
|
...(advice.findings.length ? { advice: advice.findings } : {}),
|
|
71
|
-
|
|
74
|
+
...(Object.keys(shared).length ? { problems: shared } : {}),
|
|
75
|
+
fixes: { ...compact.fixes, ...advised.fixes },
|
|
72
76
|
...(notice ? { findings_notice: notice } : {}),
|
|
73
77
|
};
|
|
74
78
|
}
|
|
@@ -2306,7 +2310,12 @@ export function registerPageTools(server, ctx) {
|
|
|
2306
2310
|
base: ctx.base,
|
|
2307
2311
|
method: 'POST',
|
|
2308
2312
|
path: `/api/sites/${encodeURIComponent(toSite)}/clipboard/reconcile`,
|
|
2309
|
-
|
|
2313
|
+
// THE ACCOUNT SESSION, never the key, even on the key's own site: the reconcile
|
|
2314
|
+
// reads the SOURCE site's assets, which only a person's membership vouches for.
|
|
2315
|
+
// The platform refuses a delegated (API-key) caller here (web_builder
|
|
2316
|
+
// sitecopy/rest, 2026-11-25); a key on the target used to pass because it
|
|
2317
|
+
// borrowed its creator's standing on every other site.
|
|
2318
|
+
token: ctx.session.loggedIn() ? ctx.session.token() : siteToken(ctx),
|
|
2310
2319
|
body: { sourceSiteId: from.siteId, tree },
|
|
2311
2320
|
fetchImpl: ctx.fetchImpl,
|
|
2312
2321
|
}));
|
|
@@ -2582,41 +2591,50 @@ export function registerPageTools(server, ctx) {
|
|
|
2582
2591
|
// in this server can tell a site that has them from one that does not.
|
|
2583
2592
|
// See ./inventory.ts: advice, matched by name, and the note says both.
|
|
2584
2593
|
const missing = missingUsualPages(raw.pages ?? null);
|
|
2594
|
+
// The type table and both notes are DIRECTIVES, not data about this site —
|
|
2595
|
+
// ~1,500 characters that rode on every listing. Said once per process
|
|
2596
|
+
// (ctx.notices); `usually_also` itself is data and stays on every call.
|
|
2597
|
+
const firstTypes = ctx.notices.once('page_list.types', '1') !== undefined;
|
|
2598
|
+
const firstUsual = missing.length > 0 && ctx.notices.once('page_list.usual', '1') !== undefined;
|
|
2585
2599
|
return text({
|
|
2586
2600
|
...projectList(raw, 'pages', PAGE_FIELDS),
|
|
2587
|
-
|
|
2588
|
-
|
|
2589
|
-
|
|
2590
|
-
|
|
2591
|
-
|
|
2592
|
-
|
|
2593
|
-
|
|
2594
|
-
|
|
2595
|
-
|
|
2596
|
-
|
|
2597
|
-
|
|
2598
|
-
t
|
|
2599
|
-
|
|
2600
|
-
|
|
2601
|
-
|
|
2602
|
-
|
|
2603
|
-
|
|
2604
|
-
|
|
2605
|
-
|
|
2606
|
-
|
|
2607
|
-
|
|
2608
|
-
|
|
2609
|
-
|
|
2610
|
-
'
|
|
2611
|
-
|
|
2612
|
-
|
|
2613
|
-
|
|
2601
|
+
...(firstTypes ? {
|
|
2602
|
+
// EVERY TYPE THE PLATFORM HAS, and the address each one answers at.
|
|
2603
|
+
//
|
|
2604
|
+
// Here rather than in `sb_page_create`'s argument description, because
|
|
2605
|
+
// that string rides in `tools/list` and the token budget caps it — the
|
|
2606
|
+
// table put the payload over twice while being trimmed. It is also the
|
|
2607
|
+
// better home: an agent reads this while ORIENTING, before it has
|
|
2608
|
+
// decided what to build, and a type it has never heard of is exactly
|
|
2609
|
+
// what it cannot ask for. `sb_page_create` used to name six of twelve
|
|
2610
|
+
// from a hand-typed string, so search, account, blog, complete, error
|
|
2611
|
+
// and maintain were unreachable to anyone who only read the tool.
|
|
2612
|
+
page_types: Object.fromEntries(PAGE_TYPES.map((t) => [
|
|
2613
|
+
t.type,
|
|
2614
|
+
t.routePattern ??
|
|
2615
|
+
(t.servedRole ? `served as the site's ${t.servedRole}` : 'an address you choose'),
|
|
2616
|
+
])),
|
|
2617
|
+
// NOT A LIST OF THE PAGES A SITE NEEDS, and this line is here because
|
|
2618
|
+
// the table above reads like one. A type is a fixed ADDRESS the
|
|
2619
|
+
// storefront routes by; most of a real website has no type at all —
|
|
2620
|
+
// login, register, contact, about, the policies, and whatever else this
|
|
2621
|
+
// particular shop sells or must say — and every one of those is an
|
|
2622
|
+
// ordinary `page`. Twelve is the number of routed types, never the
|
|
2623
|
+
// number of pages.
|
|
2624
|
+
page_types_note: 'Types with a pattern are the storefront\'s fixed addresses, not an inventory of a site. ' +
|
|
2625
|
+
'about, contact, policy, faq, login and register name a content page\'s PURPOSE (own ' +
|
|
2626
|
+
'icon, own slug, any number); everything else is type "page". sb_page_create picks ' +
|
|
2627
|
+
'the purpose type from the name when you pass none. ' +
|
|
2628
|
+
'usually_also below lists the ones most sites have; it is a floor, not a ceiling.',
|
|
2629
|
+
} : {}),
|
|
2614
2630
|
...(missing.length
|
|
2615
2631
|
? {
|
|
2616
2632
|
usually_also: Object.fromEntries(missing.map((m) => [m.key, m.why])),
|
|
2617
|
-
|
|
2618
|
-
'have
|
|
2619
|
-
|
|
2633
|
+
...(firstUsual ? {
|
|
2634
|
+
usually_also_note: 'Pages most sites have that this one appears not to, found by NAME because they ' +
|
|
2635
|
+
'have no type — one you named unusually will show here anyway. Advice, not ' +
|
|
2636
|
+
'defects: sb_review reports the pages the storefront routes by type.',
|
|
2637
|
+
} : {}),
|
|
2620
2638
|
}
|
|
2621
2639
|
: {}),
|
|
2622
2640
|
});
|
package/dist/tools/session.js
CHANGED
|
@@ -122,6 +122,31 @@ export async function connect(ctx, args) {
|
|
|
122
122
|
}
|
|
123
123
|
return result;
|
|
124
124
|
}
|
|
125
|
+
/**
|
|
126
|
+
* ONE SITE ROW, WITHOUT WHAT EVERY ROW REPEATS.
|
|
127
|
+
*
|
|
128
|
+
* The raw `GET /api/sites` row carries `effectivePermissions` — 54 strings, the
|
|
129
|
+
* same 54 on every site the caller owns — plus zero-value timestamps, redirect
|
|
130
|
+
* settings and a screenshot. Measured 2026-11-24: nine sites, ~12,000 characters,
|
|
131
|
+
* ~10,000 of them the permission list. An owner holds every permission, so the
|
|
132
|
+
* list is said only for a non-owner role, where it is the point. Flags that are
|
|
133
|
+
* false are left out; a `true` one (template, maintenance, building) changes what
|
|
134
|
+
* a caller should do with the site, so it stays.
|
|
135
|
+
*/
|
|
136
|
+
export function compactSite(s) {
|
|
137
|
+
const out = { id: s.id, name: s.name, slug: s.slug, url: s.publicUrl, role: s.role };
|
|
138
|
+
if (s.orgId)
|
|
139
|
+
out.org_id = s.orgId;
|
|
140
|
+
if (s.isTemplate)
|
|
141
|
+
out.template = s.templateName || true;
|
|
142
|
+
if (s.maintenanceMode)
|
|
143
|
+
out.maintenance = true;
|
|
144
|
+
if (s.building)
|
|
145
|
+
out.building = true;
|
|
146
|
+
if (s.role !== 'owner' && Array.isArray(s.effectivePermissions))
|
|
147
|
+
out.permissions = s.effectivePermissions;
|
|
148
|
+
return out;
|
|
149
|
+
}
|
|
125
150
|
export function registerSessionTools(server, ctx) {
|
|
126
151
|
server.registerTool('sb_connect', {
|
|
127
152
|
description: 'Call this first: what this install can reach, and the account\'s sites.',
|
|
@@ -153,12 +178,14 @@ export function registerSessionTools(server, ctx) {
|
|
|
153
178
|
throw new Error('sbuilder: no credential. Call sb_login (approve in the browser), or set SB_TOKEN to an ' +
|
|
154
179
|
'API key.');
|
|
155
180
|
}
|
|
156
|
-
|
|
181
|
+
const listed = (await request({
|
|
157
182
|
base: ctx.base,
|
|
158
183
|
method: 'GET',
|
|
159
184
|
path: '/api/sites',
|
|
160
185
|
token: ctx.session.token(),
|
|
161
186
|
fetchImpl: ctx.fetchImpl,
|
|
162
187
|
}));
|
|
188
|
+
const sites = (listed?.sites ?? []).map(compactSite);
|
|
189
|
+
return text({ sites, total: listed?.total ?? sites.length });
|
|
163
190
|
});
|
|
164
191
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sbuilder-mcp",
|
|
3
|
-
"version": "0.113.
|
|
3
|
+
"version": "0.113.2",
|
|
4
4
|
"description": "MCP server that designs and operates a Store Builder site — pages, data, theme and publish — through the platform's own API and live-edit protocol.",
|
|
5
5
|
"mcpName": "io.github.vuluu2k/sbuilder-mcp",
|
|
6
6
|
"type": "module",
|