callman-mcp 0.4.0 → 0.5.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 (117) hide show
  1. package/CHANGELOG.md +37 -27
  2. package/README.md +33 -11
  3. package/dist/client/api.d.ts +83 -15
  4. package/dist/client/api.d.ts.map +1 -1
  5. package/dist/client/api.js +106 -21
  6. package/dist/client/api.js.map +1 -1
  7. package/dist/client/errors.d.ts.map +1 -1
  8. package/dist/client/errors.js +46 -11
  9. package/dist/client/errors.js.map +1 -1
  10. package/dist/client/types.d.ts +231 -14
  11. package/dist/client/types.d.ts.map +1 -1
  12. package/dist/domain/diagram/build.d.ts +17 -17
  13. package/dist/domain/diagram/build.d.ts.map +1 -1
  14. package/dist/domain/diagram/build.js +3 -3
  15. package/dist/domain/diagram/build.js.map +1 -1
  16. package/dist/domain/diagram/layout.d.ts +1 -3
  17. package/dist/domain/diagram/layout.d.ts.map +1 -1
  18. package/dist/domain/diagram/layout.js +3 -9
  19. package/dist/domain/diagram/layout.js.map +1 -1
  20. package/dist/domain/diagram/patch.d.ts +22 -723
  21. package/dist/domain/diagram/patch.d.ts.map +1 -1
  22. package/dist/domain/diagram/patch.js +0 -53
  23. package/dist/domain/diagram/patch.js.map +1 -1
  24. package/dist/domain/diagram/summarize.d.ts +0 -1
  25. package/dist/domain/diagram/summarize.d.ts.map +1 -1
  26. package/dist/domain/diagram/summarize.js +0 -1
  27. package/dist/domain/diagram/summarize.js.map +1 -1
  28. package/dist/domain/uiTest/compose.d.ts +55 -0
  29. package/dist/domain/uiTest/compose.d.ts.map +1 -0
  30. package/dist/domain/uiTest/compose.js +228 -0
  31. package/dist/domain/uiTest/compose.js.map +1 -0
  32. package/dist/domain/uiTest/summarize.d.ts +273 -0
  33. package/dist/domain/uiTest/summarize.d.ts.map +1 -0
  34. package/dist/domain/uiTest/summarize.js +145 -0
  35. package/dist/domain/uiTest/summarize.js.map +1 -0
  36. package/dist/lib/truncate.d.ts +1 -1
  37. package/dist/lib/truncate.d.ts.map +1 -1
  38. package/dist/lib/truncate.js.map +1 -1
  39. package/dist/resources/docs/diagramSchema.d.ts +1 -1
  40. package/dist/resources/docs/diagramSchema.d.ts.map +1 -1
  41. package/dist/resources/docs/diagramSchema.js +1 -33
  42. package/dist/resources/docs/diagramSchema.js.map +1 -1
  43. package/dist/resources/docs/overview.d.ts +1 -1
  44. package/dist/resources/docs/overview.d.ts.map +1 -1
  45. package/dist/resources/docs/overview.js +13 -7
  46. package/dist/resources/docs/overview.js.map +1 -1
  47. package/dist/resources/docs/uiTests.d.ts +2 -0
  48. package/dist/resources/docs/uiTests.d.ts.map +1 -0
  49. package/dist/resources/docs/uiTests.js +101 -0
  50. package/dist/resources/docs/uiTests.js.map +1 -0
  51. package/dist/resources/generated/aiPacks.d.ts +1 -1
  52. package/dist/resources/generated/aiPacks.js +2 -2
  53. package/dist/resources/index.d.ts.map +1 -1
  54. package/dist/resources/index.js +13 -2
  55. package/dist/resources/index.js.map +1 -1
  56. package/dist/server.d.ts +1 -1
  57. package/dist/server.d.ts.map +1 -1
  58. package/dist/server.js +2 -2
  59. package/dist/server.js.map +1 -1
  60. package/dist/tools/catalog.d.ts +1 -1
  61. package/dist/tools/catalog.d.ts.map +1 -1
  62. package/dist/tools/catalog.js +31 -5
  63. package/dist/tools/catalog.js.map +1 -1
  64. package/dist/tools/diagrams.d.ts.map +1 -1
  65. package/dist/tools/diagrams.js +42 -328
  66. package/dist/tools/diagrams.js.map +1 -1
  67. package/dist/tools/index.d.ts.map +1 -1
  68. package/dist/tools/index.js +6 -0
  69. package/dist/tools/index.js.map +1 -1
  70. package/dist/tools/lookups.d.ts +19 -5
  71. package/dist/tools/lookups.d.ts.map +1 -1
  72. package/dist/tools/lookups.js +77 -41
  73. package/dist/tools/lookups.js.map +1 -1
  74. package/dist/tools/shared.d.ts +5 -0
  75. package/dist/tools/shared.d.ts.map +1 -1
  76. package/dist/tools/shared.js +10 -0
  77. package/dist/tools/shared.js.map +1 -1
  78. package/dist/tools/uiTestAdmin.d.ts +4 -0
  79. package/dist/tools/uiTestAdmin.d.ts.map +1 -0
  80. package/dist/tools/uiTestAdmin.js +509 -0
  81. package/dist/tools/uiTestAdmin.js.map +1 -0
  82. package/dist/tools/uiTestRuns.d.ts +24 -0
  83. package/dist/tools/uiTestRuns.d.ts.map +1 -0
  84. package/dist/tools/uiTestRuns.js +367 -0
  85. package/dist/tools/uiTestRuns.js.map +1 -0
  86. package/dist/tools/uiTestShared.d.ts +236 -0
  87. package/dist/tools/uiTestShared.d.ts.map +1 -0
  88. package/dist/tools/uiTestShared.js +187 -0
  89. package/dist/tools/uiTestShared.js.map +1 -0
  90. package/dist/tools/uiTests.d.ts +4 -0
  91. package/dist/tools/uiTests.d.ts.map +1 -0
  92. package/dist/tools/uiTests.js +572 -0
  93. package/dist/tools/uiTests.js.map +1 -0
  94. package/dist-cjs/client/api.js +106 -21
  95. package/dist-cjs/client/errors.js +46 -11
  96. package/dist-cjs/domain/diagram/build.js +3 -3
  97. package/dist-cjs/domain/diagram/layout.js +3 -10
  98. package/dist-cjs/domain/diagram/patch.js +1 -54
  99. package/dist-cjs/domain/diagram/summarize.js +0 -1
  100. package/dist-cjs/domain/uiTest/compose.js +242 -0
  101. package/dist-cjs/domain/uiTest/summarize.js +155 -0
  102. package/dist-cjs/resources/docs/diagramSchema.js +1 -33
  103. package/dist-cjs/resources/docs/overview.js +13 -7
  104. package/dist-cjs/resources/docs/uiTests.js +103 -0
  105. package/dist-cjs/resources/generated/aiPacks.js +2 -2
  106. package/dist-cjs/resources/index.js +11 -0
  107. package/dist-cjs/server.js +2 -2
  108. package/dist-cjs/tools/catalog.js +31 -5
  109. package/dist-cjs/tools/diagrams.js +37 -323
  110. package/dist-cjs/tools/index.js +6 -0
  111. package/dist-cjs/tools/lookups.js +83 -46
  112. package/dist-cjs/tools/shared.js +12 -1
  113. package/dist-cjs/tools/uiTestAdmin.js +512 -0
  114. package/dist-cjs/tools/uiTestRuns.js +372 -0
  115. package/dist-cjs/tools/uiTestShared.js +202 -0
  116. package/dist-cjs/tools/uiTests.js +575 -0
  117. package/package.json +3 -3
@@ -8,10 +8,12 @@ const requestShape_js_1 = require("../domain/requestShape.js");
8
8
  const summarize_js_2 = require("../domain/scenario/summarize.js");
9
9
  const truncate_js_1 = require("../lib/truncate.js");
10
10
  const lookups_js_1 = require("../tools/lookups.js");
11
+ const uiTestShared_js_1 = require("../tools/uiTestShared.js");
11
12
  const contracts_js_1 = require("./docs/contracts.js");
12
13
  const diagramSchema_js_1 = require("./docs/diagramSchema.js");
13
14
  const overview_js_1 = require("./docs/overview.js");
14
15
  const requestSchema_js_1 = require("./docs/requestSchema.js");
16
+ const uiTests_js_1 = require("./docs/uiTests.js");
15
17
  const aiPacks_js_1 = require("./generated/aiPacks.js");
16
18
  // Resources: reference material a model reads on demand (schemas, the
17
19
  // scripting API, the scenario node reference, the diagram component catalog
@@ -43,6 +45,8 @@ const registerResources = (server, ctx) => {
43
45
  { name: "docs-scripting-db-queries", uri: "callman://docs/scripting/db-queries", title: "Scripting: database queries", description: "How pm.db.* queries work per database provider.", body: () => (0, callman_core_1.renderDbQueryReference)() },
44
46
  { name: "docs-scripting-templating", uri: "callman://docs/scripting/templating", title: "Templating: {{variables}} and generators", description: "Variable resolution order and dynamic generators ({{$uuid}}, {{$randomInt}} …).", body: () => aiPacks_js_1.AI_PACKS.templating ?? "" },
45
47
  { name: "docs-scripting-sandbox", uri: "callman://docs/scripting/sandbox", title: "Scripting: sandbox and feature policy", description: "Globals available in the script sandbox and the feature policy for DB/Kafka capabilities.", body: () => `${aiPacks_js_1.AI_PACKS["sandbox-globals"] ?? ""}\n\n${aiPacks_js_1.AI_PACKS["feature-policy"] ?? ""}` },
48
+ { name: "docs-ui-tests", uri: "callman://docs/ui-tests", title: "UI tests", description: "UI-test concepts: platforms, header, preconditions and sub-flows, datasets and DB sources, hybrid data steps, settings, where runs happen (server runner vs your desktop app), reports and screenshots, schedules, review, masked secrets, and the recommended workflow.", body: () => uiTests_js_1.UI_TESTS_DOC },
49
+ { name: "docs-ui-test-steps", uri: "callman://docs/ui-test-steps", title: "UI-test step reference", description: "Every UI-test step (web / Android / iOS / hybrid data steps): aliases, platforms, forms, arguments and an example — generated from callman-core, the same catalog the linter uses.", body: () => (0, callman_core_1.renderUiTestCommandReference)() },
46
50
  { name: "docs-diagram-schema", uri: "callman://docs/diagram-schema", title: "Diagram schema", description: "Every node and edge field, styling (colors, borders, fonts), containers, edge semantics and colors, patch operations and merge rules, and the stored DiagramDocument.", body: () => diagramSchema_js_1.DIAGRAM_SCHEMA_DOC },
47
51
  ];
48
52
  for (const doc of staticDocs) {
@@ -105,6 +109,13 @@ const registerResources = (server, ctx) => {
105
109
  const resolved = await (0, lookups_js_1.resolveScenario)(ctx, ws?.id ?? null, variable(variables.scenario));
106
110
  return json(uri, { scenario: (0, summarize_js_2.scenarioFullView)(resolved.item) });
107
111
  });
112
+ server.registerResource("ui-test", new mcp_js_1.ResourceTemplate("callman://ui-test/{flow}", { list: undefined }), { title: "A UI test", description: "One UI test (id or name): header, settings, dataset (masked), preconditions, numbered steps, lint result and YAML.", mimeType: "application/json" }, async (uri, variables) => {
113
+ const resolved = await (0, lookups_js_1.resolveUiTest)(ctx, null, variable(variables.flow));
114
+ const fresh = await ctx.api.getUiTest(resolved.item.clientId);
115
+ const context = await (0, uiTestShared_js_1.lintContext)(ctx, fresh.workspaceId);
116
+ const lint = (0, uiTestShared_js_1.lintFlow)(fresh.content ?? "", fresh.platform, context, [...Object.keys(fresh.dataset ?? {}), ...Object.keys(fresh.datasetSources ?? {})]);
117
+ return json(uri, { uiTest: await (0, uiTestShared_js_1.flowDetailView)(ctx, fresh, lint, context, { workspaces: await ctx.listWorkspaces() }) });
118
+ });
108
119
  server.registerResource("diagram", new mcp_js_1.ResourceTemplate("callman://diagram/{diagram}", { list: undefined }), { title: "A diagram", description: "One diagram (id or name) as nodes/edges with edge semantics.", mimeType: "application/json" }, async (uri, variables) => {
109
120
  const ref = variable(variables.diagram);
110
121
  const resolved = await (0, lookups_js_1.resolveDiagram)(ctx, ref);
@@ -7,8 +7,8 @@ const index_js_1 = require("./prompts/index.js");
7
7
  const index_js_2 = require("./resources/index.js");
8
8
  const index_js_3 = require("./tools/index.js");
9
9
  exports.SERVER_NAME = "callman";
10
- exports.SERVER_INSTRUCTIONS = `Callman is an API client and test platform: collections of HTTP requests, environments with variables, multi-step test scenarios, and system-design diagrams. You act as the user whose token is configured, within that token's permissions and the user's workspace role.
11
- Start with whoami. The token works in every workspace the user belongs to: lists and searches cover all of them unless you pass \`workspace\`, names are looked up in the default workspace first and then everywhere, and results say which workspace they come from; creating something needs a target (\`workspace\`, the collection it goes into, or the session default — use_workspace). Names work as references (collection, folder, request, environment, scenario, diagram, workspace); ambiguous names return candidates. List before creating — duplicate collection names are refused. Preview large writes with dryRun: true; deletions need confirm: true and the user's agreement. Environment values are masked unless the token holds environments:reveal and you pass reveal: true; never write a masked value back. Arguments are strict — an unknown key is an error listing the valid ones. Read callman://docs/overview for the conventions, callman://docs/request-schema before creating or editing requests, callman://docs/contracts before contract checks, callman://docs/scenario-nodes before scenarios, and callman://docs/diagram-schema + callman://diagram/components before diagrams.`;
10
+ exports.SERVER_INSTRUCTIONS = `Callman is an API client and test platform: collections of HTTP requests, environments with variables, multi-step API test scenarios, UI tests (web / Android / iOS flows), and system-design diagrams. You act as the user whose token is configured, within that token's permissions and the user's workspace role.
11
+ Start with whoami. The token works in every workspace the user belongs to: lists and searches cover all of them unless you pass \`workspace\`, names are looked up in the default workspace first and then everywhere, and results say which workspace they come from; creating something needs a target (\`workspace\`, the collection it goes into, or the session default — use_workspace). Names work as references (collection, folder, request, environment, scenario, UI test, diagram, workspace); ambiguous names return candidates. List before creating — duplicate collection names are refused. Preview large writes with dryRun: true; deletions need confirm: true and the user's agreement. Environment values are masked unless the token holds environments:reveal and you pass reveal: true; never write a masked value back. Arguments are strict — an unknown key is an error listing the valid ones. Read callman://docs/overview for the conventions, callman://docs/request-schema before creating or editing requests, callman://docs/contracts before contract checks, callman://docs/scenario-nodes before scenarios, callman://docs/ui-tests (+ callman://docs/ui-test-steps) before UI tests — they run on the server runner (web) or the user's own desktop app (list_ui_test_devices), and callman://docs/diagram-schema + callman://diagram/components before diagrams.`;
12
12
  const createCallmanMcpServer = (options) => {
13
13
  const version = options.version ?? "0.0.0";
14
14
  const context = (0, context_js_1.createToolContext)({
@@ -44,8 +44,6 @@ exports.TOOL_CATALOG = [
44
44
  { name: "delete_data_contract", group: "contracts", scopes: ["requests:delete"], destructive: true },
45
45
  // The safe connection record (no credentials) — readable with either family.
46
46
  { name: "list_connections", group: "connections", scopes: ["requests:read", "scenarios:read"], anyOf: true },
47
- // The database behind a connection (metadata only) — what a Database Diagram is built from.
48
- { name: "introspect_database", group: "connections", scopes: ["requests:read", "scenarios:read", "diagrams:write"], anyOf: true },
49
47
  // Documents and new collections → import:write; cURL/.http into an existing
50
48
  // collection → requests:write.
51
49
  { name: "import_content", group: "import", scopes: ["import:write", "requests:write"], anyOf: true },
@@ -67,6 +65,37 @@ exports.TOOL_CATALOG = [
67
65
  { name: "submit_scenario", group: "scenarios", scopes: ["scenarios:write"] },
68
66
  { name: "delete_scenario", group: "scenarios", scopes: ["scenarios:delete"], destructive: true },
69
67
  { name: "run_scenario", group: "scenarios", scopes: ["scenarios:run"] },
68
+ // UI tests (web / Android / iOS flows): ui_tests:* scopes. Runs start on the
69
+ // server runner (web) or the user's desktop app (desktop relay).
70
+ { name: "list_ui_tests", group: "uiTests", scopes: ["ui_tests:read"] },
71
+ { name: "get_ui_test", group: "uiTests", scopes: ["ui_tests:read"] },
72
+ { name: "validate_ui_test", group: "uiTests", scopes: ["ui_tests:read"] },
73
+ { name: "create_ui_test", group: "uiTests", scopes: ["ui_tests:write"] },
74
+ { name: "update_ui_test", group: "uiTests", scopes: ["ui_tests:write"] },
75
+ { name: "patch_ui_test_steps", group: "uiTests", scopes: ["ui_tests:write"] },
76
+ { name: "delete_ui_test", group: "uiTests", scopes: ["ui_tests:delete"], destructive: true },
77
+ { name: "list_ui_test_folders", group: "uiTests", scopes: ["ui_tests:read"] },
78
+ { name: "create_ui_test_folder", group: "uiTests", scopes: ["ui_tests:write"] },
79
+ { name: "update_ui_test_folder", group: "uiTests", scopes: ["ui_tests:write"] },
80
+ { name: "delete_ui_test_folder", group: "uiTests", scopes: ["ui_tests:delete"], destructive: true },
81
+ { name: "move_ui_tests", group: "uiTests", scopes: ["ui_tests:write"] },
82
+ { name: "list_ui_test_devices", group: "uiTests", scopes: ["ui_tests:read"] },
83
+ { name: "run_ui_test", group: "uiTests", scopes: ["ui_tests:run"] },
84
+ { name: "run_ui_tests", group: "uiTests", scopes: ["ui_tests:run"] },
85
+ { name: "get_ui_test_run", group: "uiTests", scopes: ["ui_tests:read"] },
86
+ { name: "list_ui_test_runs", group: "uiTests", scopes: ["ui_tests:read"] },
87
+ { name: "cancel_ui_test_run", group: "uiTests", scopes: ["ui_tests:run"] },
88
+ { name: "list_ui_test_schedules", group: "uiTests", scopes: ["ui_tests:read"] },
89
+ { name: "create_ui_test_schedule", group: "uiTests", scopes: ["ui_tests:write"] },
90
+ { name: "update_ui_test_schedule", group: "uiTests", scopes: ["ui_tests:write"] },
91
+ { name: "delete_ui_test_schedule", group: "uiTests", scopes: ["ui_tests:delete"], destructive: true },
92
+ { name: "run_ui_test_schedule_now", group: "uiTests", scopes: ["ui_tests:run"] },
93
+ { name: "submit_ui_test", group: "uiTests", scopes: ["ui_tests:write"] },
94
+ { name: "review_ui_test", group: "uiTests", scopes: ["ui_tests:write"] },
95
+ { name: "list_ui_test_versions", group: "uiTests", scopes: ["ui_tests:read"] },
96
+ { name: "restore_ui_test_version", group: "uiTests", scopes: ["ui_tests:write"] },
97
+ { name: "export_ui_tests", group: "uiTests", scopes: ["ui_tests:read"] },
98
+ { name: "import_ui_tests", group: "uiTests", scopes: ["ui_tests:write"] },
70
99
  { name: "list_diagrams", group: "diagrams", scopes: ["diagrams:read"] },
71
100
  { name: "get_diagram", group: "diagrams", scopes: ["diagrams:read"] },
72
101
  { name: "create_diagram", group: "diagrams", scopes: ["diagrams:write"] },
@@ -74,9 +103,6 @@ exports.TOOL_CATALOG = [
74
103
  { name: "patch_diagram", group: "diagrams", scopes: ["diagrams:write"] },
75
104
  { name: "delete_diagram", group: "diagrams", scopes: ["diagrams:delete"], destructive: true },
76
105
  { name: "share_diagram", group: "diagrams", scopes: ["diagrams:share"] },
77
- { name: "create_diagram_folder", group: "diagrams", scopes: ["diagrams:write"] },
78
- { name: "update_diagram_folder", group: "diagrams", scopes: ["diagrams:write"] },
79
- { name: "delete_diagram_folder", group: "diagrams", scopes: ["diagrams:delete"], destructive: true },
80
106
  ];
81
107
  const toolAvailability = (tokenScopes, allowLocalRun) => {
82
108
  const held = new Set(tokenScopes);