Skip to content

fix(mcp-analytics): suggest server apps before setup - #1239

Open
lucasheriques wants to merge 4 commits into
mainfrom
codex/mcp-onboarding-recovery
Open

fix(mcp-analytics): suggest server apps before setup#1239
lucasheriques wants to merge 4 commits into
mainfrom
codex/mcp-onboarding-recovery

Conversation

@lucasheriques

@lucasheriques lucasheriques commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Problem

MCP analytics users starting from a monorepo root can select a shared helper instead of the server they want to instrument.
A generic intro also misses custom constructors and gives no useful explanation when a launcher delegates to another package.

Changes

  • Users start from a single suggestion with one action; manual paths remain optional.
  • Workspace users choose application packages, with related transport files grouped together and examples listed later.
  • Shared factories identify consuming apps; development dependencies and client-only consumers do not create server suggestions.
  • Launcher users get source tracing, and shared-library users get application discovery before instrumentation.
  • Large repositories reserve scan capacity for likely server paths and exclude test fixtures and comment-only examples.
  • Suggestions recognize official SDK constructors, TypeScript FastMCP generics, and Mastra wrappers.
  • The agent follows workspace imports while keeping changes scoped to the selected app and avoiding installed dependency edits.
  • Invalid paths stay editable, repeated submissions cannot duplicate scans, and completion links to the selected project's first-event check.
  • Screen registration, metadata types, and harness routing are mechanical changes.

Real Ink renders use fictional example projects:

Before Application suggestions
Before Application suggestions

Launcher source tracing:

Launcher source tracing

Test plan

  • Build, security smoke checks, lint fixes, and screen checks passed.
  • All 2,612 unit tests passed with four workers.
  • Typecheck produced 26 diagnostics, identical to the clean base.
  • Thirty-five real-repository keyboard flows passed across eight starting directories, including every Cloudflare app choice and both Supabase packages.
  • Regression cases cover shared factories, cyclic dependencies, client exclusion, nested workers, launcher guidance, malformed manifests, and scoped agent instructions.

Source probes now suggest Cloudflare's 18 app packages and Supabase's two server packages. Playwright's launcher gets source-tracing guidance.
Firecrawl remains a single application; official MCP servers retain seven choices; Mastra's server apps exclude its client apps.

Pinned validation repositories: Cloudflare, Supabase, Playwright MCP, Firecrawl MCP, official MCP servers, and Mastra.

These checks cover discovery and selection before authentication. Full agent installations, wrapper runtime compatibility, and event ingestion were not exercised.
Suggestions remain bounded heuristics; they do not certify SDK compatibility or successful activation.

LLM context

Codex implemented the change in an isolated wizard checkout. Unit fixtures and screenshot projects are fictional; public repository clones remained unchanged.

🤖 Agent context

Skills used: debugging-mcp-analytics, wizard-development, adding-skill-program, ink-tui, exploring-the-wizard, and writing-pr-descriptions.

Suggest local MCP server entry points before authentication and let users
correct the directory or choose a file. Keep agent discovery available for
custom servers, and explain the separate command for connecting PostHog to
a coding agent.

Run against the selected project directory and ask the agent to verify the
chosen entry point. Use language-appropriate SDK instructions and finish
with first-event steps and a link to the authenticated project and region.
Record selection outcomes without including local paths in the new events.

Validation:
- Build and smoke checks passed.
- All 2,595 tests passed with vitest run --maxWorkers=4.
- Real Ink keyboard checks passed for directory/file recovery, custom
  server discovery, client guidance, and duplicate submissions.
- pnpm fix and the targeted ESLint checks passed.
- Typecheck reports 26 diagnostics identical to the clean base commit.
  The initial unrestricted test run hit a CLI timeout; the isolated CLI
  suite and full four-worker suite passed.

Event ingestion verification and live activation measurement remain outside
this change. Installation completion is not proof that data has arrived.
@lucasheriques
lucasheriques requested a review from a team as a code owner September 9, 2026 18:47
@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown

🧙 Wizard CI

Run the Wizard CI and test your changes against wizard-workbench example apps by replying with a GitHub comment using one of the following commands:

Test all apps:

  • /wizard-ci all

Test all apps in a directory:

  • /wizard-ci ai-observability
  • /wizard-ci basic-integration
  • /wizard-ci mcp-analytics
  • /wizard-ci replay-vision
  • /wizard-ci revenue
  • /wizard-ci self-driving
  • /wizard-ci warehouse
  • /wizard-ci warehouse-seeded

Test an individual app:

  • /wizard-ci ai-observability/anthropic
  • /wizard-ci ai-observability/google-adk
  • /wizard-ci ai-observability/groq
Show more apps
  • /wizard-ci ai-observability/manual-capture
  • /wizard-ci ai-observability/openai
  • /wizard-ci ai-observability/openai-agents
  • /wizard-ci ai-observability/opentelemetry
  • /wizard-ci ai-observability/vercel-ai
  • /wizard-ci basic-integration/android
  • /wizard-ci basic-integration/angular
  • /wizard-ci basic-integration/astro
  • /wizard-ci basic-integration/django
  • /wizard-ci basic-integration/fastapi
  • /wizard-ci basic-integration/flask
  • /wizard-ci basic-integration/flutter
  • /wizard-ci basic-integration/javascript-node
  • /wizard-ci basic-integration/javascript-web
  • /wizard-ci basic-integration/laravel
  • /wizard-ci basic-integration/next-js
  • /wizard-ci basic-integration/nuxt
  • /wizard-ci basic-integration/python
  • /wizard-ci basic-integration/rails
  • /wizard-ci basic-integration/react-native
  • /wizard-ci basic-integration/react-router
  • /wizard-ci basic-integration/sveltekit
  • /wizard-ci basic-integration/swift
  • /wizard-ci basic-integration/tanstack-router
  • /wizard-ci basic-integration/tanstack-start
  • /wizard-ci basic-integration/vue
  • /wizard-ci mcp-analytics/custom-dispatcher
  • /wizard-ci mcp-analytics/typescript-sdk
  • /wizard-ci replay-vision/javascript-node
  • /wizard-ci replay-vision/next-js
  • /wizard-ci replay-vision/react-vite
  • /wizard-ci revenue/stripe
  • /wizard-ci self-driving/astro
  • /wizard-ci self-driving/fastapi
  • /wizard-ci self-driving/nuxt
  • /wizard-ci self-driving/react-router
  • /wizard-ci self-driving/sveltekit
  • /wizard-ci warehouse/monorepo-env
  • /wizard-ci warehouse/multi-source-next
  • /wizard-ci warehouse/stripe-node
  • /wizard-ci warehouse/zero-source
  • /wizard-ci warehouse-seeded/next-stripe
  • /wizard-ci warehouse-seeded/next-stripe-declined

Test against a Context Mill branch:

  • /wizard-ci all context-mill:my-branch

Add context-mill:<branch> to any command above to pin the Context Mill branch. It defaults to main.

Results will be posted here when complete.

Start setup directly from a single detected server and make agent discovery
primary when the scan is inconclusive. Keep manual paths optional and review
ambiguous selections. Recognize the official Python v2 MCPServer constructor.

Validation: build and smoke checks passed; 2,596 tests passed with four workers;
real Ink keyboard checks and pnpm fix passed. Typecheck diagnostics match the
clean base. Full authenticated wizard installs remain untested.
@lucasheriques lucasheriques changed the title fix(mcp-analytics): let users select their server before setup fix(mcp-analytics): suggest servers and default to discovery Sep 9, 2026
);
store.setFrameworkContext(MCP_SCAN_ERROR_KEY, undefined);
setView(View.Select);
} else if (startSetup) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Medium: Automatic selection can expand the agent root

resolveMcpTarget searches upward for project markers, so a directory beneath another project can supply one matching server file and resolve to the enclosing project root. Auto-confirming that result makes the enclosing root the agent’s working directory, allowing attacker-controlled project content to direct reads or writes against sibling files that the user did not select; retain the review screen whenever resolution changes the directory.

Suggested change
} else if (startSetup) {
} else if (startSetup && resolved.directory === directory) {

@veria-ai

veria-ai Bot commented Sep 9, 2026

Copy link
Copy Markdown

PR overview

This pull request updates the MCP analytics setup flow to suggest available servers and use discovery by default. The intro screen resolves the selected directory to an MCP project target and can proceed directly into setup.

One issue remains in the automatic setup path: resolving a selected directory can move the agent’s working root to an enclosing project without retaining the user review step. In a crafted project layout, this could expose sibling files outside the directory the user intended to select to agent-directed reads or writes.

Open issues (1)

Fixed/addressed: 0 · PR risk: 7/10

Recognize generic FastMCP and Mastra constructors. Reserve a bounded scan
pass for likely server paths so unrelated files cannot consume the whole
budget. Filter test fixtures and comment-only examples, and order application
packages before examples and templates.

Validation: 2,600 unit tests, build/security smoke checks, screen checks and
pnpm fix passed. Twenty real-repository keyboard flows passed across nine
starting directories. Typecheck matches all 26 clean-base diagnostics.

Validation covers discovery and selection, not full agent installation or
runtime instrumentation support for the recognized wrapper classes.
Group JavaScript entry points by runnable application package and follow
runtime workspace dependencies to include factory consumers. Exclude client
apps and development-only relationships. Route shared-library-only scans and
MCP launchers through guided discovery instead of selecting a helper file.

Pass scoped app/source-tracing instructions to the agent and document the
bounded metadata scan. Keep Python file suggestions and manual recovery.

Validation: 2,612 unit tests, build/security smoke checks, lint and screen
checks passed. 35 keyboard flows passed on six public repos across eight
starting directories. Typecheck matches all 26 clean-base diagnostics.
Full agent installation, runtime wrapper compatibility and ingestion remain
outside this validation.
@lucasheriques lucasheriques changed the title fix(mcp-analytics): suggest servers and default to discovery fix(mcp-analytics): suggest server apps before setup Sep 9, 2026
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