@democratize-quality/mcp-server 1.1.8 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. package/LICENSE +658 -12
  2. package/README.md +11 -6
  3. package/dist/server.d.ts +41 -0
  4. package/dist/server.d.ts.map +1 -0
  5. package/dist/server.js +225 -0
  6. package/dist/server.js.map +1 -0
  7. package/package.json +24 -25
  8. package/browserControl.js +0 -113
  9. package/cli.js +0 -228
  10. package/mcpServer.js +0 -335
  11. package/run-server.js +0 -140
  12. package/src/chatmodes//360/237/214/220 api-generator.chatmode.md" +0 -409
  13. package/src/chatmodes//360/237/214/220 api-healer.chatmode.md" +0 -494
  14. package/src/chatmodes//360/237/214/220 api-planner.chatmode.md" +0 -954
  15. package/src/config/environments/api-only.js +0 -53
  16. package/src/config/environments/development.js +0 -54
  17. package/src/config/environments/production.js +0 -69
  18. package/src/config/index.js +0 -341
  19. package/src/config/server.js +0 -41
  20. package/src/config/tools/api.js +0 -67
  21. package/src/config/tools/browser.js +0 -90
  22. package/src/config/tools/default.js +0 -32
  23. package/src/docs/Agent_README.md +0 -310
  24. package/src/docs/QUICK_REFERENCE.md +0 -111
  25. package/src/services/browserService.js +0 -325
  26. package/src/skills/api-planning/SKILL.md +0 -224
  27. package/src/skills/test-execution/SKILL.md +0 -728
  28. package/src/skills/test-generation/SKILL.md +0 -309
  29. package/src/skills/test-healing/SKILL.md +0 -405
  30. package/src/tools/api/api-generator.js +0 -1865
  31. package/src/tools/api/api-healer.js +0 -617
  32. package/src/tools/api/api-planner.js +0 -2598
  33. package/src/tools/api/api-project-setup.js +0 -313
  34. package/src/tools/api/api-request.js +0 -641
  35. package/src/tools/api/api-session-report.js +0 -1278
  36. package/src/tools/api/api-session-status.js +0 -395
  37. package/src/tools/api/prompts/README.md +0 -293
  38. package/src/tools/api/prompts/generation-prompts.js +0 -703
  39. package/src/tools/api/prompts/healing-prompts.js +0 -195
  40. package/src/tools/api/prompts/index.js +0 -25
  41. package/src/tools/api/prompts/orchestrator.js +0 -334
  42. package/src/tools/api/prompts/validation-rules.js +0 -339
  43. package/src/tools/base/ToolBase.js +0 -230
  44. package/src/tools/base/ToolRegistry.js +0 -269
  45. package/src/tools/browser/advanced/browser-console.js +0 -384
  46. package/src/tools/browser/advanced/browser-dialog.js +0 -319
  47. package/src/tools/browser/advanced/browser-evaluate.js +0 -337
  48. package/src/tools/browser/advanced/browser-file.js +0 -480
  49. package/src/tools/browser/advanced/browser-keyboard.js +0 -343
  50. package/src/tools/browser/advanced/browser-mouse.js +0 -332
  51. package/src/tools/browser/advanced/browser-network.js +0 -421
  52. package/src/tools/browser/advanced/browser-pdf.js +0 -407
  53. package/src/tools/browser/advanced/browser-tabs.js +0 -497
  54. package/src/tools/browser/advanced/browser-wait.js +0 -378
  55. package/src/tools/browser/click.js +0 -168
  56. package/src/tools/browser/close.js +0 -60
  57. package/src/tools/browser/dom.js +0 -70
  58. package/src/tools/browser/launch.js +0 -67
  59. package/src/tools/browser/navigate.js +0 -270
  60. package/src/tools/browser/screenshot.js +0 -351
  61. package/src/tools/browser/type.js +0 -174
  62. package/src/tools/index.js +0 -95
  63. package/src/utils/agentInstaller.js +0 -418
  64. package/src/utils/browserHelpers.js +0 -83
@@ -1,53 +0,0 @@
1
- /**
2
- * API-only environment configuration
3
- * Only enables API testing tools, disables all browser automation tools
4
- * Ideal for lightweight deployments focused on API testing
5
- */
6
- module.exports = {
7
- features: {
8
- enableDebugMode: process.env.MCP_FEATURES_ENABLEDEBUGMODE === 'true',
9
- // Only API tools enabled
10
- enableApiTools: true,
11
- enableBrowserTools: false,
12
- enableAdvancedTools: false,
13
- enableFileTools: false,
14
- enableNetworkTools: false,
15
- enableOtherTools: false
16
- },
17
-
18
- logging: {
19
- level: 'warn',
20
- enableToolDebug: false
21
- },
22
-
23
- tools: {
24
- validationLevel: 'strict',
25
- // API tool specific configurations
26
- api: {
27
- api_request: {
28
- maxSessionTimeout: 300000, // 5 minutes
29
- maxConcurrentSessions: 10,
30
- enableRetries: true,
31
- defaultRetryAttempts: 3,
32
- enableRequestLogging: true,
33
- enableResponseLogging: true
34
- },
35
- api_session_report: {
36
- defaultTheme: 'light',
37
- includeTimestamp: true,
38
- maxReportSize: '10MB',
39
- enableCompressionForLargeReports: true
40
- },
41
- api_session_status: {
42
- enableRealTimeUpdates: true,
43
- maxHistoryEntries: 1000
44
- }
45
- }
46
- },
47
-
48
- security: {
49
- enableInputValidation: true,
50
- rateLimiting: true,
51
- maxRequestsPerMinute: 100
52
- }
53
- };
@@ -1,54 +0,0 @@
1
- /**
2
- * Development environment configuration
3
- * Settings optimized for development and debugging
4
- */
5
- module.exports = {
6
- features: {
7
- enableDebugMode: true,
8
- // Tool category feature flags - all enabled by default in development
9
- enableApiTools: true,
10
- enableBrowserTools: true,
11
- enableAdvancedTools: true,
12
- enableFileTools: true,
13
- enableNetworkTools: true,
14
- enableOtherTools: true
15
- },
16
-
17
- logging: {
18
- level: 'debug',
19
- enableToolDebug: true
20
- },
21
-
22
- tools: {
23
- validationLevel: 'strict',
24
- browser: {
25
- browser_launch: {
26
- defaultHeadless: false, // Show browser in development
27
- maxInstances: 5,
28
- chromeFlags: [
29
- '--disable-gpu',
30
- '--no-sandbox',
31
- '--disable-web-security', // Allow CORS in development
32
- '--disable-features=VizDisplayCompositor'
33
- ]
34
- },
35
- browser_screenshot: {
36
- enableTimestamps: true,
37
- outputDirectory: require('path').resolve(__dirname, '../../../output/dev')
38
- },
39
- browser_dom: {
40
- highlightElements: true, // Highlight elements for debugging
41
- enableRetries: true
42
- },
43
- global: {
44
- enableScreenshotOnError: true,
45
- enablePerformanceMetrics: true
46
- }
47
- }
48
- },
49
-
50
- security: {
51
- enableInputValidation: true,
52
- rateLimiting: false
53
- }
54
- };
@@ -1,69 +0,0 @@
1
- /**
2
- * Production environment configuration
3
- * Settings optimized for production deployment
4
- */
5
- module.exports = {
6
- features: {
7
- enableDebugMode: false,
8
- // Tool category feature flags - API tools enabled by default, others can be controlled
9
- enableApiTools: true,
10
- enableBrowserTools: process.env.ENABLE_BROWSER_TOOLS !== 'false',
11
- enableAdvancedTools: process.env.ENABLE_ADVANCED_TOOLS === 'true',
12
- enableFileTools: process.env.ENABLE_FILE_TOOLS === 'true',
13
- enableNetworkTools: process.env.ENABLE_NETWORK_TOOLS === 'true',
14
- enableOtherTools: process.env.ENABLE_OTHER_TOOLS === 'true'
15
- },
16
-
17
- logging: {
18
- level: 'error',
19
- enableToolDebug: false
20
- },
21
-
22
- tools: {
23
- validationLevel: 'strict',
24
- browser: {
25
- browser_launch: {
26
- defaultHeadless: true, // Always headless in production
27
- maxInstances: 3, // Conservative limit
28
- launchTimeout: 15000, // Shorter timeout
29
- chromeFlags: [
30
- '--headless=new',
31
- '--disable-gpu',
32
- '--no-sandbox',
33
- '--disable-dev-shm-usage',
34
- '--disable-background-timer-throttling',
35
- '--disable-backgrounding-occluded-windows',
36
- '--disable-renderer-backgrounding',
37
- '--memory-pressure-off',
38
- '--max_old_space_size=4096'
39
- ]
40
- },
41
- browser_screenshot: {
42
- defaultQuality: 60, // Lower quality for performance
43
- compressionLevel: 9, // Higher compression
44
- enableTimestamps: false
45
- },
46
- browser_dom: {
47
- highlightElements: false,
48
- enableRetries: false, // Fail fast in production
49
- defaultWaitTimeout: 3000 // Shorter timeout
50
- },
51
- browser_type: {
52
- typingDelay: 5, // Faster typing
53
- enableNaturalTyping: false
54
- },
55
- global: {
56
- maxConcurrentOperations: 2,
57
- enableScreenshotOnError: false,
58
- enablePerformanceMetrics: false,
59
- healthCheckInterval: 300000 // 5 minutes
60
- }
61
- }
62
- },
63
-
64
- security: {
65
- enableInputValidation: true,
66
- rateLimiting: true,
67
- maxRequestSize: '5MB'
68
- }
69
- };
@@ -1,341 +0,0 @@
1
- const path = require('path');
2
- const fs = require('fs');
3
-
4
- /**
5
- * Configuration Management System
6
- * Loads and manages configuration from multiple sources with environment-based overrides
7
- */
8
- class ConfigManager {
9
- constructor(options = {}) {
10
- this.config = {};
11
- this.environment = process.env.NODE_ENV || 'api-only';
12
- this.configDir = path.join(__dirname);
13
-
14
- // Check for debug mode early
15
- const debugFromEnv = process.env.MCP_FEATURES_ENABLEDEBUGMODE === 'true' || this.environment === 'development';
16
- this.quiet = options.quiet !== undefined ? options.quiet : !debugFromEnv;
17
-
18
- this.loadConfiguration();
19
- }
20
-
21
- /**
22
- * Load configuration from multiple sources in order of precedence:
23
- * 1. Environment variables (highest precedence)
24
- * 2. Environment-specific config files
25
- * 3. Default configuration files (lowest precedence)
26
- */
27
- loadConfiguration() {
28
- if (!this.quiet) {
29
- console.error('[Config] Loading configuration...');
30
- }
31
-
32
- try {
33
- // Load base server configuration
34
- this.config = this.loadConfigFile('server.js', {});
35
-
36
- // Load tool configurations
37
- this.config.tools = this.loadToolConfigs();
38
-
39
- // Load environment-specific overrides
40
- this.loadEnvironmentConfig();
41
-
42
- // Apply environment variable overrides (highest precedence)
43
- this.applyEnvironmentVariables();
44
-
45
- if (!this.quiet) {
46
- console.error(`[Config] Configuration loaded for environment: ${this.environment}`);
47
- }
48
-
49
- } catch (error) {
50
- console.error('[Config] Error loading configuration:', error.message);
51
- // Use defaults if config loading fails
52
- this.config = this.getDefaultConfig();
53
- }
54
- }
55
-
56
- /**
57
- * Load a configuration file if it exists
58
- * @param {string} filename - The config file name
59
- * @param {object} defaultValue - Default value if file doesn't exist
60
- * @returns {object} - The loaded configuration
61
- */
62
- loadConfigFile(filename, defaultValue = {}) {
63
- const filePath = path.join(this.configDir, filename);
64
-
65
- if (fs.existsSync(filePath)) {
66
- try {
67
- return require(filePath);
68
- } catch (error) {
69
- console.error(`[Config] Error loading ${filename}:`, error.message);
70
- return defaultValue;
71
- }
72
- }
73
-
74
- return defaultValue;
75
- }
76
-
77
- /**
78
- * Load all tool-specific configurations
79
- * @returns {object} - Combined tool configurations
80
- */
81
- loadToolConfigs() {
82
- const toolsDir = path.join(this.configDir, 'tools');
83
- const toolConfigs = {};
84
-
85
- // Load default tool config
86
- const defaultToolConfig = this.loadConfigFile('tools/default.js', {});
87
-
88
- if (fs.existsSync(toolsDir)) {
89
- const toolConfigFiles = fs.readdirSync(toolsDir).filter(file =>
90
- file.endsWith('.js') && file !== 'default.js'
91
- );
92
-
93
- for (const file of toolConfigFiles) {
94
- const configName = path.basename(file, '.js');
95
- toolConfigs[configName] = {
96
- ...defaultToolConfig,
97
- ...this.loadConfigFile(`tools/${file}`, {})
98
- };
99
- }
100
- }
101
-
102
- return toolConfigs;
103
- }
104
-
105
- /**
106
- * Load environment-specific configuration overrides
107
- */
108
- loadEnvironmentConfig() {
109
- const envConfig = this.loadConfigFile(`environments/${this.environment}.js`, {});
110
-
111
- // Deep merge environment config
112
- this.config = this.deepMerge(this.config, envConfig);
113
- }
114
-
115
- /**
116
- * Apply environment variable overrides
117
- * Environment variables follow the pattern: MCP_SECTION_KEY=value
118
- */
119
- applyEnvironmentVariables() {
120
- const envPrefix = 'MCP_';
121
-
122
- for (const [key, value] of Object.entries(process.env)) {
123
- if (key.startsWith(envPrefix)) {
124
- let configPath = key.substring(envPrefix.length).toLowerCase().split('_');
125
- const parsedValue = this.parseEnvValue(value);
126
-
127
- // Special handling for feature flags to maintain camelCase
128
- if (configPath[0] === 'features' && configPath.length > 1) {
129
- // Convert features_enablebrowsertools to features.enableBrowserTools
130
- const featureName = configPath.slice(1).join('_');
131
- const camelCaseFeature = this.toCamelCase(featureName);
132
- configPath = ['features', camelCaseFeature];
133
-
134
- // Remove the lowercase version if it exists
135
- if (this.config.features && this.config.features[featureName]) {
136
- delete this.config.features[featureName];
137
- }
138
- }
139
-
140
- this.setNestedValue(this.config, configPath, parsedValue);
141
- }
142
- }
143
- }
144
-
145
- /**
146
- * Convert snake_case to camelCase
147
- * @param {string} str - Snake case string
148
- * @returns {string} - CamelCase string
149
- */
150
- toCamelCase(str) {
151
- // Handle special cases for tool feature flags
152
- if (str === 'enableapitools') return 'enableApiTools';
153
- if (str === 'enablebrowsertools') return 'enableBrowserTools';
154
- if (str === 'enableadvancedtools') return 'enableAdvancedTools';
155
- if (str === 'enablefiletools') return 'enableFileTools';
156
- if (str === 'enablenetworktools') return 'enableNetworkTools';
157
- if (str === 'enableothertools') return 'enableOtherTools';
158
- if (str === 'enabledebugmode') return 'enableDebugMode';
159
-
160
- // General snake_case to camelCase conversion
161
- return str.replace(/_([a-z])/g, (match, letter) => letter.toUpperCase());
162
- }
163
-
164
- /**
165
- * Parse environment variable values to appropriate types
166
- * @param {string} value - The environment variable value
167
- * @returns {any} - Parsed value
168
- */
169
- parseEnvValue(value) {
170
- // Boolean values
171
- if (value.toLowerCase() === 'true') return true;
172
- if (value.toLowerCase() === 'false') return false;
173
-
174
- // Number values
175
- if (/^\d+$/.test(value)) return parseInt(value, 10);
176
- if (/^\d+\.\d+$/.test(value)) return parseFloat(value);
177
-
178
- // JSON values
179
- if (value.startsWith('{') || value.startsWith('[')) {
180
- try {
181
- return JSON.parse(value);
182
- } catch {
183
- return value;
184
- }
185
- }
186
-
187
- return value;
188
- }
189
-
190
- /**
191
- * Deep merge two objects
192
- * @param {object} target - Target object
193
- * @param {object} source - Source object
194
- * @returns {object} - Merged object
195
- */
196
- deepMerge(target, source) {
197
- const result = { ...target };
198
-
199
- for (const [key, value] of Object.entries(source)) {
200
- if (value && typeof value === 'object' && !Array.isArray(value)) {
201
- result[key] = this.deepMerge(result[key] || {}, value);
202
- } else {
203
- result[key] = value;
204
- }
205
- }
206
-
207
- return result;
208
- }
209
-
210
- /**
211
- * Set a nested value in an object using a path array
212
- * @param {object} obj - Target object
213
- * @param {Array<string>} path - Path array
214
- * @param {any} value - Value to set
215
- */
216
- setNestedValue(obj, path, value) {
217
- let current = obj;
218
-
219
- for (let i = 0; i < path.length - 1; i++) {
220
- if (!(path[i] in current)) {
221
- current[path[i]] = {};
222
- }
223
- current = current[path[i]];
224
- }
225
-
226
- current[path[path.length - 1]] = value;
227
- }
228
-
229
- /**
230
- * Get default configuration
231
- * @returns {object} - Default configuration
232
- */
233
- getDefaultConfig() {
234
- return {
235
- server: {
236
- name: 'democratize-quality-mcp-server',
237
- version: '1.0.0',
238
- protocolVersion: '2024-11-05',
239
- port: process.env.PORT || 3000
240
- },
241
- features: {
242
- // Tool category feature flags with sensible defaults
243
- enableApiTools: true,
244
- enableBrowserTools: true,
245
- enableAdvancedTools: false, // Conservative default for advanced tools
246
- enableFileTools: false, // Security consideration
247
- enableNetworkTools: false, // Security consideration
248
- enableOtherTools: false, // Conservative default
249
- enableDebugMode: this.environment !== 'production'
250
- },
251
- tools: {
252
- autoDiscovery: true,
253
- enableCache: true,
254
- validationLevel: 'strict',
255
- browser: {
256
- maxInstances: 10,
257
- defaultHeadless: true,
258
- launchTimeout: 30000
259
- }
260
- },
261
- logging: {
262
- level: this.environment === 'production' ? 'error' : 'debug',
263
- enableToolDebug: this.environment !== 'production'
264
- },
265
- // Legacy compatibility
266
- PORT: process.env.PORT || 3000,
267
- OUTPUT_DIR: path.resolve(__dirname, '../../output')
268
- };
269
- }
270
-
271
- /**
272
- * Get configuration value by path
273
- * @param {string} path - Dot-separated path (e.g., 'tools.browser.maxInstances')
274
- * @param {any} defaultValue - Default value if path doesn't exist
275
- * @returns {any} - Configuration value
276
- */
277
- get(path, defaultValue = undefined) {
278
- const keys = path.split('.');
279
- let current = this.config;
280
-
281
- for (const key of keys) {
282
- if (current && typeof current === 'object' && key in current) {
283
- current = current[key];
284
- } else {
285
- return defaultValue;
286
- }
287
- }
288
-
289
- return current;
290
- }
291
-
292
- /**
293
- * Check if a feature is enabled
294
- * @param {string} featureName - Name of the feature
295
- * @returns {boolean} - True if enabled
296
- */
297
- isFeatureEnabled(featureName) {
298
- return this.get(`features.${featureName}`, false);
299
- }
300
-
301
- /**
302
- * Get tool-specific configuration
303
- * @param {string} toolName - Name of the tool
304
- * @param {string} configKey - Configuration key (optional)
305
- * @returns {any} - Tool configuration
306
- */
307
- getToolConfig(toolName, configKey = null) {
308
- const toolConfig = this.get(`tools.${toolName}`, {});
309
-
310
- if (configKey) {
311
- return toolConfig[configKey];
312
- }
313
-
314
- return toolConfig;
315
- }
316
-
317
- /**
318
- * Set quiet mode for logging
319
- * @param {boolean} quiet - Whether to suppress non-essential logs
320
- */
321
- setQuiet(quiet) {
322
- this.quiet = quiet;
323
- }
324
-
325
- /**
326
- * Get all configuration
327
- * @returns {object} - Complete configuration
328
- */
329
- getAll() {
330
- return { ...this.config };
331
- }
332
-
333
- // Legacy compatibility methods
334
- get PORT() { return this.get('PORT', 3000); }
335
- get OUTPUT_DIR() { return this.get('OUTPUT_DIR'); }
336
- }
337
-
338
- // Create singleton instance
339
- const configManager = new ConfigManager();
340
-
341
- module.exports = configManager;
@@ -1,41 +0,0 @@
1
- /**
2
- * Server-level configuration
3
- * Core server settings and MCP protocol configuration
4
- */
5
- module.exports = {
6
- server: {
7
- name: 'democratize-quality-mcp-server',
8
- version: '1.0.0',
9
- protocolVersion: '2024-11-05',
10
- port: process.env.PORT || 3000
11
- },
12
-
13
- features: {
14
- enableBrowserTools: true,
15
- enableFileTools: false,
16
- enableNetworkTools: false,
17
- enableOtherTools: true,
18
- enableDebugMode: process.env.NODE_ENV !== 'production'
19
- },
20
-
21
- tools: {
22
- autoDiscovery: true,
23
- enableCache: true,
24
- validationLevel: 'strict' // 'strict', 'loose', 'none'
25
- },
26
-
27
- logging: {
28
- level: process.env.NODE_ENV === 'production' ? 'error' : 'debug',
29
- enableToolDebug: process.env.NODE_ENV !== 'production'
30
- },
31
-
32
- security: {
33
- enableInputValidation: true,
34
- maxRequestSize: '10MB',
35
- rateLimiting: false // Disabled by default for MCP
36
- },
37
-
38
- // Legacy compatibility
39
- PORT: process.env.PORT || 3000,
40
- OUTPUT_DIR: require('path').resolve(__dirname, '../../output')
41
- };
@@ -1,67 +0,0 @@
1
- /**
2
- * API Tools Configuration
3
- * Configuration specific to API testing tools
4
- */
5
- module.exports = {
6
- // API Request Tool
7
- api_request: {
8
- // Session management
9
- maxSessions: 50,
10
- sessionTimeout: 600000, // 10 minutes
11
- enableSessionPersistence: true,
12
-
13
- // Request settings
14
- defaultTimeout: 30000,
15
- maxRetries: 3,
16
- retryDelay: 1000,
17
- enableRedirects: true,
18
- maxRedirects: 5,
19
-
20
- // Validation settings
21
- enableResponseValidation: true,
22
- enableBodyValidation: true,
23
- strictContentTypeCheck: true,
24
-
25
- // Logging settings
26
- enableRequestLogging: true,
27
- enableResponseLogging: true,
28
- logLevel: 'info',
29
-
30
- // Rate limiting
31
- rateLimitEnabled: false,
32
- maxRequestsPerSecond: 10
33
- },
34
-
35
- // API Session Status Tool
36
- api_session_status: {
37
- enableRealTimeUpdates: true,
38
- maxHistoryEntries: 1000,
39
- includeDetailedLogs: true,
40
- enableSessionMetrics: true
41
- },
42
-
43
- // API Session Report Tool
44
- api_session_report: {
45
- defaultTheme: 'light',
46
- includeRequestData: true,
47
- includeResponseData: true,
48
- includeTiming: true,
49
- includeValidationResults: true,
50
-
51
- // Report generation settings
52
- maxReportSize: 10485760, // 10MB
53
- enableCompression: true,
54
- compressionLevel: 6,
55
-
56
- // HTML report settings
57
- enableInteractiveReports: true,
58
- includeCharts: true,
59
- enableSyntaxHighlighting: true,
60
-
61
- // Output settings
62
- defaultOutputDir: process.env.API_REPORTS_DIR || 'output/reports',
63
- enableTimestampInFilename: true,
64
- enableAutoCleanup: true,
65
- maxReportsToKeep: 100
66
- }
67
- };