Skip to content

fix(mcp): register the marketplace before installing the Claude Code plugin - #1007

Draft
posthog[bot] wants to merge 1 commit into
mainfrom
posthog-code/claude-code-plugin-marketplace
Draft

fix(mcp): register the marketplace before installing the Claude Code plugin#1007
posthog[bot] wants to merge 1 commit into
mainfrom
posthog-code/claude-code-plugin-marketplace

Conversation

@posthog

@posthog posthog Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Problem

ClaudeCodeMCPClient.installPlugin shells straight into claude plugin install posthog with no marketplace registration step. Claude Code only resolves a plugin name against marketplaces the user already has, and it registers the official Anthropic marketplace (which carries the posthog plugin) when it starts interactively — the wizard uses the non-interactive plugin subcommand, so on a machine that never opened Claude Code the catalog isn't there and the install dies with Plugin "posthog" not found in any configured marketplace.

Nothing surfaced this: installPlugins only debug()s the failure and the TUI treats plugins as best-effort, so users quietly walked away without the plugin even though MCP registration and the main flow succeeded. The Codex client next door already does the marketplace step, so this was an asymmetry rather than a missing capability.

Separately, the catch block stuffed raw stderr — including the resolved binary path and user home directories — into the exception message, splitting one root cause across several error-tracking issues and spawning fresh ones for unactionable local-environment failures.

Changes

  • Register the marketplace first. Skip the add when it's already listed, install the plugin qualified against it, refresh a stale catalog and retry once, then fall back to the bare plugin name as a last resort so we never do worse than today.
  • Classify expected local failures. A CLI too old for plugin, unreadable settings/marketplace JSON, ENOBUFS, network/clone failures, permissions, and managed-settings restrictions now return a short hint instead of calling captureException.
  • Group what we do report. The exception message is constant (only the stage varies); stderr, stage and the binary basename move into properties, and home directories are normalised to ~.
  • Tell the user. installPlugins returns hints alongside installed names, and the MCP screen renders them instead of silently moving on.
  • Fixes a stale-state bug in the same path: with exactly one detected client, the recommended flow read installMode before its setter had landed, took the custom branch, and skipped the plugin install entirely.

Test plan

  • pnpm build && pnpm test && pnpm fix — 1634 tests pass.
  • Extended clients/__tests__/claude-code.test.ts: marketplace registered when absent / skipped when present, stale-catalog refresh + retry, bare-name fallback, each expected-failure class hinting without a capture, and the stable message + scrubbed properties for unexpected failures.
  • Rendered McpScreen against ink's real renderer (it's stubbed in the vitest config, so this was a manual pass) to confirm the done screen shows ⚠ Claude Code plugin not installed with the hint on failure, and still shows ✔ Plugin installed for: on success.

Created with PostHog Desktop from this inbox report.

…plugin

`claude plugin install posthog` only resolves against marketplaces the user
already has registered. Claude Code registers the official Anthropic
marketplace (which carries the posthog plugin) when it starts interactively —
the wizard shells straight into the non-interactive `plugin` subcommand, so on
a machine that never opened Claude Code the catalog isn't there and the install
dies with `Plugin "posthog" not found in any configured marketplace`.

Register the marketplace first (skipping the add when it's already listed),
install the plugin qualified against it, refresh a stale catalog and retry
once, and fall back to the bare plugin name as a last resort.

Known local-environment failures — a CLI too old for `plugin`, unreadable
settings/marketplace JSON, ENOBUFS, network/clone failures, permissions,
managed-settings restrictions — now produce a short user-facing hint instead of
an exception capture. Remaining failures report under a constant message with
the stderr, stage and binary basename moved into properties and home
directories normalised to `~`, so one root cause is one issue.

The TUI now renders those hints on the MCP done screen rather than treating a
failed plugin install as silent best-effort.

Also fixes a stale-state bug in the same path: with exactly one detected
client, the recommended flow read `installMode` before its setter had landed,
so it took the 'custom' branch and skipped the plugin install entirely.


Generated-By: PostHog Code
Task-Id: 262e7a1b-5564-4d76-8a68-f5126e86c990
@github-actions

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 basic-integration
  • /wizard-ci mcp-analytics
  • /wizard-ci revenue
  • /wizard-ci self-driving

Test an individual app:

  • /wizard-ci basic-integration/android
  • /wizard-ci basic-integration/angular
  • /wizard-ci basic-integration/astro
Show more apps
  • /wizard-ci basic-integration/django
  • /wizard-ci basic-integration/fastapi
  • /wizard-ci basic-integration/flask
  • /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 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

Results will be posted here when complete.

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.

0 participants