@stellisoft/stellify-mcp 0.1.13 → 0.1.16

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
@@ -1195,6 +1195,93 @@ Examples of capability requests:
1195
1195
  required: ['capability', 'description', 'use_case'],
1196
1196
  },
1197
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
+ },
1246
+ {
1247
+ name: 'analyze_quality',
1248
+ description: `Analyze Laravel code structure for quality issues. Detects missing relationships, fillables, casts, and route problems.
1249
+
1250
+ Use this tool PROACTIVELY to:
1251
+ - Review code quality after creating models or controllers
1252
+ - Detect missing Eloquent relationships (belongsTo, hasMany)
1253
+ - Find migration fields not in $fillable
1254
+ - Suggest type casts for columns (json → array, datetime → datetime)
1255
+ - Identify broken route bindings (orphaned methods, missing controllers)
1256
+
1257
+ ANALYSIS TYPES:
1258
+ - full: Comprehensive analysis of all categories with recommendations
1259
+ - relationships: Missing belongsTo/hasMany based on foreign keys
1260
+ - fillables: Migration fields not in Model $fillable array
1261
+ - casts: Columns that should have type casts
1262
+ - routes: Orphaned controller methods, routes pointing to missing methods
1263
+
1264
+ EXAMPLE - Full analysis:
1265
+ { "type": "full" }
1266
+
1267
+ EXAMPLE - Check relationships only:
1268
+ { "type": "relationships" }
1269
+
1270
+ The response includes actionable suggestions like:
1271
+ - "Add belongsTo relationship: public function user() { return $this->belongsTo(User::class); }"
1272
+ - "Add 'published_at' to $fillable array"
1273
+ - "Add cast: 'metadata' => 'array'"`,
1274
+ inputSchema: {
1275
+ type: 'object',
1276
+ properties: {
1277
+ type: {
1278
+ type: 'string',
1279
+ enum: ['full', 'relationships', 'fillables', 'casts', 'routes'],
1280
+ description: 'Type of analysis to run (default: full)',
1281
+ },
1282
+ },
1283
+ },
1284
+ },
1198
1285
  ];
1199
1286
  // Server instructions for tool discovery (used by MCP Tool Search)
1200
1287
  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.
@@ -1774,6 +1861,86 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
1774
1861
  ],
1775
1862
  };
1776
1863
  }
1864
+ case 'analyze_performance': {
1865
+ const result = await stellify.analyzePerformance(args);
1866
+ const data = result.data || result;
1867
+ const analysisType = args.type || 'full';
1868
+ // Build message based on analysis type
1869
+ let message = '';
1870
+ if (analysisType === 'full') {
1871
+ message = data.summary || `Analyzed ${data.analyzed_executions || 0} executions`;
1872
+ if (data.issues?.length > 0) {
1873
+ message += ` - Found ${data.issues.length} potential issue(s)`;
1874
+ }
1875
+ }
1876
+ else if (analysisType === 'slow_methods') {
1877
+ const methods = data.slow_methods || data;
1878
+ message = `Found ${Array.isArray(methods) ? methods.length : 0} slow methods`;
1879
+ }
1880
+ else if (analysisType === 'high_query_methods') {
1881
+ const methods = data.high_query_methods || data;
1882
+ message = `Found ${Array.isArray(methods) ? methods.length : 0} methods with high query counts (potential N+1)`;
1883
+ }
1884
+ else if (analysisType === 'high_memory_methods') {
1885
+ const methods = data.high_memory_methods || data;
1886
+ message = `Found ${Array.isArray(methods) ? methods.length : 0} methods with high memory usage`;
1887
+ }
1888
+ else if (analysisType === 'failure_rates') {
1889
+ const methods = data.failure_rates || data;
1890
+ message = `Found ${Array.isArray(methods) ? methods.length : 0} methods with failures`;
1891
+ }
1892
+ else if (analysisType === 'trend') {
1893
+ const trend = data.trend || data;
1894
+ message = `Performance trend: ${Array.isArray(trend) ? trend.length : 0} days of data`;
1895
+ }
1896
+ return {
1897
+ content: [
1898
+ {
1899
+ type: 'text',
1900
+ text: JSON.stringify({
1901
+ success: true,
1902
+ message,
1903
+ analysis_type: analysisType,
1904
+ data,
1905
+ }, null, 2),
1906
+ },
1907
+ ],
1908
+ };
1909
+ }
1910
+ case 'analyze_quality': {
1911
+ const result = await stellify.analyzeQuality(args);
1912
+ const data = result.data || result;
1913
+ const analysisType = args.type || 'full';
1914
+ // Build message based on analysis type
1915
+ let message = '';
1916
+ const issues = data.issues || [];
1917
+ if (analysisType === 'full') {
1918
+ const summary = data.summary || {};
1919
+ message = `Analyzed ${summary.models_analyzed || 0} models, ${summary.controllers_analyzed || 0} controllers`;
1920
+ if (summary.total_issues > 0) {
1921
+ message += ` - Found ${summary.total_issues} issue(s): ${summary.high_severity || 0} high, ${summary.medium_severity || 0} medium, ${summary.low_severity || 0} low`;
1922
+ }
1923
+ else {
1924
+ message += ' - No issues found';
1925
+ }
1926
+ }
1927
+ else {
1928
+ message = `Found ${issues.length} ${analysisType} issue(s)`;
1929
+ }
1930
+ return {
1931
+ content: [
1932
+ {
1933
+ type: 'text',
1934
+ text: JSON.stringify({
1935
+ success: true,
1936
+ message,
1937
+ analysis_type: analysisType,
1938
+ data,
1939
+ }, null, 2),
1940
+ },
1941
+ ],
1942
+ };
1943
+ }
1777
1944
  default:
1778
1945
  throw new Error(`Unknown tool: ${name}`);
1779
1946
  }
@@ -158,4 +158,12 @@ export declare class StellifyClient {
158
158
  workaround?: string;
159
159
  priority?: 'low' | 'medium' | 'high' | 'critical';
160
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>;
166
+ analyzeQuality(params: {
167
+ type?: 'full' | 'relationships' | 'fillables' | 'casts' | 'routes';
168
+ }): Promise<any>;
161
169
  }
@@ -150,4 +150,36 @@ export class StellifyClient {
150
150
  const response = await this.client.post('/capabilities/request', params);
151
151
  return response.data;
152
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
+ }
172
+ // Code quality analysis - analyze Laravel structure for issues
173
+ async analyzeQuality(params) {
174
+ const type = params.type || 'full';
175
+ // Map type to endpoint
176
+ const endpoint = type === 'full' ? '/quality/analyze' :
177
+ type === 'relationships' ? '/quality/relationships' :
178
+ type === 'fillables' ? '/quality/fillables' :
179
+ type === 'casts' ? '/quality/casts' :
180
+ type === 'routes' ? '/quality/routes' :
181
+ '/quality/analyze';
182
+ const response = await this.client.get(endpoint);
183
+ return response.data;
184
+ }
153
185
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stellisoft/stellify-mcp",
3
- "version": "0.1.13",
3
+ "version": "0.1.16",
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",