fix(mcp): register marketplace and gate Claude Code plugin install on version#470
Draft
posthog[bot] wants to merge 1 commit into
Draft
fix(mcp): register marketplace and gate Claude Code plugin install on version#470posthog[bot] wants to merge 1 commit into
posthog[bot] wants to merge 1 commit into
Conversation
… version
`ClaudeCodeMCPClient.installPlugin()` ran `claude plugin install posthog`
unconditionally and reported every failure through `captureException`. The
dominant failure (~325 distinct users / 30d) was `Plugin "posthog" not
found in any configured marketplace` — the wizard never registered the
marketplace. Secondary clusters hit `unknown command 'install'` (Claude
Code without the `plugin` subcommand) or the built-in `needs an update`
hard-stop on versions below 1.0.88.
This change:
- Parses `${binary} --version` and short-circuits with
`{ success: false, unsupported: true }` when Claude Code is below the
1.0.88 floor that introduced the `plugin` subcommand and marketplace
flow.
- Runs `claude plugin marketplace add PostHog/ai-plugin` before the
install (matching the identifier the Codex client already uses), and
tolerates `already added` so reruns are idempotent.
- Treats `unknown command`, `needs an update`, and `not found in any
configured marketplace` as known unsupported outcomes — quiet
`{ success: false, unsupported: true }` returns, no `captureException`,
so error tracking stops being flooded for users whose tooling is
simply too old.
- Adds unit coverage for each branch (version too low / unparseable,
marketplace already-added, all three known-unsupported error
substrings, and unexpected failures that still report).
Net effect: the ~325-user marketplace-not-found cluster is fixed by the
new `plugin marketplace add` step, and the ~5 users on outdated CLIs no
longer pollute `$exception` with the predictable upgrade-required errors.
Generated-By: PostHog Code
Task-Id: 02b404c7-0819-419c-a596-fadc60958675
🧙 Wizard CIRun 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:
Test all apps in a directory:
Test an individual app:
Show more apps
Results will be posted here when complete. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
ClaudeCodeMCPClient.installPlugin()(src/steps/add-mcp-server-to-clients/clients/claude-code.ts:143) executedclaude plugin install posthogunconditionally and routed every failure throughcaptureException. Over the last 30 days theClaude Code plugin install failedexception fired for ~480 events / ~330 distinct users on the wizard's MCP setup flow:Plugin "posthog" not found in any configured marketplace— the wizard never registered the marketplace before the install. (Introduced when chore: plugin interface for claude and codex #428 swappedclaude mcp addforclaude plugin installwithout the prerequisite step.)error: unknown command 'install'(binaries that predate thepluginsubcommand) or Claude Code's ownneeds an updatehard-stop.All of these are predictable, recoverable outcomes, but they were polluting
$exceptionand the user saw a generic "install failed" with no upgrade hint.Changes
In
src/steps/add-mcp-server-to-clients/clients/claude-code.ts:${binary} --versionand short-circuit with{ success: false, unsupported: true }when Claude Code is below the 1.0.88 floor that introduced thepluginsubcommand and marketplace flow. NocaptureException.claude plugin marketplace add PostHog/ai-plugin(the same identifier the Codex client already uses). Tolerate thealready addedsubstring so reruns are idempotent.plugin installcatch block, treat the three known-unsupported substrings —unknown command,needs an update, andnot found in any configured marketplace— as quiet{ success: false, unsupported: true }returns. Genuine network / unknown failures still flow throughcaptureExceptionexactly as before.In
src/steps/add-mcp-server-to-clients/plugin-client.ts:unsupported?: booleantoPluginInstallResultso callers can distinguish "client too old" from a real install failure without parsing strings. No call sites currently branch on it; the field is forward-looking for the TUI upgrade prompt called out in the report.Test plan
pnpm test --testPathPattern=claude-code— 17 cases, including: marketplace registration ordering,already addedtolerance, version too low (skips marketplace + install entirely), unparseable--version, each of the three known-unsupported error substrings, unexpected install / marketplace errors still capturing the exception, and the existing already-installed paths.pnpm test --testPathPattern="mcp-installer|add-mcp-server"— 67 cases pass; the existinginstallPluginscontract and Codex client are unaffected.pnpm build(incl. smoke test) andpnpm lintclean (no new warnings).LLM context
Authored by an LLM agent acting on a signal report that quantified the failure mode (~325 users on missing marketplace, ~5 on outdated CLIs) and proposed the fix shape. Marketplace identifier
PostHog/ai-pluginwas verified by reading the live.claude-plugin/plugin.jsonin https://github.com/PostHog/ai-plugin (plugin nameposthog, version 1.1.24) and cross-referenced against the existing Codex client which uses the same string.Created with PostHog Code