Integrate Fragment UI with MCP Server for AI-native workflows.
The Model Context Protocol (MCP) is a standard protocol that allows AI assistants to interact with external tools and services. Fragment UI’s MCP server runs over stdio (it does not open an HTTP port).
It provides:
fragment://components, fragment://tokens, fragment://rulesAdd the Fragment UI MCP server to your Cursor configuration file (usually ~/.cursor/mcp.json or in your project's .cursor directory).
Recommended (works in the Fragment UI monorepo workspace):
{
"mcpServers": {
"fragment-ui": {
"command": "npx",
"args": [
"-y",
"@fragment_ui/mcp-server"
]
}
}
}Alternative (pin to a local path, best for debugging):
{
"mcpServers": {
"fragment-ui": {
"command": "node",
"args": [
"/absolute/path/to/fragment-ui/packages/mcp-server/dist/index.js"
]
}
}
}Notes:
@fragment_ui/mcp-server (not @fragment-ui/mcp-server).FRAGMENT_UI_ROOT.Core tools:
get_component_infosuggest_componentvalidate_codegenerate_componentget_tokensAdditional tools:
list_registry, search_componentslist_scaffolds, get_scaffold_info, create_scaffoldedit_apply, edit_findhistory_list, history_checkout, history_get, history_branches (git history)selection_set, selection_clear, selection_get, selection_history, selection_previous (selection management)Get detailed information about any Fragment UI component:
// Ask AI: "What props does the Button component accept?"
// AI will provide complete prop documentationGenerate components that follow Fragment UI patterns:
// Ask AI: "Create a form with validation using Fragment UI"
// AI will generate code using Fragment UI componentsAccess design tokens for consistent styling:
// Ask AI: "What spacing tokens are available?"
// AI will list all spacing tokens with valuesValidate your code against basic Fragment UI design system rules:
// Ask AI: "Validate this component code"
// AI will check for design system complianceThe server also exposes read-only MCP resources:
fragment://components (registry)fragment://tokens (design tokens)fragment://rules (rules from mcp/rules.json)If the MCP server doesn't start, check:
packages/mcp-server/dist/index.js exists (run pnpm --filter @fragment_ui/mcp-server build)If AI doesn't recognize Fragment UI components: