@shoppexio/mcp-theme-server 0.1.3 → 0.2.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.
- package/package.json +1 -1
- package/src/server.mjs +26 -21
package/package.json
CHANGED
package/src/server.mjs
CHANGED
|
@@ -22,7 +22,7 @@ function jsonContent(value) {
|
|
|
22
22
|
export function createThemeToolCatalog() {
|
|
23
23
|
return [
|
|
24
24
|
{
|
|
25
|
-
name: '
|
|
25
|
+
name: 'theme_inspect',
|
|
26
26
|
description: 'Inspect a Shoppex theme and return editable areas, sections, settings, design tokens, and constraints.',
|
|
27
27
|
inputSchema: {
|
|
28
28
|
theme_id: z.string().min(1),
|
|
@@ -30,7 +30,7 @@ export function createThemeToolCatalog() {
|
|
|
30
30
|
execute: ({ theme_id }, client) => client.inspectTheme(theme_id),
|
|
31
31
|
},
|
|
32
32
|
{
|
|
33
|
-
name: '
|
|
33
|
+
name: 'theme_diff',
|
|
34
34
|
description: 'Show changes between the current draft and the latest published theme snapshot.',
|
|
35
35
|
inputSchema: {
|
|
36
36
|
theme_id: z.string().min(1),
|
|
@@ -38,7 +38,7 @@ export function createThemeToolCatalog() {
|
|
|
38
38
|
execute: ({ theme_id }, client) => client.diffTheme(theme_id),
|
|
39
39
|
},
|
|
40
40
|
{
|
|
41
|
-
name: '
|
|
41
|
+
name: 'theme_read_file',
|
|
42
42
|
description: 'Read a single source file from a Shoppex theme.',
|
|
43
43
|
inputSchema: {
|
|
44
44
|
theme_id: z.string().min(1),
|
|
@@ -47,7 +47,7 @@ export function createThemeToolCatalog() {
|
|
|
47
47
|
execute: ({ theme_id, file_path }, client) => client.readThemeFile(theme_id, file_path),
|
|
48
48
|
},
|
|
49
49
|
{
|
|
50
|
-
name: '
|
|
50
|
+
name: 'theme_search_files',
|
|
51
51
|
description: 'Search theme files by path or content.',
|
|
52
52
|
inputSchema: {
|
|
53
53
|
theme_id: z.string().min(1),
|
|
@@ -57,7 +57,7 @@ export function createThemeToolCatalog() {
|
|
|
57
57
|
execute: ({ theme_id, query, limit }, client) => client.searchThemeFiles(theme_id, query, limit),
|
|
58
58
|
},
|
|
59
59
|
{
|
|
60
|
-
name: '
|
|
60
|
+
name: 'theme_apply',
|
|
61
61
|
description: 'Apply one or more text-file changes to a theme draft with server-side verification.',
|
|
62
62
|
inputSchema: {
|
|
63
63
|
theme_id: z.string().min(1),
|
|
@@ -75,7 +75,7 @@ export function createThemeToolCatalog() {
|
|
|
75
75
|
}),
|
|
76
76
|
},
|
|
77
77
|
{
|
|
78
|
-
name: '
|
|
78
|
+
name: 'theme_accept',
|
|
79
79
|
description: 'Accept an already generated draft patch from a dashboard-agent run.',
|
|
80
80
|
inputSchema: {
|
|
81
81
|
theme_id: z.string().min(1),
|
|
@@ -90,7 +90,7 @@ export function createThemeToolCatalog() {
|
|
|
90
90
|
}),
|
|
91
91
|
},
|
|
92
92
|
{
|
|
93
|
-
name: '
|
|
93
|
+
name: 'theme_create',
|
|
94
94
|
description: 'Create a new theme scaffold from a Shoppex base theme.',
|
|
95
95
|
inputSchema: {
|
|
96
96
|
base: z.enum(['default', 'classic', 'nebula', 'pulse', 'phantom', 'starlight']),
|
|
@@ -104,7 +104,7 @@ export function createThemeToolCatalog() {
|
|
|
104
104
|
}),
|
|
105
105
|
},
|
|
106
106
|
{
|
|
107
|
-
name: '
|
|
107
|
+
name: 'theme_create_section',
|
|
108
108
|
description: 'Scaffold a new theme section and wire it into theme.config.ts.',
|
|
109
109
|
inputSchema: {
|
|
110
110
|
theme_id: z.string().min(1),
|
|
@@ -119,7 +119,7 @@ export function createThemeToolCatalog() {
|
|
|
119
119
|
}),
|
|
120
120
|
},
|
|
121
121
|
{
|
|
122
|
-
name: '
|
|
122
|
+
name: 'theme_create_page',
|
|
123
123
|
description: 'Scaffold a new static page and wire its route into src/App.tsx.',
|
|
124
124
|
inputSchema: {
|
|
125
125
|
theme_id: z.string().min(1),
|
|
@@ -134,7 +134,7 @@ export function createThemeToolCatalog() {
|
|
|
134
134
|
}),
|
|
135
135
|
},
|
|
136
136
|
{
|
|
137
|
-
name: '
|
|
137
|
+
name: 'theme_update_config',
|
|
138
138
|
description: 'Extend theme.config.ts with a new settings field.',
|
|
139
139
|
inputSchema: {
|
|
140
140
|
theme_id: z.string().min(1),
|
|
@@ -149,7 +149,7 @@ export function createThemeToolCatalog() {
|
|
|
149
149
|
}),
|
|
150
150
|
},
|
|
151
151
|
{
|
|
152
|
-
name: '
|
|
152
|
+
name: 'theme_preview',
|
|
153
153
|
description: 'Start or reuse a live preview session for the current theme draft.',
|
|
154
154
|
inputSchema: {
|
|
155
155
|
theme_id: z.string().min(1),
|
|
@@ -157,7 +157,7 @@ export function createThemeToolCatalog() {
|
|
|
157
157
|
execute: ({ theme_id }, client) => client.startThemePreview(theme_id),
|
|
158
158
|
},
|
|
159
159
|
{
|
|
160
|
-
name: '
|
|
160
|
+
name: 'theme_stop_preview',
|
|
161
161
|
description: 'Stop a running live preview session.',
|
|
162
162
|
inputSchema: {
|
|
163
163
|
theme_id: z.string().min(1),
|
|
@@ -166,7 +166,7 @@ export function createThemeToolCatalog() {
|
|
|
166
166
|
execute: ({ theme_id, session_id }, client) => client.stopThemePreview(theme_id, session_id),
|
|
167
167
|
},
|
|
168
168
|
{
|
|
169
|
-
name: '
|
|
169
|
+
name: 'theme_publish',
|
|
170
170
|
description: 'Queue a publish/deploy for the current accepted theme draft.',
|
|
171
171
|
inputSchema: {
|
|
172
172
|
theme_id: z.string().min(1),
|
|
@@ -174,7 +174,7 @@ export function createThemeToolCatalog() {
|
|
|
174
174
|
execute: ({ theme_id }, client) => client.publishTheme(theme_id),
|
|
175
175
|
},
|
|
176
176
|
{
|
|
177
|
-
name: '
|
|
177
|
+
name: 'theme_publish_status',
|
|
178
178
|
description: 'Read the current publish job status.',
|
|
179
179
|
inputSchema: {
|
|
180
180
|
theme_id: z.string().min(1),
|
|
@@ -183,7 +183,7 @@ export function createThemeToolCatalog() {
|
|
|
183
183
|
execute: ({ theme_id, job_id }, client) => client.getThemePublishStatus(theme_id, job_id),
|
|
184
184
|
},
|
|
185
185
|
{
|
|
186
|
-
name: '
|
|
186
|
+
name: 'theme_validate',
|
|
187
187
|
description: 'Run a validation-only build and optional typecheck without publishing.',
|
|
188
188
|
inputSchema: {
|
|
189
189
|
theme_id: z.string().min(1),
|
|
@@ -194,7 +194,7 @@ export function createThemeToolCatalog() {
|
|
|
194
194
|
}),
|
|
195
195
|
},
|
|
196
196
|
{
|
|
197
|
-
name: '
|
|
197
|
+
name: 'theme_settings_get',
|
|
198
198
|
description: 'Read the current builder settings values for a theme.',
|
|
199
199
|
inputSchema: {
|
|
200
200
|
theme_id: z.string().min(1),
|
|
@@ -202,7 +202,7 @@ export function createThemeToolCatalog() {
|
|
|
202
202
|
execute: ({ theme_id }, client) => client.getThemeSettings(theme_id),
|
|
203
203
|
},
|
|
204
204
|
{
|
|
205
|
-
name: '
|
|
205
|
+
name: 'theme_settings_update',
|
|
206
206
|
description: 'Update theme builder settings without editing source files directly.',
|
|
207
207
|
inputSchema: {
|
|
208
208
|
theme_id: z.string().min(1),
|
|
@@ -213,7 +213,7 @@ export function createThemeToolCatalog() {
|
|
|
213
213
|
}),
|
|
214
214
|
},
|
|
215
215
|
{
|
|
216
|
-
name: '
|
|
216
|
+
name: 'theme_backups',
|
|
217
217
|
description: 'List available theme backups for rollback.',
|
|
218
218
|
inputSchema: {
|
|
219
219
|
theme_id: z.string().min(1),
|
|
@@ -221,7 +221,7 @@ export function createThemeToolCatalog() {
|
|
|
221
221
|
execute: ({ theme_id }, client) => client.listThemeBackups(theme_id),
|
|
222
222
|
},
|
|
223
223
|
{
|
|
224
|
-
name: '
|
|
224
|
+
name: 'theme_rollback',
|
|
225
225
|
description: 'Rollback a theme to a previous backup snapshot.',
|
|
226
226
|
inputSchema: {
|
|
227
227
|
theme_id: z.string().min(1),
|
|
@@ -230,7 +230,7 @@ export function createThemeToolCatalog() {
|
|
|
230
230
|
execute: ({ theme_id, backup_id }, client) => client.rollbackTheme(theme_id, backup_id),
|
|
231
231
|
},
|
|
232
232
|
{
|
|
233
|
-
name: '
|
|
233
|
+
name: 'theme_latest_run',
|
|
234
234
|
description: 'Read the latest dashboard-agent run metadata for a theme.',
|
|
235
235
|
inputSchema: {
|
|
236
236
|
theme_id: z.string().min(1),
|
|
@@ -240,8 +240,13 @@ export function createThemeToolCatalog() {
|
|
|
240
240
|
];
|
|
241
241
|
}
|
|
242
242
|
|
|
243
|
+
function normalizeToolName(name) {
|
|
244
|
+
return typeof name === 'string' ? name.replace(/\./g, '_') : name;
|
|
245
|
+
}
|
|
246
|
+
|
|
243
247
|
export async function executeThemeTool(toolName, args, client) {
|
|
244
|
-
const
|
|
248
|
+
const normalized = normalizeToolName(toolName);
|
|
249
|
+
const tool = createThemeToolCatalog().find((entry) => entry.name === normalized);
|
|
245
250
|
if (!tool) {
|
|
246
251
|
throw new Error(`Unknown tool: ${toolName}`);
|
|
247
252
|
}
|