@clipform/mcp-server 4.10.4 → 4.10.6

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.
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  FULL_CAPS,
3
3
  getSessionContext
4
- } from "./chunk-CB6GJKIE.js";
4
+ } from "./chunk-ZQNMSNWA.js";
5
5
  import {
6
6
  ALL_VARIANTS,
7
7
  FORM_TYPES,
8
8
  FORM_TYPE_KEYS,
9
9
  callApi
10
- } from "./chunk-B537GXNT.js";
10
+ } from "./chunk-GQQ3LUAC.js";
11
11
  import {
12
12
  getMcpAuth
13
13
  } from "./chunk-ENVV65JX.js";
@@ -67,15 +67,6 @@ function applyCapsToGuide(text, caps) {
67
67
  // src/resources.ts
68
68
  var GUIDE_TYPES = FORM_TYPE_KEYS;
69
69
  var QUIZ_VARIANTS = ALL_VARIANTS;
70
- var GUIDE_DESCRIPTIONS = {
71
- "quiz": "Craft knowledge for writing engaging quizzes - difficulty curves, question psychology, narration style, scoring",
72
- "survey": "Craft knowledge for feedback surveys, NPS, and research forms - brevity, rating scales, respondent fatigue",
73
- "interview": "Craft knowledge for building interview forms - warm-up pacing, open questions, consent, video responses",
74
- "funnel": "Craft knowledge for lead qualification funnels - planned feature, conditional routing coming soon",
75
- "testimonial": "Craft knowledge for collecting testimonials and customer stories on video - storytelling prompts, comfort techniques, consent",
76
- "application": "Craft knowledge for application and evaluation forms - multi-section structure, video responses for behavioural questions, screening",
77
- "booking": "Craft knowledge for event registration and booking forms - minimal friction, video welcome, confirmation flow"
78
- };
79
70
  var QUIZ_VARIANT_DESCRIPTIONS = FORM_TYPES.quiz.variant_descriptions;
80
71
  function getGuideUri(type, variant) {
81
72
  if (type === "quiz" && variant) {
@@ -87,12 +78,12 @@ async function readGuide(uri, caps) {
87
78
  return applyCapsToGuide(await fetchGuideText(uri) ?? guideFallbackText(uri), caps);
88
79
  }
89
80
  function registerResources(server, caps = FULL_CAPS) {
90
- for (const type of GUIDE_TYPES) {
81
+ for (const type of FORM_TYPE_KEYS) {
91
82
  server.registerResource(
92
83
  `guide-${type}`,
93
84
  getGuideUri(type),
94
85
  {
95
- description: GUIDE_DESCRIPTIONS[type],
86
+ description: FORM_TYPES[type].guide_description,
96
87
  mimeType: "text/markdown",
97
88
  annotations: { audience: ["assistant"], priority: 0.8 }
98
89
  },
@@ -155,4 +146,4 @@ export {
155
146
  getGuideUri,
156
147
  registerResources
157
148
  };
158
- //# sourceMappingURL=chunk-BXLWHTT4.js.map
149
+ //# sourceMappingURL=chunk-CVYFKBBY.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/lib/guides.ts","../src/resources.ts"],"sourcesContent":["import { callApi } from \"./api-client.js\";\nimport { getMcpAuth } from \"./auth-context.js\";\nimport type { ServerCaps } from \"./caps.js\";\n\n/**\n * Craft guide bodies live server-side (#470) - the npm package is a shim\n * that fetches them at runtime instead of bundling them in the tarball.\n * One fetch per process (all ~30KB of guides in a single response), cached;\n * a failed fetch is NOT cached so the next read retries.\n */\n\nexport interface RemoteGuide {\n type: string;\n variant: string | null;\n uri: string;\n mimeType: string;\n text: string;\n}\n\nlet guidesPromise: Promise<Map<string, RemoteGuide>> | null = null;\n\nasync function loadGuides(): Promise<Map<string, RemoteGuide>> {\n // #4657: the anonymous no-workspace lane serves the static guides in-process.\n const loader = getMcpAuth()?.loadInternalContent;\n let data: Record<string, unknown>;\n if (loader) {\n data = await loader(\"guides\");\n } else {\n const result = await callApi(\"/internal/mcp/guides\", { method: \"GET\" });\n if (!result.ok) {\n throw new Error(`Failed to load guides: ${result.error}`);\n }\n data = result.data;\n }\n const guides = (data as { guides?: RemoteGuide[] }).guides ?? [];\n return new Map(guides.map((g) => [g.uri, g]));\n}\n\n/** Fetch a guide body by its clipform:// URI. Returns null when unavailable. */\nexport async function fetchGuideText(uri: string): Promise<string | null> {\n if (!guidesPromise) {\n guidesPromise = loadGuides();\n }\n try {\n const guides = await guidesPromise;\n return guides.get(uri)?.text ?? null;\n } catch (err) {\n guidesPromise = null; // don't cache failures - retry on the next read\n // Loud, not silent: a misconfigured API_URL/key otherwise degrades every\n // guide to the stub with nothing in the logs.\n console.error(`[guides] Failed to fetch ${uri}: ${err instanceof Error ? err.message : String(err)}`);\n return null;\n }\n}\n\n/** Shown in place of a guide when the API is unreachable or unauthenticated. */\nexport function guideFallbackText(uri: string): string {\n return [\n `# Guide unavailable`,\n ``,\n `The craft guide (${uri}) could not be loaded from the Clipform API.`,\n `Guides are served at runtime and need a reachable API with a valid key -`,\n `check API_URL and CLIPFORM_API_KEY, then try again.`,\n ``,\n `General principles in the meantime: write narration for the ear (short,`,\n `conversational), never reveal answers in narration or media, and keep`,\n `forms tight - every question must earn its place.`,\n ].join(\"\\n\");\n}\n\n/**\n * Craft guide bodies are written for the full tool surface and mention the\n * narration/video tools by name. On a surface that doesn't register them\n * (the Claude Connectors Directory resource, #3681) prefix the guide with a\n * note so the model doesn't chase tools it can't call. The body itself is\n * untouched - the craft (question design, pacing) is the same either way.\n */\nexport function applyCapsToGuide(text: string, caps: ServerCaps): string {\n if (caps.media) return text;\n return [\n \"> **This connection exposes form-building tools only** - no narration, video, image, or music tools. Where this guide mentions narration, media, or rendering, skip that part and carry the same craft into the written question text.\",\n \"\",\n text,\n ].join(\"\\n\");\n}\n","import { McpServer } from \"@modelcontextprotocol/server\";\nimport { getSessionContext } from \"./lib/session-context.js\";\nimport { FORM_TYPE_KEYS, FORM_TYPES, ALL_VARIANTS } from \"@vid-master/config\";\n\nexport const GUIDE_TYPES = FORM_TYPE_KEYS as readonly string[] as readonly [string, ...string[]];\nexport type GuideType = (typeof FORM_TYPE_KEYS)[number];\n\nexport const QUIZ_VARIANTS = ALL_VARIANTS as readonly string[] as readonly [string, ...string[]];\nexport type QuizVariant = (typeof ALL_VARIANTS)[number];\n// Guide BODIES are not bundled here (#470): the npm tarball ships only this\n// registration metadata. Text is fetched from the API at runtime - see\n// lib/guides.ts (cached per process, stub fallback when unreachable).\nimport { fetchGuideText, guideFallbackText, applyCapsToGuide } from \"./lib/guides.js\";\nimport { FULL_CAPS, type ServerCaps } from \"./lib/caps.js\";\n\n// Sourced from config (single source of truth) so the agent-facing resource\n// descriptions can't drift from FORM_TYPES.quiz.variant_descriptions (#2534,\n// the exact pair packages/config/CLAUDE.md warns about).\nconst QUIZ_VARIANT_DESCRIPTIONS = FORM_TYPES.quiz.variant_descriptions;\n\nexport function getGuideUri(type: GuideType, variant?: QuizVariant): string {\n if (type === \"quiz\" && variant) {\n return `clipform://guides/quiz/${variant}`;\n }\n return `clipform://guides/${type}`;\n}\n\nasync function readGuide(uri: string, caps: ServerCaps): Promise<string> {\n return applyCapsToGuide((await fetchGuideText(uri)) ?? guideFallbackText(uri), caps);\n}\n\nexport function registerResources(server: McpServer, caps: ServerCaps = FULL_CAPS) {\n for (const type of FORM_TYPE_KEYS) {\n server.registerResource(\n `guide-${type}`,\n getGuideUri(type),\n {\n description: FORM_TYPES[type].guide_description,\n mimeType: \"text/markdown\",\n annotations: { audience: [\"assistant\" as const], priority: 0.8 },\n },\n async () => ({\n contents: [{\n uri: getGuideUri(type),\n mimeType: \"text/markdown\",\n text: await readGuide(getGuideUri(type), caps),\n }],\n }),\n );\n }\n\n for (const variant of QUIZ_VARIANTS) {\n server.registerResource(\n `guide-quiz-${variant}`,\n getGuideUri(\"quiz\", variant),\n {\n description: QUIZ_VARIANT_DESCRIPTIONS[variant],\n mimeType: \"text/markdown\",\n annotations: { audience: [\"assistant\" as const], priority: 0.8 },\n },\n async () => ({\n contents: [{\n uri: getGuideUri(\"quiz\", variant),\n mimeType: \"text/markdown\",\n text: await readGuide(getGuideUri(\"quiz\", variant), caps),\n }],\n }),\n );\n }\n\n server.registerResource(\n \"context-session\",\n \"clipform://context/session\",\n {\n description:\n \"Current session info: auth mode, workspace name, plan name, and node/form limits. Read this before planning content to know your constraints.\",\n mimeType: \"text/markdown\",\n annotations: { audience: [\"assistant\"], priority: 1.0 },\n },\n async () => {\n const text = await getSessionContext();\n return {\n contents: [\n {\n uri: \"clipform://context/session\",\n mimeType: \"text/markdown\",\n text: text || \"Session context unavailable - API may not be reachable.\",\n },\n ],\n };\n }\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;AAmBA,IAAI,gBAA0D;AAE9D,eAAe,aAAgD;AAE7D,QAAM,SAAS,WAAW,GAAG;AAC7B,MAAI;AACJ,MAAI,QAAQ;AACV,WAAO,MAAM,OAAO,QAAQ;AAAA,EAC9B,OAAO;AACL,UAAM,SAAS,MAAM,QAAQ,wBAAwB,EAAE,QAAQ,MAAM,CAAC;AACtE,QAAI,CAAC,OAAO,IAAI;AACd,YAAM,IAAI,MAAM,0BAA0B,OAAO,KAAK,EAAE;AAAA,IAC1D;AACA,WAAO,OAAO;AAAA,EAChB;AACA,QAAM,SAAU,KAAoC,UAAU,CAAC;AAC/D,SAAO,IAAI,IAAI,OAAO,IAAI,CAAC,MAAM,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC;AAC9C;AAGA,eAAsB,eAAe,KAAqC;AACxE,MAAI,CAAC,eAAe;AAClB,oBAAgB,WAAW;AAAA,EAC7B;AACA,MAAI;AACF,UAAM,SAAS,MAAM;AACrB,WAAO,OAAO,IAAI,GAAG,GAAG,QAAQ;AAAA,EAClC,SAAS,KAAK;AACZ,oBAAgB;AAGhB,YAAQ,MAAM,4BAA4B,GAAG,KAAK,eAAe,QAAQ,IAAI,UAAU,OAAO,GAAG,CAAC,EAAE;AACpG,WAAO;AAAA,EACT;AACF;AAGO,SAAS,kBAAkB,KAAqB;AACrD,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA,oBAAoB,GAAG;AAAA,IACvB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,EAAE,KAAK,IAAI;AACb;AASO,SAAS,iBAAiB,MAAc,MAA0B;AACvE,MAAI,KAAK,MAAO,QAAO;AACvB,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAA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A,EACF;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,MACE,aACE;AAAA,MACF,UAAU;AAAA,MACV,aAAa,EAAE,UAAU,CAAC,WAAW,GAAG,UAAU,EAAI;AAAA,IACxD;AAAA,IACA,YAAY;AACV,YAAM,OAAO,MAAM,kBAAkB;AACrC,aAAO;AAAA,QACL,UAAU;AAAA,UACR;AAAA,YACE,KAAK;AAAA,YACL,UAAU;AAAA,YACV,MAAM,QAAQ;AAAA,UAChB;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;","names":[]}
@@ -29,7 +29,7 @@ import {
29
29
  union,
30
30
  unknown,
31
31
  url
32
- } from "./chunk-FMGNRBCL.js";
32
+ } from "./chunk-AAULLE63.js";
33
33
  import {
34
34
  GUIDE_TYPES,
35
35
  QUIZ_VARIANTS,
@@ -38,7 +38,7 @@ import {
38
38
  getGuideUri,
39
39
  guideFallbackText,
40
40
  registerResources
41
- } from "./chunk-BXLWHTT4.js";
41
+ } from "./chunk-CVYFKBBY.js";
42
42
  import {
43
43
  ANON_PREVIEW_LINK_LABEL,
44
44
  ANON_PREVIEW_NOTICE,
@@ -52,7 +52,7 @@ import {
52
52
  isPreviewViewerUrl,
53
53
  previewOnlyNotice,
54
54
  withAdoptedNotice
55
- } from "./chunk-CB6GJKIE.js";
55
+ } from "./chunk-ZQNMSNWA.js";
56
56
  import {
57
57
  ACTIVE_NODE_TYPES,
58
58
  ANON_MCP_BLOCKED_NODE_TYPES,
@@ -81,7 +81,7 @@ import {
81
81
  stripGatedConfigKeys,
82
82
  structuredResult,
83
83
  textResult
84
- } from "./chunk-B537GXNT.js";
84
+ } from "./chunk-GQQ3LUAC.js";
85
85
  import {
86
86
  getMcpAuth,
87
87
  runWithMcpAuth,
@@ -20427,4 +20427,4 @@ export {
20427
20427
  * MIT Licensed
20428
20428
  *)
20429
20429
  */
20430
- //# sourceMappingURL=chunk-7YMFQZB3.js.map
20430
+ //# sourceMappingURL=chunk-GQA6MFO7.js.map
@@ -1314,9 +1314,11 @@ var NODE_TYPES = {
1314
1314
  is_terminal: false,
1315
1315
  show_nav_bar: true,
1316
1316
  loading: "lazy",
1317
- supports_prompt: true,
1317
+ // Like Payment: no generic prompt; the heading + description are config title/description
1318
+ // (NodeHeadingFields in the builder, shown above the scheduler in the viewer).
1319
+ supports_prompt: false,
1318
1320
  supports_media: false,
1319
- // The interaction takes the stage height under the prompt (an inline embed).
1321
+ // The interaction takes the stage height under the heading + description (an inline embed).
1320
1322
  interaction_fills_stage: true,
1321
1323
  is_system: false,
1322
1324
  show_in_results: true,
@@ -1344,6 +1346,8 @@ var NODE_TYPES = {
1344
1346
  properties: {
1345
1347
  provider: { type: "string", enum: BOOKING_PROVIDERS, label: "Provider", description: "Scheduling provider (one per node)" },
1346
1348
  workspace_integration_id: { type: "string", description: "Connected workspace integration (calendar account) this booking uses" },
1349
+ title: { type: "string", label: "Heading", maxLength: 80, description: "Heading shown above the scheduler", anon_locked_keep: true },
1350
+ description: { type: "string", label: "Description", maxLength: 140, description: "Body text shown below the heading", anon_locked_keep: true },
1347
1351
  allow_skip: { type: "boolean", feature: "optional_questions", default: false, label: "Optional", description: "Let respondents continue without booking" },
1348
1352
  calendly: {
1349
1353
  type: "object",
@@ -3756,4 +3760,4 @@ export {
3756
3760
  textResult,
3757
3761
  structuredResult
3758
3762
  };
3759
- //# sourceMappingURL=chunk-B537GXNT.js.map
3763
+ //# sourceMappingURL=chunk-GQQ3LUAC.js.map