@charisol/plexo-mcp 1.0.15 → 1.0.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/dist/appToolDefs.js +553 -0
- package/dist/appTools.js +24 -0
- package/dist/index.js +5 -0
- package/package.json +1 -1
- package/src/appToolDefs.ts +550 -0
- package/src/appTools.ts +29 -0
- package/src/index.ts +5 -0
|
@@ -0,0 +1,553 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.APP_TOOL_DEFS = void 0;
|
|
4
|
+
// Mirrors plexo-web lib/mcp/appTools.ts (the definitions only — every call is executed by
|
|
5
|
+
// plexo-web itself, see appTools.ts). Regenerate when that file changes.
|
|
6
|
+
exports.APP_TOOL_DEFS = [
|
|
7
|
+
{
|
|
8
|
+
"name": "create_app",
|
|
9
|
+
"description": "Creates a new full-stack React app (Vite + React + TypeScript + Tailwind + shadcn/ui-style components + React Router, with a Postgres database, sign-in, file storage and server functions built in). Use this whenever someone wants an app, tool, dashboard, portal, SaaS, marketplace, booking system, CRM, game or anything interactive — not for a simple marketing page. Returns the app id and its preview link. Next: read PLEXO.md (app_read_files) for the conventions, then write the app with app_write_files / app_edit_file, then app_build.",
|
|
10
|
+
"inputSchema": {
|
|
11
|
+
"type": "object",
|
|
12
|
+
"properties": {
|
|
13
|
+
"name": {
|
|
14
|
+
"type": "string",
|
|
15
|
+
"description": "Short, human name for the app (renameable later)."
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"required": [
|
|
19
|
+
"name"
|
|
20
|
+
]
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"name": "list_apps",
|
|
25
|
+
"description": "Lists this account's React apps with their preview links and whether they're published.",
|
|
26
|
+
"inputSchema": {
|
|
27
|
+
"type": "object",
|
|
28
|
+
"properties": {}
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"name": "app_status",
|
|
33
|
+
"description": "An app at a glance: preview and live links, domains, latest build, whether it's published, and its databases.",
|
|
34
|
+
"inputSchema": {
|
|
35
|
+
"type": "object",
|
|
36
|
+
"properties": {
|
|
37
|
+
"appId": {
|
|
38
|
+
"type": "string",
|
|
39
|
+
"description": "The app's id (from create_app or list_apps)."
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
"required": [
|
|
43
|
+
"appId"
|
|
44
|
+
]
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"name": "app_list_files",
|
|
49
|
+
"description": "Lists the app's files (paths and sizes). Optionally only those under a folder prefix like \"src/pages\".",
|
|
50
|
+
"inputSchema": {
|
|
51
|
+
"type": "object",
|
|
52
|
+
"properties": {
|
|
53
|
+
"appId": {
|
|
54
|
+
"type": "string",
|
|
55
|
+
"description": "The app's id (from create_app or list_apps)."
|
|
56
|
+
},
|
|
57
|
+
"prefix": {
|
|
58
|
+
"type": "string"
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
"required": [
|
|
62
|
+
"appId"
|
|
63
|
+
]
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
"name": "app_read_files",
|
|
68
|
+
"description": "Reads up to 30 files' contents. Always read a file before editing it.",
|
|
69
|
+
"inputSchema": {
|
|
70
|
+
"type": "object",
|
|
71
|
+
"properties": {
|
|
72
|
+
"appId": {
|
|
73
|
+
"type": "string",
|
|
74
|
+
"description": "The app's id (from create_app or list_apps)."
|
|
75
|
+
},
|
|
76
|
+
"paths": {
|
|
77
|
+
"type": "array",
|
|
78
|
+
"items": {
|
|
79
|
+
"type": "string"
|
|
80
|
+
},
|
|
81
|
+
"maxItems": 30
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
"required": [
|
|
85
|
+
"appId",
|
|
86
|
+
"paths"
|
|
87
|
+
]
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
"name": "app_write_files",
|
|
92
|
+
"description": "Creates or completely replaces files (up to 50 per call). Use for new files or full rewrites; for changing part of an existing file use app_edit_file instead (cheaper, and can't accidentally drop code). Paths are from the project root, e.g. src/pages/Dashboard.tsx, db/migrations/0002_tasks.sql, functions/send-invoice.ts. Changes aren't visible until app_build.",
|
|
93
|
+
"inputSchema": {
|
|
94
|
+
"type": "object",
|
|
95
|
+
"properties": {
|
|
96
|
+
"appId": {
|
|
97
|
+
"type": "string",
|
|
98
|
+
"description": "The app's id (from create_app or list_apps)."
|
|
99
|
+
},
|
|
100
|
+
"files": {
|
|
101
|
+
"type": "array",
|
|
102
|
+
"maxItems": 50,
|
|
103
|
+
"items": {
|
|
104
|
+
"type": "object",
|
|
105
|
+
"properties": {
|
|
106
|
+
"path": {
|
|
107
|
+
"type": "string"
|
|
108
|
+
},
|
|
109
|
+
"content": {
|
|
110
|
+
"type": "string"
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
"required": [
|
|
114
|
+
"path",
|
|
115
|
+
"content"
|
|
116
|
+
]
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
"required": [
|
|
121
|
+
"appId",
|
|
122
|
+
"files"
|
|
123
|
+
]
|
|
124
|
+
}
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
"name": "app_edit_file",
|
|
128
|
+
"description": "Changes part of one file with exact find/replace edits. Each `find` must match the file exactly (spaces and line breaks included) and exactly once — include a few surrounding lines to make it unique, or set all: true to replace every occurrence. Read the file first.",
|
|
129
|
+
"inputSchema": {
|
|
130
|
+
"type": "object",
|
|
131
|
+
"properties": {
|
|
132
|
+
"appId": {
|
|
133
|
+
"type": "string",
|
|
134
|
+
"description": "The app's id (from create_app or list_apps)."
|
|
135
|
+
},
|
|
136
|
+
"path": {
|
|
137
|
+
"type": "string"
|
|
138
|
+
},
|
|
139
|
+
"edits": {
|
|
140
|
+
"type": "array",
|
|
141
|
+
"items": {
|
|
142
|
+
"type": "object",
|
|
143
|
+
"properties": {
|
|
144
|
+
"find": {
|
|
145
|
+
"type": "string"
|
|
146
|
+
},
|
|
147
|
+
"replace": {
|
|
148
|
+
"type": "string"
|
|
149
|
+
},
|
|
150
|
+
"all": {
|
|
151
|
+
"type": "boolean"
|
|
152
|
+
}
|
|
153
|
+
},
|
|
154
|
+
"required": [
|
|
155
|
+
"find",
|
|
156
|
+
"replace"
|
|
157
|
+
]
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
},
|
|
161
|
+
"required": [
|
|
162
|
+
"appId",
|
|
163
|
+
"path",
|
|
164
|
+
"edits"
|
|
165
|
+
]
|
|
166
|
+
}
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
"name": "app_delete_files",
|
|
170
|
+
"description": "Deletes files (a folder path deletes everything under it). Undoable via app_restore_version.",
|
|
171
|
+
"inputSchema": {
|
|
172
|
+
"type": "object",
|
|
173
|
+
"properties": {
|
|
174
|
+
"appId": {
|
|
175
|
+
"type": "string",
|
|
176
|
+
"description": "The app's id (from create_app or list_apps)."
|
|
177
|
+
},
|
|
178
|
+
"paths": {
|
|
179
|
+
"type": "array",
|
|
180
|
+
"items": {
|
|
181
|
+
"type": "string"
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
},
|
|
185
|
+
"required": [
|
|
186
|
+
"appId",
|
|
187
|
+
"paths"
|
|
188
|
+
]
|
|
189
|
+
}
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
"name": "app_rename_file",
|
|
193
|
+
"description": "Renames or moves a file. Update its imports with app_edit_file afterwards.",
|
|
194
|
+
"inputSchema": {
|
|
195
|
+
"type": "object",
|
|
196
|
+
"properties": {
|
|
197
|
+
"appId": {
|
|
198
|
+
"type": "string",
|
|
199
|
+
"description": "The app's id (from create_app or list_apps)."
|
|
200
|
+
},
|
|
201
|
+
"from": {
|
|
202
|
+
"type": "string"
|
|
203
|
+
},
|
|
204
|
+
"to": {
|
|
205
|
+
"type": "string"
|
|
206
|
+
}
|
|
207
|
+
},
|
|
208
|
+
"required": [
|
|
209
|
+
"appId",
|
|
210
|
+
"from",
|
|
211
|
+
"to"
|
|
212
|
+
]
|
|
213
|
+
}
|
|
214
|
+
},
|
|
215
|
+
{
|
|
216
|
+
"name": "app_build",
|
|
217
|
+
"description": "Saves the current files as a version and builds the preview: compiles the app, type-checks it, applies new db/migrations to the preview database, and deploys server functions. Returns every problem with file:line and a hint. Fix ALL errors (and type problems) and build again until it's clean, then check it with app_screenshot. If it's still running when this returns, call app_build_status with the buildId.",
|
|
218
|
+
"inputSchema": {
|
|
219
|
+
"type": "object",
|
|
220
|
+
"properties": {
|
|
221
|
+
"appId": {
|
|
222
|
+
"type": "string",
|
|
223
|
+
"description": "The app's id (from create_app or list_apps)."
|
|
224
|
+
},
|
|
225
|
+
"message": {
|
|
226
|
+
"type": "string",
|
|
227
|
+
"description": "One line describing the change, for the version history."
|
|
228
|
+
}
|
|
229
|
+
},
|
|
230
|
+
"required": [
|
|
231
|
+
"appId"
|
|
232
|
+
]
|
|
233
|
+
}
|
|
234
|
+
},
|
|
235
|
+
{
|
|
236
|
+
"name": "app_build_status",
|
|
237
|
+
"description": "The result of a build or publish started earlier (when app_build/app_publish returned pending).",
|
|
238
|
+
"inputSchema": {
|
|
239
|
+
"type": "object",
|
|
240
|
+
"properties": {
|
|
241
|
+
"appId": {
|
|
242
|
+
"type": "string",
|
|
243
|
+
"description": "The app's id (from create_app or list_apps)."
|
|
244
|
+
},
|
|
245
|
+
"buildId": {
|
|
246
|
+
"type": "string"
|
|
247
|
+
}
|
|
248
|
+
},
|
|
249
|
+
"required": [
|
|
250
|
+
"appId",
|
|
251
|
+
"buildId"
|
|
252
|
+
]
|
|
253
|
+
}
|
|
254
|
+
},
|
|
255
|
+
{
|
|
256
|
+
"name": "app_screenshot",
|
|
257
|
+
"description": "Opens the app's preview in a real browser and returns a screenshot plus every error the page hit (console errors, crashes, failed requests). Use after every successful build to check the result actually looks and works right — on mobile too (viewport: mobile).",
|
|
258
|
+
"inputSchema": {
|
|
259
|
+
"type": "object",
|
|
260
|
+
"properties": {
|
|
261
|
+
"appId": {
|
|
262
|
+
"type": "string",
|
|
263
|
+
"description": "The app's id (from create_app or list_apps)."
|
|
264
|
+
},
|
|
265
|
+
"path": {
|
|
266
|
+
"type": "string",
|
|
267
|
+
"description": "Page to open, e.g. /dashboard (default /)."
|
|
268
|
+
},
|
|
269
|
+
"viewport": {
|
|
270
|
+
"type": "string",
|
|
271
|
+
"enum": [
|
|
272
|
+
"desktop",
|
|
273
|
+
"tablet",
|
|
274
|
+
"mobile"
|
|
275
|
+
],
|
|
276
|
+
"description": "desktop (default), tablet or mobile."
|
|
277
|
+
},
|
|
278
|
+
"fullPage": {
|
|
279
|
+
"type": "boolean",
|
|
280
|
+
"description": "Capture the whole scrolling page instead of the first screen."
|
|
281
|
+
}
|
|
282
|
+
},
|
|
283
|
+
"required": [
|
|
284
|
+
"appId"
|
|
285
|
+
]
|
|
286
|
+
}
|
|
287
|
+
},
|
|
288
|
+
{
|
|
289
|
+
"name": "app_runtime_errors",
|
|
290
|
+
"description": "Errors the app's preview reported recently while people (or the owner) used it — crashes, failed backend calls. Check this when the owner says something is broken.",
|
|
291
|
+
"inputSchema": {
|
|
292
|
+
"type": "object",
|
|
293
|
+
"properties": {
|
|
294
|
+
"appId": {
|
|
295
|
+
"type": "string",
|
|
296
|
+
"description": "The app's id (from create_app or list_apps)."
|
|
297
|
+
},
|
|
298
|
+
"minutes": {
|
|
299
|
+
"type": "number",
|
|
300
|
+
"description": "How far back (default 60)."
|
|
301
|
+
}
|
|
302
|
+
},
|
|
303
|
+
"required": [
|
|
304
|
+
"appId"
|
|
305
|
+
]
|
|
306
|
+
}
|
|
307
|
+
},
|
|
308
|
+
{
|
|
309
|
+
"name": "app_db_schema",
|
|
310
|
+
"description": "The app's database: tables, columns, relations, row-level-security policies, applied migrations, and security findings with fixes.",
|
|
311
|
+
"inputSchema": {
|
|
312
|
+
"type": "object",
|
|
313
|
+
"properties": {
|
|
314
|
+
"appId": {
|
|
315
|
+
"type": "string",
|
|
316
|
+
"description": "The app's id (from create_app or list_apps)."
|
|
317
|
+
},
|
|
318
|
+
"env": {
|
|
319
|
+
"type": "string",
|
|
320
|
+
"enum": [
|
|
321
|
+
"dev",
|
|
322
|
+
"live"
|
|
323
|
+
],
|
|
324
|
+
"description": "Which database: \"dev\" (the preview, default) or \"live\" (the published app)."
|
|
325
|
+
}
|
|
326
|
+
},
|
|
327
|
+
"required": [
|
|
328
|
+
"appId"
|
|
329
|
+
]
|
|
330
|
+
}
|
|
331
|
+
},
|
|
332
|
+
{
|
|
333
|
+
"name": "app_sql",
|
|
334
|
+
"description": "Runs SQL on the app's PREVIEW database as its owner (sees every row; new tables get row-level security on). For exploring data or quick fixes while developing. Lasting schema changes belong in a new db/migrations/NNNN_name.sql file instead, so they reach the live database on publish.",
|
|
335
|
+
"inputSchema": {
|
|
336
|
+
"type": "object",
|
|
337
|
+
"properties": {
|
|
338
|
+
"appId": {
|
|
339
|
+
"type": "string",
|
|
340
|
+
"description": "The app's id (from create_app or list_apps)."
|
|
341
|
+
},
|
|
342
|
+
"sql": {
|
|
343
|
+
"type": "string"
|
|
344
|
+
}
|
|
345
|
+
},
|
|
346
|
+
"required": [
|
|
347
|
+
"appId",
|
|
348
|
+
"sql"
|
|
349
|
+
]
|
|
350
|
+
}
|
|
351
|
+
},
|
|
352
|
+
{
|
|
353
|
+
"name": "app_design_describe",
|
|
354
|
+
"description": "Reads the app's visually designed pages (the Design tab, src/plexo-canvas): for each page its slug, name, address and its sections in order (id, kind, layout, a few words of what it says), plus the brand (colours, fonts, corners) and the catalog of every section kind with its layouts and the fields you can fill in, and the ready-made page templates. Call this before app_design_edit, and again after you change a page if you need fresh section ids. Pages marked codeEdited were changed in code — edit those with app_edit_file, not app_design_edit.",
|
|
355
|
+
"inputSchema": {
|
|
356
|
+
"type": "object",
|
|
357
|
+
"properties": {
|
|
358
|
+
"appId": {
|
|
359
|
+
"type": "string",
|
|
360
|
+
"description": "The app's id (from create_app or list_apps)."
|
|
361
|
+
}
|
|
362
|
+
},
|
|
363
|
+
"required": [
|
|
364
|
+
"appId"
|
|
365
|
+
]
|
|
366
|
+
}
|
|
367
|
+
},
|
|
368
|
+
{
|
|
369
|
+
"name": "app_design_edit",
|
|
370
|
+
"description": "Changes designed pages section by section — the right way to edit a page built in the Design tab, instead of editing its generated .tsx. Pass commands, each one of: {op:\"addSection\", pageId, kind, variant?, content?, style?, afterSectionId? | index?} · {op:\"updateSection\", sectionId, content?, variant?, style?} · {op:\"removeSection\", sectionId} · {op:\"moveSection\", sectionId, index? | afterSectionId?} · {op:\"duplicateSection\", sectionId} · {op:\"setBrand\", tokens:{primaryColor?, secondaryColor?, headingFont?, bodyFont?, neutrals? (cool|warm|dark), roundness? (sharp|soft|round)}} · {op:\"addPage\", name, templateId?} (templateId from the catalog: home, landing, about, services, contact, pricing, blank — gives a complete, filled-in page) · {op:\"renamePage\", pageId, name}. pageId is the page's slug from app_design_describe; sectionId is a section id from it. Content keys are the field paths from the catalog (\"headline\", \"items.0.title\"); a list field needs the whole list; write real copy for the business. Each command is checked on its own — good ones are saved, bad ones come back with a plain-English reason, so read results. slug (optional) is the page you're working on: an addSection without a pageId goes there. A page that was edited in code is not changed (the reply says so); only pass overwrite: true if the owner chose to replace their code edits. Saving regenerates the page's React code and its route. Run app_build afterwards, then app_screenshot.",
|
|
371
|
+
"inputSchema": {
|
|
372
|
+
"type": "object",
|
|
373
|
+
"properties": {
|
|
374
|
+
"appId": {
|
|
375
|
+
"type": "string",
|
|
376
|
+
"description": "The app's id (from create_app or list_apps)."
|
|
377
|
+
},
|
|
378
|
+
"slug": {
|
|
379
|
+
"type": "string",
|
|
380
|
+
"description": "The designed page being edited (from app_design_describe)."
|
|
381
|
+
},
|
|
382
|
+
"commands": {
|
|
383
|
+
"type": "array",
|
|
384
|
+
"maxItems": 40,
|
|
385
|
+
"items": {
|
|
386
|
+
"type": "object",
|
|
387
|
+
"properties": {
|
|
388
|
+
"op": {
|
|
389
|
+
"type": "string"
|
|
390
|
+
}
|
|
391
|
+
},
|
|
392
|
+
"required": [
|
|
393
|
+
"op"
|
|
394
|
+
],
|
|
395
|
+
"additionalProperties": true
|
|
396
|
+
}
|
|
397
|
+
},
|
|
398
|
+
"overwrite": {
|
|
399
|
+
"type": "boolean",
|
|
400
|
+
"description": "Replace hand edits made to the page's code. Only when the owner asked for it."
|
|
401
|
+
}
|
|
402
|
+
},
|
|
403
|
+
"required": [
|
|
404
|
+
"appId",
|
|
405
|
+
"commands"
|
|
406
|
+
]
|
|
407
|
+
}
|
|
408
|
+
},
|
|
409
|
+
{
|
|
410
|
+
"name": "app_publish",
|
|
411
|
+
"description": "Publishes the app: a clean release build, then the live database gets new migrations, server functions are deployed, and the live site switches over. The first publish gives it an address (subdomain picked from the app's name unless given). Only after the preview builds cleanly and the owner wants it live.",
|
|
412
|
+
"inputSchema": {
|
|
413
|
+
"type": "object",
|
|
414
|
+
"properties": {
|
|
415
|
+
"appId": {
|
|
416
|
+
"type": "string",
|
|
417
|
+
"description": "The app's id (from create_app or list_apps)."
|
|
418
|
+
},
|
|
419
|
+
"subdomain": {
|
|
420
|
+
"type": "string",
|
|
421
|
+
"description": "Optional, e.g. \"acme-crm\" → acme-crm.<pages domain>."
|
|
422
|
+
}
|
|
423
|
+
},
|
|
424
|
+
"required": [
|
|
425
|
+
"appId"
|
|
426
|
+
]
|
|
427
|
+
}
|
|
428
|
+
},
|
|
429
|
+
{
|
|
430
|
+
"name": "app_versions",
|
|
431
|
+
"description": "The app's version history (every build and save), newest first.",
|
|
432
|
+
"inputSchema": {
|
|
433
|
+
"type": "object",
|
|
434
|
+
"properties": {
|
|
435
|
+
"appId": {
|
|
436
|
+
"type": "string",
|
|
437
|
+
"description": "The app's id (from create_app or list_apps)."
|
|
438
|
+
}
|
|
439
|
+
},
|
|
440
|
+
"required": [
|
|
441
|
+
"appId"
|
|
442
|
+
]
|
|
443
|
+
}
|
|
444
|
+
},
|
|
445
|
+
{
|
|
446
|
+
"name": "app_restore_version",
|
|
447
|
+
"description": "Puts the app's files back to an earlier version (recorded as a new version, so it's undoable) and rebuilds the preview. The live app changes only on the next publish.",
|
|
448
|
+
"inputSchema": {
|
|
449
|
+
"type": "object",
|
|
450
|
+
"properties": {
|
|
451
|
+
"appId": {
|
|
452
|
+
"type": "string",
|
|
453
|
+
"description": "The app's id (from create_app or list_apps)."
|
|
454
|
+
},
|
|
455
|
+
"versionId": {
|
|
456
|
+
"type": "string"
|
|
457
|
+
}
|
|
458
|
+
},
|
|
459
|
+
"required": [
|
|
460
|
+
"appId",
|
|
461
|
+
"versionId"
|
|
462
|
+
]
|
|
463
|
+
}
|
|
464
|
+
},
|
|
465
|
+
{
|
|
466
|
+
"name": "app_request_secret",
|
|
467
|
+
"description": "Asks the owner to add a secret (an API key a server function needs, e.g. STRIPE_SECRET_KEY). Never ask for a secret's value in chat — this shows them where to paste it safely. Returns which secrets already exist.",
|
|
468
|
+
"inputSchema": {
|
|
469
|
+
"type": "object",
|
|
470
|
+
"properties": {
|
|
471
|
+
"appId": {
|
|
472
|
+
"type": "string",
|
|
473
|
+
"description": "The app's id (from create_app or list_apps)."
|
|
474
|
+
},
|
|
475
|
+
"name": {
|
|
476
|
+
"type": "string",
|
|
477
|
+
"description": "UPPER_SNAKE_CASE, e.g. OPENAI_API_KEY."
|
|
478
|
+
},
|
|
479
|
+
"why": {
|
|
480
|
+
"type": "string",
|
|
481
|
+
"description": "One line: what it's for and where to get it."
|
|
482
|
+
}
|
|
483
|
+
},
|
|
484
|
+
"required": [
|
|
485
|
+
"appId",
|
|
486
|
+
"name",
|
|
487
|
+
"why"
|
|
488
|
+
]
|
|
489
|
+
}
|
|
490
|
+
},
|
|
491
|
+
{
|
|
492
|
+
"name": "app_function_logs",
|
|
493
|
+
"description": "Recent logs (console output and errors) of one of the app's server functions.",
|
|
494
|
+
"inputSchema": {
|
|
495
|
+
"type": "object",
|
|
496
|
+
"properties": {
|
|
497
|
+
"appId": {
|
|
498
|
+
"type": "string",
|
|
499
|
+
"description": "The app's id (from create_app or list_apps)."
|
|
500
|
+
},
|
|
501
|
+
"name": {
|
|
502
|
+
"type": "string"
|
|
503
|
+
},
|
|
504
|
+
"env": {
|
|
505
|
+
"type": "string",
|
|
506
|
+
"enum": [
|
|
507
|
+
"dev",
|
|
508
|
+
"live"
|
|
509
|
+
],
|
|
510
|
+
"description": "Which database: \"dev\" (the preview, default) or \"live\" (the published app)."
|
|
511
|
+
},
|
|
512
|
+
"minutes": {
|
|
513
|
+
"type": "number"
|
|
514
|
+
}
|
|
515
|
+
},
|
|
516
|
+
"required": [
|
|
517
|
+
"appId",
|
|
518
|
+
"name"
|
|
519
|
+
]
|
|
520
|
+
}
|
|
521
|
+
},
|
|
522
|
+
{
|
|
523
|
+
"name": "app_update_auth_settings",
|
|
524
|
+
"description": "Turns the app's sign-in methods on or off (password, magic link, Google), requires email confirmation, or closes sign-ups (invite-only). Google sign-in works without any setup.",
|
|
525
|
+
"inputSchema": {
|
|
526
|
+
"type": "object",
|
|
527
|
+
"properties": {
|
|
528
|
+
"appId": {
|
|
529
|
+
"type": "string",
|
|
530
|
+
"description": "The app's id (from create_app or list_apps)."
|
|
531
|
+
},
|
|
532
|
+
"password": {
|
|
533
|
+
"type": "boolean"
|
|
534
|
+
},
|
|
535
|
+
"magicLink": {
|
|
536
|
+
"type": "boolean"
|
|
537
|
+
},
|
|
538
|
+
"google": {
|
|
539
|
+
"type": "boolean"
|
|
540
|
+
},
|
|
541
|
+
"requireEmailConfirmation": {
|
|
542
|
+
"type": "boolean"
|
|
543
|
+
},
|
|
544
|
+
"allowSignups": {
|
|
545
|
+
"type": "boolean"
|
|
546
|
+
}
|
|
547
|
+
},
|
|
548
|
+
"required": [
|
|
549
|
+
"appId"
|
|
550
|
+
]
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
];
|
package/dist/appTools.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.APP_TOOL_NAMES = exports.APP_TOOL_DEFS = void 0;
|
|
4
|
+
exports.callHostedAppTool = callHostedAppTool;
|
|
5
|
+
const config_js_1 = require("./config.js");
|
|
6
|
+
const appToolDefs_js_1 = require("./appToolDefs.js");
|
|
7
|
+
Object.defineProperty(exports, "APP_TOOL_DEFS", { enumerable: true, get: function () { return appToolDefs_js_1.APP_TOOL_DEFS; } });
|
|
8
|
+
exports.APP_TOOL_NAMES = new Set(appToolDefs_js_1.APP_TOOL_DEFS.map((t) => t.name));
|
|
9
|
+
async function callHostedAppTool(name, args) {
|
|
10
|
+
const config = (0, config_js_1.getConfig)();
|
|
11
|
+
if (!config.apiKey) {
|
|
12
|
+
throw new Error(`Authentication Required: set PLEXO_API_KEY (log in at ${config.baseUrl.replace(/\/$/, "")}/mcp/login to get one).`);
|
|
13
|
+
}
|
|
14
|
+
const res = await fetch(`${config.baseUrl.replace(/\/$/, "")}/api/v1/mcp`, {
|
|
15
|
+
method: "POST",
|
|
16
|
+
headers: { "Content-Type": "application/json", Authorization: `Bearer ${config.apiKey}`, "User-Agent": "Plexo-MCP-Server/1.0" },
|
|
17
|
+
body: JSON.stringify({ jsonrpc: "2.0", id: Date.now(), method: "tools/call", params: { name, arguments: args ?? {} } }),
|
|
18
|
+
});
|
|
19
|
+
const data = (await res.json().catch(() => null));
|
|
20
|
+
if (!res.ok || !data?.result) {
|
|
21
|
+
throw new Error(data?.error?.message ?? `Plexo couldn't run ${name} (status ${res.status}).`);
|
|
22
|
+
}
|
|
23
|
+
return data.result;
|
|
24
|
+
}
|
package/dist/index.js
CHANGED
|
@@ -11,6 +11,7 @@ const lmsTools_js_1 = require("./lmsTools.js");
|
|
|
11
11
|
const donationTools_js_1 = require("./donationTools.js");
|
|
12
12
|
const wpMigrationTools_js_1 = require("./wpMigrationTools.js");
|
|
13
13
|
const formTools_js_1 = require("./formTools.js");
|
|
14
|
+
const appTools_js_1 = require("./appTools.js");
|
|
14
15
|
const server = new index_js_1.Server({
|
|
15
16
|
name: "plexo-mcp",
|
|
16
17
|
version: "1.0.0",
|
|
@@ -649,6 +650,7 @@ To edit a page's CONTENT (designJson), use update_template with the same templat
|
|
|
649
650
|
...donationTools_js_1.DONATION_TOOL_DEFS,
|
|
650
651
|
...wpMigrationTools_js_1.WP_MIGRATION_TOOL_DEFS,
|
|
651
652
|
...formTools_js_1.FORM_TOOL_DEFS,
|
|
653
|
+
...appTools_js_1.APP_TOOL_DEFS,
|
|
652
654
|
],
|
|
653
655
|
};
|
|
654
656
|
});
|
|
@@ -925,6 +927,9 @@ server.setRequestHandler(types_js_1.CallToolRequestSchema, async (request) => {
|
|
|
925
927
|
],
|
|
926
928
|
};
|
|
927
929
|
}
|
|
930
|
+
if (appTools_js_1.APP_TOOL_NAMES.has(name)) {
|
|
931
|
+
return await (0, appTools_js_1.callHostedAppTool)(name, args);
|
|
932
|
+
}
|
|
928
933
|
for (const [names, handler] of [
|
|
929
934
|
[donationTools_js_1.DONATION_TOOL_NAMES, donationTools_js_1.handleDonationToolCall],
|
|
930
935
|
[wpMigrationTools_js_1.WP_MIGRATION_TOOL_NAMES, wpMigrationTools_js_1.handleWpMigrationToolCall],
|
package/package.json
CHANGED
|
@@ -0,0 +1,550 @@
|
|
|
1
|
+
// Mirrors plexo-web lib/mcp/appTools.ts (the definitions only — every call is executed by
|
|
2
|
+
// plexo-web itself, see appTools.ts). Regenerate when that file changes.
|
|
3
|
+
export const APP_TOOL_DEFS = [
|
|
4
|
+
{
|
|
5
|
+
"name": "create_app",
|
|
6
|
+
"description": "Creates a new full-stack React app (Vite + React + TypeScript + Tailwind + shadcn/ui-style components + React Router, with a Postgres database, sign-in, file storage and server functions built in). Use this whenever someone wants an app, tool, dashboard, portal, SaaS, marketplace, booking system, CRM, game or anything interactive — not for a simple marketing page. Returns the app id and its preview link. Next: read PLEXO.md (app_read_files) for the conventions, then write the app with app_write_files / app_edit_file, then app_build.",
|
|
7
|
+
"inputSchema": {
|
|
8
|
+
"type": "object",
|
|
9
|
+
"properties": {
|
|
10
|
+
"name": {
|
|
11
|
+
"type": "string",
|
|
12
|
+
"description": "Short, human name for the app (renameable later)."
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"required": [
|
|
16
|
+
"name"
|
|
17
|
+
]
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"name": "list_apps",
|
|
22
|
+
"description": "Lists this account's React apps with their preview links and whether they're published.",
|
|
23
|
+
"inputSchema": {
|
|
24
|
+
"type": "object",
|
|
25
|
+
"properties": {}
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"name": "app_status",
|
|
30
|
+
"description": "An app at a glance: preview and live links, domains, latest build, whether it's published, and its databases.",
|
|
31
|
+
"inputSchema": {
|
|
32
|
+
"type": "object",
|
|
33
|
+
"properties": {
|
|
34
|
+
"appId": {
|
|
35
|
+
"type": "string",
|
|
36
|
+
"description": "The app's id (from create_app or list_apps)."
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
"required": [
|
|
40
|
+
"appId"
|
|
41
|
+
]
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
"name": "app_list_files",
|
|
46
|
+
"description": "Lists the app's files (paths and sizes). Optionally only those under a folder prefix like \"src/pages\".",
|
|
47
|
+
"inputSchema": {
|
|
48
|
+
"type": "object",
|
|
49
|
+
"properties": {
|
|
50
|
+
"appId": {
|
|
51
|
+
"type": "string",
|
|
52
|
+
"description": "The app's id (from create_app or list_apps)."
|
|
53
|
+
},
|
|
54
|
+
"prefix": {
|
|
55
|
+
"type": "string"
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
"required": [
|
|
59
|
+
"appId"
|
|
60
|
+
]
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
"name": "app_read_files",
|
|
65
|
+
"description": "Reads up to 30 files' contents. Always read a file before editing it.",
|
|
66
|
+
"inputSchema": {
|
|
67
|
+
"type": "object",
|
|
68
|
+
"properties": {
|
|
69
|
+
"appId": {
|
|
70
|
+
"type": "string",
|
|
71
|
+
"description": "The app's id (from create_app or list_apps)."
|
|
72
|
+
},
|
|
73
|
+
"paths": {
|
|
74
|
+
"type": "array",
|
|
75
|
+
"items": {
|
|
76
|
+
"type": "string"
|
|
77
|
+
},
|
|
78
|
+
"maxItems": 30
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
"required": [
|
|
82
|
+
"appId",
|
|
83
|
+
"paths"
|
|
84
|
+
]
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
"name": "app_write_files",
|
|
89
|
+
"description": "Creates or completely replaces files (up to 50 per call). Use for new files or full rewrites; for changing part of an existing file use app_edit_file instead (cheaper, and can't accidentally drop code). Paths are from the project root, e.g. src/pages/Dashboard.tsx, db/migrations/0002_tasks.sql, functions/send-invoice.ts. Changes aren't visible until app_build.",
|
|
90
|
+
"inputSchema": {
|
|
91
|
+
"type": "object",
|
|
92
|
+
"properties": {
|
|
93
|
+
"appId": {
|
|
94
|
+
"type": "string",
|
|
95
|
+
"description": "The app's id (from create_app or list_apps)."
|
|
96
|
+
},
|
|
97
|
+
"files": {
|
|
98
|
+
"type": "array",
|
|
99
|
+
"maxItems": 50,
|
|
100
|
+
"items": {
|
|
101
|
+
"type": "object",
|
|
102
|
+
"properties": {
|
|
103
|
+
"path": {
|
|
104
|
+
"type": "string"
|
|
105
|
+
},
|
|
106
|
+
"content": {
|
|
107
|
+
"type": "string"
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
"required": [
|
|
111
|
+
"path",
|
|
112
|
+
"content"
|
|
113
|
+
]
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
},
|
|
117
|
+
"required": [
|
|
118
|
+
"appId",
|
|
119
|
+
"files"
|
|
120
|
+
]
|
|
121
|
+
}
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
"name": "app_edit_file",
|
|
125
|
+
"description": "Changes part of one file with exact find/replace edits. Each `find` must match the file exactly (spaces and line breaks included) and exactly once — include a few surrounding lines to make it unique, or set all: true to replace every occurrence. Read the file first.",
|
|
126
|
+
"inputSchema": {
|
|
127
|
+
"type": "object",
|
|
128
|
+
"properties": {
|
|
129
|
+
"appId": {
|
|
130
|
+
"type": "string",
|
|
131
|
+
"description": "The app's id (from create_app or list_apps)."
|
|
132
|
+
},
|
|
133
|
+
"path": {
|
|
134
|
+
"type": "string"
|
|
135
|
+
},
|
|
136
|
+
"edits": {
|
|
137
|
+
"type": "array",
|
|
138
|
+
"items": {
|
|
139
|
+
"type": "object",
|
|
140
|
+
"properties": {
|
|
141
|
+
"find": {
|
|
142
|
+
"type": "string"
|
|
143
|
+
},
|
|
144
|
+
"replace": {
|
|
145
|
+
"type": "string"
|
|
146
|
+
},
|
|
147
|
+
"all": {
|
|
148
|
+
"type": "boolean"
|
|
149
|
+
}
|
|
150
|
+
},
|
|
151
|
+
"required": [
|
|
152
|
+
"find",
|
|
153
|
+
"replace"
|
|
154
|
+
]
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
},
|
|
158
|
+
"required": [
|
|
159
|
+
"appId",
|
|
160
|
+
"path",
|
|
161
|
+
"edits"
|
|
162
|
+
]
|
|
163
|
+
}
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
"name": "app_delete_files",
|
|
167
|
+
"description": "Deletes files (a folder path deletes everything under it). Undoable via app_restore_version.",
|
|
168
|
+
"inputSchema": {
|
|
169
|
+
"type": "object",
|
|
170
|
+
"properties": {
|
|
171
|
+
"appId": {
|
|
172
|
+
"type": "string",
|
|
173
|
+
"description": "The app's id (from create_app or list_apps)."
|
|
174
|
+
},
|
|
175
|
+
"paths": {
|
|
176
|
+
"type": "array",
|
|
177
|
+
"items": {
|
|
178
|
+
"type": "string"
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
},
|
|
182
|
+
"required": [
|
|
183
|
+
"appId",
|
|
184
|
+
"paths"
|
|
185
|
+
]
|
|
186
|
+
}
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
"name": "app_rename_file",
|
|
190
|
+
"description": "Renames or moves a file. Update its imports with app_edit_file afterwards.",
|
|
191
|
+
"inputSchema": {
|
|
192
|
+
"type": "object",
|
|
193
|
+
"properties": {
|
|
194
|
+
"appId": {
|
|
195
|
+
"type": "string",
|
|
196
|
+
"description": "The app's id (from create_app or list_apps)."
|
|
197
|
+
},
|
|
198
|
+
"from": {
|
|
199
|
+
"type": "string"
|
|
200
|
+
},
|
|
201
|
+
"to": {
|
|
202
|
+
"type": "string"
|
|
203
|
+
}
|
|
204
|
+
},
|
|
205
|
+
"required": [
|
|
206
|
+
"appId",
|
|
207
|
+
"from",
|
|
208
|
+
"to"
|
|
209
|
+
]
|
|
210
|
+
}
|
|
211
|
+
},
|
|
212
|
+
{
|
|
213
|
+
"name": "app_build",
|
|
214
|
+
"description": "Saves the current files as a version and builds the preview: compiles the app, type-checks it, applies new db/migrations to the preview database, and deploys server functions. Returns every problem with file:line and a hint. Fix ALL errors (and type problems) and build again until it's clean, then check it with app_screenshot. If it's still running when this returns, call app_build_status with the buildId.",
|
|
215
|
+
"inputSchema": {
|
|
216
|
+
"type": "object",
|
|
217
|
+
"properties": {
|
|
218
|
+
"appId": {
|
|
219
|
+
"type": "string",
|
|
220
|
+
"description": "The app's id (from create_app or list_apps)."
|
|
221
|
+
},
|
|
222
|
+
"message": {
|
|
223
|
+
"type": "string",
|
|
224
|
+
"description": "One line describing the change, for the version history."
|
|
225
|
+
}
|
|
226
|
+
},
|
|
227
|
+
"required": [
|
|
228
|
+
"appId"
|
|
229
|
+
]
|
|
230
|
+
}
|
|
231
|
+
},
|
|
232
|
+
{
|
|
233
|
+
"name": "app_build_status",
|
|
234
|
+
"description": "The result of a build or publish started earlier (when app_build/app_publish returned pending).",
|
|
235
|
+
"inputSchema": {
|
|
236
|
+
"type": "object",
|
|
237
|
+
"properties": {
|
|
238
|
+
"appId": {
|
|
239
|
+
"type": "string",
|
|
240
|
+
"description": "The app's id (from create_app or list_apps)."
|
|
241
|
+
},
|
|
242
|
+
"buildId": {
|
|
243
|
+
"type": "string"
|
|
244
|
+
}
|
|
245
|
+
},
|
|
246
|
+
"required": [
|
|
247
|
+
"appId",
|
|
248
|
+
"buildId"
|
|
249
|
+
]
|
|
250
|
+
}
|
|
251
|
+
},
|
|
252
|
+
{
|
|
253
|
+
"name": "app_screenshot",
|
|
254
|
+
"description": "Opens the app's preview in a real browser and returns a screenshot plus every error the page hit (console errors, crashes, failed requests). Use after every successful build to check the result actually looks and works right — on mobile too (viewport: mobile).",
|
|
255
|
+
"inputSchema": {
|
|
256
|
+
"type": "object",
|
|
257
|
+
"properties": {
|
|
258
|
+
"appId": {
|
|
259
|
+
"type": "string",
|
|
260
|
+
"description": "The app's id (from create_app or list_apps)."
|
|
261
|
+
},
|
|
262
|
+
"path": {
|
|
263
|
+
"type": "string",
|
|
264
|
+
"description": "Page to open, e.g. /dashboard (default /)."
|
|
265
|
+
},
|
|
266
|
+
"viewport": {
|
|
267
|
+
"type": "string",
|
|
268
|
+
"enum": [
|
|
269
|
+
"desktop",
|
|
270
|
+
"tablet",
|
|
271
|
+
"mobile"
|
|
272
|
+
],
|
|
273
|
+
"description": "desktop (default), tablet or mobile."
|
|
274
|
+
},
|
|
275
|
+
"fullPage": {
|
|
276
|
+
"type": "boolean",
|
|
277
|
+
"description": "Capture the whole scrolling page instead of the first screen."
|
|
278
|
+
}
|
|
279
|
+
},
|
|
280
|
+
"required": [
|
|
281
|
+
"appId"
|
|
282
|
+
]
|
|
283
|
+
}
|
|
284
|
+
},
|
|
285
|
+
{
|
|
286
|
+
"name": "app_runtime_errors",
|
|
287
|
+
"description": "Errors the app's preview reported recently while people (or the owner) used it — crashes, failed backend calls. Check this when the owner says something is broken.",
|
|
288
|
+
"inputSchema": {
|
|
289
|
+
"type": "object",
|
|
290
|
+
"properties": {
|
|
291
|
+
"appId": {
|
|
292
|
+
"type": "string",
|
|
293
|
+
"description": "The app's id (from create_app or list_apps)."
|
|
294
|
+
},
|
|
295
|
+
"minutes": {
|
|
296
|
+
"type": "number",
|
|
297
|
+
"description": "How far back (default 60)."
|
|
298
|
+
}
|
|
299
|
+
},
|
|
300
|
+
"required": [
|
|
301
|
+
"appId"
|
|
302
|
+
]
|
|
303
|
+
}
|
|
304
|
+
},
|
|
305
|
+
{
|
|
306
|
+
"name": "app_db_schema",
|
|
307
|
+
"description": "The app's database: tables, columns, relations, row-level-security policies, applied migrations, and security findings with fixes.",
|
|
308
|
+
"inputSchema": {
|
|
309
|
+
"type": "object",
|
|
310
|
+
"properties": {
|
|
311
|
+
"appId": {
|
|
312
|
+
"type": "string",
|
|
313
|
+
"description": "The app's id (from create_app or list_apps)."
|
|
314
|
+
},
|
|
315
|
+
"env": {
|
|
316
|
+
"type": "string",
|
|
317
|
+
"enum": [
|
|
318
|
+
"dev",
|
|
319
|
+
"live"
|
|
320
|
+
],
|
|
321
|
+
"description": "Which database: \"dev\" (the preview, default) or \"live\" (the published app)."
|
|
322
|
+
}
|
|
323
|
+
},
|
|
324
|
+
"required": [
|
|
325
|
+
"appId"
|
|
326
|
+
]
|
|
327
|
+
}
|
|
328
|
+
},
|
|
329
|
+
{
|
|
330
|
+
"name": "app_sql",
|
|
331
|
+
"description": "Runs SQL on the app's PREVIEW database as its owner (sees every row; new tables get row-level security on). For exploring data or quick fixes while developing. Lasting schema changes belong in a new db/migrations/NNNN_name.sql file instead, so they reach the live database on publish.",
|
|
332
|
+
"inputSchema": {
|
|
333
|
+
"type": "object",
|
|
334
|
+
"properties": {
|
|
335
|
+
"appId": {
|
|
336
|
+
"type": "string",
|
|
337
|
+
"description": "The app's id (from create_app or list_apps)."
|
|
338
|
+
},
|
|
339
|
+
"sql": {
|
|
340
|
+
"type": "string"
|
|
341
|
+
}
|
|
342
|
+
},
|
|
343
|
+
"required": [
|
|
344
|
+
"appId",
|
|
345
|
+
"sql"
|
|
346
|
+
]
|
|
347
|
+
}
|
|
348
|
+
},
|
|
349
|
+
{
|
|
350
|
+
"name": "app_design_describe",
|
|
351
|
+
"description": "Reads the app's visually designed pages (the Design tab, src/plexo-canvas): for each page its slug, name, address and its sections in order (id, kind, layout, a few words of what it says), plus the brand (colours, fonts, corners) and the catalog of every section kind with its layouts and the fields you can fill in, and the ready-made page templates. Call this before app_design_edit, and again after you change a page if you need fresh section ids. Pages marked codeEdited were changed in code — edit those with app_edit_file, not app_design_edit.",
|
|
352
|
+
"inputSchema": {
|
|
353
|
+
"type": "object",
|
|
354
|
+
"properties": {
|
|
355
|
+
"appId": {
|
|
356
|
+
"type": "string",
|
|
357
|
+
"description": "The app's id (from create_app or list_apps)."
|
|
358
|
+
}
|
|
359
|
+
},
|
|
360
|
+
"required": [
|
|
361
|
+
"appId"
|
|
362
|
+
]
|
|
363
|
+
}
|
|
364
|
+
},
|
|
365
|
+
{
|
|
366
|
+
"name": "app_design_edit",
|
|
367
|
+
"description": "Changes designed pages section by section — the right way to edit a page built in the Design tab, instead of editing its generated .tsx. Pass commands, each one of: {op:\"addSection\", pageId, kind, variant?, content?, style?, afterSectionId? | index?} · {op:\"updateSection\", sectionId, content?, variant?, style?} · {op:\"removeSection\", sectionId} · {op:\"moveSection\", sectionId, index? | afterSectionId?} · {op:\"duplicateSection\", sectionId} · {op:\"setBrand\", tokens:{primaryColor?, secondaryColor?, headingFont?, bodyFont?, neutrals? (cool|warm|dark), roundness? (sharp|soft|round)}} · {op:\"addPage\", name, templateId?} (templateId from the catalog: home, landing, about, services, contact, pricing, blank — gives a complete, filled-in page) · {op:\"renamePage\", pageId, name}. pageId is the page's slug from app_design_describe; sectionId is a section id from it. Content keys are the field paths from the catalog (\"headline\", \"items.0.title\"); a list field needs the whole list; write real copy for the business. Each command is checked on its own — good ones are saved, bad ones come back with a plain-English reason, so read results. slug (optional) is the page you're working on: an addSection without a pageId goes there. A page that was edited in code is not changed (the reply says so); only pass overwrite: true if the owner chose to replace their code edits. Saving regenerates the page's React code and its route. Run app_build afterwards, then app_screenshot.",
|
|
368
|
+
"inputSchema": {
|
|
369
|
+
"type": "object",
|
|
370
|
+
"properties": {
|
|
371
|
+
"appId": {
|
|
372
|
+
"type": "string",
|
|
373
|
+
"description": "The app's id (from create_app or list_apps)."
|
|
374
|
+
},
|
|
375
|
+
"slug": {
|
|
376
|
+
"type": "string",
|
|
377
|
+
"description": "The designed page being edited (from app_design_describe)."
|
|
378
|
+
},
|
|
379
|
+
"commands": {
|
|
380
|
+
"type": "array",
|
|
381
|
+
"maxItems": 40,
|
|
382
|
+
"items": {
|
|
383
|
+
"type": "object",
|
|
384
|
+
"properties": {
|
|
385
|
+
"op": {
|
|
386
|
+
"type": "string"
|
|
387
|
+
}
|
|
388
|
+
},
|
|
389
|
+
"required": [
|
|
390
|
+
"op"
|
|
391
|
+
],
|
|
392
|
+
"additionalProperties": true
|
|
393
|
+
}
|
|
394
|
+
},
|
|
395
|
+
"overwrite": {
|
|
396
|
+
"type": "boolean",
|
|
397
|
+
"description": "Replace hand edits made to the page's code. Only when the owner asked for it."
|
|
398
|
+
}
|
|
399
|
+
},
|
|
400
|
+
"required": [
|
|
401
|
+
"appId",
|
|
402
|
+
"commands"
|
|
403
|
+
]
|
|
404
|
+
}
|
|
405
|
+
},
|
|
406
|
+
{
|
|
407
|
+
"name": "app_publish",
|
|
408
|
+
"description": "Publishes the app: a clean release build, then the live database gets new migrations, server functions are deployed, and the live site switches over. The first publish gives it an address (subdomain picked from the app's name unless given). Only after the preview builds cleanly and the owner wants it live.",
|
|
409
|
+
"inputSchema": {
|
|
410
|
+
"type": "object",
|
|
411
|
+
"properties": {
|
|
412
|
+
"appId": {
|
|
413
|
+
"type": "string",
|
|
414
|
+
"description": "The app's id (from create_app or list_apps)."
|
|
415
|
+
},
|
|
416
|
+
"subdomain": {
|
|
417
|
+
"type": "string",
|
|
418
|
+
"description": "Optional, e.g. \"acme-crm\" → acme-crm.<pages domain>."
|
|
419
|
+
}
|
|
420
|
+
},
|
|
421
|
+
"required": [
|
|
422
|
+
"appId"
|
|
423
|
+
]
|
|
424
|
+
}
|
|
425
|
+
},
|
|
426
|
+
{
|
|
427
|
+
"name": "app_versions",
|
|
428
|
+
"description": "The app's version history (every build and save), newest first.",
|
|
429
|
+
"inputSchema": {
|
|
430
|
+
"type": "object",
|
|
431
|
+
"properties": {
|
|
432
|
+
"appId": {
|
|
433
|
+
"type": "string",
|
|
434
|
+
"description": "The app's id (from create_app or list_apps)."
|
|
435
|
+
}
|
|
436
|
+
},
|
|
437
|
+
"required": [
|
|
438
|
+
"appId"
|
|
439
|
+
]
|
|
440
|
+
}
|
|
441
|
+
},
|
|
442
|
+
{
|
|
443
|
+
"name": "app_restore_version",
|
|
444
|
+
"description": "Puts the app's files back to an earlier version (recorded as a new version, so it's undoable) and rebuilds the preview. The live app changes only on the next publish.",
|
|
445
|
+
"inputSchema": {
|
|
446
|
+
"type": "object",
|
|
447
|
+
"properties": {
|
|
448
|
+
"appId": {
|
|
449
|
+
"type": "string",
|
|
450
|
+
"description": "The app's id (from create_app or list_apps)."
|
|
451
|
+
},
|
|
452
|
+
"versionId": {
|
|
453
|
+
"type": "string"
|
|
454
|
+
}
|
|
455
|
+
},
|
|
456
|
+
"required": [
|
|
457
|
+
"appId",
|
|
458
|
+
"versionId"
|
|
459
|
+
]
|
|
460
|
+
}
|
|
461
|
+
},
|
|
462
|
+
{
|
|
463
|
+
"name": "app_request_secret",
|
|
464
|
+
"description": "Asks the owner to add a secret (an API key a server function needs, e.g. STRIPE_SECRET_KEY). Never ask for a secret's value in chat — this shows them where to paste it safely. Returns which secrets already exist.",
|
|
465
|
+
"inputSchema": {
|
|
466
|
+
"type": "object",
|
|
467
|
+
"properties": {
|
|
468
|
+
"appId": {
|
|
469
|
+
"type": "string",
|
|
470
|
+
"description": "The app's id (from create_app or list_apps)."
|
|
471
|
+
},
|
|
472
|
+
"name": {
|
|
473
|
+
"type": "string",
|
|
474
|
+
"description": "UPPER_SNAKE_CASE, e.g. OPENAI_API_KEY."
|
|
475
|
+
},
|
|
476
|
+
"why": {
|
|
477
|
+
"type": "string",
|
|
478
|
+
"description": "One line: what it's for and where to get it."
|
|
479
|
+
}
|
|
480
|
+
},
|
|
481
|
+
"required": [
|
|
482
|
+
"appId",
|
|
483
|
+
"name",
|
|
484
|
+
"why"
|
|
485
|
+
]
|
|
486
|
+
}
|
|
487
|
+
},
|
|
488
|
+
{
|
|
489
|
+
"name": "app_function_logs",
|
|
490
|
+
"description": "Recent logs (console output and errors) of one of the app's server functions.",
|
|
491
|
+
"inputSchema": {
|
|
492
|
+
"type": "object",
|
|
493
|
+
"properties": {
|
|
494
|
+
"appId": {
|
|
495
|
+
"type": "string",
|
|
496
|
+
"description": "The app's id (from create_app or list_apps)."
|
|
497
|
+
},
|
|
498
|
+
"name": {
|
|
499
|
+
"type": "string"
|
|
500
|
+
},
|
|
501
|
+
"env": {
|
|
502
|
+
"type": "string",
|
|
503
|
+
"enum": [
|
|
504
|
+
"dev",
|
|
505
|
+
"live"
|
|
506
|
+
],
|
|
507
|
+
"description": "Which database: \"dev\" (the preview, default) or \"live\" (the published app)."
|
|
508
|
+
},
|
|
509
|
+
"minutes": {
|
|
510
|
+
"type": "number"
|
|
511
|
+
}
|
|
512
|
+
},
|
|
513
|
+
"required": [
|
|
514
|
+
"appId",
|
|
515
|
+
"name"
|
|
516
|
+
]
|
|
517
|
+
}
|
|
518
|
+
},
|
|
519
|
+
{
|
|
520
|
+
"name": "app_update_auth_settings",
|
|
521
|
+
"description": "Turns the app's sign-in methods on or off (password, magic link, Google), requires email confirmation, or closes sign-ups (invite-only). Google sign-in works without any setup.",
|
|
522
|
+
"inputSchema": {
|
|
523
|
+
"type": "object",
|
|
524
|
+
"properties": {
|
|
525
|
+
"appId": {
|
|
526
|
+
"type": "string",
|
|
527
|
+
"description": "The app's id (from create_app or list_apps)."
|
|
528
|
+
},
|
|
529
|
+
"password": {
|
|
530
|
+
"type": "boolean"
|
|
531
|
+
},
|
|
532
|
+
"magicLink": {
|
|
533
|
+
"type": "boolean"
|
|
534
|
+
},
|
|
535
|
+
"google": {
|
|
536
|
+
"type": "boolean"
|
|
537
|
+
},
|
|
538
|
+
"requireEmailConfirmation": {
|
|
539
|
+
"type": "boolean"
|
|
540
|
+
},
|
|
541
|
+
"allowSignups": {
|
|
542
|
+
"type": "boolean"
|
|
543
|
+
}
|
|
544
|
+
},
|
|
545
|
+
"required": [
|
|
546
|
+
"appId"
|
|
547
|
+
]
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
];
|
package/src/appTools.ts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { getConfig } from "./config.js";
|
|
2
|
+
import { APP_TOOL_DEFS } from "./appToolDefs.js";
|
|
3
|
+
|
|
4
|
+
// Full-stack React apps (create_app, app_build, app_screenshot, …). Unlike the other tool
|
|
5
|
+
// groups, these aren't reimplemented here: each call is forwarded to plexo-web's hosted MCP
|
|
6
|
+
// endpoint, which runs the exact same code SOL uses — builds, database, screenshots — and
|
|
7
|
+
// returns MCP content as-is (including app_screenshot's image).
|
|
8
|
+
|
|
9
|
+
export { APP_TOOL_DEFS };
|
|
10
|
+
export const APP_TOOL_NAMES = new Set(APP_TOOL_DEFS.map((t) => t.name));
|
|
11
|
+
|
|
12
|
+
type McpContent = Array<{ type: string; [key: string]: unknown }>;
|
|
13
|
+
|
|
14
|
+
export async function callHostedAppTool(name: string, args: unknown): Promise<{ content: McpContent; isError?: boolean }> {
|
|
15
|
+
const config = getConfig();
|
|
16
|
+
if (!config.apiKey) {
|
|
17
|
+
throw new Error(`Authentication Required: set PLEXO_API_KEY (log in at ${config.baseUrl.replace(/\/$/, "")}/mcp/login to get one).`);
|
|
18
|
+
}
|
|
19
|
+
const res = await fetch(`${config.baseUrl.replace(/\/$/, "")}/api/v1/mcp`, {
|
|
20
|
+
method: "POST",
|
|
21
|
+
headers: { "Content-Type": "application/json", Authorization: `Bearer ${config.apiKey}`, "User-Agent": "Plexo-MCP-Server/1.0" },
|
|
22
|
+
body: JSON.stringify({ jsonrpc: "2.0", id: Date.now(), method: "tools/call", params: { name, arguments: args ?? {} } }),
|
|
23
|
+
});
|
|
24
|
+
const data = (await res.json().catch(() => null)) as { result?: { content: McpContent; isError?: boolean }; error?: { message?: string } } | null;
|
|
25
|
+
if (!res.ok || !data?.result) {
|
|
26
|
+
throw new Error(data?.error?.message ?? `Plexo couldn't run ${name} (status ${res.status}).`);
|
|
27
|
+
}
|
|
28
|
+
return data.result;
|
|
29
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -13,6 +13,7 @@ import { LMS_TOOL_DEFS, LMS_TOOL_NAMES, handleLmsToolCall } from "./lmsTools.js"
|
|
|
13
13
|
import { DONATION_TOOL_DEFS, DONATION_TOOL_NAMES, handleDonationToolCall } from "./donationTools.js";
|
|
14
14
|
import { WP_MIGRATION_TOOL_DEFS, WP_MIGRATION_TOOL_NAMES, handleWpMigrationToolCall } from "./wpMigrationTools.js";
|
|
15
15
|
import { FORM_TOOL_DEFS, FORM_TOOL_NAMES, handleFormToolCall } from "./formTools.js";
|
|
16
|
+
import { APP_TOOL_DEFS, APP_TOOL_NAMES, callHostedAppTool } from "./appTools.js";
|
|
16
17
|
|
|
17
18
|
const server = new Server(
|
|
18
19
|
{
|
|
@@ -656,6 +657,7 @@ To edit a page's CONTENT (designJson), use update_template with the same templat
|
|
|
656
657
|
...DONATION_TOOL_DEFS,
|
|
657
658
|
...WP_MIGRATION_TOOL_DEFS,
|
|
658
659
|
...FORM_TOOL_DEFS,
|
|
660
|
+
...APP_TOOL_DEFS,
|
|
659
661
|
],
|
|
660
662
|
};
|
|
661
663
|
});
|
|
@@ -961,6 +963,9 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
961
963
|
],
|
|
962
964
|
};
|
|
963
965
|
}
|
|
966
|
+
if (APP_TOOL_NAMES.has(name)) {
|
|
967
|
+
return await callHostedAppTool(name, args);
|
|
968
|
+
}
|
|
964
969
|
for (const [names, handler] of [
|
|
965
970
|
[DONATION_TOOL_NAMES, handleDonationToolCall],
|
|
966
971
|
[WP_MIGRATION_TOOL_NAMES, handleWpMigrationToolCall],
|