code-auditor-mcp 2.0.2 → 2.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 (82) hide show
  1. package/README.md +41 -3
  2. package/dist/analyzers/universal/UniversalDataAccessAnalyzer.d.ts.map +1 -1
  3. package/dist/analyzers/universal/UniversalDataAccessAnalyzer.js +50 -35
  4. package/dist/analyzers/universal/UniversalDataAccessAnalyzer.js.map +1 -1
  5. package/dist/applyDataDirEnv.d.ts +2 -0
  6. package/dist/applyDataDirEnv.d.ts.map +1 -0
  7. package/dist/applyDataDirEnv.js +21 -0
  8. package/dist/applyDataDirEnv.js.map +1 -0
  9. package/dist/auditRunner.d.ts.map +1 -1
  10. package/dist/auditRunner.js +48 -13
  11. package/dist/auditRunner.js.map +1 -1
  12. package/dist/codeIndexDB-enhanced.d.ts +2 -3
  13. package/dist/codeIndexDB-enhanced.d.ts.map +1 -1
  14. package/dist/codeIndexDB-enhanced.js +41 -15
  15. package/dist/codeIndexDB-enhanced.js.map +1 -1
  16. package/dist/codeIndexDb.d.ts +30 -1
  17. package/dist/codeIndexDb.d.ts.map +1 -1
  18. package/dist/codeIndexDb.js +114 -15
  19. package/dist/codeIndexDb.js.map +1 -1
  20. package/dist/codeIndexService.d.ts +7 -3
  21. package/dist/codeIndexService.d.ts.map +1 -1
  22. package/dist/codeIndexService.js +14 -22
  23. package/dist/codeIndexService.js.map +1 -1
  24. package/dist/constants.d.ts +2 -0
  25. package/dist/constants.d.ts.map +1 -1
  26. package/dist/constants.js +6 -0
  27. package/dist/constants.js.map +1 -1
  28. package/dist/dataPaths.d.ts +10 -0
  29. package/dist/dataPaths.d.ts.map +1 -0
  30. package/dist/dataPaths.js +19 -0
  31. package/dist/dataPaths.js.map +1 -0
  32. package/dist/languages/UniversalAnalyzer.d.ts.map +1 -1
  33. package/dist/languages/UniversalAnalyzer.js +23 -7
  34. package/dist/languages/UniversalAnalyzer.js.map +1 -1
  35. package/dist/mcp-index.d.ts +3 -1
  36. package/dist/mcp-index.d.ts.map +1 -1
  37. package/dist/mcp-index.js +30 -8
  38. package/dist/mcp-index.js.map +1 -1
  39. package/dist/mcp-standalone.d.ts +1 -1
  40. package/dist/mcp-standalone.d.ts.map +1 -1
  41. package/dist/mcp-standalone.js +160 -55
  42. package/dist/mcp-standalone.js.map +1 -1
  43. package/dist/mcp-tools/projectTasks.d.ts +69 -0
  44. package/dist/mcp-tools/projectTasks.d.ts.map +1 -0
  45. package/dist/mcp-tools/projectTasks.js +129 -0
  46. package/dist/mcp-tools/projectTasks.js.map +1 -0
  47. package/dist/mcp-tools-shared.d.ts.map +1 -1
  48. package/dist/mcp-tools-shared.js +3 -3
  49. package/dist/mcp-tools-shared.js.map +1 -1
  50. package/dist/mcp-ui-simple.d.ts.map +1 -1
  51. package/dist/mcp-ui-simple.js +3 -2
  52. package/dist/mcp-ui-simple.js.map +1 -1
  53. package/dist/mcp.js +203 -61
  54. package/dist/mcp.js.map +1 -1
  55. package/dist/mcpAutoIndex.d.ts +2 -0
  56. package/dist/mcpAutoIndex.d.ts.map +1 -0
  57. package/dist/mcpAutoIndex.js +71 -0
  58. package/dist/mcpAutoIndex.js.map +1 -0
  59. package/dist/mcpDiagnostics.d.ts +11 -0
  60. package/dist/mcpDiagnostics.d.ts.map +1 -0
  61. package/dist/mcpDiagnostics.js +54 -0
  62. package/dist/mcpDiagnostics.js.map +1 -0
  63. package/dist/mcpToolErrors.d.ts +21 -0
  64. package/dist/mcpToolErrors.d.ts.map +1 -0
  65. package/dist/mcpToolErrors.js +81 -0
  66. package/dist/mcpToolErrors.js.map +1 -0
  67. package/dist/search/QueryParser.d.ts.map +1 -1
  68. package/dist/search/QueryParser.js +11 -12
  69. package/dist/search/QueryParser.js.map +1 -1
  70. package/dist/services/ProjectTaskRepository.d.ts +20 -0
  71. package/dist/services/ProjectTaskRepository.d.ts.map +1 -0
  72. package/dist/services/ProjectTaskRepository.js +96 -0
  73. package/dist/services/ProjectTaskRepository.js.map +1 -0
  74. package/dist/services/projectTaskHelpers.d.ts +23 -0
  75. package/dist/services/projectTaskHelpers.d.ts.map +1 -0
  76. package/dist/services/projectTaskHelpers.js +232 -0
  77. package/dist/services/projectTaskHelpers.js.map +1 -0
  78. package/dist/types/projectTask.d.ts +64 -0
  79. package/dist/types/projectTask.d.ts.map +1 -0
  80. package/dist/types/projectTask.js +6 -0
  81. package/dist/types/projectTask.js.map +1 -0
  82. package/package.json +34 -27
@@ -1 +1 @@
1
- {"version":3,"file":"mcp-ui-simple.js","sourceRoot":"","sources":["../src/mcp-ui-simple.ts"],"names":[],"mappings":";AAEA;;;;;GAKG;AAEH,OAAO,OAAO,MAAM,SAAS,CAAC;AAC9B,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACpC,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAkB,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrE,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,GAAG,GAAwB,OAAO,EAAE,CAAC;AAC3C,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,WAAW,IAAI,IAAI,CAAC;AAE7C,aAAa;AACb,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;AACxB,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC;IACX,MAAM,EAAE,GAAG;IACX,cAAc,EAAE,CAAC,cAAc,CAAC;IAChC,cAAc,EAAE,CAAC,cAAc,EAAE,eAAe,CAAC;CAClD,CAAC,CAAC,CAAC;AAEJ;;GAEG;AACH,GAAG,CAAC,IAAI,CAAC,sBAAsB,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE;IAClD,IAAI,CAAC;QACH,MAAM,IAAI,GAAG,GAAG,CAAC,IAAI,IAAI,EAAE,CAAC;QAE5B,qCAAqC;QACrC,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U,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;IACpD,gBAAgB,EAAE,CAAC;AACrB,CAAC;AAED,OAAO,EAAE,GAAG,EAAE,CAAC"}
package/dist/mcp.js CHANGED
@@ -2,24 +2,21 @@
2
2
  // MCP servers use stdio: stdout for protocol messages, stderr for logging
3
3
  // All log messages must go to stderr to avoid interfering with MCP protocol
4
4
  import chalk from 'chalk';
5
- console.error(chalk.blue('[INFO]'), 'Loading modules...');
6
5
  import { Server } from '@modelcontextprotocol/sdk/server/index.js';
7
6
  import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
8
7
  import { CallToolRequestSchema, ListToolsRequestSchema, InitializeRequestSchema } from '@modelcontextprotocol/sdk/types.js';
9
- console.error(chalk.blue('[INFO]'), 'MCP SDK loaded');
10
8
  import { createAuditRunner } from './auditRunner.js';
11
- console.error(chalk.blue('[INFO]'), 'Audit runner loaded');
12
9
  import { searchFunctions, findDefinition, syncFileIndex, getDatabase } from './codeIndexService.js';
13
10
  import { CodeMapGenerator } from './services/CodeMapGenerator.js';
14
11
  import { analyzeDocumentation } from './analyzers/documentationAnalyzer.js';
15
12
  import { ConfigGeneratorFactory } from './generators/ConfigGeneratorFactory.js';
16
- import { DEFAULT_SERVER_URL, IS_DEV_MODE } from './constants.js';
17
- console.error(chalk.blue('[INFO]'), 'Code index service loaded');
13
+ import { DEFAULT_SERVER_URL, IS_DEV_MODE, PACKAGE_VERSION } from './constants.js';
18
14
  import path from 'node:path';
19
15
  import fs from 'node:fs/promises';
20
16
  import { createWriteStream } from 'node:fs';
21
17
  import { CodeIndexDB } from './codeIndexDB.js';
22
- console.error(chalk.blue('[INFO]'), 'All modules loaded successfully');
18
+ import { logMcpDebug, logMcpInfo, mcpDebugStderr } from './mcpDiagnostics.js';
19
+ import { assertAuditPathExists, formatMcpToolErrorPayload } from './mcpToolErrors.js';
23
20
  // Set up file logging (only in development mode)
24
21
  let logStream = null;
25
22
  if (IS_DEV_MODE) {
@@ -191,13 +188,13 @@ const tools = [
191
188
  },
192
189
  {
193
190
  name: 'sync_index',
194
- description: 'Synchronize, cleanup, or reset the code index',
191
+ description: 'Synchronize, cleanup, or reset analysis-derived data (indexed functions, FlexSearch, cached audits, code maps, schema overlays). Project tasks, analyzer configs, and whitelist entries are preserved on reset.',
195
192
  parameters: [
196
193
  {
197
194
  name: 'mode',
198
195
  type: 'string',
199
196
  required: false,
200
- description: 'Operation mode: sync (update), cleanup (remove stale), or reset (clear all)',
197
+ description: 'sync: update index from files; cleanup: remove index rows for deleted files; reset: clear all analysis-derived data (not tasks/config/whitelist)',
201
198
  default: 'sync',
202
199
  enum: ['sync', 'cleanup', 'reset'],
203
200
  },
@@ -333,32 +330,149 @@ const tools = [
333
330
  },
334
331
  ],
335
332
  },
333
+ {
334
+ name: 'project_tasks',
335
+ description: 'Manage a persistent per-project task queue. Tasks and analyzer configs survive sync_index reset; reset clears function index, cached audits, code maps, and schema overlays (no ghost code references). Use delete to remove a task.',
336
+ parameters: [
337
+ {
338
+ name: 'action',
339
+ type: 'string',
340
+ required: true,
341
+ description: 'list | create | get | update | delete. list/create use projectPath or default to process.cwd(); create also needs title; get/update/delete need taskId; update needs patch object.',
342
+ enum: ['list', 'create', 'get', 'update', 'delete'],
343
+ },
344
+ {
345
+ name: 'projectPath',
346
+ type: 'string',
347
+ required: false,
348
+ description: 'Project root (resolved). Omit to use the MCP server working directory (same default idea as audit path); response includes projectPathDefaulted when omitted.',
349
+ },
350
+ {
351
+ name: 'taskId',
352
+ type: 'string',
353
+ required: false,
354
+ description: 'Stable task id (UUID). Required for get, update, delete.',
355
+ },
356
+ {
357
+ name: 'title',
358
+ type: 'string',
359
+ required: false,
360
+ description: 'Task title. Required for create.',
361
+ },
362
+ {
363
+ name: 'description',
364
+ type: 'string',
365
+ required: false,
366
+ description: 'Longer description / notes.',
367
+ },
368
+ {
369
+ name: 'status',
370
+ type: 'string',
371
+ required: false,
372
+ description: 'pending | in_progress | blocked | done | cancelled. Filter for list; initial status for create; can be set via update patch.',
373
+ enum: ['pending', 'in_progress', 'blocked', 'done', 'cancelled'],
374
+ },
375
+ {
376
+ name: 'priority',
377
+ type: 'string',
378
+ required: false,
379
+ description: 'Optional priority for create/update patch.',
380
+ enum: ['low', 'medium', 'high'],
381
+ },
382
+ {
383
+ name: 'labels',
384
+ type: 'array',
385
+ required: false,
386
+ description: 'String tags (e.g. ["audit","refactor"]).',
387
+ },
388
+ {
389
+ name: 'metadata',
390
+ type: 'object',
391
+ required: false,
392
+ description: 'Arbitrary JSON object: related file paths, links, audit IDs, etc.',
393
+ },
394
+ {
395
+ name: 'parentTaskId',
396
+ type: 'string',
397
+ required: false,
398
+ description: 'Optional parent task for subtasks.',
399
+ },
400
+ {
401
+ name: 'source',
402
+ type: 'string',
403
+ required: false,
404
+ description: 'manual | audit | mcp. Filter for list; provenance for create; can be set via update patch.',
405
+ enum: ['manual', 'audit', 'mcp'],
406
+ },
407
+ {
408
+ name: 'blockedBy',
409
+ type: 'array',
410
+ required: false,
411
+ description: 'Task IDs this item is blocked by (waiting-on).',
412
+ },
413
+ {
414
+ name: 'dueAt',
415
+ type: 'string',
416
+ required: false,
417
+ description: 'ISO 8601 due datetime for create; omit or null in patch to clear.',
418
+ },
419
+ {
420
+ name: 'sortOrder',
421
+ type: 'number',
422
+ required: false,
423
+ description: 'Lower numbers sort first within a project (default 0).',
424
+ },
425
+ {
426
+ name: 'relatedFiles',
427
+ type: 'array',
428
+ required: false,
429
+ description: 'Repo-relative or absolute file paths tied to the task.',
430
+ },
431
+ {
432
+ name: 'relatedSymbols',
433
+ type: 'array',
434
+ required: false,
435
+ description: 'Function, class, or component names for cross-linking.',
436
+ },
437
+ {
438
+ name: 'patch',
439
+ type: 'object',
440
+ required: false,
441
+ description: 'For update: partial fields (title, description, status, priority, labels, metadata, parentTaskId, source, blockedBy, dueAt, sortOrder, relatedFiles, relatedSymbols).',
442
+ },
443
+ {
444
+ name: 'limit',
445
+ type: 'number',
446
+ required: false,
447
+ description: 'Max tasks to return for list (default 500, max 1000).',
448
+ },
449
+ ],
450
+ },
336
451
  ];
337
452
  async function startMcpServer() {
338
- console.error(chalk.blue('[INFO]'), 'Starting Code Auditor MCP Server...');
339
- console.error(chalk.blue('[DEBUG]'), `Process PID: ${process.pid}`);
340
- console.error(chalk.blue('[DEBUG]'), `Node version: ${process.version}`);
341
- console.error(chalk.blue('[DEBUG]'), `Working directory: ${process.cwd()}`);
453
+ logMcpInfo('startup', `code-auditor-mcp ${PACKAGE_VERSION} (stdio)`, {
454
+ pid: process.pid,
455
+ cwd: process.cwd(),
456
+ dataDir: process.env.CODE_AUDITOR_DATA_DIR ?? '(default)',
457
+ debug: process.env.CODE_AUDITOR_DEBUG ?? '0',
458
+ logFile: process.env.CODE_AUDITOR_LOG_FILE ?? '(none)'
459
+ });
460
+ mcpDebugStderr(chalk.blue('[DEBUG]'), `Node ${process.version} · cwd ${process.cwd()}`);
342
461
  const server = new Server({
343
462
  name: 'code-auditor',
463
+ version: PACKAGE_VERSION,
344
464
  }, {
345
465
  capabilities: {
346
466
  tools: {},
347
467
  },
348
468
  });
349
- console.error(chalk.blue('[INFO]'), 'Server instance created');
350
- console.error(chalk.blue('[DEBUG]'), 'Server capabilities:', JSON.stringify({ tools: {} }));
351
469
  // Add error handler
352
470
  server.onerror = (error) => {
353
471
  console.error(chalk.red('[ERROR]'), 'Server error occurred:', error);
354
472
  console.error(chalk.red('[ERROR]'), 'Error stack:', error.stack);
355
473
  };
356
- // Handle tool listing
357
- console.error(chalk.blue('[INFO]'), 'Setting up request handlers...');
358
474
  server.setRequestHandler(ListToolsRequestSchema, async (request) => {
359
- console.error(chalk.blue('[DEBUG]'), 'Received ListTools request');
360
- console.error(chalk.blue('[DEBUG]'), 'Request:', JSON.stringify(request, null, 2));
361
- console.error(chalk.blue('[DEBUG]'), 'Handling ListTools request');
475
+ mcpDebugStderr(chalk.blue('[DEBUG]'), 'ListTools', JSON.stringify(request, null, 2));
362
476
  const response = {
363
477
  tools: tools.map(tool => ({
364
478
  name: tool.name,
@@ -378,15 +492,11 @@ async function startMcpServer() {
378
492
  },
379
493
  })),
380
494
  };
381
- console.error(chalk.blue('[DEBUG]'), `Returning ${response.tools.length} tools`);
382
- console.error(chalk.blue('[DEBUG]'), 'ListTools response:', JSON.stringify(response, null, 2));
495
+ mcpDebugStderr(chalk.blue('[DEBUG]'), `ListTools ${response.tools.length} tools`);
383
496
  return response;
384
497
  });
385
- console.error(chalk.blue('[INFO]'), `Registered ${tools.length} tools`);
386
- // Add handler for initialize request
387
498
  server.setRequestHandler(InitializeRequestSchema, async (request) => {
388
- console.error(chalk.blue('[DEBUG]'), 'Received initialize request');
389
- console.error(chalk.blue('[DEBUG]'), 'Request:', JSON.stringify(request, null, 2));
499
+ mcpDebugStderr(chalk.blue('[DEBUG]'), 'initialize', JSON.stringify(request, null, 2));
390
500
  const response = {
391
501
  protocolVersion: '2024-11-05',
392
502
  capabilities: {
@@ -394,31 +504,30 @@ async function startMcpServer() {
394
504
  },
395
505
  serverInfo: {
396
506
  name: 'code-auditor',
397
- version: '1.0.0',
507
+ version: PACKAGE_VERSION,
398
508
  },
399
509
  };
400
- console.error(chalk.blue('[DEBUG]'), 'Initialize response:', JSON.stringify(response, null, 2));
510
+ mcpDebugStderr(chalk.blue('[DEBUG]'), 'initialize response', JSON.stringify(response, null, 2));
401
511
  return response;
402
512
  });
403
- // Handle tool execution
404
513
  server.setRequestHandler(CallToolRequestSchema, async (request) => {
405
- console.error(chalk.blue('[DEBUG]'), 'Received CallTool request');
406
- console.error(chalk.blue('[DEBUG]'), 'Request:', JSON.stringify(request, null, 2));
514
+ mcpDebugStderr(chalk.blue('[DEBUG]'), 'CallTool raw', JSON.stringify(request, null, 2));
407
515
  const { name, arguments: args } = request.params;
408
- console.error(chalk.blue('[DEBUG]'), `Tool name: ${name}`);
409
- console.error(chalk.blue('[DEBUG]'), `Tool arguments:`, JSON.stringify(args, null, 2));
410
- console.error(chalk.blue('[DEBUG]'), `Handling CallTool request for: ${name}`);
516
+ mcpDebugStderr(chalk.blue('[DEBUG]'), `CallTool ${name}`, JSON.stringify(args, null, 2));
517
+ const toolStartedAt = Date.now();
411
518
  try {
412
- console.error(chalk.blue('[DEBUG]'), `Starting tool execution for: ${name}`);
519
+ logMcpDebug('tool', `call ${name}`, {
520
+ argKeys: args && typeof args === 'object' ? Object.keys(args) : [],
521
+ pathArg: args?.path,
522
+ cwd: process.cwd()
523
+ });
413
524
  let result;
414
525
  switch (name) {
415
526
  case 'audit': {
416
527
  const auditPath = path.resolve(args.path || process.cwd());
417
528
  const indexFunctions = args.indexFunctions !== false; // Default true
418
529
  const generateCodeMap = args.generateCodeMap || false;
419
- // Check if path is a file or directory
420
- const stats = await fs.stat(auditPath).catch(() => null);
421
- const isFile = stats?.isFile() || false;
530
+ const { isFile } = await assertAuditPathExists(auditPath);
422
531
  // Get stored analyzer configs from database
423
532
  const db = CodeIndexDB.getInstance();
424
533
  await db.initialize();
@@ -436,12 +545,27 @@ async function startMcpServer() {
436
545
  indexFunctions,
437
546
  ...(isFile && { includePaths: [auditPath] }),
438
547
  ...(Object.keys(analyzerConfigs).length > 0 && { analyzerConfigs }),
548
+ progressCallback: (p) => {
549
+ if (p.phase === 'function-indexing' &&
550
+ typeof p.current === 'number' &&
551
+ typeof p.total === 'number' &&
552
+ p.total > 0 &&
553
+ p.current % 50 !== 0 &&
554
+ p.current !== p.total) {
555
+ return;
556
+ }
557
+ logMcpDebug('audit', p.message ?? p.phase ?? 'progress', {
558
+ phase: p.phase,
559
+ analyzer: p.analyzer,
560
+ current: p.current,
561
+ total: p.total
562
+ });
563
+ }
439
564
  };
440
- console.error(chalk.blue('[DEBUG]'), 'Creating audit runner with options:', JSON.stringify(options, null, 2));
565
+ mcpDebugStderr(chalk.blue('[DEBUG]'), 'audit runner options', JSON.stringify(options, null, 2));
441
566
  const runner = createAuditRunner(options);
442
- console.error(chalk.blue('[DEBUG]'), 'About to run audit...');
443
567
  const auditResult = await runner.run();
444
- console.error(chalk.blue('[DEBUG]'), 'Audit completed, result summary:', auditResult.summary);
568
+ mcpDebugStderr(chalk.blue('[DEBUG]'), 'audit summary', auditResult.summary);
445
569
  // Handle function indexing if enabled and functions were collected
446
570
  let indexingResult = null;
447
571
  if (indexFunctions && auditResult.metadata.fileToFunctionsMap) {
@@ -460,7 +584,7 @@ async function startMcpServer() {
460
584
  failed: 0,
461
585
  syncStats
462
586
  };
463
- console.error(chalk.blue('[INFO]'), `Synced functions: ${syncStats.added} added, ${syncStats.updated} updated, ${syncStats.removed} removed`);
587
+ mcpDebugStderr(chalk.blue('[INFO]'), `Synced functions: ${syncStats.added} added, ${syncStats.updated} updated, ${syncStats.removed} removed`);
464
588
  }
465
589
  catch (error) {
466
590
  console.error(chalk.yellow('[WARN]'), 'Failed to sync functions:', error);
@@ -507,7 +631,7 @@ async function startMcpServer() {
507
631
  sections: paginatedResult.summary.sectionsAvailable,
508
632
  documentationCoverage: documentation?.coverageScore
509
633
  };
510
- console.error(chalk.blue('[INFO]'), `Generated paginated code map: ${paginatedResult.summary.stats.totalFiles} files, ${paginatedResult.summary.totalSections} sections`);
634
+ mcpDebugStderr(chalk.blue('[INFO]'), `Generated paginated code map: ${paginatedResult.summary.stats.totalFiles} files, ${paginatedResult.summary.totalSections} sections`);
511
635
  }
512
636
  catch (error) {
513
637
  console.error(chalk.yellow('[WARN]'), 'Failed to generate code map:', error);
@@ -537,6 +661,7 @@ async function startMcpServer() {
537
661
  }
538
662
  case 'audit_health': {
539
663
  const auditPath = path.resolve(args.path || process.cwd());
664
+ await assertAuditPathExists(auditPath);
540
665
  const threshold = args.threshold || 70;
541
666
  const indexFunctions = args.indexFunctions !== false; // Default true
542
667
  const generateCodeMap = args.generateCodeMap !== false; // Default true
@@ -556,6 +681,22 @@ async function startMcpServer() {
556
681
  verbose: false,
557
682
  indexFunctions, // Pass the flag to the runner
558
683
  ...(Object.keys(analyzerConfigs).length > 0 && { analyzerConfigs }),
684
+ progressCallback: (p) => {
685
+ if (p.phase === 'function-indexing' &&
686
+ typeof p.current === 'number' &&
687
+ typeof p.total === 'number' &&
688
+ p.total > 0 &&
689
+ p.current % 50 !== 0 &&
690
+ p.current !== p.total) {
691
+ return;
692
+ }
693
+ logMcpDebug('audit_health', p.message ?? p.phase ?? 'progress', {
694
+ phase: p.phase,
695
+ analyzer: p.analyzer,
696
+ current: p.current,
697
+ total: p.total
698
+ });
699
+ }
559
700
  });
560
701
  const auditResult = await runner.run();
561
702
  const healthScore = calculateHealthScore(auditResult);
@@ -577,7 +718,7 @@ async function startMcpServer() {
577
718
  failed: 0,
578
719
  syncStats
579
720
  };
580
- console.error(chalk.blue('[INFO]'), `Synced functions: ${syncStats.added} added, ${syncStats.updated} updated, ${syncStats.removed} removed`);
721
+ mcpDebugStderr(chalk.blue('[INFO]'), `Synced functions: ${syncStats.added} added, ${syncStats.updated} updated, ${syncStats.removed} removed`);
581
722
  }
582
723
  catch (error) {
583
724
  console.error(chalk.yellow('[WARN]'), 'Failed to sync functions:', error);
@@ -624,7 +765,7 @@ async function startMcpServer() {
624
765
  sections: paginatedResult.summary.sectionsAvailable,
625
766
  documentationCoverage: documentation?.coverageScore
626
767
  };
627
- console.error(chalk.blue('[INFO]'), `Generated paginated code map: ${paginatedResult.summary.stats.totalFiles} files, ${paginatedResult.summary.totalSections} sections`);
768
+ mcpDebugStderr(chalk.blue('[INFO]'), `Generated paginated code map: ${paginatedResult.summary.stats.totalFiles} files, ${paginatedResult.summary.totalSections} sections`);
628
769
  }
629
770
  catch (error) {
630
771
  console.error(chalk.yellow('[WARN]'), 'Failed to generate code map:', error);
@@ -784,7 +925,7 @@ async function startMcpServer() {
784
925
  result = {
785
926
  mode: 'reset',
786
927
  success: true,
787
- message: 'Index cleared successfully'
928
+ message: 'Analysis-derived data cleared (functions, search index, cached audits, code maps, schemas). Project tasks, whitelist, and analyzer configs were preserved.'
788
929
  };
789
930
  break;
790
931
  }
@@ -983,6 +1124,11 @@ async function startMcpServer() {
983
1124
  }
984
1125
  break;
985
1126
  }
1127
+ case 'project_tasks': {
1128
+ const { handleProjectTasks } = await import('./mcp-tools/projectTasks.js');
1129
+ result = await handleProjectTasks((args || {}));
1130
+ break;
1131
+ }
986
1132
  default:
987
1133
  throw new Error(`Unknown tool: ${name}`);
988
1134
  }
@@ -994,30 +1140,31 @@ async function startMcpServer() {
994
1140
  },
995
1141
  ],
996
1142
  };
997
- console.error(chalk.blue('[DEBUG]'), `Tool ${name} executed successfully`);
998
- console.error(chalk.blue('[DEBUG]'), 'CallTool response:', JSON.stringify(response, null, 2).substring(0, 500) + '...');
1143
+ mcpDebugStderr(chalk.blue('[DEBUG]'), `Tool ${name} ok`, JSON.stringify(response, null, 2).substring(0, 500) + '...');
999
1144
  return response;
1000
1145
  }
1001
1146
  catch (error) {
1002
1147
  console.error(chalk.red('[ERROR]'), `Tool ${name} execution failed:`, error);
1003
1148
  console.error(chalk.red('[ERROR]'), 'Error stack:', error instanceof Error ? error.stack : 'No stack trace');
1149
+ logMcpDebug('tool', `call ${name} failed`, {
1150
+ ms: Date.now() - toolStartedAt,
1151
+ error: error instanceof Error ? error.message : String(error)
1152
+ });
1004
1153
  return {
1005
1154
  content: [
1006
1155
  {
1007
1156
  type: 'text',
1008
- text: JSON.stringify({
1009
- error: error instanceof Error ? error.message : 'Unknown error',
1010
- tool: name,
1011
- }),
1157
+ text: JSON.stringify(formatMcpToolErrorPayload(name, error), null, 2),
1012
1158
  },
1013
1159
  ],
1014
1160
  isError: true,
1015
1161
  };
1016
1162
  }
1163
+ finally {
1164
+ logMcpDebug('tool', `call ${name} finished`, { ms: Date.now() - toolStartedAt });
1165
+ }
1017
1166
  });
1018
- console.error(chalk.blue('[INFO]'), 'Request handlers configured');
1019
1167
  const transport = new StdioServerTransport();
1020
- console.error(chalk.blue('[INFO]'), 'Creating stdio transport...');
1021
1168
  // Add transport event handlers if available
1022
1169
  if (transport.onclose) {
1023
1170
  transport.onclose = () => {
@@ -1029,16 +1176,13 @@ async function startMcpServer() {
1029
1176
  console.error(chalk.red('[ERROR]'), 'Transport error:', error);
1030
1177
  };
1031
1178
  }
1032
- console.error(chalk.blue('[DEBUG]'), 'Connecting server to transport...');
1033
1179
  await server.connect(transport);
1034
- console.error(chalk.blue('[DEBUG]'), 'Server connected to transport');
1035
1180
  console.error(chalk.green('✓ Code Auditor MCP Server started'));
1036
- console.error(chalk.gray('Listening on stdio...'));
1037
- console.error(chalk.blue('[DEBUG]'), 'Server state after initialization:', {
1181
+ console.error(chalk.gray(`Listening on stdio · ${tools.length} tools · ${PACKAGE_VERSION}`));
1182
+ mcpDebugStderr(chalk.blue('[DEBUG]'), 'Server ready', {
1038
1183
  name: 'code-auditor',
1039
1184
  transport: 'stdio',
1040
- handlers: ['ListTools', 'CallTool', 'initialize'],
1041
- toolCount: tools.length,
1185
+ toolCount: tools.length
1042
1186
  });
1043
1187
  }
1044
1188
  function getAllViolations(result) {
@@ -1126,8 +1270,6 @@ process.stdin.on('error', (error) => {
1126
1270
  process.stdout.on('error', (error) => {
1127
1271
  console.error(chalk.red('[ERROR]'), 'stdout error:', error);
1128
1272
  });
1129
- // Start server
1130
- console.error(chalk.blue('[INFO]'), 'Initializing server...');
1131
1273
  startMcpServer().catch(error => {
1132
1274
  console.error(chalk.red('[ERROR]'), 'Failed to start MCP server:', error);
1133
1275
  console.error(chalk.red('[ERROR]'), 'Stack:', error.stack);