@lalalic/markcut 3.2.11 → 3.2.12

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lalalic/markcut",
3
- "version": "3.2.11",
3
+ "version": "3.2.12",
4
4
  "description": "Markdown-to-video engine. Describe scenes in markdown, get a rendered video.",
5
5
  "bin": {
6
6
  "markcut": "bin/markcut"
@@ -5,6 +5,25 @@ import { buildPreviewBridgeScript } from "./bridge.mjs";
5
5
  export const TOOL_NAME = "markcut.preview";
6
6
  export const SUBMIT_TOOL_NAME = "markcut.preview.submit";
7
7
  export const RESOURCE_URI = "ui://markcut/markdown-preview-v2.html";
8
+ export const RESOURCE_MIME_TYPE = "text/html;profile=mcp-app";
9
+
10
+ export function buildPreviewResourceResult() {
11
+ return {
12
+ ttlMs: 0,
13
+ cacheScope: "private",
14
+ contents: [{
15
+ uri: RESOURCE_URI,
16
+ mimeType: RESOURCE_MIME_TYPE,
17
+ text: buildPreviewHtml({ path: "", markdown: "" }),
18
+ _meta: {
19
+ ui: {
20
+ prefersBorder: true,
21
+ csp: { connectDomains: [], resourceDomains: [] },
22
+ },
23
+ },
24
+ }],
25
+ };
26
+ }
8
27
 
9
28
  export function validateMarkdownPath(value) {
10
29
  if (typeof value !== "string" || !isAbsolute(value)) {
@@ -1,10 +1,10 @@
1
1
  #!/usr/bin/env node
2
2
  import { McpServer } from "@modelcontextprotocol/server";
3
3
  import { StdioServerTransport } from "@modelcontextprotocol/server/stdio";
4
- import { registerAppResource, registerAppTool, RESOURCE_MIME_TYPE } from "@modelcontextprotocol/ext-apps/server";
4
+ import { registerAppResource, registerAppTool } from "@modelcontextprotocol/ext-apps/server";
5
5
  import { z } from "zod";
6
6
  import {
7
- TOOL_NAME, SUBMIT_TOOL_NAME, RESOURCE_URI, buildPreviewHtml, readMarkdownPreview, reviewResult,
7
+ TOOL_NAME, SUBMIT_TOOL_NAME, RESOURCE_URI, buildPreviewResourceResult, readMarkdownPreview, reviewResult,
8
8
  } from "./preview.mjs";
9
9
 
10
10
  const server = new McpServer({ name: "markcut", version: "3.2.0" });
@@ -82,19 +82,7 @@ registerAppResource(
82
82
  },
83
83
  },
84
84
  },
85
- async () => ({
86
- contents: [{
87
- uri: RESOURCE_URI,
88
- mimeType: RESOURCE_MIME_TYPE,
89
- text: buildPreviewHtml({ path: "", markdown: "" }),
90
- _meta: {
91
- ui: {
92
- prefersBorder: true,
93
- csp: { connectDomains: [], resourceDomains: [] },
94
- },
95
- },
96
- }],
97
- }),
85
+ async () => buildPreviewResourceResult(),
98
86
  );
99
87
 
100
88
  await server.connect(new StdioServerTransport());
@@ -3,7 +3,16 @@ import { mkdtempSync, writeFileSync } from "node:fs";
3
3
  import { join } from "node:path";
4
4
  import { tmpdir } from "node:os";
5
5
  import vm from "node:vm";
6
- import { buildPreviewHtml, readMarkdownPreview, reviewMessage, reviewResult, validateMarkdownPath } from "../src/mcp/preview.mjs";
6
+ import {
7
+ buildPreviewHtml,
8
+ buildPreviewResourceResult,
9
+ readMarkdownPreview,
10
+ RESOURCE_MIME_TYPE,
11
+ RESOURCE_URI,
12
+ reviewMessage,
13
+ reviewResult,
14
+ validateMarkdownPath,
15
+ } from "../src/mcp/preview.mjs";
7
16
  import { buildPreviewBridgeScript } from "../src/mcp/bridge.mjs";
8
17
 
9
18
  describe("MarkCut MCP Markdown preview", () => {
@@ -29,6 +38,19 @@ describe("MarkCut MCP Markdown preview", () => {
29
38
  expect(html).toContain("review.md");
30
39
  });
31
40
 
41
+ it("returns Codex-compatible private no-cache resource metadata", () => {
42
+ const result = buildPreviewResourceResult();
43
+ expect(result.ttlMs).toBe(0);
44
+ expect(result.cacheScope).toBe("private");
45
+ expect(result.contents).toHaveLength(1);
46
+ expect(result.contents[0]).toMatchObject({
47
+ uri: RESOURCE_URI,
48
+ mimeType: RESOURCE_MIME_TYPE,
49
+ });
50
+ expect(result.contents[0].text).toContain("ui/initialize");
51
+ expect(result.contents[0].text).toContain("ui/notifications/initialized");
52
+ });
53
+
32
54
  it("returns approved", () => {
33
55
  expect(reviewResult("approved")).toEqual({ decision: "approved" });
34
56
  });