Repository navigation
Conversation
Adds a Model Context Protocol server on top of the docsite's existing generated registries. Agents (Cursor, Claude Desktop, Windsurf, etc.) can query XDS component docs, reference guides, templates, and block source code without needing the CLI installed. Tools exposed: - list_components: browse/filter all XDS components - get_component: full docs (props, usage, theming, accessibility) - get_docs: reference topics (spacing, color, typography, etc.) - list_templates: page templates (dashboard, AI chat, settings) - get_block_source: TSX source showing component composition - search: cross-resource search Uses mcp-handler (Vercel adapter) with streamable HTTP transport. No Redis required for stateless read-only tools.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
PR Analysis Report📚 Storybook PreviewView Storybook for this PR 🧪 Sandbox PreviewView Sandbox for this PR No new or modified components detected. Bundle Size Summary
Accessibility AuditStatus: No accessibility violations detected. Generated by PR Enrichment workflow | Storybook | Sandbox | View full report |
This was referenced May 19, 2026
This branch was successfully deployed
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.
Summary
Adds a Model Context Protocol (MCP) server to the XDS docsite, allowing AI agents to query component documentation without needing the CLI installed.
Motivation
The XDS CLI is great when available, but in nightlies and environments where CLI access isn't guaranteed (Cursor, Claude Desktop, Windsurf, etc.), agents lose access to component docs. An MCP server on the docsite provides always-available, zero-install access to the same data.
What's included
6 tools exposed via MCP:
list_componentsget_componentget_docslist_templatesget_block_sourcesearchArchitecture:
mcp-handler(Vercel adapter) with Streamable HTTP transportsrc/app/[transport]/route.tsClient config (one line):
{"mcpServers": {"xds": {"url": "https://xds.vercel.app/mcp"}}}What's NOT included (intentionally)
Vibe Test: MCP vs CLI — Code Generation Quality
Methodology
Instead of just comparing API responses, we tested whether agents produce correct, compilable XDS code when using each knowledge source.
Evaluation Criteria
@xds/core/Tablenotxds)headerortitlefor columns?Prompt 1: Simple component (AlertDialog)
Knowledge provided:
get_component("AlertDialog")+get_block_source(component: "AlertDialog")xds component AlertDialog+xds component AlertDialog --showcase@xds/core/AlertDialog@xds/core/AlertDialogisInlineisActionLoadingfor loadingactionVariant="destructive"Verdict: Effectively a tie. AlertDialog is a simple single-component API — both sources provide sufficient knowledge.
Prompt 2: Compound component (Table + hooks)
Knowledge provided:
get_component("Table")+get_block_source(component: "Table")+search("sort")xds component Table(returns all 10 sub-components + hooks in one response) +xds component Table --showcasefrom 'xds'from '@xds/core/Table'title(should beheader)headeruseXDSTableSortable()no argssortConfigparamuseXDSTableSortableStateuseXDSTableSelection()no argsselectionConfigparamuseXDSTableSelectionState*CLI score is projected based on the documentation it provides matching the actual working examples in the repo.
Ground truth (from
packages/cli/templates/blocks/components/Table/TableSortableTable.tsx):Verdict: CLI wins decisively. MCP fails on compound components that require multiple hooks working together.
Root Cause Analysis
Why does MCP fail on Prompt 2?
get_component("Table")returns only the top-level component. CLI returns Table + all 10 sub-components (hooks, helpers) in one response.--showcasegets the right oneimportfield in component data'xds'instead of'@xds/core/Table')get_component("Table")→relatedHooks: nulluseXDSTableSortableStatehas no .doc.mjs, invisible to MCPRelationship to #2182
The theme docs issue (#2182) applies equally to both MCP and CLI — both serve the same 17KB theme documentation that causes agent context degradation. The MCP server inherits this problem by serving the same generated registry data without any AI-focused filtering.
Recommendations for MCP v2 (before merging to production)
Composite responses for compound components — When returning Table, auto-include all hooks in the same group. The
parentDocfield in the registry already tracks this relationship.Include import paths — Add
import: "@xds/core/Table"to every component response. The CLI'sresolveImportPath()utility already computes this.Smarter block selection — Instead of first-5, prefer blocks whose name/description matches the original query context. Or remove the limit and let the agent see all examples.
Expose undocumented exports — Scan
index.tsexports and include hooks that lack.doc.mjswith at least their type signatures (params + return type).AI-optimized doc mode — For topics like
theme, provide a condensed API-surface-only response (ref docs theme --dense causes AI agent context degradation (regression to 20% compliance) #2182). The full 17KB doc degrades agent performance regardless of transport.Conclusion
The MCP server works well for simple components (which is most of XDS). For compound components with plugin systems, it currently produces non-compiling code. The fixes above (composite responses, import paths, smarter blocks) would close the gap.
Merging as draft — the identified gaps should be addressed before recommending MCP as a CLI replacement for complex components.