@plitzi/sdk-server 0.32.15 → 0.32.17
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 +20 -0
- package/dist/adapters/jsonAdapters.js +2 -1
- package/dist/core/createServer.js +10 -2
- package/dist/core/http/stages/middlewares.js +3 -2
- package/dist/core/http/stages/pluginAssets.js +3 -2
- package/dist/core/http/stages/static.js +3 -2
- package/dist/core/requestParser.js +1 -1
- package/dist/core/server/{ssrServer.js → pageServer.js} +15 -6
- package/dist/core/services/registry.js +2 -2
- package/dist/helpers/cache/defaults.js +3 -3
- package/dist/helpers/serverLog.js +3 -3
- package/dist/index.js +1 -1
- package/dist/modules/mcp/apps/shared/shell.ejs +19 -2
- package/dist/modules/mcp/catalogs/cssCatalog/border.js +30 -0
- package/dist/modules/mcp/catalogs/cssCatalog/box.js +31 -0
- package/dist/modules/mcp/catalogs/cssCatalog/helpers.js +185 -0
- package/dist/modules/mcp/catalogs/cssCatalog/index.js +131 -0
- package/dist/modules/mcp/catalogs/cssCatalog/layout.js +98 -0
- package/dist/modules/mcp/catalogs/cssCatalog/visual.js +144 -0
- package/dist/modules/mcp/catalogs/registry.js +1 -1
- package/dist/modules/mcp/helpers/guide.js +23 -13
- package/dist/modules/mcp/helpers/space.js +1 -1
- package/dist/modules/mcp/resources/core.js +5 -2
- package/dist/modules/mcp/resources/primer.js +2 -1
- package/dist/modules/mcp/resources/register.js +6 -3
- package/dist/modules/mcp/resources/renderGuide.js +90 -10
- package/dist/modules/mcp/server.js +1 -1
- package/dist/modules/mcp/tools/operations/schema/interactions/upsertInteractionFlow.js +3 -2
- package/dist/modules/mcp/tools/operations/style/shared.js +2 -2
- package/dist/modules/mcp/tools/operations/style/write.js +2 -2
- package/dist/modules/mcp/tools/render.js +1 -1
- package/dist/modules/mcp/tools/shared/validator/audit.js +1 -4
- package/dist/modules/mcp/tools/shared/validator/css.js +3 -11
- package/dist/modules/mcp/tools/shared/validator/elements.js +4 -1
- package/dist/modules/mcp/tools/shared/validator/index.js +15 -15
- package/dist/modules/mcp/tools/shared/validator/interactions.js +1 -4
- package/dist/modules/oauth/authorize.js +2 -1
- package/dist/modules/oauth/metadata.js +15 -2
- package/dist/modules/oauth/records.js +1 -1
- package/dist/modules/oauth/token.js +2 -2
- package/dist/modules/ssr/registerExternalPlugins.js +1 -1
- package/dist/plugins/manager.js +1 -1
- package/dist/src/core/createServer.d.ts +9 -1
- package/dist/src/core/server/pageServer.d.ts +10 -0
- package/dist/src/core/services/registry.d.ts +1 -1
- package/dist/src/helpers/serverLog.d.ts +1 -1
- package/dist/src/modules/mcp/catalogs/cssCatalog/border.d.ts +4 -0
- package/dist/src/modules/mcp/catalogs/cssCatalog/box.d.ts +4 -0
- package/dist/src/modules/mcp/catalogs/cssCatalog/helpers.d.ts +34 -0
- package/dist/src/modules/mcp/catalogs/{cssCatalog.d.ts → cssCatalog/index.d.ts} +10 -5
- package/dist/src/modules/mcp/catalogs/cssCatalog/layout.d.ts +9 -0
- package/dist/src/modules/mcp/catalogs/cssCatalog/visual.d.ts +8 -0
- package/dist/src/modules/mcp/helpers/guide.d.ts +2 -2
- package/dist/src/modules/mcp/helpers/space.d.ts +1 -1
- package/dist/src/modules/mcp/resources/index.d.ts +1 -1
- package/dist/src/modules/mcp/tests/apply.test.d.ts +1 -0
- package/dist/src/modules/mcp/tests/bindings.test.d.ts +1 -0
- package/dist/src/modules/mcp/tests/css.test.d.ts +1 -0
- package/dist/src/modules/mcp/tests/helpers.d.ts +13 -0
- package/dist/src/modules/mcp/tests/interactions.test.d.ts +1 -0
- package/dist/src/modules/mcp/tests/pages.test.d.ts +1 -0
- package/dist/src/modules/mcp/tests/reads.test.d.ts +1 -0
- package/dist/src/modules/mcp/tests/search.test.d.ts +1 -0
- package/dist/src/modules/mcp/tests/styles.test.d.ts +1 -0
- package/dist/src/modules/mcp/tests/tools.test.d.ts +1 -0
- package/dist/src/modules/mcp/tests/validation.test.d.ts +1 -0
- package/dist/src/modules/mcp/tools/screenshot.d.ts +1 -1
- package/dist/src/modules/oauth/metadata.d.ts +14 -1
- package/package.json +10 -10
- package/dist/modules/mcp/catalogs/cssCatalog.js +0 -205
- package/dist/src/core/server/ssrServer.d.ts +0 -2
- /package/dist/src/modules/mcp/{mcp.test.d.ts → catalogs/cssCatalog/cssCatalog.test.d.ts} +0 -0
|
@@ -412,9 +412,9 @@ export declare const screenshotShape: {
|
|
|
412
412
|
name: z.ZodString;
|
|
413
413
|
}, z.core.$strip>], "type">>>;
|
|
414
414
|
viewport: z.ZodOptional<z.ZodEnum<{
|
|
415
|
+
both: "both";
|
|
415
416
|
desktop: "desktop";
|
|
416
417
|
mobile: "mobile";
|
|
417
|
-
both: "both";
|
|
418
418
|
}>>;
|
|
419
419
|
};
|
|
420
420
|
export declare const screenshotTool: import('.').ToolDef;
|
|
@@ -19,7 +19,20 @@ export declare const resourceMetadataUrl: (config: OAuthConfig, req: SSRRequest)
|
|
|
19
19
|
*
|
|
20
20
|
* `resource` echoes the path the document was asked for: Claude requires it to match the server URL the user
|
|
21
21
|
* typed, path included, and a dedicated MCP server answers JSON-RPC on every path — so `/.well-known/…/mcp`
|
|
22
|
-
* describes `https://host/mcp` while the bare path describes the origin.
|
|
22
|
+
* describes `https://host/mcp` while the bare path describes the origin.
|
|
23
|
+
*
|
|
24
|
+
* A server mounted at the ORIGIN is `https://host/`, WITH the trailing slash: a host parses the URL the user
|
|
25
|
+
* typed before it does anything with it, and an empty path renders as `/` — Claude's connector was observed
|
|
26
|
+
* asking for exactly `resource=https%3A%2F%2Fhost%2F`, so that is the form the document must claim.
|
|
27
|
+
*
|
|
28
|
+
* It does NOT make a bare-origin connector work, and nothing here can. Claude's remote-connector service will
|
|
29
|
+
* not open a session against an MCP endpoint whose URL has no path: the whole grant succeeds — discovery,
|
|
30
|
+
* registration, consent, a 200 from /token with the scope it asked for — and then it reports
|
|
31
|
+
* `McpAuthorizationError` ("the integration rejected the credentials it just issued") without ever presenting
|
|
32
|
+
* the bearer. Verified against the same deployment, minutes apart: at /mcp the token is followed by
|
|
33
|
+
* `initialize`, at / nothing follows it, in the ingress log as well as this server's. Claiming `https://host/mcp`
|
|
34
|
+
* from the bare document would only fail sooner — a client checks that the resource it is handed is no MORE
|
|
35
|
+
* specific than the URL it holds. Publish the connector URL WITH its path. */
|
|
23
36
|
export declare const protectedResourceMetadata: (config: OAuthConfig, req: SSRRequest) => Record<string, unknown>;
|
|
24
37
|
/** RFC 8414. Public clients with PKCE only: a desktop host stores no secret, so `none` is the sole endpoint auth
|
|
25
38
|
* method and S256 the sole challenge method. `offline_access` is advertised whenever refresh grants are issued,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plitzi/sdk-server",
|
|
3
|
-
"version": "0.32.
|
|
3
|
+
"version": "0.32.17",
|
|
4
4
|
"license": "AGPL-3.0",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist"
|
|
@@ -28,10 +28,10 @@
|
|
|
28
28
|
"sideEffects": false,
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@modelcontextprotocol/ext-apps": "^1.7.5",
|
|
31
|
-
"@modelcontextprotocol/sdk": "^1.
|
|
32
|
-
"@plitzi/plitzi-sdk": "0.32.
|
|
33
|
-
"@plitzi/sdk-schema": "0.32.
|
|
34
|
-
"@plitzi/sdk-shared": "0.32.
|
|
31
|
+
"@modelcontextprotocol/sdk": "^1.30.0",
|
|
32
|
+
"@plitzi/plitzi-sdk": "0.32.17",
|
|
33
|
+
"@plitzi/sdk-schema": "0.32.17",
|
|
34
|
+
"@plitzi/sdk-shared": "0.32.17",
|
|
35
35
|
"ejs": "^6.0.1",
|
|
36
36
|
"esbuild": "^0.28.1",
|
|
37
37
|
"zod": "^4.4.3"
|
|
@@ -43,18 +43,18 @@
|
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@types/ejs": "^3.1.5",
|
|
45
45
|
"@types/jsdom": "^28.0.3",
|
|
46
|
-
"@types/node": "^26.1.
|
|
47
|
-
"@types/react": "^19.2.
|
|
48
|
-
"@vitejs/plugin-react": "^6.0.
|
|
46
|
+
"@types/node": "^26.1.2",
|
|
47
|
+
"@types/react": "^19.2.18",
|
|
48
|
+
"@vitejs/plugin-react": "^6.0.5",
|
|
49
49
|
"@vitest/coverage-v8": "^4.1.10",
|
|
50
50
|
"eslint": "^9.39.5",
|
|
51
51
|
"eslint-plugin-import": "^2.32.0",
|
|
52
|
-
"jsdom": "^
|
|
52
|
+
"jsdom": "^30.0.1",
|
|
53
53
|
"react": "^19.2.8",
|
|
54
54
|
"react-dom": "^19.2.8",
|
|
55
55
|
"tsx": "^4.23.1",
|
|
56
56
|
"typescript": "^6.0.3",
|
|
57
|
-
"vite": "^8.
|
|
57
|
+
"vite": "^8.2.0",
|
|
58
58
|
"vite-plugin-dts": "^5.0.3",
|
|
59
59
|
"vitest": "^4.1.10"
|
|
60
60
|
},
|
|
@@ -1,205 +0,0 @@
|
|
|
1
|
-
import styleConstants from "@plitzi/sdk-shared/style/styleConstants";
|
|
2
|
-
//#region src/modules/mcp/catalogs/cssCatalog.ts
|
|
3
|
-
/** Every kebab-case CSS property Plitzi's style engine understands. Values written to a definition
|
|
4
|
-
* must use these exact keys — camelCase or unknown keys are rejected by the validator. */
|
|
5
|
-
var cssProperties = Array.from(new Set(Object.values(styleConstants))).sort();
|
|
6
|
-
var cssPropertySet = new Set(cssProperties);
|
|
7
|
-
var isCssProperty = (key) => cssPropertySet.has(key);
|
|
8
|
-
var toKebab = (key) => key.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
|
|
9
|
-
/** If a camelCase key maps to a known kebab-case property, return it — used to teach the agent the correct key. */
|
|
10
|
-
var suggestCssProperty = (key) => {
|
|
11
|
-
const kebab = toKebab(key);
|
|
12
|
-
return cssPropertySet.has(kebab) ? kebab : void 0;
|
|
13
|
-
};
|
|
14
|
-
var splitTokens = (value) => {
|
|
15
|
-
const tokens = [];
|
|
16
|
-
let depth = 0;
|
|
17
|
-
let current = "";
|
|
18
|
-
for (const ch of value.trim()) {
|
|
19
|
-
if (ch === "(") depth += 1;
|
|
20
|
-
else if (ch === ")") depth = Math.max(0, depth - 1);
|
|
21
|
-
if (/\s/.test(ch) && depth === 0) {
|
|
22
|
-
if (current) {
|
|
23
|
-
tokens.push(current);
|
|
24
|
-
current = "";
|
|
25
|
-
}
|
|
26
|
-
} else current += ch;
|
|
27
|
-
}
|
|
28
|
-
if (current) tokens.push(current);
|
|
29
|
-
return tokens;
|
|
30
|
-
};
|
|
31
|
-
var COMPOUND_SHORTHANDS = {
|
|
32
|
-
flex: [
|
|
33
|
-
"flex-grow",
|
|
34
|
-
"flex-shrink",
|
|
35
|
-
"flex-basis"
|
|
36
|
-
],
|
|
37
|
-
"flex-flow": ["flex-direction", "flex-wrap"],
|
|
38
|
-
background: [
|
|
39
|
-
"background-color",
|
|
40
|
-
"background-image",
|
|
41
|
-
"background-position",
|
|
42
|
-
"background-size",
|
|
43
|
-
"background-repeat"
|
|
44
|
-
],
|
|
45
|
-
font: [
|
|
46
|
-
"font-family",
|
|
47
|
-
"font-size",
|
|
48
|
-
"font-weight",
|
|
49
|
-
"line-height"
|
|
50
|
-
],
|
|
51
|
-
transition: [
|
|
52
|
-
"transition-property",
|
|
53
|
-
"transition-duration",
|
|
54
|
-
"transition-timing-function",
|
|
55
|
-
"transition-delay"
|
|
56
|
-
],
|
|
57
|
-
animation: [
|
|
58
|
-
"animation-name",
|
|
59
|
-
"animation-duration",
|
|
60
|
-
"animation-timing-function",
|
|
61
|
-
"animation-delay",
|
|
62
|
-
"animation-iteration-count"
|
|
63
|
-
],
|
|
64
|
-
grid: [
|
|
65
|
-
"grid-template-columns",
|
|
66
|
-
"grid-template-rows",
|
|
67
|
-
"grid-template-areas"
|
|
68
|
-
],
|
|
69
|
-
"grid-template": [
|
|
70
|
-
"grid-template-columns",
|
|
71
|
-
"grid-template-rows",
|
|
72
|
-
"grid-template-areas"
|
|
73
|
-
],
|
|
74
|
-
"grid-area": [
|
|
75
|
-
"grid-row-start",
|
|
76
|
-
"grid-column-start",
|
|
77
|
-
"grid-row-end",
|
|
78
|
-
"grid-column-end"
|
|
79
|
-
],
|
|
80
|
-
"place-content": ["align-content", "justify-content"],
|
|
81
|
-
"place-items": ["align-items", "justify-items"],
|
|
82
|
-
"place-self": ["align-self", "justify-self"],
|
|
83
|
-
"list-style": [
|
|
84
|
-
"list-style-type",
|
|
85
|
-
"list-style-position",
|
|
86
|
-
"list-style-image"
|
|
87
|
-
],
|
|
88
|
-
"text-decoration": [
|
|
89
|
-
"text-decoration-line",
|
|
90
|
-
"text-decoration-color",
|
|
91
|
-
"text-decoration-style"
|
|
92
|
-
],
|
|
93
|
-
outline: [
|
|
94
|
-
"outline-width",
|
|
95
|
-
"outline-style",
|
|
96
|
-
"outline-color"
|
|
97
|
-
],
|
|
98
|
-
columns: ["column-width", "column-count"],
|
|
99
|
-
overflow: ["overflow-x", "overflow-y"]
|
|
100
|
-
};
|
|
101
|
-
/** The atomic longhands to write instead of a compound shorthand, or undefined when the key is not a compound
|
|
102
|
-
* shorthand. `flex` layout in particular is NOT `display` + `flex-direction` (those are their own properties). */
|
|
103
|
-
var compoundLonghands = (key) => Object.hasOwn(COMPOUND_SHORTHANDS, key) ? COMPOUND_SHORTHANDS[key] : void 0;
|
|
104
|
-
var SIDES = [
|
|
105
|
-
"top",
|
|
106
|
-
"right",
|
|
107
|
-
"bottom",
|
|
108
|
-
"left"
|
|
109
|
-
];
|
|
110
|
-
var box4 = (tokens) => {
|
|
111
|
-
const [a, b = a, c = a, d = b] = tokens;
|
|
112
|
-
return [
|
|
113
|
-
a,
|
|
114
|
-
b,
|
|
115
|
-
c,
|
|
116
|
-
d
|
|
117
|
-
];
|
|
118
|
-
};
|
|
119
|
-
var radius4 = (tokens) => {
|
|
120
|
-
const [a, b = a, c = a, d = b] = tokens;
|
|
121
|
-
return [
|
|
122
|
-
a,
|
|
123
|
-
b,
|
|
124
|
-
c,
|
|
125
|
-
d
|
|
126
|
-
];
|
|
127
|
-
};
|
|
128
|
-
var BORDER_STYLES = /* @__PURE__ */ new Set([
|
|
129
|
-
"none",
|
|
130
|
-
"hidden",
|
|
131
|
-
"dotted",
|
|
132
|
-
"dashed",
|
|
133
|
-
"solid",
|
|
134
|
-
"double",
|
|
135
|
-
"groove",
|
|
136
|
-
"ridge",
|
|
137
|
-
"inset",
|
|
138
|
-
"outset"
|
|
139
|
-
]);
|
|
140
|
-
var BORDER_WIDTH_KEYWORDS = /* @__PURE__ */ new Set([
|
|
141
|
-
"thin",
|
|
142
|
-
"medium",
|
|
143
|
-
"thick"
|
|
144
|
-
]);
|
|
145
|
-
var LENGTH_RE = /^-?[\d.]+([a-z%]*)$/;
|
|
146
|
-
var classifyBorderToken = (token) => {
|
|
147
|
-
if (BORDER_STYLES.has(token)) return "style";
|
|
148
|
-
if (BORDER_WIDTH_KEYWORDS.has(token) || LENGTH_RE.test(token)) return "width";
|
|
149
|
-
return "color";
|
|
150
|
-
};
|
|
151
|
-
var expandBorder = (key, value, out) => {
|
|
152
|
-
const sides = key === "border" ? SIDES : [key.slice(7)];
|
|
153
|
-
for (const token of splitTokens(value)) {
|
|
154
|
-
const kind = classifyBorderToken(token);
|
|
155
|
-
for (const side of sides) out[`border-${side}-${kind}`] = token;
|
|
156
|
-
}
|
|
157
|
-
};
|
|
158
|
-
var BORDER_SIDE_KEYS = new Set(SIDES.map((s) => `border-${s}`));
|
|
159
|
-
var expandOne = (key, raw, out) => {
|
|
160
|
-
const value = String(raw);
|
|
161
|
-
if (key === "padding" || key === "margin" || key === "inset") {
|
|
162
|
-
const [t, r, b, l] = box4(splitTokens(value));
|
|
163
|
-
const prefix = key === "inset" ? "" : `${key}-`;
|
|
164
|
-
out[`${prefix}top`] = t;
|
|
165
|
-
out[`${prefix}right`] = r;
|
|
166
|
-
out[`${prefix}bottom`] = b;
|
|
167
|
-
out[`${prefix}left`] = l;
|
|
168
|
-
return true;
|
|
169
|
-
}
|
|
170
|
-
if (key === "border-radius" && !value.includes("/")) {
|
|
171
|
-
const [tl, tr, br, bl] = radius4(splitTokens(value));
|
|
172
|
-
const corners = [
|
|
173
|
-
["top-left", tl],
|
|
174
|
-
["top-right", tr],
|
|
175
|
-
["bottom-right", br],
|
|
176
|
-
["bottom-left", bl]
|
|
177
|
-
];
|
|
178
|
-
for (const [corner, v] of corners) out[`border-${corner}-radius`] = v;
|
|
179
|
-
return true;
|
|
180
|
-
}
|
|
181
|
-
if (key === "gap") {
|
|
182
|
-
const [row, col = row] = splitTokens(value);
|
|
183
|
-
out["row-gap"] = row;
|
|
184
|
-
out["column-gap"] = col;
|
|
185
|
-
return true;
|
|
186
|
-
}
|
|
187
|
-
if (key === "border" || BORDER_SIDE_KEYS.has(key)) {
|
|
188
|
-
expandBorder(key, value, out);
|
|
189
|
-
return true;
|
|
190
|
-
}
|
|
191
|
-
return false;
|
|
192
|
-
};
|
|
193
|
-
/** Expand supported CSS shorthands to their longhand keys. Explicit longhands in the same map win over any
|
|
194
|
-
* expansion (so `{ padding: 8, padding-left: 0 }` keeps padding-left: 0). Unrecognized keys pass through. */
|
|
195
|
-
var expandShorthand = (css) => {
|
|
196
|
-
const expanded = {};
|
|
197
|
-
const direct = {};
|
|
198
|
-
for (const [key, value] of Object.entries(css)) if (!expandOne(key, value, expanded)) direct[key] = value;
|
|
199
|
-
return {
|
|
200
|
-
...expanded,
|
|
201
|
-
...direct
|
|
202
|
-
};
|
|
203
|
-
};
|
|
204
|
-
//#endregion
|
|
205
|
-
export { COMPOUND_SHORTHANDS, compoundLonghands, cssProperties, expandShorthand, isCssProperty, suggestCssProperty };
|
|
File without changes
|