@stellisoft/stellify-mcp 0.1.12 → 0.1.15

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/index.js CHANGED
@@ -178,6 +178,10 @@ The system resolves these to UUIDs automatically, creating missing dependencies
178
178
  items: { type: 'string' },
179
179
  description: 'Array of namespace strings to include as dependencies (e.g., ["App\\Models\\User", "Illuminate\\Support\\Facades\\Hash"]). These are resolved to UUIDs automatically.',
180
180
  },
181
+ module: {
182
+ type: 'string',
183
+ description: 'Optional module name to group this file with related code (e.g., "blog-posts", "user-auth"). Module is auto-created if it doesn\'t exist.',
184
+ },
181
185
  },
182
186
  required: ['directory', 'name', 'type'],
183
187
  },
@@ -406,6 +410,10 @@ Example:
406
410
  type: 'object',
407
411
  description: 'Additional route data (title, description, element UUIDs)',
408
412
  },
413
+ module: {
414
+ type: 'string',
415
+ description: 'Optional module name to group this route with related code (e.g., "blog-posts", "user-auth"). Module is auto-created if it doesn\'t exist.',
416
+ },
409
417
  },
410
418
  required: ['project_id', 'name', 'path', 'method'],
411
419
  },
@@ -654,150 +662,6 @@ IMPORTANT: Use the returned root element UUID in save_file's template array.`,
654
662
  required: ['elements'],
655
663
  },
656
664
  },
657
- {
658
- name: 'list_globals',
659
- description: 'List all global files in the Application database. Globals are reusable, curated code (controllers, models, services) that can be installed into tenant projects.',
660
- inputSchema: {
661
- type: 'object',
662
- properties: {},
663
- },
664
- },
665
- {
666
- name: 'get_global',
667
- description: 'Get a global file with all its methods, statements, and clauses. Returns the full structure of a reusable code file.',
668
- inputSchema: {
669
- type: 'object',
670
- properties: {
671
- uuid: {
672
- type: 'string',
673
- description: 'UUID of the global file to retrieve',
674
- },
675
- },
676
- required: ['uuid'],
677
- },
678
- },
679
- {
680
- name: 'install_global',
681
- description: 'Install a global file from the Application database into a tenant project. Copies the file, methods, and statements to the tenant database with the same UUIDs (for deduplication). Clauses remain shared in the Application DB.',
682
- inputSchema: {
683
- type: 'object',
684
- properties: {
685
- file_uuid: {
686
- type: 'string',
687
- description: 'UUID of the global file to install',
688
- },
689
- directory_uuid: {
690
- type: 'string',
691
- description: 'UUID of the directory in the tenant project to install the file into',
692
- },
693
- },
694
- required: ['file_uuid', 'directory_uuid'],
695
- },
696
- },
697
- {
698
- name: 'search_global_methods',
699
- description: 'Search for methods across the Application database (global/framework methods). Use this to find reusable Laravel framework methods, facades, and shared code.',
700
- inputSchema: {
701
- type: 'object',
702
- properties: {
703
- query: {
704
- type: 'string',
705
- description: 'Search query to find methods by name',
706
- },
707
- },
708
- required: ['query'],
709
- },
710
- },
711
- // Module tools (groups of globals)
712
- {
713
- name: 'list_modules',
714
- description: 'List all available modules. A module is a named collection of related global files that can be installed together as a package.',
715
- inputSchema: {
716
- type: 'object',
717
- properties: {},
718
- },
719
- },
720
- {
721
- name: 'get_module',
722
- description: 'Get a module with all its files. Returns the module metadata and list of global files it contains, in installation order.',
723
- inputSchema: {
724
- type: 'object',
725
- properties: {
726
- uuid: {
727
- type: 'string',
728
- description: 'UUID of the module to retrieve',
729
- },
730
- },
731
- required: ['uuid'],
732
- },
733
- },
734
- {
735
- name: 'create_module',
736
- description: 'Create a new module to group related global files together.',
737
- inputSchema: {
738
- type: 'object',
739
- properties: {
740
- name: {
741
- type: 'string',
742
- description: 'Unique name for the module (e.g., "laravel-sanctum-auth")',
743
- },
744
- description: {
745
- type: 'string',
746
- description: 'Description of what the module provides',
747
- },
748
- version: {
749
- type: 'string',
750
- description: 'Version string (default: "1.0.0")',
751
- },
752
- tags: {
753
- type: 'array',
754
- items: { type: 'string' },
755
- description: 'Tags for categorization (e.g., ["auth", "api", "sanctum"])',
756
- },
757
- },
758
- required: ['name'],
759
- },
760
- },
761
- {
762
- name: 'add_file_to_module',
763
- description: 'Add a global file to a module. Files are installed in order when the module is installed.',
764
- inputSchema: {
765
- type: 'object',
766
- properties: {
767
- module_uuid: {
768
- type: 'string',
769
- description: 'UUID of the module',
770
- },
771
- file_uuid: {
772
- type: 'string',
773
- description: 'UUID of the global file to add',
774
- },
775
- order: {
776
- type: 'number',
777
- description: 'Installation order (optional, auto-increments if not specified)',
778
- },
779
- },
780
- required: ['module_uuid', 'file_uuid'],
781
- },
782
- },
783
- {
784
- name: 'install_module',
785
- description: 'Install all files from a module into a tenant project. Copies files, methods, and statements in the defined order. Clauses remain shared in the Application DB.',
786
- inputSchema: {
787
- type: 'object',
788
- properties: {
789
- module_uuid: {
790
- type: 'string',
791
- description: 'UUID of the module to install',
792
- },
793
- directory_uuid: {
794
- type: 'string',
795
- description: 'UUID of the directory in the tenant project to install files into',
796
- },
797
- },
798
- required: ['module_uuid', 'directory_uuid'],
799
- },
800
- },
801
665
  // =============================================================================
802
666
  // STATEMENT & FILE MANAGEMENT TOOLS
803
667
  // =============================================================================
@@ -1331,6 +1195,54 @@ Examples of capability requests:
1331
1195
  required: ['capability', 'description', 'use_case'],
1332
1196
  },
1333
1197
  },
1198
+ {
1199
+ name: 'analyze_performance',
1200
+ description: `Analyze code execution performance from logs. Identifies slow methods, N+1 query patterns, high memory usage, and failure rates.
1201
+
1202
+ Use this tool PROACTIVELY to:
1203
+ - Review performance after creating new methods
1204
+ - Identify optimization opportunities
1205
+ - Detect N+1 query patterns (high query counts)
1206
+ - Find methods that need caching or refactoring
1207
+ - Check failure rates and error patterns
1208
+
1209
+ ANALYSIS TYPES:
1210
+ - full: Comprehensive report with all issues, recommendations, and statistics
1211
+ - slow_methods: Methods exceeding 500ms execution time
1212
+ - high_query_methods: Methods with >10 queries (potential N+1 problems)
1213
+ - high_memory_methods: Methods using >50MB memory
1214
+ - failure_rates: Methods with high error rates
1215
+ - trend: Performance trend over time (daily averages)
1216
+
1217
+ EXAMPLE - Full analysis:
1218
+ { "type": "full", "days": 7 }
1219
+
1220
+ EXAMPLE - Check for N+1 queries:
1221
+ { "type": "high_query_methods", "limit": 10 }
1222
+
1223
+ The response includes actionable recommendations like:
1224
+ - "Consider eager loading relationships" for N+1 patterns
1225
+ - "Add database indexes" for slow queries
1226
+ - "Use chunking" for high memory usage`,
1227
+ inputSchema: {
1228
+ type: 'object',
1229
+ properties: {
1230
+ type: {
1231
+ type: 'string',
1232
+ enum: ['full', 'slow_methods', 'high_query_methods', 'high_memory_methods', 'failure_rates', 'trend'],
1233
+ description: 'Type of analysis to run (default: full)',
1234
+ },
1235
+ days: {
1236
+ type: 'number',
1237
+ description: 'Number of days to analyze (default: 7)',
1238
+ },
1239
+ limit: {
1240
+ type: 'number',
1241
+ description: 'Maximum results for specific queries (default: 10)',
1242
+ },
1243
+ },
1244
+ },
1245
+ },
1334
1246
  ];
1335
1247
  // Server instructions for tool discovery (used by MCP Tool Search)
1336
1248
  const SERVER_INSTRUCTIONS = `Stellify is a coding platform where you code alongside AI on a codebase maintained and curated by AI. Build Laravel/PHP and Vue.js applications.
@@ -1372,7 +1284,20 @@ Examples of capabilities (packages you cannot write):
1372
1284
  - Call request_capability() to log it
1373
1285
  - INFORM THE USER: "This feature requires the [X] package which isn't installed in Stellify yet. I've logged a request. This cannot be built until the package is added."
1374
1286
 
1375
- **NEVER write code that belongs in a package.** If you find yourself writing OAuth flows, payment processing, S3 clients, email transport, search indexing, or similar infrastructure - STOP. That's a capability request, not business logic.`;
1287
+ **NEVER write code that belongs in a package.** If you find yourself writing OAuth flows, payment processing, S3 clients, email transport, search indexing, or similar infrastructure - STOP. That's a capability request, not business logic.
1288
+
1289
+ ## Project Modules (Code Organization)
1290
+
1291
+ When building features, group related files by passing a "module" parameter.
1292
+
1293
+ **WORKFLOW:** Simply include the 'module' parameter when creating files or routes:
1294
+
1295
+ - create_file(..., module: "blog-posts") - auto-groups file
1296
+ - create_route(..., module: "blog-posts") - auto-groups route
1297
+
1298
+ Modules are auto-created if they don't exist. This helps users see all code related to a feature grouped together.
1299
+
1300
+ Example module names: "user-auth", "blog-posts", "product-catalog", "order-management", "admin-dashboard"`;
1376
1301
  // Create MCP server
1377
1302
  const server = new Server({
1378
1303
  name: 'stellify-mcp',
@@ -1663,143 +1588,6 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
1663
1588
  ],
1664
1589
  };
1665
1590
  }
1666
- case 'list_globals': {
1667
- const result = await stellify.listGlobals();
1668
- return {
1669
- content: [
1670
- {
1671
- type: 'text',
1672
- text: JSON.stringify({
1673
- success: true,
1674
- message: `Found ${result.data?.length || 0} globals`,
1675
- globals: result.data,
1676
- }, null, 2),
1677
- },
1678
- ],
1679
- };
1680
- }
1681
- case 'get_global': {
1682
- const { uuid } = args;
1683
- const result = await stellify.getGlobal(uuid);
1684
- return {
1685
- content: [
1686
- {
1687
- type: 'text',
1688
- text: JSON.stringify({
1689
- success: true,
1690
- global: result,
1691
- }, null, 2),
1692
- },
1693
- ],
1694
- };
1695
- }
1696
- case 'install_global': {
1697
- const result = await stellify.installGlobal(args);
1698
- return {
1699
- content: [
1700
- {
1701
- type: 'text',
1702
- text: JSON.stringify({
1703
- success: true,
1704
- message: `Installed global "${result.data?.file_name}" (${result.data?.methods_copied} methods, ${result.data?.statements_copied} statements)`,
1705
- data: result.data,
1706
- }, null, 2),
1707
- },
1708
- ],
1709
- };
1710
- }
1711
- case 'search_global_methods': {
1712
- const result = await stellify.searchGlobalMethods(args);
1713
- return {
1714
- content: [
1715
- {
1716
- type: 'text',
1717
- text: JSON.stringify({
1718
- success: true,
1719
- message: `Found ${result.data?.length || 0} global methods`,
1720
- methods: result.data,
1721
- }, null, 2),
1722
- },
1723
- ],
1724
- };
1725
- }
1726
- // Module handlers
1727
- case 'list_modules': {
1728
- const result = await stellify.listModules();
1729
- return {
1730
- content: [
1731
- {
1732
- type: 'text',
1733
- text: JSON.stringify({
1734
- success: true,
1735
- message: `Found ${result.data?.length || 0} modules`,
1736
- modules: result.data,
1737
- }, null, 2),
1738
- },
1739
- ],
1740
- };
1741
- }
1742
- case 'get_module': {
1743
- const { uuid } = args;
1744
- const result = await stellify.getModule(uuid);
1745
- return {
1746
- content: [
1747
- {
1748
- type: 'text',
1749
- text: JSON.stringify({
1750
- success: true,
1751
- module: result.module,
1752
- files: result.files,
1753
- }, null, 2),
1754
- },
1755
- ],
1756
- };
1757
- }
1758
- case 'create_module': {
1759
- const result = await stellify.createModule(args);
1760
- return {
1761
- content: [
1762
- {
1763
- type: 'text',
1764
- text: JSON.stringify({
1765
- success: true,
1766
- message: `Created module "${result.data?.name}"`,
1767
- data: result.data,
1768
- }, null, 2),
1769
- },
1770
- ],
1771
- };
1772
- }
1773
- case 'add_file_to_module': {
1774
- const result = await stellify.addFileToModule(args);
1775
- return {
1776
- content: [
1777
- {
1778
- type: 'text',
1779
- text: JSON.stringify({
1780
- success: true,
1781
- message: `Added "${result.data?.file_name}" to module (order: ${result.data?.order})`,
1782
- data: result.data,
1783
- }, null, 2),
1784
- },
1785
- ],
1786
- };
1787
- }
1788
- case 'install_module': {
1789
- const result = await stellify.installModule(args);
1790
- return {
1791
- content: [
1792
- {
1793
- type: 'text',
1794
- text: JSON.stringify({
1795
- success: true,
1796
- message: `Installed module "${result.data?.module_name}" (${result.data?.files_installed} files, ${result.data?.methods_copied} methods, ${result.data?.statements_copied} statements)`,
1797
- data: result.data,
1798
- }, null, 2),
1799
- },
1800
- ],
1801
- };
1802
- }
1803
1591
  // Statement & File Management handlers
1804
1592
  case 'get_statement': {
1805
1593
  const result = await stellify.getStatement(args.uuid);
@@ -2034,6 +1822,52 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
2034
1822
  ],
2035
1823
  };
2036
1824
  }
1825
+ case 'analyze_performance': {
1826
+ const result = await stellify.analyzePerformance(args);
1827
+ const data = result.data || result;
1828
+ const analysisType = args.type || 'full';
1829
+ // Build message based on analysis type
1830
+ let message = '';
1831
+ if (analysisType === 'full') {
1832
+ message = data.summary || `Analyzed ${data.analyzed_executions || 0} executions`;
1833
+ if (data.issues?.length > 0) {
1834
+ message += ` - Found ${data.issues.length} potential issue(s)`;
1835
+ }
1836
+ }
1837
+ else if (analysisType === 'slow_methods') {
1838
+ const methods = data.slow_methods || data;
1839
+ message = `Found ${Array.isArray(methods) ? methods.length : 0} slow methods`;
1840
+ }
1841
+ else if (analysisType === 'high_query_methods') {
1842
+ const methods = data.high_query_methods || data;
1843
+ message = `Found ${Array.isArray(methods) ? methods.length : 0} methods with high query counts (potential N+1)`;
1844
+ }
1845
+ else if (analysisType === 'high_memory_methods') {
1846
+ const methods = data.high_memory_methods || data;
1847
+ message = `Found ${Array.isArray(methods) ? methods.length : 0} methods with high memory usage`;
1848
+ }
1849
+ else if (analysisType === 'failure_rates') {
1850
+ const methods = data.failure_rates || data;
1851
+ message = `Found ${Array.isArray(methods) ? methods.length : 0} methods with failures`;
1852
+ }
1853
+ else if (analysisType === 'trend') {
1854
+ const trend = data.trend || data;
1855
+ message = `Performance trend: ${Array.isArray(trend) ? trend.length : 0} days of data`;
1856
+ }
1857
+ return {
1858
+ content: [
1859
+ {
1860
+ type: 'text',
1861
+ text: JSON.stringify({
1862
+ success: true,
1863
+ message,
1864
+ analysis_type: analysisType,
1865
+ data,
1866
+ }, null, 2),
1867
+ },
1868
+ ],
1869
+ };
1870
+ }
2037
1871
  default:
2038
1872
  throw new Error(`Unknown tool: ${name}`);
2039
1873
  }
@@ -105,34 +105,6 @@ export declare class StellifyClient {
105
105
  selection?: string;
106
106
  test?: boolean;
107
107
  }): Promise<any>;
108
- listGlobals(): Promise<any>;
109
- getGlobal(uuid: string): Promise<any>;
110
- installGlobal(params: {
111
- file_uuid: string;
112
- directory_uuid: string;
113
- }): Promise<any>;
114
- searchGlobalMethods(params: {
115
- query: string;
116
- }): Promise<any>;
117
- listModules(): Promise<any>;
118
- getModule(module: string): Promise<any>;
119
- createModule(params: {
120
- name: string;
121
- description?: string;
122
- version?: string;
123
- tags?: string[];
124
- }): Promise<any>;
125
- addFileToModule(params: {
126
- module: string;
127
- file: string;
128
- order?: number;
129
- }): Promise<any>;
130
- removeFileFromModule(module: string, file: string): Promise<any>;
131
- installModule(params: {
132
- module: string;
133
- directory: string;
134
- }): Promise<any>;
135
- deleteModule(uuid: string): Promise<any>;
136
108
  getDirectory(uuid: string): Promise<any>;
137
109
  createDirectory(params: {
138
110
  name: string;
@@ -186,4 +158,9 @@ export declare class StellifyClient {
186
158
  workaround?: string;
187
159
  priority?: 'low' | 'medium' | 'high' | 'critical';
188
160
  }): Promise<any>;
161
+ analyzePerformance(params: {
162
+ type?: 'full' | 'slow_methods' | 'high_query_methods' | 'high_memory_methods' | 'failure_rates' | 'trend';
163
+ days?: number;
164
+ limit?: number;
165
+ }): Promise<any>;
189
166
  }
@@ -103,52 +103,6 @@ export class StellifyClient {
103
103
  const response = await this.client.post('/html/elements', params);
104
104
  return response.data;
105
105
  }
106
- // Global methods (Application DB)
107
- async listGlobals() {
108
- const response = await this.client.get('/globals/');
109
- return response.data;
110
- }
111
- async getGlobal(uuid) {
112
- const response = await this.client.get(`/globals/file/${uuid}`);
113
- return response.data;
114
- }
115
- async installGlobal(params) {
116
- const response = await this.client.post('/globals/install', params);
117
- return response.data;
118
- }
119
- async searchGlobalMethods(params) {
120
- const response = await this.client.post('/method/search-global', params);
121
- return response.data;
122
- }
123
- // Module methods (groups of globals)
124
- async listModules() {
125
- const response = await this.client.get('/modules/');
126
- return response.data;
127
- }
128
- async getModule(module) {
129
- const response = await this.client.get(`/modules/${module}`);
130
- return response.data;
131
- }
132
- async createModule(params) {
133
- const response = await this.client.post('/modules/', params);
134
- return response.data;
135
- }
136
- async addFileToModule(params) {
137
- const response = await this.client.post('/modules/add-file', params);
138
- return response.data;
139
- }
140
- async removeFileFromModule(module, file) {
141
- const response = await this.client.delete(`/modules/${module}/file/${file}`);
142
- return response.data;
143
- }
144
- async installModule(params) {
145
- const response = await this.client.post('/modules/install', params);
146
- return response.data;
147
- }
148
- async deleteModule(uuid) {
149
- const response = await this.client.delete(`/modules/${module}`);
150
- return response.data;
151
- }
152
106
  // Directory methods
153
107
  async getDirectory(uuid) {
154
108
  const response = await this.client.get(`/directory/${uuid}`);
@@ -196,4 +150,23 @@ export class StellifyClient {
196
150
  const response = await this.client.post('/capabilities/request', params);
197
151
  return response.data;
198
152
  }
153
+ // Performance analysis - analyze execution logs for optimization opportunities
154
+ async analyzePerformance(params) {
155
+ const type = params.type || 'full';
156
+ const queryParams = {};
157
+ if (params.days)
158
+ queryParams.days = params.days;
159
+ if (params.limit)
160
+ queryParams.limit = params.limit;
161
+ // Map type to endpoint
162
+ const endpoint = type === 'full' ? '/performance/analyze' :
163
+ type === 'slow_methods' ? '/performance/slow-methods' :
164
+ type === 'high_query_methods' ? '/performance/high-query-methods' :
165
+ type === 'high_memory_methods' ? '/performance/high-memory-methods' :
166
+ type === 'failure_rates' ? '/performance/failure-rates' :
167
+ type === 'trend' ? '/performance/trend' :
168
+ '/performance/analyze';
169
+ const response = await this.client.get(endpoint, { params: queryParams });
170
+ return response.data;
171
+ }
199
172
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stellisoft/stellify-mcp",
3
- "version": "0.1.12",
3
+ "version": "0.1.15",
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",