@plitzi/sdk-mcp 0.39.1 → 0.39.2
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/CHANGELOG.md +15 -0
- package/README.md +5 -1
- package/dist/createServer.d.ts +3 -2
- package/dist/createServer.js +3 -13
- package/dist/index.js +8 -8
- package/dist/modules/mcp/accessibilityOutline.js +1 -2
- package/dist/modules/mcp/apps/index.js +3 -4
- package/dist/modules/mcp/apps/render/index.js +3 -7
- package/dist/modules/mcp/apps/render/styles.js +2 -3
- package/dist/modules/mcp/apps/shared/assets.d.ts +6 -0
- package/dist/modules/mcp/apps/shared/assets.js +15 -4
- package/dist/modules/mcp/apps/shared/bundle.js +3 -4
- package/dist/modules/mcp/apps/shared/index.d.ts +1 -1
- package/dist/modules/mcp/apps/shared/page.js +3 -5
- package/dist/modules/mcp/apps/shared/registerApp.js +1 -2
- package/dist/modules/mcp/apps/shared/resolve.js +1 -2
- package/dist/modules/mcp/apps/shared/zodEnglishOnly.js +1 -2
- package/dist/modules/mcp/catalogs/observed.js +1 -2
- package/dist/modules/mcp/catalogs/pluginCatalog.d.ts +1 -1
- package/dist/modules/mcp/catalogs/pluginCatalog.js +1 -2
- package/dist/modules/mcp/catalogs/registry.d.ts +2 -1
- package/dist/modules/mcp/catalogs/registry.js +1 -2
- package/dist/modules/mcp/handler.d.ts +1 -1
- package/dist/modules/mcp/handler.js +1 -2
- package/dist/modules/mcp/helpers/callToolResult.js +1 -2
- package/dist/modules/mcp/helpers/components.js +1 -2
- package/dist/modules/mcp/helpers/computeVersion.js +1 -2
- package/dist/modules/mcp/helpers/guide/index.js +1 -2
- package/dist/modules/mcp/helpers/guide/instructions.js +1 -2
- package/dist/modules/mcp/helpers/guide/logic.js +1 -2
- package/dist/modules/mcp/helpers/guide/practice.js +4 -4
- package/dist/modules/mcp/helpers/guide/reference.js +1 -2
- package/dist/modules/mcp/helpers/guide/server.d.ts +1 -1
- package/dist/modules/mcp/helpers/guide/server.js +3 -4
- package/dist/modules/mcp/helpers/guide/structure.js +1 -2
- package/dist/modules/mcp/helpers/guide/styling.js +1 -2
- package/dist/modules/mcp/helpers/guide/values.js +1 -2
- package/dist/modules/mcp/helpers/interactions.js +1 -2
- package/dist/modules/mcp/helpers/log.d.ts +1 -1
- package/dist/modules/mcp/helpers/log.js +2 -3
- package/dist/modules/mcp/helpers/opResult.js +1 -2
- package/dist/modules/mcp/helpers/space.d.ts +2 -1
- package/dist/modules/mcp/helpers/space.js +1 -2
- package/dist/modules/mcp/helpers/uris.js +1 -2
- package/dist/modules/mcp/localScreenshotClient.js +9 -6
- package/dist/modules/mcp/previewClient.js +1 -2
- package/dist/modules/mcp/proxy/config.d.ts +1 -1
- package/dist/modules/mcp/proxy/config.js +2 -3
- package/dist/modules/mcp/proxy/fetch.js +1 -2
- package/dist/modules/mcp/proxy/grant.js +1 -2
- package/dist/modules/mcp/proxy/guard.js +2 -3
- package/dist/modules/mcp/proxy/handler.d.ts +1 -1
- package/dist/modules/mcp/proxy/handler.js +2 -3
- package/dist/modules/mcp/proxy/payload.js +1 -2
- package/dist/modules/mcp/proxy/rewrite.js +1 -2
- package/dist/modules/mcp/proxy/sign.js +1 -2
- package/dist/modules/mcp/proxy/types.js +1 -2
- package/dist/modules/mcp/resources/actions.js +2 -3
- package/dist/modules/mcp/resources/canonical.js +1 -2
- package/dist/modules/mcp/resources/connectors.js +2 -3
- package/dist/modules/mcp/resources/core.js +4 -5
- package/dist/modules/mcp/resources/data.js +1 -2
- package/dist/modules/mcp/resources/envelope.js +1 -2
- package/dist/modules/mcp/resources/explain.js +1 -2
- package/dist/modules/mcp/resources/functions.js +1 -2
- package/dist/modules/mcp/resources/primer.js +7 -8
- package/dist/modules/mcp/resources/register.d.ts +1 -1
- package/dist/modules/mcp/resources/register.js +6 -7
- package/dist/modules/mcp/resources/renderGuide.js +2 -3
- package/dist/modules/mcp/resources/router.js +3 -4
- package/dist/modules/mcp/resources/schema.js +3 -4
- package/dist/modules/mcp/resources/style.js +2 -3
- package/dist/modules/mcp/screenshotClient.js +6 -5
- package/dist/modules/mcp/server.d.ts +1 -1
- package/dist/modules/mcp/server.js +4 -5
- package/dist/modules/mcp/tools/activity.js +1 -2
- package/dist/modules/mcp/tools/apply/dispatch.js +4 -5
- package/dist/modules/mcp/tools/apply/index.d.ts +4 -0
- package/dist/modules/mcp/tools/apply/index.js +3 -4
- package/dist/modules/mcp/tools/apply/writeResult.js +1 -2
- package/dist/modules/mcp/tools/describeOperation.js +2 -3
- package/dist/modules/mcp/tools/index.js +1 -2
- package/dist/modules/mcp/tools/intents.js +3 -4
- package/dist/modules/mcp/tools/look.js +2 -3
- package/dist/modules/mcp/tools/operations/actions/deleteAction.js +2 -3
- package/dist/modules/mcp/tools/operations/actions/document.d.ts +2 -0
- package/dist/modules/mcp/tools/operations/actions/document.js +4 -3
- package/dist/modules/mcp/tools/operations/actions/index.d.ts +4 -0
- package/dist/modules/mcp/tools/operations/actions/index.js +1 -2
- package/dist/modules/mcp/tools/operations/actions/patchAction.d.ts +2 -0
- package/dist/modules/mcp/tools/operations/actions/patchAction.js +3 -4
- package/dist/modules/mcp/tools/operations/actions/upsertAction.d.ts +2 -0
- package/dist/modules/mcp/tools/operations/actions/upsertAction.js +3 -4
- package/dist/modules/mcp/tools/operations/closed.js +1 -2
- package/dist/modules/mcp/tools/operations/connectors/deleteConnector.js +2 -3
- package/dist/modules/mcp/tools/operations/connectors/index.js +1 -2
- package/dist/modules/mcp/tools/operations/connectors/manifest.js +1 -2
- package/dist/modules/mcp/tools/operations/connectors/patchConnector.js +3 -4
- package/dist/modules/mcp/tools/operations/connectors/upsertConnector.js +3 -4
- package/dist/modules/mcp/tools/operations/data/index.js +1 -2
- package/dist/modules/mcp/tools/operations/functions/index.js +2 -3
- package/dist/modules/mcp/tools/operations/index.d.ts +8 -0
- package/dist/modules/mcp/tools/operations/index.js +1 -2
- package/dist/modules/mcp/tools/operations/schema/bindings/deleteBinding.js +1 -2
- package/dist/modules/mcp/tools/operations/schema/bindings/patchBinding.js +1 -2
- package/dist/modules/mcp/tools/operations/schema/bindings/upsertBinding.js +1 -2
- package/dist/modules/mcp/tools/operations/schema/components/deleteComponent.js +1 -2
- package/dist/modules/mcp/tools/operations/schema/components/upsertComponent.js +2 -3
- package/dist/modules/mcp/tools/operations/schema/elements/deleteElement.js +2 -3
- package/dist/modules/mcp/tools/operations/schema/elements/moveElement.js +3 -4
- package/dist/modules/mcp/tools/operations/schema/elements/patchElement.js +3 -4
- package/dist/modules/mcp/tools/operations/schema/elements/repeatElement.js +1 -2
- package/dist/modules/mcp/tools/operations/schema/elements/upsertElement.js +3 -4
- package/dist/modules/mcp/tools/operations/schema/flags/deleteFlag.js +2 -3
- package/dist/modules/mcp/tools/operations/schema/flags/upsertFlag.js +2 -3
- package/dist/modules/mcp/tools/operations/schema/folders/deleteFolder.js +2 -3
- package/dist/modules/mcp/tools/operations/schema/folders/upsertFolder.js +2 -3
- package/dist/modules/mcp/tools/operations/schema/interactions/deleteInteraction.js +1 -2
- package/dist/modules/mcp/tools/operations/schema/interactions/patchInteractionNode.js +1 -2
- package/dist/modules/mcp/tools/operations/schema/interactions/upsertInteractionFlow.js +2 -3
- package/dist/modules/mcp/tools/operations/schema/operations.js +1 -2
- package/dist/modules/mcp/tools/operations/schema/pages/deleteLayout.js +2 -3
- package/dist/modules/mcp/tools/operations/schema/pages/deletePage.js +2 -3
- package/dist/modules/mcp/tools/operations/schema/pages/upsertLayout.js +3 -4
- package/dist/modules/mcp/tools/operations/schema/pages/upsertPage.js +3 -4
- package/dist/modules/mcp/tools/operations/schema/settings/patchSettings.js +2 -3
- package/dist/modules/mcp/tools/operations/schema/shared.js +1 -2
- package/dist/modules/mcp/tools/operations/schema/translator.js +2 -3
- package/dist/modules/mcp/tools/operations/schema/variables/deleteVariable.js +2 -3
- package/dist/modules/mcp/tools/operations/schema/variables/upsertVariable.js +2 -3
- package/dist/modules/mcp/tools/operations/schema/write.js +3 -4
- package/dist/modules/mcp/tools/operations/schemaIds.js +1 -2
- package/dist/modules/mcp/tools/operations/style/definitions/deleteDefinition.js +1 -2
- package/dist/modules/mcp/tools/operations/style/definitions/patchDefinition.js +2 -3
- package/dist/modules/mcp/tools/operations/style/definitions/upsertDefinition.js +1 -2
- package/dist/modules/mcp/tools/operations/style/definitions/upsertDefinitions.js +1 -2
- package/dist/modules/mcp/tools/operations/style/fonts/deleteFont.js +2 -3
- package/dist/modules/mcp/tools/operations/style/fonts/upsertFont.js +2 -3
- package/dist/modules/mcp/tools/operations/style/globalStyles/deleteGlobalStyle.js +1 -2
- package/dist/modules/mcp/tools/operations/style/globalStyles/patchGlobalStyle.js +2 -3
- package/dist/modules/mcp/tools/operations/style/globalStyles/upsertGlobalStyle.js +1 -2
- package/dist/modules/mcp/tools/operations/style/idStyles/deleteIdStyle.js +1 -2
- package/dist/modules/mcp/tools/operations/style/idStyles/patchIdStyle.js +2 -3
- package/dist/modules/mcp/tools/operations/style/idStyles/upsertIdStyle.js +1 -2
- package/dist/modules/mcp/tools/operations/style/operations.js +1 -2
- package/dist/modules/mcp/tools/operations/style/shared.js +1 -2
- package/dist/modules/mcp/tools/operations/style/translator.js +1 -2
- package/dist/modules/mcp/tools/operations/style/validate.js +1 -2
- package/dist/modules/mcp/tools/operations/style/variables/deleteStyleVariable.js +2 -3
- package/dist/modules/mcp/tools/operations/style/variables/upsertStyleVariable.js +2 -3
- package/dist/modules/mcp/tools/operations/style/write.js +2 -3
- package/dist/modules/mcp/tools/read.js +2 -3
- package/dist/modules/mcp/tools/render.js +3 -4
- package/dist/modules/mcp/tools/renderWidget.js +2 -3
- package/dist/modules/mcp/tools/search.js +2 -3
- package/dist/modules/mcp/tools/shared/draftBatch.js +2 -3
- package/dist/modules/mcp/tools/shared/effects.js +1 -2
- package/dist/modules/mcp/tools/shared/expandOperations.js +1 -2
- package/dist/modules/mcp/tools/shared/interactionReport.js +1 -2
- package/dist/modules/mcp/tools/shared/lintDraft.js +1 -2
- package/dist/modules/mcp/tools/shared/look.js +1 -2
- package/dist/modules/mcp/tools/shared/newSuggestions.js +1 -2
- package/dist/modules/mcp/tools/shared/normalizeOperations.js +1 -2
- package/dist/modules/mcp/tools/shared/repeats.js +1 -2
- package/dist/modules/mcp/tools/shared/tool.js +1 -2
- package/dist/modules/mcp/tools/shared/validator/batch.js +1 -2
- package/dist/modules/mcp/tools/shared/validator/bindings.js +1 -2
- package/dist/modules/mcp/tools/shared/validator/connectors.js +2 -3
- package/dist/modules/mcp/tools/shared/validator/context.js +1 -2
- package/dist/modules/mcp/tools/shared/validator/css.js +2 -3
- package/dist/modules/mcp/tools/shared/validator/elements.js +2 -3
- package/dist/modules/mcp/tools/shared/validator/index.js +8 -9
- package/dist/modules/mcp/tools/shared/validator/interactions.js +2 -3
- package/dist/modules/mcp/tools/shared/validator/refs.js +1 -2
- package/dist/modules/mcp/tools/test.js +1 -2
- package/dist/modules/mcp/tools/tryFunction.js +1 -2
- package/dist/modules/mcp/types/screenshotTypes.d.ts +8 -0
- package/dist/options.d.ts +1 -1
- package/dist/pipeline.d.ts +2 -1
- package/dist/pipeline.js +4 -3
- package/dist/preview/createPreview.d.ts +1 -1
- package/dist/preview/createPreview.js +1 -2
- package/dist/preview.d.ts +7 -0
- package/dist/preview.js +1 -0
- package/dist/render.js +1 -1
- package/dist/server.js +3 -3
- package/dist/stages/mcp.d.ts +1 -1
- package/dist/stages/mcp.js +2 -3
- package/dist/stages/preview.d.ts +2 -1
- package/dist/stages/preview.js +3 -4
- package/dist/stages/proxy.d.ts +1 -1
- package/dist/stages/proxy.js +2 -3
- package/package.json +23 -16
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { warnOnce } from "./context.js";
|
|
1
2
|
import { findConnectorEntry } from "../../../helpers/space.js";
|
|
2
3
|
import { toManifest } from "../../operations/connectors/upsertConnector.js";
|
|
3
|
-
import { warnOnce } from "./context.js";
|
|
4
4
|
import { validateConnectorManifest } from "@plitzi/sdk-shared/connectors";
|
|
5
|
-
|
|
5
|
+
// src/modules/mcp/tools/shared/validator/connectors.ts
|
|
6
6
|
/** Run the one shared manifest validator and fold its report into the batch result. Errors reject the batch;
|
|
7
7
|
* warnings ride along — notably "reads {{credential.…}} but names no credential", which is expected here: the
|
|
8
8
|
* agent authors the manifest and the space owner attaches the secret afterwards. */
|
|
@@ -71,5 +71,4 @@ var checkProviderElement = (space, ctx, ref, runtime, props, batchConnectors, ba
|
|
|
71
71
|
});
|
|
72
72
|
});
|
|
73
73
|
};
|
|
74
|
-
//#endregion
|
|
75
74
|
export { batchDeclaredConnectors, checkConnectorOp, checkProviderElement };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/modules/mcp/tools/shared/validator/context.ts
|
|
2
2
|
var VAR_REF = /\{\{\s*([A-Za-z_][\w.-]*)\s*\}\}/g;
|
|
3
3
|
var CSS_VAR = /var\(\s*--([A-Za-z_][\w-]*)\s*\)/g;
|
|
4
4
|
var RAW_CODE_TYPES = /* @__PURE__ */ new Set([
|
|
@@ -31,5 +31,4 @@ var checkObservedName = (value, observed, kind, resource, path, ctx) => {
|
|
|
31
31
|
if (!value || observed.size === 0 || observed.has(value)) return;
|
|
32
32
|
warnOnce(ctx, `${kind} "${value}" at ${path} was not seen in this space. Verify against ${resource}; it may still be valid.`);
|
|
33
33
|
};
|
|
34
|
-
//#endregion
|
|
35
34
|
export { RAW_CODE_TYPES, checkObservedName, checkStyleVarRefs, checkVarRefs, warnOnce };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ambiguousShorthands, expandShorthand, isCssProperty, suggestCssProperty } from "../../../catalogs/index.js";
|
|
2
1
|
import { checkStyleVarRefs, checkVarRefs } from "./context.js";
|
|
3
|
-
|
|
2
|
+
import { ambiguousShorthands, expandShorthand, isCssProperty, suggestCssProperty } from "../../../catalogs/index.js";
|
|
3
|
+
// src/modules/mcp/tools/shared/validator/css.ts
|
|
4
4
|
var checkCss = (css, path, ctx) => {
|
|
5
5
|
if (!css) return;
|
|
6
6
|
const declared = {};
|
|
@@ -40,5 +40,4 @@ var checkSlotCss = (slot, path, ctx) => {
|
|
|
40
40
|
checkCss(dm.mobile, `${path}.variants.${name}.mobile`, ctx);
|
|
41
41
|
}
|
|
42
42
|
};
|
|
43
|
-
//#endregion
|
|
44
43
|
export { checkCss, checkSlotCss };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { definitionVariantNames } from "../../operations/style/translator.js";
|
|
2
1
|
import { RAW_CODE_TYPES, warnOnce } from "./context.js";
|
|
3
2
|
import { checkIdRef } from "./refs.js";
|
|
4
|
-
|
|
3
|
+
import { definitionVariantNames } from "../../operations/style/translator.js";
|
|
4
|
+
// src/modules/mcp/tools/shared/validator/elements.ts
|
|
5
5
|
var checkTypeProps = (type, props, path, ctx) => {
|
|
6
6
|
const meta = ctx.typeMeta.get(type);
|
|
7
7
|
if (!props || RAW_CODE_TYPES.has(type) || meta?.custom === false) return;
|
|
@@ -51,5 +51,4 @@ var checkElementInput = (element, path, ctx, seen) => {
|
|
|
51
51
|
checkElementProps(element, path, ctx);
|
|
52
52
|
element.children?.forEach((child, i) => checkElementInput(child, `${path}.children[${i}]`, ctx, seen));
|
|
53
53
|
};
|
|
54
|
-
//#endregion
|
|
55
54
|
export { checkElementInput, checkRawMarkup, checkTypeProps, checkVariantApplication };
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { componentView, findComponentByRef } from "../../../helpers/components.js";
|
|
2
|
-
import { findElementByRef, findFolderByRef, findPageByRef, findRootByRef, folderAncestorIds, getLayoutElements, getPageElements, pageFoldersOf, resolveRef, routeParamNames } from "../../../helpers/space.js";
|
|
3
|
-
import { observedDataSources, observedInteractionActions } from "../../../catalogs/observed.js";
|
|
4
|
-
import { buildTypeRegistry } from "../../../catalogs/registry.js";
|
|
5
|
-
import { MAX_OPS } from "../../operations/index.js";
|
|
6
1
|
import { batchDeclaredElements, batchDeclaredFolders, batchDeclaredPages, batchDeclaredVariants, batchDeclaredVars } from "./batch.js";
|
|
7
|
-
import { checkObservedName, warnOnce } from "./context.js";
|
|
8
2
|
import { checkBindingTarget } from "./bindings.js";
|
|
9
3
|
import { batchDeclaredConnectors, checkConnectorOp, checkProviderElement } from "./connectors.js";
|
|
4
|
+
import { checkObservedName, warnOnce } from "./context.js";
|
|
10
5
|
import { checkSlotCss } from "./css.js";
|
|
11
|
-
import { checkRef } from "./refs.js";
|
|
12
6
|
import { checkElementInput, checkRawMarkup, checkTypeProps, checkVariantApplication } from "./elements.js";
|
|
13
7
|
import { checkInteractionNode } from "./interactions.js";
|
|
8
|
+
import { checkRef } from "./refs.js";
|
|
9
|
+
import { observedDataSources, observedInteractionActions } from "../../../catalogs/observed.js";
|
|
10
|
+
import { buildTypeRegistry } from "../../../catalogs/registry.js";
|
|
11
|
+
import { componentView, findComponentByRef } from "../../../helpers/components.js";
|
|
12
|
+
import { findElementByRef, findFolderByRef, findPageByRef, findRootByRef, folderAncestorIds, getLayoutElements, getPageElements, pageFoldersOf, resolveRef, routeParamNames } from "../../../helpers/space.js";
|
|
13
|
+
import { MAX_OPS } from "../../operations/index.js";
|
|
14
14
|
import { isValidElementId, treeOf } from "@plitzi/sdk-schema";
|
|
15
15
|
import { closest } from "@plitzi/sdk-authoring";
|
|
16
|
-
|
|
16
|
+
// src/modules/mcp/tools/shared/validator/index.ts
|
|
17
17
|
var STYLE_CATEGORIES = [
|
|
18
18
|
"color",
|
|
19
19
|
"spacing",
|
|
@@ -330,5 +330,4 @@ var validateOperations = (space, ops, mode = "space") => {
|
|
|
330
330
|
warnings: ctx.warnings
|
|
331
331
|
};
|
|
332
332
|
};
|
|
333
|
-
//#endregion
|
|
334
333
|
export { validateOperations };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { checkObservedName, warnOnce } from "./context.js";
|
|
1
2
|
import { getElementCallback, getGlobalCallback, getUtility, hiddenParams, reconcileParams } from "../../../catalogs/index.js";
|
|
2
3
|
import { NULLISH_ELEMENT_IDS } from "../../../helpers/interactions.js";
|
|
3
|
-
|
|
4
|
-
//#region src/modules/mcp/tools/shared/validator/interactions.ts
|
|
4
|
+
// src/modules/mcp/tools/shared/validator/interactions.ts
|
|
5
5
|
var ELEMENT_FIELD_ACTIONS = /* @__PURE__ */ new Set(["setState", "toggleState"]);
|
|
6
6
|
var checkParams = (label, action, params, spec, base, ctx) => {
|
|
7
7
|
const unknown = Object.keys(params).filter((key) => !(key in spec));
|
|
@@ -78,5 +78,4 @@ var checkInteractionNode = (node, base, ctx, hostRef) => {
|
|
|
78
78
|
case "utility": checkUtility(node, base, ctx);
|
|
79
79
|
}
|
|
80
80
|
};
|
|
81
|
-
//#endregion
|
|
82
81
|
export { checkInteractionNode };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { isValidElementId } from "@plitzi/sdk-schema";
|
|
2
|
-
|
|
2
|
+
// src/modules/mcp/tools/shared/validator/refs.ts
|
|
3
3
|
var REF_RE = /^[a-zA-Z0-9._-]+$/;
|
|
4
4
|
var checkRef = (ref, path, ctx) => {
|
|
5
5
|
if (!ref || ref.trim().length === 0) {
|
|
@@ -24,5 +24,4 @@ var checkIdRef = (ref, path, ctx) => {
|
|
|
24
24
|
hint: "Use only letters, numbers, hyphens and underscores (e.g. \"hero-cta\" or \"my_list_card\"). The name IS the element id, which the runtime embeds in source names like `apiContainer_<id>.field` and in interaction targets — a dot would break those paths."
|
|
25
25
|
});
|
|
26
26
|
};
|
|
27
|
-
//#endregion
|
|
28
27
|
export { REF_RE, checkIdRef, checkRef };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { defineTool } from "./shared/tool.js";
|
|
2
2
|
import { e2eTestProblems, journeyStartWarnings, readSpaceTests, runUnitTests, testAccountWarnings, unitTestProblems } from "@plitzi/sdk-authoring";
|
|
3
3
|
import { z } from "zod";
|
|
4
|
-
|
|
4
|
+
// src/modules/mcp/tools/test.ts
|
|
5
5
|
var testShape = {
|
|
6
6
|
action: z.enum([
|
|
7
7
|
"list",
|
|
@@ -81,5 +81,4 @@ var testTool = defineTool({
|
|
|
81
81
|
access: "write",
|
|
82
82
|
run: (input, ctx) => test(input, ctx)
|
|
83
83
|
});
|
|
84
|
-
//#endregion
|
|
85
84
|
export { test, testShape, testTool };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defineTool } from "./shared/tool.js";
|
|
2
2
|
import { z } from "zod";
|
|
3
|
-
|
|
3
|
+
// src/modules/mcp/tools/tryFunction.ts
|
|
4
4
|
var tryFunctionShape = {
|
|
5
5
|
task: z.string().describe("`<namespace>.<action>`"),
|
|
6
6
|
params: z.record(z.string(), z.unknown()).optional(),
|
|
@@ -39,5 +39,4 @@ var tryFunctionTool = defineTool({
|
|
|
39
39
|
access: "write",
|
|
40
40
|
run: (input, ctx) => tryFunction(input, ctx)
|
|
41
41
|
});
|
|
42
|
-
//#endregion
|
|
43
42
|
export { tryFunction, tryFunctionShape, tryFunctionTool };
|
|
@@ -43,6 +43,14 @@ export type ScreenshotInput = {
|
|
|
43
43
|
* `accessibility`, and the caller says so rather than failing.
|
|
44
44
|
*/
|
|
45
45
|
views?: CaptureView[];
|
|
46
|
+
/**
|
|
47
|
+
* How the picture is encoded: `png` when left out — what a check that compares pixels needs — or `webp`, for a picture
|
|
48
|
+
* a person is shown, at a tenth of the size (a full-page thumbnail was 2 MB of PNG). A browser service that cannot
|
|
49
|
+
* answers PNG, and the image's `mimeType` says which it got.
|
|
50
|
+
*/
|
|
51
|
+
format?: 'png' | 'webp';
|
|
52
|
+
/** WebP's quality, 1–100. Default 80. */
|
|
53
|
+
quality?: number;
|
|
46
54
|
};
|
|
47
55
|
/** How a look reaches the headless-browser service. The consumer injects an implementation (an HTTP
|
|
48
56
|
* client to the dedicated browser pod); absent, or a capture that fails (pod down) and answers `ok:false` rather than
|
package/dist/options.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { OAuthConfig } from '@plitzi/sdk-
|
|
1
|
+
import { OAuthConfig } from '@plitzi/sdk-kernel/types';
|
|
2
2
|
/** How a rendered widget reaches ANYTHING outside its sandbox — images, media, fonts, and the endpoints an
|
|
3
3
|
* apiContainer fetches. A widget runs in an iframe under a CSP the host builds from the origins this server
|
|
4
4
|
* declares on its `ui://` resource, which is read before any widget exists (and the spec allows no per-call CSP),
|
package/dist/pipeline.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { McpOptions } from './options';
|
|
2
|
-
import { BaseContext,
|
|
2
|
+
import { BaseContext, Stage } from '@plitzi/sdk-kernel/http';
|
|
3
|
+
import { PipelineExtensions } from '@plitzi/sdk-server';
|
|
3
4
|
export declare const buildMCPPipeline: (options?: McpOptions) => Stage<BaseContext>[];
|
|
4
5
|
/** What this package contributes to somebody else's PAGE server: the MCP endpoint alongside SSR on one port.
|
|
5
6
|
* Every stage here gates itself — MCP is self-authenticating, the widget proxy must stay reachable without a
|
package/dist/pipeline.js
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { createMcpOnlyStage, createMcpStage } from "./stages/mcp.js";
|
|
2
2
|
import { previewStage } from "./stages/preview.js";
|
|
3
3
|
import { createWidgetProxyStage } from "./stages/proxy.js";
|
|
4
|
-
import { configStaticStage, healthStage } from "@plitzi/sdk-
|
|
4
|
+
import { configStaticStage, healthStage } from "@plitzi/sdk-kernel/http";
|
|
5
|
+
import { statsStage } from "@plitzi/sdk-kernel/stats";
|
|
5
6
|
import { createOAuthGuardStage, createOAuthStage } from "@plitzi/sdk-server/oauth";
|
|
6
|
-
|
|
7
|
+
// src/pipeline.ts
|
|
7
8
|
var buildMCPPipeline = (options = {}) => [
|
|
8
9
|
healthStage,
|
|
10
|
+
statsStage,
|
|
9
11
|
configStaticStage,
|
|
10
12
|
createWidgetProxyStage(options),
|
|
11
13
|
createOAuthStage(options.oauth),
|
|
@@ -25,5 +27,4 @@ var mcpExtensions = (options = {}) => ({ preAuth: [
|
|
|
25
27
|
createMcpStage(options),
|
|
26
28
|
previewStage
|
|
27
29
|
] });
|
|
28
|
-
//#endregion
|
|
29
30
|
export { buildMCPPipeline, mcpExtensions };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { PreviewRequestBody, PreviewResult } from '../modules/mcp/types';
|
|
2
|
+
import { SSRPageServerConfig, SSRTemplateFn } from '@plitzi/sdk-server';
|
|
2
3
|
import { PluginManager, ServerCaches } from '@plitzi/sdk-server/ssr';
|
|
3
|
-
import { SSRPageServerConfig, SSRTemplateFn } from '@plitzi/sdk-shared';
|
|
4
4
|
/** Build a preview of a page: apply any unsaved `operations` to a clone (never persisted), render the resulting
|
|
5
5
|
* draft to full HTML via the SSR pipeline, and stash the draft under a token so a browser can fetch the exact same
|
|
6
6
|
* render at `?__pt=<token>`. With no operations it previews persisted state.
|
|
@@ -3,7 +3,7 @@ import { findPageByRef, getPageElements } from "../modules/mcp/helpers/space.js"
|
|
|
3
3
|
import { draftBatch } from "../modules/mcp/tools/shared/draftBatch.js";
|
|
4
4
|
import { randomUUID } from "node:crypto";
|
|
5
5
|
import { buildBody } from "@plitzi/sdk-server/ssr";
|
|
6
|
-
|
|
6
|
+
// src/preview/createPreview.ts
|
|
7
7
|
var resolvePagePath = (schema, pageRef) => {
|
|
8
8
|
const pages = getPageElements(schema);
|
|
9
9
|
const page = pageRef ? findPageByRef(schema, pageRef) : pages.find((p) => p.attributes.default) ?? pages[0];
|
|
@@ -83,5 +83,4 @@ var createPreview = async (body, config, renderFn, pluginManager, caches) => {
|
|
|
83
83
|
...token ? { expiresInMs: ttlMs } : {}
|
|
84
84
|
};
|
|
85
85
|
};
|
|
86
|
-
//#endregion
|
|
87
86
|
export { createPreview };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** The draft-preview endpoint alone, for the page server that mounts it: `POST /__preview` applies unsaved operations
|
|
2
|
+
* to a copy of the draft and renders it.
|
|
3
|
+
*
|
|
4
|
+
* Import it as `@plitzi/sdk-mcp/preview`. The package root carries the MCP server too — its SDK, its tools, its
|
|
5
|
+
* resources — which a page server never runs; and what a preview itself needs (the operations, their lint, the
|
|
6
|
+
* render) is loaded by the first preview the process is asked for, not when it starts. */
|
|
7
|
+
export { previewStage } from './stages/preview';
|
package/dist/preview.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { previewStage } from "./stages/preview.js";
|
package/dist/render.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { renderGuideCore, renderGuideText, renderGuideTopicUri, renderGuideTopics } from "./modules/mcp/resources/renderGuide.js";
|
|
2
1
|
import { HOST_PAGE_REF, render, renderWidgetShape } from "./modules/mcp/tools/renderWidget.js";
|
|
2
|
+
import { renderGuideCore, renderGuideText, renderGuideTopicUri, renderGuideTopics } from "./modules/mcp/resources/renderGuide.js";
|
|
3
3
|
export { HOST_PAGE_REF as RENDER_ROOT_REF, render, renderGuideCore, renderGuideText, renderGuideTopicUri, renderGuideTopics, renderWidgetShape };
|
package/dist/server.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { createMcpServer } from "./modules/mcp/server.js";
|
|
2
|
+
import { createServer } from "./createServer.js";
|
|
3
|
+
import { buildMCPPipeline } from "./pipeline.js";
|
|
2
4
|
import { handleMcp, readMcpBody, serveMcp } from "./modules/mcp/handler.js";
|
|
3
5
|
import { createHttpPreviewClient } from "./modules/mcp/previewClient.js";
|
|
6
|
+
import { pluginCatalog, stringDeclarations } from "./modules/mcp/catalogs/pluginCatalog.js";
|
|
4
7
|
import { createHttpScreenshotClient } from "./modules/mcp/screenshotClient.js";
|
|
5
|
-
import { buildMCPPipeline } from "./pipeline.js";
|
|
6
|
-
import { createServer } from "./createServer.js";
|
|
7
8
|
import { createLocalScreenshotClient, resolveLocalBrowser } from "./modules/mcp/localScreenshotClient.js";
|
|
8
|
-
import { pluginCatalog, stringDeclarations } from "./modules/mcp/catalogs/pluginCatalog.js";
|
|
9
9
|
export { buildMCPPipeline, createHttpPreviewClient, createHttpScreenshotClient, createLocalScreenshotClient, createMcpServer, createServer, handleMcp, pluginCatalog, readMcpBody, resolveLocalBrowser, serveMcp, stringDeclarations };
|
package/dist/stages/mcp.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { McpOptions } from '../options';
|
|
2
|
-
import { Stage } from '@plitzi/sdk-
|
|
2
|
+
import { Stage } from '@plitzi/sdk-kernel/http';
|
|
3
3
|
export declare const createMcpStage: (options?: McpOptions) => Stage;
|
|
4
4
|
export declare const createMcpOnlyStage: (options?: McpOptions) => Stage;
|
package/dist/stages/mcp.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { requestProxy } from "../modules/mcp/proxy/config.js";
|
|
2
1
|
import { handleMcp } from "../modules/mcp/handler.js";
|
|
3
2
|
import { createHttpPreviewClient } from "../modules/mcp/previewClient.js";
|
|
3
|
+
import { requestProxy } from "../modules/mcp/proxy/config.js";
|
|
4
4
|
import { createHttpScreenshotClient } from "../modules/mcp/screenshotClient.js";
|
|
5
|
-
|
|
5
|
+
// src/stages/mcp.ts
|
|
6
6
|
var DEFAULT_PATH = "/mcp";
|
|
7
7
|
var serveMcp = async (ctx, options) => {
|
|
8
8
|
const { previewClient, screenshot } = options;
|
|
@@ -26,5 +26,4 @@ var createMcpOnlyStage = (options = {}) => async (ctx) => {
|
|
|
26
26
|
await serveMcp(ctx, options);
|
|
27
27
|
return true;
|
|
28
28
|
};
|
|
29
|
-
//#endregion
|
|
30
29
|
export { createMcpOnlyStage, createMcpStage };
|
package/dist/stages/preview.d.ts
CHANGED
package/dist/stages/preview.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { readRawBody } from "@plitzi/sdk-server/kernel";
|
|
1
|
+
import { readRawBody } from "@plitzi/sdk-kernel/http";
|
|
3
2
|
import { createHash, timingSafeEqual } from "node:crypto";
|
|
4
|
-
|
|
3
|
+
// src/stages/preview.ts
|
|
5
4
|
var PREVIEW_PATH_DEFAULT = "/__preview";
|
|
6
5
|
var digest = (value) => createHash("sha256").update(value).digest();
|
|
7
6
|
/**
|
|
@@ -63,8 +62,8 @@ var previewStage = async (ctx) => {
|
|
|
63
62
|
error: "BAD_REQUEST",
|
|
64
63
|
message: "revision must be a positive integer when given."
|
|
65
64
|
});
|
|
65
|
+
const { createPreview } = await import("../preview/createPreview.js");
|
|
66
66
|
const result = await createPreview(body, ctx.config, ctx.renderFn, ctx.pluginManager, ctx.caches);
|
|
67
67
|
return json(ctx, result.ok ? 200 : 422, result);
|
|
68
68
|
};
|
|
69
|
-
//#endregion
|
|
70
69
|
export { previewStage };
|
package/dist/stages/proxy.d.ts
CHANGED
package/dist/stages/proxy.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { proxySettings } from "../modules/mcp/proxy/config.js";
|
|
2
1
|
import { handleProxyRequest } from "../modules/mcp/proxy/handler.js";
|
|
3
|
-
|
|
2
|
+
import { proxySettings } from "../modules/mcp/proxy/config.js";
|
|
3
|
+
// src/stages/proxy.ts
|
|
4
4
|
var createWidgetProxyStage = (options = {}) => {
|
|
5
5
|
const settings = proxySettings(options.proxy);
|
|
6
6
|
return async (ctx) => {
|
|
@@ -10,5 +10,4 @@ var createWidgetProxyStage = (options = {}) => {
|
|
|
10
10
|
return true;
|
|
11
11
|
};
|
|
12
12
|
};
|
|
13
|
-
//#endregion
|
|
14
13
|
export { createWidgetProxyStage };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plitzi/sdk-mcp",
|
|
3
|
-
"version": "0.39.
|
|
3
|
+
"version": "0.39.2",
|
|
4
4
|
"license": "AGPL-3.0",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
@@ -27,6 +27,12 @@
|
|
|
27
27
|
"types": "./dist/render.d.ts",
|
|
28
28
|
"import": "./dist/render.js",
|
|
29
29
|
"default": "./dist/render.js"
|
|
30
|
+
},
|
|
31
|
+
"./preview": {
|
|
32
|
+
"@plitzi/source": "./src/preview.ts",
|
|
33
|
+
"types": "./dist/preview.d.ts",
|
|
34
|
+
"import": "./dist/preview.js",
|
|
35
|
+
"default": "./dist/preview.js"
|
|
30
36
|
}
|
|
31
37
|
},
|
|
32
38
|
"repository": {
|
|
@@ -40,13 +46,14 @@
|
|
|
40
46
|
"sideEffects": false,
|
|
41
47
|
"dependencies": {
|
|
42
48
|
"@modelcontextprotocol/ext-apps": "^1.7.5",
|
|
43
|
-
"@modelcontextprotocol/sdk": "^1.32.
|
|
44
|
-
"@plitzi/plitzi-sdk": "0.39.
|
|
45
|
-
"@plitzi/sdk-authoring": "0.39.
|
|
46
|
-
"@plitzi/sdk-
|
|
47
|
-
"@plitzi/sdk-
|
|
48
|
-
"@plitzi/sdk-
|
|
49
|
-
"@plitzi/sdk-
|
|
49
|
+
"@modelcontextprotocol/sdk": "^1.32.2",
|
|
50
|
+
"@plitzi/plitzi-sdk": "0.39.2",
|
|
51
|
+
"@plitzi/sdk-authoring": "0.39.2",
|
|
52
|
+
"@plitzi/sdk-kernel": "0.39.2",
|
|
53
|
+
"@plitzi/sdk-schema": "0.39.2",
|
|
54
|
+
"@plitzi/sdk-server": "0.39.2",
|
|
55
|
+
"@plitzi/sdk-shared": "0.39.2",
|
|
56
|
+
"@plitzi/sdk-style": "0.39.2",
|
|
50
57
|
"ejs": "^7.0.2",
|
|
51
58
|
"esbuild": "^0.28.2",
|
|
52
59
|
"zod": "^4.6.7"
|
|
@@ -58,20 +65,20 @@
|
|
|
58
65
|
"devDependencies": {
|
|
59
66
|
"@types/ejs": "^3.1.5",
|
|
60
67
|
"@types/jsdom": "^30.0.0",
|
|
61
|
-
"@types/node": "^26.6.
|
|
68
|
+
"@types/node": "^26.6.6",
|
|
62
69
|
"@types/react": "^19.3.0",
|
|
63
|
-
"@vitejs/plugin-react": "^6.
|
|
64
|
-
"@vitest/coverage-v8": "^5.0
|
|
70
|
+
"@vitejs/plugin-react": "^6.3.0",
|
|
71
|
+
"@vitest/coverage-v8": "^5.1.0",
|
|
65
72
|
"eslint": "^9.39.5",
|
|
66
73
|
"eslint-plugin-import": "^2.32.0",
|
|
67
|
-
"jsdom": "^
|
|
74
|
+
"jsdom": "^31.0.0",
|
|
68
75
|
"react": "^19.3.1",
|
|
69
76
|
"react-dom": "^19.3.1",
|
|
70
77
|
"tsx": "^4.23.15",
|
|
71
78
|
"typescript": "^6.0.3",
|
|
72
|
-
"vite": "^8.3.
|
|
79
|
+
"vite": "^8.3.7",
|
|
73
80
|
"vite-plugin-dts": "^5.1.2",
|
|
74
|
-
"vitest": "^5.0
|
|
81
|
+
"vitest": "^5.1.0"
|
|
75
82
|
},
|
|
76
83
|
"scripts": {
|
|
77
84
|
"start": "TSX_TSCONFIG_PATH=tsconfig.app.json node --import tsx dev/main.ts",
|
|
@@ -81,8 +88,8 @@
|
|
|
81
88
|
"inspector:legacy": "yarn dlx @modelcontextprotocol/inspector@1.0.1",
|
|
82
89
|
"build:dev": "vite build --mode development",
|
|
83
90
|
"build:prod": "vite build",
|
|
84
|
-
"lint": "TIMING=1 eslint ./src ./dev",
|
|
85
|
-
"typecheck": "tsc -p tsconfig.app.json --noEmit",
|
|
91
|
+
"lint": "TIMING=1 eslint --cache --cache-location .eslintcache --cache-strategy content ./src ./dev",
|
|
92
|
+
"typecheck": "tsc -p tsconfig.app.json --noEmit --incremental --tsBuildInfoFile .tsbuildinfo/app.tsbuildinfo",
|
|
86
93
|
"test": "vitest run",
|
|
87
94
|
"test:e2e": "vitest run src/modules/mcp/e2e",
|
|
88
95
|
"test:coverage": "vitest run --coverage",
|