drivn 1.11.0 → 1.12.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -92,6 +92,51 @@ export function ConfirmDialog() {
92
92
  }
93
93
  ```
94
94
 
95
+ ## MCP Server
96
+
97
+ Connect your AI assistant directly to the Drivn component registry via the [Model Context Protocol](https://modelcontextprotocol.io). Instead of copy-pasting component code into chat, your AI gets exact source code, design tokens, and coding conventions automatically.
98
+
99
+ ### Claude Code
100
+
101
+ ```sh
102
+ claude mcp add drivn -- npx drivn@latest mcp
103
+ ```
104
+
105
+ ### Cursor
106
+
107
+ ```sh
108
+ npx @anthropic-ai/cursor-mcp-installer drivn -- npx drivn@latest mcp
109
+ ```
110
+
111
+ ### Manual configuration
112
+
113
+ For any MCP-compatible client, add the following to your config file:
114
+
115
+ ```json
116
+ {
117
+ "mcpServers": {
118
+ "drivn": {
119
+ "command": "npx",
120
+ "args": ["drivn@latest", "mcp"]
121
+ }
122
+ }
123
+ }
124
+ ```
125
+
126
+ ### Available tools
127
+
128
+ | Tool | Description |
129
+ |---|---|
130
+ | `list_components` | List all available components with descriptions |
131
+ | `get_component` | Get full source code and metadata for a component |
132
+ | `get_component_metadata` | Get metadata only (no source) — useful for planning |
133
+ | `search_components` | Search components by name or description |
134
+ | `get_installation_instructions` | Get step-by-step install instructions with dependency resolution |
135
+ | `get_design_tokens` | Get CSS design tokens (globals and theme tokens) |
136
+ | `get_drivn_rules` | Get Drivn coding conventions and component patterns |
137
+
138
+ ---
139
+
95
140
  ## License
96
141
 
97
142
  Licensed under the [MIT License](./LICENSE.md).
package/dist/index.js CHANGED
@@ -3340,6 +3340,7 @@ function Trigger({
3340
3340
  const { open, setOpen } = useSelect()
3341
3341
  return (
3342
3342
  <button
3343
+ type="button"
3343
3344
  className={cn(styles.trigger, className)}
3344
3345
  onClick={() => setOpen(!open)}
3345
3346
  {...props}
@@ -3380,6 +3381,7 @@ function Option({
3380
3381
  const { value, onSelect } = useSelect()
3381
3382
  return (
3382
3383
  <button
3384
+ type="button"
3383
3385
  className={cn(styles.option, optValue === value && styles.selected, className)}
3384
3386
  onClick={() => onSelect(optValue)}
3385
3387
  {...props}
@@ -3951,6 +3953,7 @@ export function Switch({
3951
3953
  }: SwitchProps) {
3952
3954
  return (
3953
3955
  <button
3956
+ type="button"
3954
3957
  role="switch"
3955
3958
  aria-checked={checked}
3956
3959
  onClick={() => onChange?.(!checked)}
@@ -4650,7 +4653,7 @@ import { cn } from '@/utils/cn'
4650
4653
  - Components declare internal deps (other Drivn components)
4651
4654
  - Some components need npm packages (react-day-picker, cmdk, embla-carousel-react, sonner)
4652
4655
  - The CLI resolves and installs all dependencies automatically
4653
- `;var L={version:"1.11.0"};function O(e){return v.find(r=>r.name===e)}function Je(e){let r=new Set,t=a=>{if(r.has(a))return;let l=O(a);l&&(l.dependencies.forEach(d=>t(d)),r.add(a));};return t(e),r.delete(e),[...r]}async function Be(){let e=new McpServer({name:"drivn",version:L.version});e.tool("list_components","List all available Drivn UI components with descriptions",{},async()=>({content:[{type:"text",text:JSON.stringify(v.map(t=>({name:t.name,description:t.description})),null,2)}]})),e.tool("get_component","Get the full source code and metadata for a Drivn component",{name:z$1.string().describe('Component name (e.g. "button", "dialog")')},async({name:t})=>{let a=O(t);if(!a)return {content:[{type:"text",text:`Component "${t}" not found. Use list_components to see available components.`}],isError:true};let l=R[t];return {content:[{type:"text",text:JSON.stringify({name:a.name,description:a.description,dependencies:a.dependencies,npmDependencies:a.npmDependencies,source:l},null,2)}]}}),e.tool("get_component_metadata","Get metadata only (no source code) for a Drivn component \u2014 useful for planning",{name:z$1.string().describe("Component name")},async({name:t})=>{let a=O(t);if(!a)return {content:[{type:"text",text:`Component "${t}" not found. Use list_components to see available components.`}],isError:true};let l=Je(t);return {content:[{type:"text",text:JSON.stringify({name:a.name,description:a.description,dependencies:a.dependencies,npmDependencies:a.npmDependencies,allResolvedDependencies:l},null,2)}]}}),e.tool("search_components","Search Drivn components by name or description",{query:z$1.string().describe("Search query")},async({query:t})=>{let a=t.toLowerCase(),l=v.filter(d=>d.name.includes(a)||d.description.toLowerCase().includes(a));return {content:[{type:"text",text:l.length?JSON.stringify(l.map(d=>({name:d.name,description:d.description})),null,2):`No components matching "${t}".`}]}}),e.tool("get_installation_instructions","Get step-by-step installation instructions for one or more components",{components:z$1.array(z$1.string()).describe("Component names to install"),packageManager:z$1.enum(["npm","pnpm"]).optional().describe("Package manager (default: npm)")},async({components:t,packageManager:a})=>{let l=a??"npm",d=new Set,p=new Set,f=[],g=o=>{if(d.has(o))return;let s=O(o);if(!s){f.push(o);return}s.dependencies.forEach(i=>g(i)),s.npmDependencies.forEach(i=>p.add(i)),d.add(o);};if(t.forEach(g),f.length)return {content:[{type:"text",text:`Unknown components: ${f.join(", ")}. Use list_components to see available components.`}],isError:true};let N=l==="pnpm"?"pnpm dlx":"npx",m=l==="pnpm"?"pnpm add":"npm install",h=[];return h.push(`# Install components via CLI
4656
+ `;var L={version:"1.12.1"};function O(e){return v.find(r=>r.name===e)}function Je(e){let r=new Set,t=a=>{if(r.has(a))return;let l=O(a);l&&(l.dependencies.forEach(d=>t(d)),r.add(a));};return t(e),r.delete(e),[...r]}async function Be(){let e=new McpServer({name:"drivn",version:L.version});e.tool("list_components","List all available Drivn UI components with descriptions",{},async()=>({content:[{type:"text",text:JSON.stringify(v.map(t=>({name:t.name,description:t.description})),null,2)}]})),e.tool("get_component","Get the full source code and metadata for a Drivn component",{name:z$1.string().describe('Component name (e.g. "button", "dialog")')},async({name:t})=>{let a=O(t);if(!a)return {content:[{type:"text",text:`Component "${t}" not found. Use list_components to see available components.`}],isError:true};let l=R[t];return {content:[{type:"text",text:JSON.stringify({name:a.name,description:a.description,dependencies:a.dependencies,npmDependencies:a.npmDependencies,source:l},null,2)}]}}),e.tool("get_component_metadata","Get metadata only (no source code) for a Drivn component \u2014 useful for planning",{name:z$1.string().describe("Component name")},async({name:t})=>{let a=O(t);if(!a)return {content:[{type:"text",text:`Component "${t}" not found. Use list_components to see available components.`}],isError:true};let l=Je(t);return {content:[{type:"text",text:JSON.stringify({name:a.name,description:a.description,dependencies:a.dependencies,npmDependencies:a.npmDependencies,allResolvedDependencies:l},null,2)}]}}),e.tool("search_components","Search Drivn components by name or description",{query:z$1.string().describe("Search query")},async({query:t})=>{let a=t.toLowerCase(),l=v.filter(d=>d.name.includes(a)||d.description.toLowerCase().includes(a));return {content:[{type:"text",text:l.length?JSON.stringify(l.map(d=>({name:d.name,description:d.description})),null,2):`No components matching "${t}".`}]}}),e.tool("get_installation_instructions","Get step-by-step installation instructions for one or more components",{components:z$1.array(z$1.string()).describe("Component names to install"),packageManager:z$1.enum(["npm","pnpm"]).optional().describe("Package manager (default: npm)")},async({components:t,packageManager:a})=>{let l=a??"npm",d=new Set,p=new Set,f=[],g=o=>{if(d.has(o))return;let s=O(o);if(!s){f.push(o);return}s.dependencies.forEach(i=>g(i)),s.npmDependencies.forEach(i=>p.add(i)),d.add(o);};if(t.forEach(g),f.length)return {content:[{type:"text",text:`Unknown components: ${f.join(", ")}. Use list_components to see available components.`}],isError:true};let N=l==="pnpm"?"pnpm dlx":"npx",m=l==="pnpm"?"pnpm add":"npm install",h=[];return h.push(`# Install components via CLI
4654
4657
  ${N} drivn@latest add ${[...d].join(" ")}`),p.size&&h.push(`# Install required npm dependencies
4655
4658
  ${m} ${[...p].join(" ")}`),h.push(`# Components will be installed to your configured components directory
4656
4659
  # (default: src/components/ui/)`),{content:[{type:"text",text:JSON.stringify({componentsToInstall:[...d],npmDependencies:[...p],steps:h},null,2)}]}}),e.tool("get_design_tokens","Get the Drivn CSS design tokens (base globals and theme tokens)",{},async()=>({content:[{type:"text",text:`/* === Base Globals === */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "drivn",
3
- "version": "1.11.0",
3
+ "version": "1.12.1",
4
4
  "description": "Modern UI components for React — add beautiful, accessible components to your project",
5
5
  "license": "MIT",
6
6
  "type": "module",