Skip to content

refactor(mcp): read live MCP servers through the mcp Evidence Source - #446

Open
onmax wants to merge 4 commits into
feat/evidence-sourcesfrom
feat/mcp-evidence-source
Open

onmax wants to merge 4 commits into
feat/evidence-sourcesfrom
feat/mcp-evidence-source

Conversation

@onmax

@onmax onmax commented Nov 27, 2026 •

Copy link
Copy Markdown
Member

Stacked on #445. This makes the live MCP check the first Evidence Source, so the core and the CLI entry no longer know MCP exists.

What changes

  • vite-doctor/builtin-mcp declares mcpEvidenceSource (src/mcp/evidence.ts). Its url and header options produce --mcp-url and --mcp-header. Header parsing, URL validation and redaction moved there from core/internal/cli.ts, cli-main.ts and core/reports.ts.

  • DoctorRunOptions.mcp is gone. Programmatic callers pass sources: { mcp: [{ url, headers }] }. The Vite plugin's mcp option stays and maps to sources.mcp.

  • The CLI declares builtin source flags from src/builtin-sources.ts, so --help still lists them and repeatable flags come from each option's repeatable. Inputs are validated before the run starts, as --mcp-url was before.

  • Reports are generic:

    • The rerun command repeats each source's args.
    • The redaction note no longer names MCP flags.
    • In a run without a project, the subject comes from Evidence Source runs.
    Format Before After
    JSON and agent subject.mcpServers: ["<origin>"] subject.live: [{ source: "mcp", target: "<origin>" }]
    Text Checked: MCP server <origin> Checked: MCP server <origin> (from the source's label)

    subject.live mirrors origin.live on Diagnostics.

  • A source only clashes with a Runtime Evidence contributor of the same name when the run reads that source. Extensions that contribute { mcpServers } under mcp keep working without --mcp-url.

  • New test: nothing under src/core/** or in src/cli-main.ts imports @loadsheet/mcp or src/mcp/, or contains a --mcp- literal.

Where MCP still lives outside src/mcp

  • runViteDoctor in src/doctor.ts still does the post-run MCP bookkeeping: checked servers, evidenceUsed, and gaps for unread servers. It applies to MCP evidence from any contributor, not just this source, so it stays there for now.
  • src/plugin.ts keeps the mcp option and resolves relative paths such as /mcp against the dev server.

Breaking

  • The JSON and agent report subject.mcpServers is now subject.live.
  • runViteDoctor({ mcp }) is now runViteDoctor({ sources: { mcp } }).

Doctor is pre-1.0, and no compatibility path is kept.

Checks

🤖 Generated with Claude Code

@onmax
onmax force-pushed the feat/evidence-sources branch from e98dd64 to 9f9c226 Compare November 27, 2026 15:27
@onmax
onmax force-pushed the feat/mcp-evidence-source branch from 1cc2925 to ab35928 Compare November 27, 2026 15:27
The core and CLI entry no longer know MCP: --mcp-url/--mcp-header come from the builtin source's options, the rerun command and the no-project subject come from Evidence Source runs, and DoctorRunOptions.mcp becomes sources.mcp.
@onmax
onmax force-pushed the feat/evidence-sources branch from 9f9c226 to d4d1728 Compare November 27, 2026 15:31
@onmax
onmax force-pushed the feat/mcp-evidence-source branch from ab35928 to 087bcec Compare November 27, 2026 15:31

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Important

An extension-only MCP report can now send an agent rerun to the wrong directory, and the unchanged Vite plugin option mcp: [] can fail a build that previously passed.

Approach: Moving the fetch, CLI options, and redaction into an Evidence Source is the right boundary, but the migration needs to preserve how Doctor composes and reports MCP evidence from extensions.

Reviewed changes

  • Evidence collection: Traced validation, collection order, contributor collisions, and Vite Surface input mapping.
  • CLI and reports: Checked repeatable flags, redaction, no-project subjects, and generated rerun commands.
  • Verification: The build and 269 focused tests passed with NO_COLOR=1. A report budget test failed with color enabled on both the base and head. Separate probes checked the regressions below against the base.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using gpt-6.2-sol(high) | 𝕏

Comment thread src/core/reports.ts Resolved
Comment thread src/doctor.ts Resolved
Comment thread src/plugin.ts Resolved
Comment thread src/cli-main.ts Resolved
@pkg-pr-new

pkg-pr-new Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

pnpm dlx https://pkg.pr.new/vite-doctor@446

commit: 0705631

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found; no P0 or P1 findings remain.

Reviewed changes

  • Moved built-in flag validation before config loading. Extension flags are still discovered after config loads; verified that both kinds of flags work in the same invocation.
  • Restored access to fetched MCP tools for Runtime Evidence contributors. The MCP Evidence Source runs before those contributors, and an empty Vite mcp list no longer reserves the evidence key.
  • Restored live subjects for contributed MCP targets. Reports deduplicate fetched and contributed targets; agent reruns keep the original directory without adding network flags for contributed targets.
  • Verified the fixes. pnpm build and 394 tests across 16 focused suites passed with NO_COLOR=1.

Pullfrog  | View workflow run | Using gpt-6.2-sol(high) | 𝕏

Keeps this PR's version over base changes:
- src/core/internal/scan-session.ts: The merge retains the base's awaited validation before any contributor or collector but deliberately replaces the collection call with one that runs early sources before Runtime Evidence contributors and other sources afterward.

Keeps the base version over this PR's changes:
- src/cli-main.ts: The base's exact-string parser supersedes the PR's CAC flag plumbing while retaining generated help, declaration-based repeatability, and built-in validation before config loading.
- src/core/internal/evidence-sources.ts: The base's awaited validation pass replaces the PR's synchronous input normalization while collection still preserves the PR's early and late phases.
- src/core/internal/scan-session.ts: The base supplies validated source requests in place of raw registry options while the updated call still runs Runtime Evidence contributors between the PR's collection phases.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found; no P0 or P1 findings remain.

Reviewed changes

  • Moved built-in Evidence Source flags to the shared string-preserving parser. Confirmed that MCP and extension flags work in the same invocation and that malformed MCP inputs are still rejected before executable config loads.
  • Integrated async validation with the existing collection order. Confirmed that a rejected extension input prevents the MCP request, and that on valid runs, Runtime Evidence contributors still see the fetched MCP tools.
  • Verified the merge. pnpm build and 247 tests across 11 focused suites passed with NO_COLOR=1.

Pullfrog  | View workflow run | Using gpt-6.2-sol(high) | 𝕏

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found; no P0 or P1 findings remain.

Reviewed changes

  • Reused resolved Doctor Extensions. Verified that the prepared run keeps both built-in MCP and extension inputs without invoking the config loader twice.
  • Preserved config reloads in watch mode. Verified that the initial run calls the loader once and a config change triggers a fresh load on the next run.

pnpm build and 81 focused tests passed.

Pullfrog  | View workflow run | Using gpt-6.2-sol(high) | 𝕏

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant