@stellisoft/stellify-mcp 0.1.29 → 0.1.30

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/dist/index.js +167 -469
  2. package/package.json +1 -1
  3. package/server.json +2 -2
package/dist/index.js CHANGED
@@ -63,29 +63,7 @@ const STELLIFY_FRAMEWORK_API = {
63
63
  const tools = [
64
64
  {
65
65
  name: 'get_stellify_framework_api',
66
- description: `Get the complete Stellify Framework API reference for Vue/JS development.
67
-
68
- Returns all modules and their methods for AI-friendly frontend code generation.
69
-
70
- Use this tool when you need to:
71
- - Look up available methods for a Stellify module
72
- - Verify method names before generating code
73
- - Understand the full API surface
74
-
75
- IMPORTANT - Stellify Framework Import:
76
- The npm package is "stellify-framework" (NOT @stellify/core).
77
- Import like: import { Http, Collection, Form } from 'stellify-framework';
78
-
79
- IMPORTANT - Collection class and Vue reactivity:
80
- Collection is iterable and works directly with Vue's v-for directive.
81
- Use Collection.collect() to wrap arrays for chainable operations (filter, map, sort, etc.).
82
-
83
- Example response:
84
- {
85
- "Form": ["create", "set", "get", "validate", "store", "update", "delete", ...],
86
- "Http": ["create", "get", "post", "put", "delete", "withToken", ...],
87
- ...
88
- }`,
66
+ description: `Get Stellify Framework API reference. Import from "stellify-framework" (not @stellify/core). Collection is iterable with v-for.`,
89
67
  inputSchema: {
90
68
  type: 'object',
91
69
  properties: {
@@ -98,18 +76,7 @@ Example response:
98
76
  },
99
77
  {
100
78
  name: 'get_project',
101
- description: `Get the active Stellify project for the authenticated user.
102
-
103
- IMPORTANT: Call this first before any other operations.
104
-
105
- Returns:
106
- - uuid: Project UUID (needed for most operations)
107
- - name: Project name
108
- - branch/branches: Git branch info
109
- - directories: Array of {uuid, name} for existing directories (js, controllers, models, etc.)
110
-
111
- Use the directories array to find existing directories before creating new ones.
112
- For example, look for a "js" directory before creating Vue components.`,
79
+ description: `Get active project. Returns uuid, name, branches, and directories array.`,
113
80
  inputSchema: {
114
81
  type: 'object',
115
82
  properties: {},
@@ -117,35 +84,12 @@ For example, look for a "js" directory before creating Vue components.`,
117
84
  },
118
85
  {
119
86
  name: 'create_file',
120
- description: `Create a new file in a Stellify project.
121
-
122
- This creates an EMPTY file shell - no methods, statements, or template yet. The file exists but has no content.
123
-
124
- COMPLETE WORKFLOW:
125
- 1. create_file → creates empty shell, returns file UUID
126
- 2. create_statement_with_code → add variables/imports in ONE call (returns statement UUIDs)
127
- 3. create_method with body param → add functions in ONE call (returns method UUIDs)
128
- 4. html_to_elements → create template elements (returns element UUIDs)
129
- 5. save_file → FINALIZE by wiring template/data arrays with all collected UUIDs
87
+ description: `Create an empty file shell in a Stellify project. Returns file UUID.
130
88
 
131
- TWO-STEP ALTERNATIVES (still supported but prefer combined tools above):
132
- - create_statement + add_statement_code (2 calls instead of 1)
133
- - create_method (without body) + add_method_body (2 calls instead of 1)
89
+ For PHP: type='class', 'model', 'controller', or 'middleware'.
90
+ For Vue: type='js', extension='vue'. Auto-creates app.js and template route.
134
91
 
135
- NOTE: add_method_body is also useful for APPENDING code to an existing method.
136
-
137
- For PHP: Use type='class', 'model', 'controller', or 'middleware'.
138
- For Vue: Use type='js' and extension='vue'. Place in the 'js' directory.
139
- - Auto-creates app.js (check response.appJs)
140
- - Auto-creates template route for visual editor (check response.templateRoute.uuid)
141
-
142
- DEPENDENCY RESOLUTION (automatic):
143
- Pass 'includes' as an array of namespace strings for FRAMEWORK classes (e.g., ["Illuminate\\Http\\Request", "Illuminate\\Support\\Facades\\Hash"]).
144
- The system resolves these to UUIDs automatically:
145
- - Illuminate\\*/Laravel\\* → fetches from Laravel API, creates in Application DB
146
- - Vendor packages → fetches from vendor, creates in Application DB
147
-
148
- NOTE: For controllers that use PROJECT models (Feedback, Vote, etc.), add those to the 'models' array in save_file instead. Do NOT put project models in includes - this causes duplicate use statement errors.`,
92
+ Pass 'includes' array for framework class dependencies (auto-resolved to UUIDs). Use 'models' array in save_file for project models.`,
149
93
  inputSchema: {
150
94
  type: 'object',
151
95
  properties: {
@@ -185,42 +129,7 @@ NOTE: For controllers that use PROJECT models (Feedback, Vote, etc.), add those
185
129
  },
186
130
  {
187
131
  name: 'create_method',
188
- description: `Create a method in a file. Can optionally include the body and async flag in a single call.
189
-
190
- **NEW: Combined creation** - Pass 'body' to create the complete method in ONE call. Async is auto-detected when body contains \`await\`.
191
-
192
- **Nested code is handled correctly.** The parser tracks brace/bracket/paren depth and only splits statements on semicolons at the top level. This means computed properties, arrow functions with block bodies, and other nested constructs work correctly as single statements.
193
-
194
- Parameters are automatically created as clauses. The response includes the clause UUIDs for each parameter.
195
-
196
- Example request (simple - signature only):
197
- {
198
- "file": "file-uuid",
199
- "name": "verify",
200
- "visibility": "public",
201
- "returnType": "object",
202
- "nullable": true,
203
- "parameters": [
204
- { "name": "credentials", "datatype": "array" }
205
- ]
206
- }
207
-
208
- Example request (combined - with body, async auto-detected):
209
- {
210
- "file": "file-uuid",
211
- "name": "fetchData",
212
- "body": "const response = await Http.get('/api/data');\\nreturn response.data;"
213
- }
214
-
215
- Example response includes:
216
- {
217
- "uuid": "method-uuid",
218
- "name": "fetchData",
219
- "is_async": true,
220
- "parameters": ["clause-uuid-for-credentials"],
221
- "statements": {...}, // Only if body was provided
222
- "clauses": {...} // Only if body was provided
223
- }`,
132
+ description: `Create a method in a file. Pass 'body' to include implementation. Async auto-detected from \`await\`. For significant methods, include context fields.`,
224
133
  inputSchema: {
225
134
  type: 'object',
226
135
  properties: {
@@ -239,11 +148,11 @@ Example response includes:
239
148
  },
240
149
  is_static: {
241
150
  type: 'boolean',
242
- description: 'Whether the method is static (PHP only)',
151
+ description: 'Static method (PHP only)',
243
152
  },
244
153
  is_async: {
245
154
  type: 'boolean',
246
- description: 'Whether the method is async (JavaScript/Vue only). Set to true for methods that use await.',
155
+ description: 'Async method (JS/Vue). Auto-detected if body contains await.',
247
156
  },
248
157
  returnType: {
249
158
  type: 'string',
@@ -251,37 +160,43 @@ Example response includes:
251
160
  },
252
161
  nullable: {
253
162
  type: 'boolean',
254
- description: 'Whether the return type is nullable (e.g., ?object)',
163
+ description: 'Nullable return type (e.g., ?object)',
255
164
  },
256
165
  parameters: {
257
166
  type: 'array',
258
- description: 'Array of method parameters. Each parameter is created as a clause.',
167
+ description: 'Method parameters (created as clauses)',
259
168
  items: {
260
169
  type: 'object',
261
170
  properties: {
262
- name: {
263
- type: 'string',
264
- description: 'Parameter name (e.g., "credentials", "id")',
265
- },
266
- datatype: {
267
- type: 'string',
268
- description: 'Parameter data type (e.g., "array", "int", "string", "Request")',
269
- },
270
- type: {
271
- type: 'string',
272
- description: 'Clause type, defaults to "variable"',
273
- },
274
- value: {
275
- type: 'string',
276
- description: 'Parameter value, defaults to the name',
277
- },
171
+ name: { type: 'string', description: 'Parameter name' },
172
+ datatype: { type: 'string', description: 'Data type' },
173
+ type: { type: 'string', description: 'Clause type (default: variable)' },
174
+ value: { type: 'string', description: 'Default value' },
278
175
  },
279
176
  required: ['name'],
280
177
  },
281
178
  },
282
179
  body: {
283
180
  type: 'string',
284
- description: 'Method body code (optional). If provided, automatically parses and adds the code. Example: "const response = await Http.get(\\"/api/data\\");\\nreturn response.data;"',
181
+ description: 'Method body code. Auto-parses statements.',
182
+ },
183
+ summary: {
184
+ type: 'string',
185
+ description: 'Context: What this method does',
186
+ },
187
+ rationale: {
188
+ type: 'string',
189
+ description: 'Context: Why built this way',
190
+ },
191
+ references: {
192
+ type: 'array',
193
+ description: 'Context: Related entities [{uuid, type, relationship, note}]',
194
+ items: { type: 'object' },
195
+ },
196
+ decisions: {
197
+ type: 'array',
198
+ description: 'Context: Design decisions',
199
+ items: { type: 'string' },
285
200
  },
286
201
  },
287
202
  required: ['file', 'name'],
@@ -321,32 +236,9 @@ IMPORTANT: This APPENDS to existing method statements. To REPLACE a method's cod
321
236
  },
322
237
  {
323
238
  name: 'save_method',
324
- description: `Update an existing method's properties (name, visibility, returnType, nullable, parameters, data, is_async).
239
+ description: `Update a method's properties. Use add_method_body to append code.
325
240
 
326
- Use this to modify a method after creation. For updating the method body, use add_method_body instead.
327
-
328
- Parameters:
329
- - data: Array of statement UUIDs that form the method body. Use this to reorder statements or remove unwanted statements from the method.
330
- - is_async: Set to true for JavaScript/Vue methods that use await.
331
-
332
- Example - Update return type:
333
- {
334
- "uuid": "method-uuid",
335
- "returnType": "object",
336
- "nullable": true
337
- }
338
-
339
- Example - Mark method as async (for methods using await):
340
- {
341
- "uuid": "method-uuid",
342
- "is_async": true
343
- }
344
-
345
- Example - Remove duplicate/unwanted statements:
346
- {
347
- "uuid": "method-uuid",
348
- "data": ["statement-uuid-1", "statement-uuid-2"] // Only keep these statements
349
- }`,
241
+ For significant changes, include context fields: summary, rationale, references, decisions.`,
350
242
  inputSchema: {
351
243
  type: 'object',
352
244
  properties: {
@@ -389,6 +281,32 @@ Example - Remove duplicate/unwanted statements:
389
281
  type: 'boolean',
390
282
  description: 'Whether the method is async (JavaScript/Vue only). Set to true for methods that use await.',
391
283
  },
284
+ summary: {
285
+ type: 'string',
286
+ description: 'Context: Brief description of what this method does',
287
+ },
288
+ rationale: {
289
+ type: 'string',
290
+ description: 'Context: Why it was built this way',
291
+ },
292
+ references: {
293
+ type: 'array',
294
+ description: 'Context: Links to related entities [{uuid, type, relationship, note}]',
295
+ items: {
296
+ type: 'object',
297
+ properties: {
298
+ uuid: { type: 'string' },
299
+ type: { type: 'string', enum: ['model', 'route', 'method', 'file', 'setting', 'element'] },
300
+ relationship: { type: 'string', enum: ['uses', 'creates', 'updates', 'calls', 'contains', 'triggers'] },
301
+ note: { type: 'string' },
302
+ },
303
+ },
304
+ },
305
+ decisions: {
306
+ type: 'array',
307
+ description: 'Context: Design decisions made',
308
+ items: { type: 'string' },
309
+ },
392
310
  },
393
311
  required: ['uuid'],
394
312
  },
@@ -531,27 +449,7 @@ Use this to look up a route you created or to find existing routes in the projec
531
449
  },
532
450
  {
533
451
  name: 'save_route',
534
- description: `Update an existing route/page. Use this to wire a route to a controller method.
535
-
536
- IMPORTANT: This is how you connect API routes to controller methods!
537
- IMPORTANT: You MUST provide BOTH controller AND controller_method together - they are a pair.
538
-
539
- Example - Wire an API route to a controller method:
540
- {
541
- "uuid": "route-uuid",
542
- "controller": "controller-file-uuid",
543
- "controller_method": "method-uuid"
544
- }
545
-
546
- Available fields:
547
- - controller: UUID of the controller file (MUST be paired with controller_method)
548
- - controller_method: UUID of the method to execute (MUST be paired with controller)
549
- - path: URL path
550
- - name: Route name
551
- - type: "web" or "api"
552
- - method: HTTP method (GET, POST, PUT, DELETE, PATCH)
553
- - middleware: Array of middleware names
554
- - public: Whether the route is public (no auth required)`,
452
+ description: `Update a route/page. Wire to controller with both controller and controller_method UUIDs. For significant routes, include context fields.`,
555
453
  inputSchema: {
556
454
  type: 'object',
557
455
  properties: {
@@ -561,11 +459,11 @@ Available fields:
561
459
  },
562
460
  controller: {
563
461
  type: 'string',
564
- description: 'UUID of the controller file. MUST be provided together with controller_method.',
462
+ description: 'Controller file UUID. Requires controller_method.',
565
463
  },
566
464
  controller_method: {
567
465
  type: 'string',
568
- description: 'UUID of the method to execute. MUST be provided together with controller.',
466
+ description: 'Method UUID. Requires controller.',
569
467
  },
570
468
  path: {
571
469
  type: 'string',
@@ -578,21 +476,36 @@ Available fields:
578
476
  type: {
579
477
  type: 'string',
580
478
  enum: ['web', 'api'],
581
- description: 'Route type',
582
479
  },
583
480
  method: {
584
481
  type: 'string',
585
482
  enum: ['GET', 'POST', 'PUT', 'DELETE', 'PATCH'],
586
- description: 'HTTP method',
587
483
  },
588
484
  middleware: {
589
485
  type: 'array',
590
486
  items: { type: 'string' },
591
- description: 'Array of middleware names',
592
487
  },
593
488
  public: {
594
489
  type: 'boolean',
595
- description: 'Whether the route is public (no auth required)',
490
+ description: 'Public route (no auth)',
491
+ },
492
+ summary: {
493
+ type: 'string',
494
+ description: 'Context: What this endpoint does',
495
+ },
496
+ rationale: {
497
+ type: 'string',
498
+ description: 'Context: Why built this way',
499
+ },
500
+ references: {
501
+ type: 'array',
502
+ description: 'Context: Related entities [{uuid, type, relationship, note}]',
503
+ items: { type: 'object' },
504
+ },
505
+ decisions: {
506
+ type: 'array',
507
+ description: 'Context: Design decisions',
508
+ items: { type: 'string' },
596
509
  },
597
510
  },
598
511
  required: ['uuid'],
@@ -641,23 +554,7 @@ Use the returned UUID with html_to_elements (page parameter) or get_route for fu
641
554
  },
642
555
  {
643
556
  name: 'create_element',
644
- description: `Create a new UI element on a page (for Elements v2). Provide either page (route UUID) for root elements, or parent (element UUID) for child elements.
645
-
646
- Valid element types:
647
- - HTML5: s-wrapper, s-input, s-form, s-svg, s-shape, s-media, s-iframe
648
- - Components: s-loop, s-transition, s-freestyle, s-motion
649
- - Blade: s-directive
650
- - Shadcn/ui: s-chart, s-table, s-combobox, s-accordion, s-calendar, s-contiguous
651
-
652
- s-loop ELEMENT TYPE:
653
- Use s-loop for elements that should render with v-for directive.
654
- Required attributes (set via update_element after creation):
655
- - loop: The v-for expression (e.g., "note in notes", "item in items")
656
- - key: The :key binding (e.g., "note.id", "item.id")
657
-
658
- Example: After creating s-loop, update it with:
659
- { "tag": "div", "loop": "note in notes", "key": "note.id", "classes": ["card", "p-4"] }
660
- Generates: <div class="card p-4" v-for="note in notes" :key="note.id">`,
557
+ description: `Create a UI element. Provide page (route UUID) for root elements, or parent (element UUID) for children. Use s-loop for v-for elements.`,
661
558
  inputSchema: {
662
559
  type: 'object',
663
560
  properties: {
@@ -685,29 +582,7 @@ Generates: <div class="card p-4" v-for="note in notes" :key="note.id">`,
685
582
  },
686
583
  {
687
584
  name: 'update_element',
688
- description: `Update a UI element's attributes.
689
-
690
- Pass data object with: tag, classes (array), text, variable (for v-model), and event handlers.
691
-
692
- Key fields: inputType (not 'type') for button/input HTML type. clickArgs for handler arguments in v-for loops.
693
-
694
- EVENT HANDLERS - Use method UUIDs:
695
- { "click": "method-uuid" } → @click="methodName"
696
- { "click": "method-uuid", "clickArgs": "item" } → @click="methodName(item)"
697
-
698
- Create methods for all handlers, including simple state changes like opening modals or toggling flags.
699
-
700
- Event types: click, submit, change, input, focus, blur, keydown, keyup, mouseenter, mouseleave.
701
-
702
- DYNAMIC CLASS BINDINGS - For classes that toggle based on expressions:
703
- { "classBindings": { "rotate-180": "panel.open", "bg-red-500": "hasError" } }
704
- Assembles to: :class="{ 'rotate-180': panel.open, 'bg-red-500': hasError }"
705
- Use for state-dependent styling in v-for loops or reactive components.
706
-
707
- EFFICIENCY - Prefer updates over delete/recreate:
708
- - Move between routes: change \`routeParent\` attribute
709
- - Reparent elements: change \`parent\` attribute
710
- - Reorder children: update parent's \`data\` array with new UUID order`,
585
+ description: `Update a UI element. Data object: tag, classes, text, event handlers (method UUIDs), classBindings. Include context for significant UI components.`,
711
586
  inputSchema: {
712
587
  type: 'object',
713
588
  properties: {
@@ -717,7 +592,7 @@ EFFICIENCY - Prefer updates over delete/recreate:
717
592
  },
718
593
  data: {
719
594
  type: 'object',
720
- description: 'Flat object with HTML attributes and Stellify fields (name, type, locked, tag, classes, text, classBindings)',
595
+ description: 'HTML attributes and Stellify fields (tag, classes, text, classBindings, click, submit). Context fields: summary, rationale, references, decisions.',
721
596
  },
722
597
  },
723
598
  required: ['uuid', 'data'],
@@ -849,19 +724,7 @@ Prefer SVG icons over emoji (encoding issues).`,
849
724
  },
850
725
  {
851
726
  name: 'create_statement',
852
- description: `Create an empty statement in a file. This is step 1 of 2 - you MUST call add_statement_code next to add the actual code.
853
-
854
- **ALTERNATIVE:** Use create_statement_with_code for a single-call approach that combines both steps.
855
-
856
- IMPORTANT: This is a TWO-STEP process:
857
- 1. create_statement → returns statement UUID
858
- 2. add_statement_code → adds the actual code to that statement
859
-
860
- Use cases:
861
- - PHP: Class properties, use statements, constants
862
- - JS/Vue: Variable declarations, imports, reactive refs
863
-
864
- For Vue components, include the returned statement UUID in save_file's 'statements' array (NOT 'data' - that's for methods).`,
727
+ description: `Create empty statement (step 1 of 2). Call add_statement_code next. Prefer create_statement_with_code for single call.`,
865
728
  inputSchema: {
866
729
  type: 'object',
867
730
  properties: {
@@ -878,17 +741,7 @@ For Vue components, include the returned statement UUID in save_file's 'statemen
878
741
  },
879
742
  {
880
743
  name: 'create_statement_with_code',
881
- description: `Create a statement with code in a SINGLE call. This combines create_statement and add_statement_code.
882
-
883
- **PREFERRED:** Use this instead of the two-step create_statement → add_statement_code process.
884
-
885
- **Nested code is handled correctly.** The parser tracks brace/bracket/paren depth and only splits on top-level semicolons. Computed properties, arrow functions with block bodies, and other nested constructs are kept as single statements.
886
-
887
- Examples:
888
- - PHP: "use Illuminate\\Http\\Request;" or "private $items = [];"
889
- - JS/Vue: "const count = ref(0);" or "import { ref } from 'vue';"
890
-
891
- For Vue components, include the returned statement UUIDs in save_file's 'statements' array (NOT 'data' - that's for methods).`,
744
+ description: `Create a statement with code in one call. Preferred over two-step create_statement + add_statement_code.`,
892
745
  inputSchema: {
893
746
  type: 'object',
894
747
  properties: {
@@ -980,38 +833,9 @@ Examples:
980
833
  },
981
834
  {
982
835
  name: 'save_file',
983
- description: `Save/update a file with its full configuration. This FINALIZES the file after create_file.
836
+ description: `Finalize a file. Full replacement - call get_file first to update existing files.
984
837
 
985
- WORKFLOW: create_file creates an empty shell add methods/statements save_file wires everything together.
986
-
987
- IMPORTANT: This is a full replacement, not a partial update. To update an existing file:
988
- 1. Call get_file to fetch current state
989
- 2. Modify the returned object
990
- 3. Call save_file with the complete object
991
-
992
- Required fields: uuid, name, type
993
-
994
- IMPORTANT - data vs statements:
995
- - 'data' array = METHOD UUIDs only (functions)
996
- - 'statements' array = STATEMENT UUIDs (imports, variables, refs - code outside methods)
997
-
998
- Vue SFC example:
999
- save_file({
1000
- uuid: fileUuid,
1001
- name: "Counter",
1002
- type: "js",
1003
- extension: "vue",
1004
- template: [rootElementUuid], // From html_to_elements
1005
- data: [methodUuid], // Method UUIDs only
1006
- statements: [importStmtUuid, refStmtUuid] // Statement UUIDs (imports, refs)
1007
- })
1008
-
1009
- For <script setup> content, the order in statements array determines output order.
1010
-
1011
- DEPENDENCY RESOLUTION (includes array):
1012
- The 'includes' array accepts BOTH UUIDs and namespace strings.
1013
- Namespace strings (e.g., "Illuminate\\Http\\JsonResponse") are automatically resolved to UUIDs.
1014
- This works the same as create_file's dependency resolution.`,
838
+ Required: uuid, name, type. For significant changes, include context fields: summary, rationale, references, decisions.`,
1015
839
  inputSchema: {
1016
840
  type: 'object',
1017
841
  properties: {
@@ -1035,27 +859,45 @@ This works the same as create_file's dependency resolution.`,
1035
859
  template: {
1036
860
  type: 'array',
1037
861
  items: { type: 'string' },
1038
- description: 'Array of root element UUIDs for Vue <template> section (from html_to_elements)',
862
+ description: 'Root element UUIDs for Vue <template>',
1039
863
  },
1040
864
  data: {
1041
865
  type: 'array',
1042
866
  items: { type: 'string' },
1043
- description: 'Array of METHOD UUIDs only (functions created via create_method)',
867
+ description: 'Method UUIDs (from create_method)',
1044
868
  },
1045
869
  statements: {
1046
870
  type: 'array',
1047
871
  items: { type: 'string' },
1048
- description: 'Array of STATEMENT UUIDs (imports, variables, refs - created via create_statement)',
872
+ description: 'Statement UUIDs (imports, variables, refs)',
1049
873
  },
1050
874
  includes: {
1051
875
  type: 'array',
1052
876
  items: { type: 'string' },
1053
- description: 'Array of file UUIDs OR namespace strings for FRAMEWORK classes only (Request, JsonResponse, etc.). Do NOT put project models here - use the models array instead.',
877
+ description: 'Framework class UUIDs or namespaces. Use models array for project models.',
1054
878
  },
1055
879
  models: {
1056
880
  type: 'array',
1057
881
  items: { type: 'string' },
1058
- description: 'Array of model file UUIDs for PROJECT models (Feedback, Vote, etc.). These get sandbox namespace automatically. Do NOT also add these to includes or you will get duplicate use statement errors.',
882
+ description: 'Project model UUIDs (auto-namespaced). Do NOT duplicate in includes.',
883
+ },
884
+ summary: {
885
+ type: 'string',
886
+ description: 'Context: What this file does and why it exists',
887
+ },
888
+ rationale: {
889
+ type: 'string',
890
+ description: 'Context: Why it was built this way',
891
+ },
892
+ references: {
893
+ type: 'array',
894
+ description: 'Context: Related entities [{uuid, type, relationship, note}]',
895
+ items: { type: 'object' },
896
+ },
897
+ decisions: {
898
+ type: 'array',
899
+ description: 'Context: Design decisions',
900
+ items: { type: 'string' },
1059
901
  },
1060
902
  },
1061
903
  required: ['uuid', 'name', 'type'],
@@ -1192,15 +1034,7 @@ Changes are EPHEMERAL (not saved). For persistent changes, use update_element or
1192
1034
  },
1193
1035
  {
1194
1036
  name: 'create_resources',
1195
- description: `Scaffold Model, Controller, Service, and Migration in ONE operation.
1196
-
1197
- Creates: Model ($fillable, $casts, relationships), Controller (CRUD actions), Service (optional), Migration.
1198
-
1199
- IMPORTANT: Routes are NOT auto-wired. After creation, use create_route with the returned controller UUID and method UUIDs.
1200
-
1201
- IMPORTANT: After creation, check the controller methods for return types and parameter types. If methods use classes not already in includes (e.g., JsonResponse), add those class UUIDs to the controller's includes via save_file.
1202
-
1203
- Response includes controller.methods array with {uuid, name} for each action (index, store, update, destroy).`,
1037
+ description: `Scaffold Model, Controller, Service, and Migration. Routes are NOT auto-wired - use create_route after.`,
1204
1038
  inputSchema: {
1205
1039
  type: 'object',
1206
1040
  properties: {
@@ -1299,40 +1133,7 @@ Response includes controller.methods array with {uuid, name} for each action (in
1299
1133
  },
1300
1134
  {
1301
1135
  name: 'run_code',
1302
- description: `Execute a method in the Stellify project environment and return the output.
1303
-
1304
- This tool allows you to run methods you've created and see the results. Use this for:
1305
- - Testing methods you've created
1306
- - Verifying code behavior
1307
- - Debugging issues
1308
- - Getting real feedback on code execution
1309
-
1310
- REQUIRED: Both file and method UUIDs must be provided.
1311
-
1312
- EXAMPLES:
1313
-
1314
- Run a method:
1315
- {
1316
- "file": "file-uuid",
1317
- "method": "method-uuid",
1318
- "args": []
1319
- }
1320
-
1321
- Run with benchmarking enabled:
1322
- {
1323
- "file": "file-uuid",
1324
- "method": "method-uuid",
1325
- "benchmark": true
1326
- }
1327
-
1328
- RESPONSE includes:
1329
- - output: The return value or printed output
1330
- - success: Whether execution succeeded
1331
- - error: Error message if failed
1332
- - execution_time: Time taken (if benchmark enabled)
1333
- - memory_usage: Memory used (if benchmark enabled)
1334
-
1335
- SECURITY: Code runs in a sandboxed environment with limited permissions.`,
1136
+ description: `Execute a method in sandboxed environment. Requires file and method UUIDs. Returns output, success, error, and optional benchmark data.`,
1336
1137
  inputSchema: {
1337
1138
  type: 'object',
1338
1139
  properties: {
@@ -1363,18 +1164,7 @@ SECURITY: Code runs in a sandboxed environment with limited permissions.`,
1363
1164
  },
1364
1165
  {
1365
1166
  name: 'request_capability',
1366
- description: `Log a missing system-level capability request.
1367
-
1368
- Use this when you encounter a user requirement that needs framework-level functionality
1369
- that doesn't exist in Stellify. This creates a ticket in the Stellify backlog.
1370
-
1371
- DO NOT try to build system capabilities yourself - log them here instead.
1372
-
1373
- Examples of capability requests:
1374
- - "Need WebSocket support for real-time chat"
1375
- - "Need S3 file upload with signed URLs"
1376
- - "Need scheduled task runner for daily reports"
1377
- - "Need OAuth2 social login (Google, GitHub)"`,
1167
+ description: `Log a missing framework-level capability. Creates a ticket in the Stellify backlog.`,
1378
1168
  inputSchema: {
1379
1169
  type: 'object',
1380
1170
  properties: {
@@ -1405,33 +1195,7 @@ Examples of capability requests:
1405
1195
  },
1406
1196
  {
1407
1197
  name: 'analyze_performance',
1408
- description: `Analyze code execution performance from logs. Identifies slow methods, N+1 query patterns, high memory usage, and failure rates.
1409
-
1410
- Use this tool PROACTIVELY to:
1411
- - Review performance after creating new methods
1412
- - Identify optimization opportunities
1413
- - Detect N+1 query patterns (high query counts)
1414
- - Find methods that need caching or refactoring
1415
- - Check failure rates and error patterns
1416
-
1417
- ANALYSIS TYPES:
1418
- - full: Comprehensive report with all issues, recommendations, and statistics
1419
- - slow_methods: Methods exceeding 500ms execution time
1420
- - high_query_methods: Methods with >10 queries (potential N+1 problems)
1421
- - high_memory_methods: Methods using >50MB memory
1422
- - failure_rates: Methods with high error rates
1423
- - trend: Performance trend over time (daily averages)
1424
-
1425
- EXAMPLE - Full analysis:
1426
- { "type": "full", "days": 7 }
1427
-
1428
- EXAMPLE - Check for N+1 queries:
1429
- { "type": "high_query_methods", "limit": 10 }
1430
-
1431
- The response includes actionable recommendations like:
1432
- - "Consider eager loading relationships" for N+1 patterns
1433
- - "Add database indexes" for slow queries
1434
- - "Use chunking" for high memory usage`,
1198
+ description: `Analyze execution performance from logs. Types: full, slow_methods, high_query_methods, high_memory_methods, failure_rates, trend.`,
1435
1199
  inputSchema: {
1436
1200
  type: 'object',
1437
1201
  properties: {
@@ -1453,32 +1217,7 @@ The response includes actionable recommendations like:
1453
1217
  },
1454
1218
  {
1455
1219
  name: 'analyze_quality',
1456
- description: `Analyze Laravel code structure for quality issues. Detects missing relationships, fillables, casts, and route problems.
1457
-
1458
- Use this tool PROACTIVELY to:
1459
- - Review code quality after creating models or controllers
1460
- - Detect missing Eloquent relationships (belongsTo, hasMany)
1461
- - Find migration fields not in $fillable
1462
- - Suggest type casts for columns (json → array, datetime → datetime)
1463
- - Identify broken route bindings (orphaned methods, missing controllers)
1464
-
1465
- ANALYSIS TYPES:
1466
- - full: Comprehensive analysis of all categories with recommendations
1467
- - relationships: Missing belongsTo/hasMany based on foreign keys
1468
- - fillables: Migration fields not in Model $fillable array
1469
- - casts: Columns that should have type casts
1470
- - routes: Orphaned controller methods, routes pointing to missing methods
1471
-
1472
- EXAMPLE - Full analysis:
1473
- { "type": "full" }
1474
-
1475
- EXAMPLE - Check relationships only:
1476
- { "type": "relationships" }
1477
-
1478
- The response includes actionable suggestions like:
1479
- - "Add belongsTo relationship: public function user() { return $this->belongsTo(User::class); }"
1480
- - "Add 'published_at' to $fillable array"
1481
- - "Add cast: 'metadata' => 'array'"`,
1220
+ description: `Analyze Laravel code for quality issues. Types: full, relationships, fillables, casts, routes. Returns actionable suggestions.`,
1482
1221
  inputSchema: {
1483
1222
  type: 'object',
1484
1223
  properties: {
@@ -1492,27 +1231,7 @@ The response includes actionable suggestions like:
1492
1231
  },
1493
1232
  {
1494
1233
  name: 'get_setting',
1495
- description: `Get a setting/config value from the tenant's settings table.
1496
-
1497
- These settings are read by the config() function in sandbox code execution.
1498
- Use this to check existing configuration values before modifying them.
1499
-
1500
- EXAMPLE:
1501
- { "name": "app" }
1502
-
1503
- Returns the setting data as key-value pairs, e.g.:
1504
- {
1505
- "name": "My App",
1506
- "timezone": "UTC",
1507
- "locale": "en"
1508
- }
1509
-
1510
- Common setting profiles:
1511
- - "app": Application settings (name, timezone, locale)
1512
- - "database": Database connection settings
1513
- - "mail": Mail configuration
1514
- - "cache": Cache settings
1515
- - Custom profiles for app-specific config`,
1234
+ description: `Get a setting profile by name. Returns key-value pairs accessible via config() in code.`,
1516
1235
  inputSchema: {
1517
1236
  type: 'object',
1518
1237
  properties: {
@@ -1526,38 +1245,7 @@ Common setting profiles:
1526
1245
  },
1527
1246
  {
1528
1247
  name: 'save_setting',
1529
- description: `Create or update a setting in the tenant's settings table.
1530
-
1531
- These settings are accessible via config() in sandbox code execution.
1532
- Use this to configure application behavior, API keys, feature flags, etc.
1533
-
1534
- IMPORTANT: This creates or updates the setting profile with the provided key-value data.
1535
- The data is merged with any existing values for that profile.
1536
-
1537
- EXAMPLE - Create app settings:
1538
- {
1539
- "name": "app",
1540
- "data": {
1541
- "name": "My Feedback App",
1542
- "timezone": "America/New_York",
1543
- "locale": "en"
1544
- }
1545
- }
1546
-
1547
- EXAMPLE - Create custom settings for voting:
1548
- {
1549
- "name": "vote",
1550
- "data": {
1551
- "salt": "my-secret-salt-for-ip-hashing",
1552
- "allow_anonymous": true,
1553
- "max_votes_per_day": 10
1554
- }
1555
- }
1556
-
1557
- In your controller code, access these with:
1558
- - config('app.name') returns "My Feedback App"
1559
- - config('vote.salt') returns "my-secret-salt-for-ip-hashing"
1560
- - config('vote.allow_anonymous') returns true`,
1248
+ description: `Create or update a setting profile. Data is merged with existing values. Access via config('name.key') in code.`,
1561
1249
  inputSchema: {
1562
1250
  type: 'object',
1563
1251
  properties: {
@@ -1597,35 +1285,7 @@ This removes the "vote" setting profile entirely.`,
1597
1285
  },
1598
1286
  {
1599
1287
  name: 'get_pattern',
1600
- description: `Get a UI pattern checklist for building common components correctly.
1601
-
1602
- WHEN TO USE: Call this BEFORE building any of these UI patterns:
1603
- - accordion: Collapsible content panels
1604
- - modal: Overlay dialogs
1605
- - tabs: Tabbed content navigation
1606
- - dropdown: Toggleable menus
1607
- - toast: Notification messages
1608
-
1609
- The checklist contains best practices and common pitfalls to avoid.
1610
- Following the checklist prevents bugs like hidden content still being visible,
1611
- missing keyboard navigation, or incorrect ARIA attributes.
1612
-
1613
- EXAMPLE:
1614
- { "name": "accordion" }
1615
-
1616
- Returns:
1617
- {
1618
- "name": "accordion",
1619
- "description": "Collapsible content panels",
1620
- "checklist": [
1621
- "Use v-show for visibility toggle (not CSS height tricks)",
1622
- "Store open state as boolean in each panel object",
1623
- ...
1624
- ],
1625
- "example": "const panels = ref([...]);"
1626
- }
1627
-
1628
- If no pattern exists for the given name, returns null.`,
1288
+ description: `Get a UI pattern checklist (accordion, modal, tabs, dropdown, toast). Returns best practices and common pitfalls.`,
1629
1289
  inputSchema: {
1630
1290
  type: 'object',
1631
1291
  properties: {
@@ -1800,11 +1460,29 @@ Vue evaluates v-model bindings before v-else is applied, causing "Cannot read pr
1800
1460
  When you create a Vue component, **app.js is automatically created/updated** with component registration. The create_file response will confirm this with an \`appJs\` field.
1801
1461
 
1802
1462
  **Page mount point:** Each page using Vue needs \`<div id="app"></div>\`:
1803
- - html_to_elements(page=routeUuid, elements='<div id="app"></div>')`;
1463
+ - html_to_elements(page=routeUuid, elements='<div id="app"></div>')
1464
+
1465
+ ## Context Documentation
1466
+
1467
+ Add context fields to significant changes (methods, files, routes, elements) to help future AI sessions understand the application.
1468
+
1469
+ **When to add context:** New features, significant changes, multi-entity implementations.
1470
+ **Skip context for:** Trivial changes, temporary code, unchanged context.
1471
+
1472
+ **Context fields** (flat in data object, used with save_method, save_file, save_route, update_element):
1473
+ - \`summary\`: What this does
1474
+ - \`rationale\`: Why it was built this way
1475
+ - \`references\`: [{uuid, type, relationship, note}] - links to related entities
1476
+ - \`decisions\`: Array of design decisions
1477
+
1478
+ Reference types: model, route, method, file, setting, element
1479
+ Relationships: uses, creates, updates, calls, contains, triggers
1480
+
1481
+ Context is preserved across updates - the backend merges fields.`;
1804
1482
  // Create MCP server
1805
1483
  const server = new Server({
1806
1484
  name: 'stellify-mcp',
1807
- version: '0.1.29',
1485
+ version: '0.1.30',
1808
1486
  }, {
1809
1487
  capabilities: {
1810
1488
  tools: {},
@@ -2676,15 +2354,35 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
2676
2354
  }
2677
2355
  }
2678
2356
  catch (error) {
2357
+ // Extract backend response data for better error messages
2358
+ const backendData = error.response?.data;
2359
+ const statusCode = error.response?.status;
2360
+ // Build a helpful error response
2361
+ const errorResponse = {
2362
+ success: false,
2363
+ error: backendData?.message || error.message || 'Request failed',
2364
+ };
2365
+ // Include hint if the backend provided one
2366
+ if (backendData?.hint) {
2367
+ errorResponse.hint = backendData.hint;
2368
+ }
2369
+ // Include validation errors if present
2370
+ if (backendData?.errors) {
2371
+ errorResponse.validation_errors = backendData.errors;
2372
+ }
2373
+ // Include status code for context
2374
+ if (statusCode) {
2375
+ errorResponse.status = statusCode;
2376
+ }
2377
+ // Include the original message if different from backend message
2378
+ if (backendData?.message && error.message && !error.message.includes(backendData.message)) {
2379
+ errorResponse.details = { message: backendData.message };
2380
+ }
2679
2381
  return {
2680
2382
  content: [
2681
2383
  {
2682
2384
  type: 'text',
2683
- text: JSON.stringify({
2684
- success: false,
2685
- error: error.message,
2686
- details: error.response?.data || error.toString(),
2687
- }, null, 2),
2385
+ text: JSON.stringify(errorResponse, null, 2),
2688
2386
  },
2689
2387
  ],
2690
2388
  isError: true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stellisoft/stellify-mcp",
3
- "version": "0.1.29",
3
+ "version": "0.1.30",
4
4
  "mcpName": "io.github.MattStellisoft/stellify-mcp",
5
5
  "description": "MCP server for Stellify - AI-native code generation platform",
6
6
  "main": "dist/index.js",
package/server.json CHANGED
@@ -6,12 +6,12 @@
6
6
  "url": "https://github.com/Stellify-Software-Ltd/stellify-mcp",
7
7
  "source": "github"
8
8
  },
9
- "version": "0.1.29",
9
+ "version": "0.1.30",
10
10
  "packages": [
11
11
  {
12
12
  "registryType": "npm",
13
13
  "identifier": "@stellisoft/stellify-mcp",
14
- "version": "0.1.29",
14
+ "version": "0.1.30",
15
15
  "transport": {
16
16
  "type": "stdio"
17
17
  },