[Quality audit] Simplify MCP coordinator and tool surface

Abierto
#159 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 4 días

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
38/100
Tipo de issue
Refactorización
Claridad
Bastante claro
Estado de actividad
Tranquilo
Stack tecnológico
typescript
Área
devtools

Línea de trabajo

Start with CODE_QUALITY_FINDINGS.md and the cited files under electron/mcp/**, especially coordinator.ts, server.ts, and validation.ts; inspect the existing config builder and related tests before choosing a finding. Run the MCP coordinator, validation, and tool-list tests, including the listed token-rotation, hydration, Docker path, prompt, idle, and cleanup cases. Done means the scoped duplications and unreachable validation branch are addressed and all acceptance checks pass.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

Derived from the local audit report CODE_QUALITY_FINDINGS.md created on 2026-05-30.

Scope

This issue tracks complexity and duplication in electron/mcp/**.

Findings

  • Finding 9: tested MCP config builder is bypassed.
    • Evidence: buildCoordinatorMCPConfig is defined and tested, but StartMCPServer manually rebuilds the same object.
    • Fix direction: call buildCoordinatorMCPConfig in StartMCPServer.
  • Finding 10: sub-task MCP config construction is duplicated.
    • Evidence: duplicated mcpServers["parallel-code"] construction in restart rewrite, task creation, and hydration.
    • Fix direction: extract buildSubTaskMcpConfig, writeSubTaskMcpConfig, and isAllowedSubTaskMcpConfigPath; confirm mcpServerInfo.token contract.
  • Finding 15: agent output monitoring is copied in MCP coordinator.
    • Evidence: duplicated base64 decode, tail buffering, ANSI stripping, prompt detection, idle transitions, and resolver flushing.
    • Fix direction: extract createAgentOutputMonitor(task) and handlePromptDetected(task).
  • Finding 16: task teardown cleanup repeats in MCP coordinator.
    • Evidence: removeCoordinatedTask, cleanupTask, and deregisterCoordinator repeat lifecycle cleanup with subtle behavior differences.
    • Fix direction: extract narrow helpers for subscriptions, idle waiters, config cleanup, and control-state clearing.
  • Finding 17: MCP createTask has too many responsibilities.
    • Evidence: electron/mcp/coordinator.ts:398-740.
    • Fix direction: move preamble write/restore logic into preamble.ts and use small queued file mutation helpers.
  • Finding 18: MCP tool diff formatting and truncation is duplicated.
    • Evidence: electron/mcp/server.ts and electron/mcp/coordinator.ts both format/truncate diffs.
    • Fix direction: centralize formatDiffForTool(result, mergeInfo?) and one MAX_DIFF_BYTES.
  • Finding 19: deprecated review_and_merge_task is still advertised.
    • Evidence: electron/mcp/mcp-tool-list.ts, electron/mcp/server.ts, electron/mcp/client.ts.
    • Fix direction: keep compatibility handler if needed but remove the tool from advertised tools.
  • Finding 35: validation has an unreachable specific branch and duplicate tests.
    • Evidence: electron/mcp/validation.ts, duplicated validation coverage in coordinator tests.
    • Fix direction: move the @{ check before the generic invalid-character regex, or remove the branch; keep validation tests in validation.test.ts.

Acceptance checks

  • MCP coordinator test suite
  • MCP validation tests
  • MCP tool-list tests
  • token-rotation, hydration, Docker path, prompt, idle, and cleanup cases
Lenguaje dominante
TypeScript
Estrellas
1k
Forks
144
Merge medio
4 d 19 h
PR fusionados (30 d)
28

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de johannesjo/parallel-code

Todos los issues de johannesjo/parallel-code

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.