feat: role-aware MCP tutorial with dialogue follow-ups and goodbye#508
Merged
Conversation
Lights up the role + framework matrix in mcp-role-prompts.ts (added in #500 but never wired up) and turns the MCP tutorial into a paced, role-tailored, branching conversation. - Greeting phase between Auth and PromptPicker — role-tuned headline / bullets / outro for every TAILORED_ROLE plus a neutral fallback. - PromptPicker now calls getRolePrompts(role, integration) so engineers see error/perf prompts, founders see growth prompts, etc. - Running phase styles tool calls / results / errors as bordered boxes; text is plain (the chunk-by-chunk arrival is the reveal animation). - FollowUp phase renders inline below the result, so the user reads at their own pace — no auto-advance timer. Follow-ups blend per-tool, per-role, generic, and late-tree deep-dive pools, rotated by branch depth so repeat visits surface different suggestions. - Goodbye phase fires on every dismissal — names installed clients (or lists common ones if standalone), shows 3 starter prompts from the role kit, and points to "npx @posthog/wizard mcp tutorial" for re-running. - [enter] skips the typewriter Greeting for returning users. +12 tests in mcp-role-prompts.test.ts covering getRoleGreeting, getFollowUps pool composition, depth-based rotation, MCP tool-name normalization, and history-based deduplication. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
🧙 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. |
Two product-discovery beats added on top of the role-aware tutorial.
- After every tool-result chunk, render a one-line cross-product hint
pointing the user at the underlying PostHog product. `query-trends`
highlights pinning to a dashboard, `create-feature-flag` calls out the
1M/month free tier, `execute-sql` plugs the data warehouse, etc.
Each agent action becomes a quiet "did you know" without breaking
flow. Implemented as getToolHint(toolName) → ToolHint with MCP-prefix
normalization, rendered under tool-result in ChunkLine.
- Above the role kit in PromptPicker, prepend 2 role-tailored
cross-sell prompts — engineers see error tracking + session replay
demos, founders see replay + surveys, marketing sees replay + web
analytics, etc. Labels are prefixed with "Try {Product} —" so they
visually stand out in the shared picker. Picking one runs the same
Streaming → FollowUp flow as a regular kit prompt, so the agent
actually demos the product against the user's real data.
+7 tests in mcp-role-prompts.test.ts cover hint lookup + normalization,
neutral / role-specific cross-sell sets, and cross-role variance.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
`runMcpPromptViaSdk` was calling the Claude Agent SDK without the env vars that point it at the PostHog LLM gateway, so the SDK tried to authenticate directly against Anthropic and 401'd with "Invalid authentication credentials" the moment a user picked a prompt. Mirror what `initializeAgent` does in agent-interface.ts: set ANTHROPIC_BASE_URL / ANTHROPIC_AUTH_TOKEN / CLAUDE_CODE_OAUTH_TOKEN / CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS from the user's OAuth credentials before calling query(). The host on the OAuth response feeds getLlmGatewayUrlFromHost so the right regional gateway is used. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
76 tasks
Member
|
i'm gonna get this out the door today, so we can have a v1 of personalized MCP tutorials |
edwinyjlim
approved these changes
Jun 5, 2026
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.
Loom: https://www.loom.com/share/fa250e9521ae4d88a45505532bb51a61
Summary
src/lib/mcp-role-prompts.ts(added in feat: Rebuild the MCP install + create role-tailored prompts screen #500 but never wired) and turns the MCP tutorial into a paced, role-tailored, branching conversation.Why
The post-#500 tutorial captured
role_at_organizationfrom OAuth but never used it — every user saw the sameSTOCK_MCP_SUGGESTED_PROMPTS. This wires the role through end-to-end: kit, greeting copy, follow-up flavor. The Goodbye phase closes a recurring "wait, how do I use MCP now?" gap — users who exit the tutorial always leave with the names of their installed clients and 3 role-tailored starter prompts.What changed
src/lib/mcp-role-prompts.ts:getRoleGreeting(role)— returns headline / bullets / outro perTAILORED_ROLEwith neutral fallback.getFollowUps({ lastToolName, role, branchHistory, ... })— expanded pools (5-6 per tool, new per-role set, 6 generic, deep-dive set at depth ≥ 3), MCP tool-name normalization (mcp__server__tool→tool), depth-based rotation, history-based dedup.FOLLOW_UP_COUNT,FOLLOW_UP_EXIT_SENTINELexported.src/ui/tui/screens/McpSuggestedPromptsScreen.tsx:Greeting,FollowUp,Goodbye.getRolePrompts(role, integration)— engineers get error/perf prompts, founders growth, PMs funnels, etc.POST_RUN_DELAY.session.mcpInstalledClientsand shows 3 starter prompts from the role kit; falls back to a generic client list when standalone.[enter]skips the auto-paced Greeting; PickerMenu owns Enter in picker phases (no double-fire).MAX_PROMPT_RUNSbumped 3 → 5 so the conversation tree has room.src/lib/__tests__/mcp-role-prompts.test.ts: +12 tests coveringgetRoleGreeting, follow-up pool composition, depth-based rotation, role-mixing variance, tool-name normalization, history-based dedup.src/ui/tui/playground/demos/McpSuggestedPromptsDemo.tsx: docstring updated to call out the new phases (no behavior change).Test plan
pnpm typecheck— cleanpnpm test— 740 / 740 passingpnpm try --playground→mcp-tutorialdemo:Rand confirm greeting copy + kit + follow-ups all changeS=with-tools, run a prompt, confirm FollowUp picker appears under the result withquery-trends-flavored suggestions[esc]mid-Greeting, mid-Running, FollowUp's "I'm done",[esc]from FollowUp) and confirm Goodbye phase fires each timeClaude Code(the mocked installed client) and 3 role-tailored sample promptswizard mcp tutorial --localagainst the local MCP, walk a real role through Greeting → Picker → Running → FollowUp → Goodbye🤖 Generated with Claude Code