[Quality audit] Simplify MCP coordinator and tool surface

オープン
#159 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 4 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
38/100
issue の種類
リファクタリング
明瞭さ
おおむね明確
活発さ
静か
技術スタック
typescript
領域
devtools

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

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
主要言語
TypeScript
スター
1k
フォーク
144
平均マージ
4日 19時間
マージ済み PR(30日)
28

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

johannesjo/parallel-code のほかの issue

johannesjo/parallel-code の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。