sbuilder-mcp 0.113.0 → 0.113.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -6,6 +6,18 @@ 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.1] - 2026-11-24
10
+
11
+ ### Changed
12
+ - `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.
13
+ - `sb_page_list` says the page-type table and its notes once per process, and keeps `pages` and `usually_also` on every call.
14
+ - 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.
15
+ - The `tools/list` response is smaller because the per-tool `$schema` and default `execution` stamps are no longer sent.
16
+
17
+ ### Fixed
18
+ - `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.
19
+ - `sb_review` no longer reports copy placed over an absolute picture child as `invisible_text` against the section's background.
20
+
9
21
  ## [0.113.0] - 2026-11-23
10
22
 
11
23
  ### Added
package/CHANGELOG.vi.md CHANGED
@@ -6,6 +6,18 @@ 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.1] - 2026-11-24
10
+
11
+ ### Changed
12
+ - `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ữ.
13
+ - `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.
14
+ - 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.
15
+ - 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.
16
+
17
+ ### Fixed
18
+ - `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.
19
+ - `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.
20
+
9
21
  ## [0.113.0] - 2026-11-23
10
22
 
11
23
  ### 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 = groundOf(d.nodes[x], opts.theme);
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))) {
@@ -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);
@@ -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 { findings, fixes } = compactFindings(all.filter((f) => f.severity !== 'maintenance'));
66
- const advice = compactFindings(all.filter((f) => f.severity === 'maintenance'));
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
- fixes: { ...fixes, ...advice.fixes },
74
+ ...(Object.keys(shared).length ? { problems: shared } : {}),
75
+ fixes: { ...compact.fixes, ...advised.fixes },
72
76
  ...(notice ? { findings_notice: notice } : {}),
73
77
  };
74
78
  }
@@ -2582,41 +2586,50 @@ export function registerPageTools(server, ctx) {
2582
2586
  // in this server can tell a site that has them from one that does not.
2583
2587
  // See ./inventory.ts: advice, matched by name, and the note says both.
2584
2588
  const missing = missingUsualPages(raw.pages ?? null);
2589
+ // The type table and both notes are DIRECTIVES, not data about this site —
2590
+ // ~1,500 characters that rode on every listing. Said once per process
2591
+ // (ctx.notices); `usually_also` itself is data and stays on every call.
2592
+ const firstTypes = ctx.notices.once('page_list.types', '1') !== undefined;
2593
+ const firstUsual = missing.length > 0 && ctx.notices.once('page_list.usual', '1') !== undefined;
2585
2594
  return text({
2586
2595
  ...projectList(raw, 'pages', PAGE_FIELDS),
2587
- // EVERY TYPE THE PLATFORM HAS, and the address each one answers at.
2588
- //
2589
- // Here rather than in `sb_page_create`'s argument description, because
2590
- // that string rides in `tools/list` and the token budget caps it — the
2591
- // table put the payload over twice while being trimmed. It is also the
2592
- // better home: an agent reads this while ORIENTING, before it has
2593
- // decided what to build, and a type it has never heard of is exactly
2594
- // what it cannot ask for. `sb_page_create` used to name six of twelve
2595
- // from a hand-typed string, so search, account, blog, complete, error
2596
- // and maintain were unreachable to anyone who only read the tool.
2597
- page_types: Object.fromEntries(PAGE_TYPES.map((t) => [
2598
- t.type,
2599
- t.routePattern ??
2600
- (t.servedRole ? `served as the site's ${t.servedRole}` : 'an address you choose'),
2601
- ])),
2602
- // NOT A LIST OF THE PAGES A SITE NEEDS, and this line is here because
2603
- // the table above reads like one. A type is a fixed ADDRESS the
2604
- // storefront routes by; most of a real website has no type at all —
2605
- // login, register, contact, about, the policies, and whatever else this
2606
- // particular shop sells or must say — and every one of those is an
2607
- // ordinary `page`. Twelve is the number of routed types, never the
2608
- // number of pages.
2609
- page_types_note: 'Types with a pattern are the storefront\'s fixed addresses, not an inventory of a site. ' +
2610
- 'about, contact, policy, faq, login and register name a content page\'s PURPOSE (own ' +
2611
- 'icon, own slug, any number); everything else is type "page". sb_page_create picks ' +
2612
- 'the purpose type from the name when you pass none. ' +
2613
- 'usually_also below lists the ones most sites have; it is a floor, not a ceiling.',
2596
+ ...(firstTypes ? {
2597
+ // EVERY TYPE THE PLATFORM HAS, and the address each one answers at.
2598
+ //
2599
+ // Here rather than in `sb_page_create`'s argument description, because
2600
+ // that string rides in `tools/list` and the token budget caps it — the
2601
+ // table put the payload over twice while being trimmed. It is also the
2602
+ // better home: an agent reads this while ORIENTING, before it has
2603
+ // decided what to build, and a type it has never heard of is exactly
2604
+ // what it cannot ask for. `sb_page_create` used to name six of twelve
2605
+ // from a hand-typed string, so search, account, blog, complete, error
2606
+ // and maintain were unreachable to anyone who only read the tool.
2607
+ page_types: Object.fromEntries(PAGE_TYPES.map((t) => [
2608
+ t.type,
2609
+ t.routePattern ??
2610
+ (t.servedRole ? `served as the site's ${t.servedRole}` : 'an address you choose'),
2611
+ ])),
2612
+ // NOT A LIST OF THE PAGES A SITE NEEDS, and this line is here because
2613
+ // the table above reads like one. A type is a fixed ADDRESS the
2614
+ // storefront routes by; most of a real website has no type at all —
2615
+ // login, register, contact, about, the policies, and whatever else this
2616
+ // particular shop sells or must say — and every one of those is an
2617
+ // ordinary `page`. Twelve is the number of routed types, never the
2618
+ // number of pages.
2619
+ page_types_note: 'Types with a pattern are the storefront\'s fixed addresses, not an inventory of a site. ' +
2620
+ 'about, contact, policy, faq, login and register name a content page\'s PURPOSE (own ' +
2621
+ 'icon, own slug, any number); everything else is type "page". sb_page_create picks ' +
2622
+ 'the purpose type from the name when you pass none. ' +
2623
+ 'usually_also below lists the ones most sites have; it is a floor, not a ceiling.',
2624
+ } : {}),
2614
2625
  ...(missing.length
2615
2626
  ? {
2616
2627
  usually_also: Object.fromEntries(missing.map((m) => [m.key, m.why])),
2617
- usually_also_note: 'Pages most sites have that this one appears not to, found by NAME because they ' +
2618
- 'have no type — one you named unusually will show here anyway. Advice, not ' +
2619
- 'defects: sb_review reports the pages the storefront routes by type.',
2628
+ ...(firstUsual ? {
2629
+ usually_also_note: 'Pages most sites have that this one appears not to, found by NAME because they ' +
2630
+ 'have no type — one you named unusually will show here anyway. Advice, not ' +
2631
+ 'defects: sb_review reports the pages the storefront routes by type.',
2632
+ } : {}),
2620
2633
  }
2621
2634
  : {}),
2622
2635
  });
@@ -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
- return text(await request({
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.0",
3
+ "version": "0.113.1",
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",