@perkyzz/emvb-mcp 0.8.0 → 0.9.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.
Files changed (2) hide show
  1. package/dist/cli.mjs +85 -43
  2. package/package.json +4 -4
package/dist/cli.mjs CHANGED
@@ -7635,6 +7635,9 @@ var PaginationNode = leafNode("pagination", strictObject({
7635
7635
  nextText: string2().max(40).optional(),
7636
7636
  showCount: boolean2().optional(),
7637
7637
  countText: string2().max(60).optional(),
7638
+ showLast: boolean2().optional(),
7639
+ lastText: string2().max(40).optional(),
7640
+ lastLabel: string2().max(60).optional(),
7638
7641
  titleText: string2().max(60).optional(),
7639
7642
  archiveTitle: string2().max(60).optional(),
7640
7643
  navLabel: string2().max(60).optional(),
@@ -9164,8 +9167,16 @@ var pagination = {
9164
9167
  kind: "text",
9165
9168
  label: "Count text",
9166
9169
  optional: true,
9167
- message: `{page} and {total} are filled in. EmDash 1.2 doesn't report a total, so the count shows "Page N" until it does.`
9170
+ message: `{page} and {total} are filled in. EmDash doesn't report a total, so the count shows "Page N" unless the site turns on page counting.`
9168
9171
  },
9172
+ {
9173
+ key: "showLast",
9174
+ kind: "boolean",
9175
+ label: "Show Last link",
9176
+ optional: true,
9177
+ message: "Links to the last page when the site counts pages; otherwise it's left out."
9178
+ },
9179
+ { key: "lastText", kind: "text", label: "Last text", optional: true },
9169
9180
  {
9170
9181
  key: "titleText",
9171
9182
  kind: "text",
@@ -9207,6 +9218,13 @@ var pagination = {
9207
9218
  label: "Next name",
9208
9219
  optional: true,
9209
9220
  message: 'Read out when Next text is only an arrow. Unset is "Next page".'
9221
+ },
9222
+ {
9223
+ key: "lastLabel",
9224
+ kind: "text",
9225
+ label: "Last name",
9226
+ optional: true,
9227
+ message: 'Read out when Last text is only an arrow. Unset is "Last page".'
9210
9228
  }
9211
9229
  ]
9212
9230
  },
@@ -12710,6 +12728,8 @@ function recipeNode(id, design, layout, random = Math.random) {
12710
12728
  }
12711
12729
  // ../emvb/src/core/share/link.ts
12712
12730
  var MAX_UNPACKED_BYTES = MAX_LAYOUT_BYTES + MAX_DESIGN_BYTES + 4096;
12731
+ // ../emvb/src/core/canvas-collections.ts
12732
+ var OWN = new Set(["emvb_pages", "emvb_theme_parts"]);
12713
12733
  // ../emvb/src/core/saved-sections.ts
12714
12734
  var SAVED_SECTION_VERSION = 1;
12715
12735
  var SAVED_SECTION_NAME_MAX = 60;
@@ -12844,6 +12864,8 @@ function classMergeNotice(merge) {
12844
12864
  }
12845
12865
  return parts.length > 0 ? `Classes: ${parts.join("; ")}.` : null;
12846
12866
  }
12867
+ // ../emvb/src/core/portable-text.ts
12868
+ var IMAGE_SCHEMES = new Set(["https:", "http:"]);
12847
12869
  // ../emvb/src/mcp/errors.ts
12848
12870
  var STATUS = {
12849
12871
  INVALID_INPUT: 400,
@@ -14385,8 +14407,66 @@ var PROMPTS = [
14385
14407
  text: (a) => `Review page ${q(a["pageId"])} without editing it: call describe_page (sections, heading outline, images with their alt text) and get_accessibility_findings, and get_layout when you need styles or ids. Then write a short review covering structure, copy, images and alt text, accessibility, and consistency with the site styles, with the element ids for each suggestion.`
14386
14408
  }
14387
14409
  ];
14410
+ // src/remote.ts
14411
+ import { Client, StreamableHTTPClientTransport } from "@modelcontextprotocol/client";
14412
+ function redactToken(error, token) {
14413
+ if (!token || !(error instanceof Error) || !error.message.includes(token))
14414
+ return error;
14415
+ const clean = new Error(error.message.split(token).join("[token]"));
14416
+ clean.name = error.name;
14417
+ return clean;
14418
+ }
14419
+ var CALL_TIMEOUT_MS = 60000;
14420
+ var CONNECT_RETRY_DELAYS_MS = [250, 1000];
14421
+ function isRetryableConnectError(error) {
14422
+ const message = error instanceof Error ? error.message : String(error);
14423
+ return !/40[13]|unauthori[sz]ed|forbidden|invalid[_ ](or expired )?token|expired token|scope/i.test(message);
14424
+ }
14425
+ async function connectWithRetry(attempt, sleep = (ms) => new Promise((r) => setTimeout(r, ms)), delays = CONNECT_RETRY_DELAYS_MS) {
14426
+ try {
14427
+ return await attempt();
14428
+ } catch (error) {
14429
+ const [wait, ...rest] = delays;
14430
+ if (wait === undefined || !isRetryableConnectError(error))
14431
+ throw error;
14432
+ await sleep(wait);
14433
+ return connectWithRetry(attempt, sleep, rest);
14434
+ }
14435
+ }
14436
+ function httpRemote(endpoint, token, version) {
14437
+ let connected = null;
14438
+ const connect = () => {
14439
+ connected ??= connectWithRetry(async () => {
14440
+ const client = new Client({ name: "emvb-mcp", version });
14441
+ const transport = new StreamableHTTPClientTransport(endpoint, {
14442
+ requestInit: { headers: { authorization: `Bearer ${token}` } }
14443
+ });
14444
+ await client.connect(transport, { timeout: CALL_TIMEOUT_MS });
14445
+ return client;
14446
+ }).catch((error) => {
14447
+ connected = null;
14448
+ throw error;
14449
+ });
14450
+ return connected;
14451
+ };
14452
+ return {
14453
+ async call(name, args) {
14454
+ try {
14455
+ const client = await connect();
14456
+ return await client.callTool({ name, arguments: args }, { timeout: CALL_TIMEOUT_MS });
14457
+ } catch (error) {
14458
+ throw redactToken(error, token);
14459
+ }
14460
+ },
14461
+ async close() {
14462
+ if (connected)
14463
+ await (await connected).close();
14464
+ }
14465
+ };
14466
+ }
14467
+
14388
14468
  // src/bridge.ts
14389
- var BRIDGE_VERSION = "0.8.0";
14469
+ var BRIDGE_VERSION = "0.9.0";
14390
14470
  var failure = (message) => ({
14391
14471
  content: [{ type: "text", text: message }],
14392
14472
  isError: true
@@ -14402,6 +14482,9 @@ function explain(error, tool) {
14402
14482
  if (/not found|unknown tool/i.test(message)) {
14403
14483
  return failure(`The site doesn't offer emvb__${tool}. Check that EmDash's MCP is on (mcp: true, EmDash 1.2+) and that an admin approved the EmVB tools.`);
14404
14484
  }
14485
+ if (/timed out|timeout/i.test(message)) {
14486
+ return failure(`The site didn't answer within ${CALL_TIMEOUT_MS / 1000} s. It may be down or slow; try again.`);
14487
+ }
14405
14488
  return failure(`Couldn't reach the site: ${message}`);
14406
14489
  }
14407
14490
  function createBridgeServer(options) {
@@ -14490,47 +14573,6 @@ function registerPrompts(server) {
14490
14573
  }
14491
14574
  }
14492
14575
 
14493
- // src/remote.ts
14494
- import { Client, StreamableHTTPClientTransport } from "@modelcontextprotocol/client";
14495
- function redactToken(error, token) {
14496
- if (!token || !(error instanceof Error) || !error.message.includes(token))
14497
- return error;
14498
- const clean = new Error(error.message.split(token).join("[token]"));
14499
- clean.name = error.name;
14500
- return clean;
14501
- }
14502
- function httpRemote(endpoint, token, version) {
14503
- let connected = null;
14504
- const connect = () => {
14505
- connected ??= (async () => {
14506
- const client = new Client({ name: "emvb-mcp", version });
14507
- const transport = new StreamableHTTPClientTransport(endpoint, {
14508
- requestInit: { headers: { authorization: `Bearer ${token}` } }
14509
- });
14510
- await client.connect(transport);
14511
- return client;
14512
- })().catch((error) => {
14513
- connected = null;
14514
- throw error;
14515
- });
14516
- return connected;
14517
- };
14518
- return {
14519
- async call(name, args) {
14520
- try {
14521
- const client = await connect();
14522
- return await client.callTool({ name, arguments: args });
14523
- } catch (error) {
14524
- throw redactToken(error, token);
14525
- }
14526
- },
14527
- async close() {
14528
- if (connected)
14529
- await (await connected).close();
14530
- }
14531
- };
14532
- }
14533
-
14534
14576
  // src/cli.ts
14535
14577
  var log = (message) => process.stderr.write(`[emvb-mcp] ${message}
14536
14578
  `);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@perkyzz/emvb-mcp",
3
- "version": "0.8.0",
3
+ "version": "0.9.0",
4
4
  "description": "Local (stdio) MCP server for EmVB pages: lets AI agents build EmDash pages through your site's EmDash MCP endpoint.",
5
5
  "keywords": [
6
6
  "emdash",
@@ -37,11 +37,11 @@
37
37
  "prepack": "bun run build"
38
38
  },
39
39
  "dependencies": {
40
- "@modelcontextprotocol/client": "2.3.1",
41
- "@modelcontextprotocol/server": "2.3.1"
40
+ "@modelcontextprotocol/client": "2.4.0",
41
+ "@modelcontextprotocol/server": "2.4.0"
42
42
  },
43
43
  "devDependencies": {
44
- "@perkyzz/emvb": "0.8.0",
44
+ "@perkyzz/emvb": "0.9.0",
45
45
  "zod": "~4.5.4"
46
46
  },
47
47
  "engines": {