fix: uninstall Claude Code plugin on removeServer, ignore missing legacy MCP entry#462
Draft
posthog[bot] wants to merge 1 commit into
Draft
fix: uninstall Claude Code plugin on removeServer, ignore missing legacy MCP entry#462posthog[bot] wants to merge 1 commit into
posthog[bot] wants to merge 1 commit into
Conversation
…cy MCP entry as no-op PR #428 switched the Claude Code install path to the plugin interface but left removeServer() running the legacy `claude mcp remove --scope user posthog` command. For users who installed via the plugin flow (or never had a user-scoped MCP entry), that command exits non-zero with "No user-scoped MCP server found", which was wrapped in analytics.captureException and surfaced to the user as success=false despite the integration being present. removeServer() now mirrors the install path: it runs `claude plugin uninstall posthog` first and only treats unexpected errors as failures. The legacy `mcp remove --scope user <serverName>` call still runs to clean up entries created before #428, but "No user-scoped MCP server found" and "not installed" are now treated as successful no-ops rather than captured exceptions. Generated-By: PostHog Code Task-Id: f7d0abc3-428c-4851-bab9-c2079575e257
🧙 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
Users running
npx @posthog/wizardto uninstall PostHog from Claude Code saw the removal silently fail ({ success: false }) with a noisy captured exception (Failed to remove server from Claude Code: ... No user-scoped MCP server found with name: posthog), even though the integration was present.PR #428 switched the Claude Code add path to the new plugin interface (
claude plugin install posthog), but the remove path insrc/steps/add-mcp-server-to-clients/clients/claude-code.tswas not updated and kept executing the legacyclaude mcp remove --scope user posthog. For anyone who installed via the plugin flow (or never had a user-scoped MCP entry), that command exits non-zero with "No user-scoped MCP server found", whichanalytics.captureExceptionwrapped — visible as PostHog error tracking issue019e4707-9ff5-7d12-8e14-baaf82e189ffon 2026-05-20.Changes
removeServer()now mirrors the install path:claude plugin uninstall posthogfirst (matches the post-chore: plugin interface for claude and codex #428 install path).claude mcp remove --scope user <serverName>afterwards to clean up entries created before chore: plugin interface for claude and codex #428.not installed/No user-scoped MCP server foundas successful no-ops on both paths instead of captured exceptions.success: falseand is captured exactly once.Test plan
src/steps/add-mcp-server-to-clients/clients/__tests__/claude-code.test.tswith a newremoveServerblock covering:success: true, no capturesuccess: true, no capture (the regression case)success: true, no capturelocal: true→ usesposthog-localfor the legacy commandsuccess: false+ capturesuccess: false+ capturesuccess: false, no capturepnpm build✅pnpm jest src/steps/add-mcp-server-to-clients/✅ (62/62 pass)pnpm lint✅ (0 errors; pre-existing warnings only)Created with PostHog Code