mirror of
https://github.com/shadcn-ui/ui.git
synced 2026-06-27 22:54:18 +00:00
feat: add OpenCode MCP client support (#8422)
* feat: add OpenCode MCP client support * chore: changeset --------- Co-authored-by: shadcn <m@shadcn.com>
This commit is contained in:
5
.changeset/shy-aliens-decide.md
Normal file
5
.changeset/shy-aliens-decide.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"shadcn": patch
|
||||
---
|
||||
|
||||
add mcp support for opencode
|
||||
@@ -29,6 +29,7 @@ Select your MCP client and follow the instructions to configure the shadcn MCP s
|
||||
<TabsTrigger value="cursor">Cursor</TabsTrigger>
|
||||
<TabsTrigger value="vscode">VS Code</TabsTrigger>
|
||||
<TabsTrigger value="codex">Codex</TabsTrigger>
|
||||
<TabsTrigger value="opencode">OpenCode</TabsTrigger>
|
||||
</TabsList>
|
||||
<TabsContent value="claude" className="mt-4">
|
||||
**Run the following command** in your project:
|
||||
@@ -95,6 +96,19 @@ Select your MCP client and follow the instructions to configure the shadcn MCP s
|
||||
- Create a contact form using components from the shadcn registry
|
||||
|
||||
</TabsContent>
|
||||
|
||||
<TabsContent value="opencode" className="mt-4">
|
||||
**Run the following command** in your project:
|
||||
```bash
|
||||
npx shadcn@latest mcp init --client opencode
|
||||
```
|
||||
|
||||
**Restart OpenCode** and try the following prompts:
|
||||
- Show me all available components in the shadcn registry
|
||||
- Add the button, dialog and card components to my project
|
||||
- Create a contact form using components from the shadcn registry
|
||||
|
||||
</TabsContent>
|
||||
</Tabs>
|
||||
|
||||
---
|
||||
|
||||
@@ -27,6 +27,7 @@ Ask your registry consumers to configure your registry in their `components.json
|
||||
<TabsTrigger value="cursor">Cursor</TabsTrigger>
|
||||
<TabsTrigger value="vscode">VS Code</TabsTrigger>
|
||||
<TabsTrigger value="codex">Codex</TabsTrigger>
|
||||
<TabsTrigger value="opencode">OpenCode</TabsTrigger>
|
||||
</TabsList>
|
||||
<TabsContent value="claude" className="mt-4">
|
||||
**Configure your registry** in your `components.json` file:
|
||||
@@ -118,6 +119,28 @@ Ask your registry consumers to configure your registry in their `components.json
|
||||
- Create a landing page using items from the acme registry
|
||||
|
||||
</TabsContent>
|
||||
|
||||
<TabsContent value="opencode" className="mt-4">
|
||||
**Configure your registry** in your `components.json` file:
|
||||
|
||||
```json title="components.json" showLineNumbers
|
||||
{
|
||||
"registries": {
|
||||
"@acme": "https://acme.com/r/{name}.json"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
**Run the following command** in your project:
|
||||
```bash
|
||||
npx shadcn@latest mcp init --client opencode
|
||||
```
|
||||
|
||||
**Restart OpenCode** and try the following prompts:
|
||||
- Show me the components in the acme registry
|
||||
- Create a landing page using items from the acme registry
|
||||
|
||||
</TabsContent>
|
||||
</Tabs>
|
||||
|
||||
You can read more about the MCP server in the [MCP documentation](/docs/mcp).
|
||||
|
||||
@@ -68,6 +68,21 @@ command = "npx"
|
||||
args = ["shadcn@${SHADCN_MCP_VERSION}", "mcp"]
|
||||
`,
|
||||
},
|
||||
{
|
||||
name: "opencode",
|
||||
label: "OpenCode",
|
||||
configPath: "opencode.json",
|
||||
config: {
|
||||
$schema: "https://opencode.ai/config.json",
|
||||
mcp: {
|
||||
shadcn: {
|
||||
type: "local",
|
||||
command: ["npx", `shadcn@${SHADCN_MCP_VERSION}`, "mcp"],
|
||||
enabled: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
] as const
|
||||
|
||||
const DEPENDENCIES = [`shadcn@${SHADCN_MCP_VERSION}`]
|
||||
@@ -92,7 +107,7 @@ export const mcp = new Command()
|
||||
})
|
||||
|
||||
const mcpInitOptionsSchema = z.object({
|
||||
client: z.enum(["claude", "cursor", "vscode", "codex"]),
|
||||
client: z.enum(["claude", "cursor", "vscode", "codex", "opencode"]),
|
||||
cwd: z.string(),
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user