@clipform/mcp-server 3.2.1 → 3.3.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.
@@ -3,7 +3,7 @@ import {
3
3
  WORKFLOW_TYPES,
4
4
  getDiscoveryParams,
5
5
  getSessionContextWithAuth
6
- } from "./chunk-VZKMOMFJ.js";
6
+ } from "./chunk-SEZ37YSH.js";
7
7
  import {
8
8
  __export
9
9
  } from "./chunk-G3PMV62Z.js";
@@ -4856,4 +4856,4 @@ export {
4856
4856
  getWorkflowText,
4857
4857
  registerPrompts
4858
4858
  };
4859
- //# sourceMappingURL=chunk-EQ6WNIA5.js.map
4859
+ //# sourceMappingURL=chunk-22BV4NSB.js.map
@@ -6,7 +6,7 @@ import {
6
6
  getWorkflowText,
7
7
  objectType,
8
8
  registerPrompts
9
- } from "./chunk-EQ6WNIA5.js";
9
+ } from "./chunk-22BV4NSB.js";
10
10
  import {
11
11
  GUIDE_TYPES,
12
12
  QUIZ_VARIANTS,
@@ -15,27 +15,31 @@ import {
15
15
  getGuideUri,
16
16
  guideFallbackText,
17
17
  registerResources
18
- } from "./chunk-236IGTEY.js";
18
+ } from "./chunk-ELK26KWM.js";
19
19
  import {
20
20
  ACTIVE_NODE_TYPES,
21
21
  CONTACT_FIELDS,
22
22
  FEATURE_FLAGS,
23
23
  FORM_TYPE_ALIASES,
24
24
  FULL_CAPS,
25
+ MCP_ANON_PUBLISH_GATE,
26
+ MCP_TOOL_SECURITY,
25
27
  MCP_TOOL_TIERS,
26
28
  MCP_TOOL_TOOLSETS,
27
29
  NODE_TYPES,
28
30
  NON_COUNTABLE_TYPES,
31
+ authChallengeMeta,
29
32
  bfsOrder,
30
33
  callApi,
31
34
  capsFromToolsets,
32
35
  defaultTarget,
33
36
  errorResult,
34
37
  exposedCompositionIds,
38
+ isAnonymousAccountRequired,
35
39
  resolveFormType,
36
40
  structuredResult,
37
41
  textResult
38
- } from "./chunk-VZKMOMFJ.js";
42
+ } from "./chunk-SEZ37YSH.js";
39
43
  import {
40
44
  getMcpAuth,
41
45
  runWithMcpAuth,
@@ -17363,7 +17367,8 @@ Example: A form that asks a question, collects contact info, then finishes:
17363
17367
  timeoutMs: 12e4
17364
17368
  });
17365
17369
  if (!createResult.ok) {
17366
- return errorResult(`Form NOT created (nothing was saved): ${createResult.error}`);
17370
+ const message = `Form NOT created (nothing was saved): ${createResult.error}`;
17371
+ return isAnonymousAccountRequired(createResult) ? errorResult(message, authChallengeMeta("invalid_token", message)) : errorResult(message);
17367
17372
  }
17368
17373
  const { data } = createResult;
17369
17374
  const formId = data.form_id;
@@ -17964,6 +17969,11 @@ function registerGetFormTool(server) {
17964
17969
  }
17965
17970
 
17966
17971
  // src/tools/update-form.ts
17972
+ if (MCP_ANON_PUBLISH_GATE.tool !== "clipform_update_form") {
17973
+ throw new Error(
17974
+ `update-form.ts registers "clipform_update_form" but MCP_ANON_PUBLISH_GATE.tool is "${MCP_ANON_PUBLISH_GATE.tool}" - update both sides together (packages/config/index.js and this file's registerTool call) or the Claude lazy-auth HTTP gate silently stops matching this tool.`
17975
+ );
17976
+ }
17967
17977
  function registerUpdateFormTool(server) {
17968
17978
  server.registerTool(
17969
17979
  "clipform_update_form",
@@ -18024,7 +18034,7 @@ function registerUpdateFormTool(server) {
18024
18034
  body
18025
18035
  });
18026
18036
  if (!result.ok) {
18027
- return errorResult(result.error);
18037
+ return isAnonymousAccountRequired(result) ? errorResult(result.error, authChallengeMeta("invalid_token", result.error)) : errorResult(result.error);
18028
18038
  }
18029
18039
  }
18030
18040
  if (tags) {
@@ -18033,7 +18043,7 @@ function registerUpdateFormTool(server) {
18033
18043
  body: { tags }
18034
18044
  });
18035
18045
  if (!tagResult.ok) {
18036
- return errorResult(tagResult.error);
18046
+ return isAnonymousAccountRequired(tagResult) ? errorResult(tagResult.error, authChallengeMeta("invalid_token", tagResult.error)) : errorResult(tagResult.error);
18037
18047
  }
18038
18048
  }
18039
18049
  const updates = [];
@@ -20847,6 +20857,15 @@ function createServer(options) {
20847
20857
  { ...MCP_SERVER_IDENTITY },
20848
20858
  { instructions: buildInstructions(caps) }
20849
20859
  );
20860
+ const rawServer = server.server;
20861
+ const nativeSetRequestHandler = rawServer.setRequestHandler.bind(rawServer);
20862
+ let baseListToolsHandler;
20863
+ rawServer.setRequestHandler = (schema, handler) => {
20864
+ if (schema === ListToolsRequestSchema && baseListToolsHandler === void 0) {
20865
+ baseListToolsHandler = handler;
20866
+ }
20867
+ return nativeSetRequestHandler(schema, handler);
20868
+ };
20850
20869
  const _registerTool = server.registerTool.bind(server);
20851
20870
  server.registerTool = (name, config2, handler) => {
20852
20871
  const requiredTier = MCP_TOOL_TIERS[name] ?? 0;
@@ -20913,6 +20932,25 @@ function createServer(options) {
20913
20932
  registerGetWorkflowTool(server, caps);
20914
20933
  registerPrompts(server, caps);
20915
20934
  registerResources(server, caps);
20935
+ rawServer.setRequestHandler = nativeSetRequestHandler;
20936
+ if (baseListToolsHandler) {
20937
+ nativeSetRequestHandler(ListToolsRequestSchema, async (request, extra) => {
20938
+ const base = await baseListToolsHandler(request, extra);
20939
+ return {
20940
+ ...base,
20941
+ tools: base.tools.map((tool) => {
20942
+ const security = MCP_TOOL_SECURITY[tool.name];
20943
+ if (security === void 0) return tool;
20944
+ const existingMeta = tool._meta ?? {};
20945
+ return {
20946
+ ...tool,
20947
+ securitySchemes: security,
20948
+ _meta: { ...existingMeta, securitySchemes: security }
20949
+ };
20950
+ })
20951
+ };
20952
+ });
20953
+ }
20916
20954
  return server;
20917
20955
  }
20918
20956
 
@@ -20923,4 +20961,4 @@ export {
20923
20961
  buildInstructions,
20924
20962
  createServer
20925
20963
  };
20926
- //# sourceMappingURL=chunk-J7727374.js.map
20964
+ //# sourceMappingURL=chunk-4XCXDH3I.js.map