Repository navigation
feat: render the mcp config component as markdown - #47292
Conversation
|
This pull request has been ignored for the connected project Preview Branches by Supabase. |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughThe PR centralizes MCP client metadata, instruction content, and config serialization, adds a docs-oriented MCP config panel, and updates the docs schema handler so component handlers can return mdast nodes as well as strings. ChangesMCP config rendering stack
Sequence Diagram(s)See hidden review stack artifact. Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/ui-patterns/src/McpUrlBuilder/clients.data.ts`:
- Around line 347-360: The Gemini and Factory MCP install commands in
MCP_CLI_COMMANDS interpolate ${url} without shell quoting, which can break URLs
containing query parameters. Update the install handlers for 'gemini-cli' and
'factory' to wrap the shared URL argument in quotes, matching the existing
quoted patterns used by 'copilot-cli' and 'goose', so the generated command
remains safe in both the dashboard and markdown output.
- Around line 104-111: The deep link generator in generateDeepLink is using
Node-specific Buffer to base64-encode the MCP config, which will fail in the
browser bundle. Update the serialization in clients.data.ts to use a
browser-compatible encoder such as btoa for the JSON string, or add an explicit
runtime-safe polyfill if Buffer behavior is required, while keeping the returned
cursor://anysphere.cursor-deeplink URL format unchanged.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI (base), Organization UI (inherited)
Review profile: CHILL
Plan: Pro
Run ID: 4ad91429-932a-4fd0-8f51-15de235978ae
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (11)
apps/docs/internals/generate-guides-markdown.tsapps/docs/package.jsonpackages/ui-patterns/package.jsonpackages/ui-patterns/src/McpUrlBuilder/McpConfigPanel.md.tsxpackages/ui-patterns/src/McpUrlBuilder/clients.data.tspackages/ui-patterns/src/McpUrlBuilder/components/McpConfigurationDisplay.tsxpackages/ui-patterns/src/McpUrlBuilder/constants.tsxpackages/ui-patterns/src/McpUrlBuilder/index.tspackages/ui-patterns/src/McpUrlBuilder/utils/getMcpUrl.tspackages/ui-patterns/src/McpUrlBuilder/utils/serializeMcpConfig.tspnpm-workspace.yaml
jeremenichelli
left a comment
There was a problem hiding this comment.
Thanks for the PR, Greg, I left some comments.
By the way, have we consider actually turning the wizard into content. Not saying to replace it (or maybe replace it) but write the configuration steps as content, maybe using Tabs which we already handle. I think it would reduce the code complexity increase and might be more accessible for humans reading the page too.
Let me know what you think.
| * the markdown and the dashboard's Connect panel can't drift. Authored with the | ||
| * mdast-jsx runtime; consumed by the docs markdown pipeline. | ||
| */ | ||
| export function McpConfigPanel() { |
There was a problem hiding this comment.
Doesn't this makes us maintain a doubled output for the same component? 🤔 Thinking about the burden of double checking the structure every time we update something, and possible differences in the future.
There was a problem hiding this comment.
Yes it does, but it's not as bad as it looks. The current approach moves 95% of content into pure functions that's reused between the dynamic and static components. There's no straightforward way to render a dynamic React component to markdown, so we need some way to represent the content statically.
Only other solution could be (as you mention), scrapping the dynamic component entirely and converting it into static content. But that touches a lot more surface area, since we reuse McpConfigPanel in both the docs and in studio (via connect panel):
Assuming we want to keep the studio version dynamic, we'll end up duplicating this anyways between docs and studio and maintain 2 different versions (which is probably worse).
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
packages/ui-patterns/src/McpUrlBuilder/clients.data.ts (1)
413-417: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winType image assets as a closed set.
asset: stringleaves this cross-file contract unchecked. A typo here will just makeInstructionBlocksmissINSTRUCTION_ASSETS[block.asset]and render nothing, so the screenshot disappears silently. Prefer a shared asset-id union instead of an open string.♻️ Proposed refactor
+export type McpInstructionAsset = 'antigravity-auth' + export interface McpImageBlock { type: 'image' - asset: string + asset: McpInstructionAsset alt: string }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/ui-patterns/src/McpUrlBuilder/clients.data.ts` around lines 413 - 417, The McpImageBlock contract currently uses an open-ended asset string, which allows typos to silently break InstructionBlocks rendering. Update the McpImageBlock.asset type to use the shared closed asset-id union from the existing asset definitions used by INSTRUCTION_ASSETS, and keep the contract aligned wherever McpImageBlock is consumed so only valid image asset keys are allowed.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/ui-patterns/src/McpUrlBuilder/components/InstructionBlocks.tsx`:
- Around line 17-20: The `INSTRUCTION_ASSETS` map in `InstructionBlocks` should
not allow plain string image sources because those are passed directly into
`next/image` by the rendering logic and can fail without intrinsic dimensions.
Update the asset typing so `INSTRUCTION_ASSETS` only contains `StaticImageData`,
or change the image rendering path in the component that uses these assets to
provide explicit width and height for any string source. Keep the fix aligned
with the existing `InstructionBlocks` asset lookup and the `<Image>` usage that
consumes it.
---
Nitpick comments:
In `@packages/ui-patterns/src/McpUrlBuilder/clients.data.ts`:
- Around line 413-417: The McpImageBlock contract currently uses an open-ended
asset string, which allows typos to silently break InstructionBlocks rendering.
Update the McpImageBlock.asset type to use the shared closed asset-id union from
the existing asset definitions used by INSTRUCTION_ASSETS, and keep the contract
aligned wherever McpImageBlock is consumed so only valid image asset keys are
allowed.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: ec5a01dc-2715-48c5-ac38-7b7e6e3ec1b8
📒 Files selected for processing (4)
packages/ui-patterns/src/McpUrlBuilder/McpConfigPanel.md.tsxpackages/ui-patterns/src/McpUrlBuilder/clients.data.tspackages/ui-patterns/src/McpUrlBuilder/components/InstructionBlocks.tsxpackages/ui-patterns/src/McpUrlBuilder/constants.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
- packages/ui-patterns/src/McpUrlBuilder/McpConfigPanel.md.tsx
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (3)
packages/ui-patterns/src/McpUrlBuilder/McpConfigPanel.md.tsx (1)
51-66: 🎯 Functional Correctness | 🔵 Trivial | 💤 Low value
instructionToMarkdownonly filtersimagenodes at the top level.If a future instruction nests an
imagenode inside another block (e.g. inside a paragraph or list item rather than as a direct sibling), it would pass through unfiltered into markdown output withnode.urlset to an internal asset id (not a real URL), producing a broken markdown image. Not an issue with the current content (allimagenodes are top-level), so this is a latent fragility rather than an active bug.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/ui-patterns/src/McpUrlBuilder/McpConfigPanel.md.tsx` around lines 51 - 66, instructionToMarkdown currently strips image nodes only when they are direct children of the root, so nested images can still leak into the markdown output. Update the traversal in instructionToMarkdown to recursively filter out any Content node with type image before returning the final array, while preserving the existing handling for blockquote callouts via calloutVariant and labelCallout.packages/ui-patterns/src/McpUrlBuilder/clients.instructions.md.tsx (1)
53-53: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winType
MCP_CLIENT_INSTRUCTIONSkeys against the client-key union instead ofstring.
Record<string, McpClientInstructions>doesn't catch typos in client keys at compile time.McpConfigPanel.md.tsxderives a stricterMcpClientKeyfromMCP_CLIENT_GROUPS; reusing that (orMCP_CLIENT_DATA[number]['key']) here would let the compiler flag a misspelled key (e.g.'gemeni-cli') instead of silently producingundefinedinstructions at runtime.♻️ Proposed direction
-export const MCP_CLIENT_INSTRUCTIONS: Record<string, McpClientInstructions> = { +export const MCP_CLIENT_INSTRUCTIONS: Partial<Record<McpClientKey, McpClientInstructions>> = {🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/ui-patterns/src/McpUrlBuilder/clients.instructions.md.tsx` at line 53, `MCP_CLIENT_INSTRUCTIONS` is typed too loosely as `Record<string, McpClientInstructions>`, so misspelled client keys can slip through. Update the export to use the same stricter client-key union used by `McpConfigPanel.md.tsx` (for example `McpClientKey` derived from `MCP_CLIENT_GROUPS` or `MCP_CLIENT_DATA[number]['key']`) so the compiler catches invalid keys in `clients.instructions.md.tsx`.packages/ui-patterns/src/McpUrlBuilder/mcpClients.tsx (1)
4-5: 🎯 Functional Correctness | 🔵 Trivial | 💤 Low valueAvoid duplicate
getMcpUrlexports../typesand./utils/getMcpUrlboth exposegetMcpUrlwith different inputs/returns, which makes the imports here easy to mix up. Renaming or aliasing one of them would reduce confusion.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/ui-patterns/src/McpUrlBuilder/mcpClients.tsx` around lines 4 - 5, Avoid the duplicate getMcpUrl export confusion in McpClients by making the import in mcpClients.tsx explicitly distinguish the two variants. Update the McpClient-related wiring to use a clearly named alias for the getMcpUrl coming from ./types, or switch to the intended implementation from ./utils/getMcpUrl, so the symbol referenced alongside McpClient is unambiguous and not easy to mix up with the other getMcpUrl export.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/ui-patterns/src/McpUrlBuilder/components/InstructionBlocks.tsx`:
- Around line 72-81: The `code` renderer in `InstructionBlocks` is hardcoding
`language="bash"` instead of using the mdast node’s `lang`, so update that
renderer to pass through `node.lang` to `CodeBlock` and keep the existing
block/className behavior intact. Use the `code` callback in
`InstructionBlocks.tsx` and the `CodeBlock` prop wiring as the place to fix it
so future non-bash snippets are highlighted correctly.
---
Nitpick comments:
In `@packages/ui-patterns/src/McpUrlBuilder/clients.instructions.md.tsx`:
- Line 53: `MCP_CLIENT_INSTRUCTIONS` is typed too loosely as `Record<string,
McpClientInstructions>`, so misspelled client keys can slip through. Update the
export to use the same stricter client-key union used by `McpConfigPanel.md.tsx`
(for example `McpClientKey` derived from `MCP_CLIENT_GROUPS` or
`MCP_CLIENT_DATA[number]['key']`) so the compiler catches invalid keys in
`clients.instructions.md.tsx`.
In `@packages/ui-patterns/src/McpUrlBuilder/mcpClients.tsx`:
- Around line 4-5: Avoid the duplicate getMcpUrl export confusion in McpClients
by making the import in mcpClients.tsx explicitly distinguish the two variants.
Update the McpClient-related wiring to use a clearly named alias for the
getMcpUrl coming from ./types, or switch to the intended implementation from
./utils/getMcpUrl, so the symbol referenced alongside McpClient is unambiguous
and not easy to mix up with the other getMcpUrl export.
In `@packages/ui-patterns/src/McpUrlBuilder/McpConfigPanel.md.tsx`:
- Around line 51-66: instructionToMarkdown currently strips image nodes only
when they are direct children of the root, so nested images can still leak into
the markdown output. Update the traversal in instructionToMarkdown to
recursively filter out any Content node with type image before returning the
final array, while preserving the existing handling for blockquote callouts via
calloutVariant and labelCallout.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: c5e2bf1a-85a9-47b0-8a83-c251edca0c9f
📒 Files selected for processing (9)
packages/ui-patterns/package.jsonpackages/ui-patterns/src/McpUrlBuilder/McpConfigPanel.md.tsxpackages/ui-patterns/src/McpUrlBuilder/McpConfigPanel.tsxpackages/ui-patterns/src/McpUrlBuilder/clients.data.tspackages/ui-patterns/src/McpUrlBuilder/clients.instructions.md.tsxpackages/ui-patterns/src/McpUrlBuilder/components/InstructionBlocks.tsxpackages/ui-patterns/src/McpUrlBuilder/constants.tsxpackages/ui-patterns/src/McpUrlBuilder/index.tspackages/ui-patterns/src/McpUrlBuilder/mcpClients.tsx
💤 Files with no reviewable changes (1)
- packages/ui-patterns/src/McpUrlBuilder/constants.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
- packages/ui-patterns/package.json
🎭 Playwright Test ResultsDetails
Flaky testsFeatures › sql-editor.spec.ts › SQL Editor › should check if SQL editor is working as expected Skipped testsFeatures › auth-users.spec.ts › should show web3 users as enabled when the matching web3 provider is enabled |
fsansalvadore
left a comment
There was a problem hiding this comment.
Reviewing as part of design team. Only two comments:
- a UI Patterns test is failing
- and the "Authentication" admonition seems to be missing from the .md content, not sure if relevant?
Approving anyway to unblock as I see the .md page does indeed show all the mcp sections content and the pr doesn't break anything else.
Braintrust eval report
|
Renders the MCP config component as markdown for static markdown builds. Currently we have no special case for
<McpConfigPanel />, so it gets stripped out during markdown rendering. This adds a static markdown version of this component that renders all agents/tools consecutively.Adds a new
McpConfigPanel.md.tsxcomponent that reuses data structures used byMcpConfigPanel.tsxbut renders as markdown instead of React. Instead of building the markdown via string concatenation, we use supabase-community/mdast-jsx which allows you to author markdown using JSX (providing type safety, better DX, maintainability). E.g.produces:
Preview
https://docs-git-feat-mcp-config-markdown-supabase.vercel.app/docs/guides/ai-tools/mcp.md
Summary by CodeRabbit
Summary by CodeRabbit
New Features
Bug Fixes
Refactor
Chores