Make your AI a shadcn expert

get_item_source

Full registry JSON including the actual TSX source for every file. The heaviest MCP tool by token cost — call it only after the agent has committed.

get_item_source returns the complete registry item with full TSX source for every file. It's what the agent calls when it wants to read the code — to adapt it, splice pieces of it, or understand how a pattern is built.

When to use it

  • The agent needs to read or modify the source rather than install verbatim.
  • Comparing two components' implementations, not just their metadata.
  • Debugging "how does X work?" prompts where get_item metadata isn't enough.

If the agent just wants to install, skip this and go straight to get_install_commandshadcn add pulls source directly server-to-server, no need to route it through the agent's token budget.

Arguments

NameTypeRequiredNotes
namestringRegistry slug

Example prompts

use shadcnio and show me the source of hero-announcement so I can match its layout in a different component
use shadcnio to fetch the source of use-debounce — I want to see how it handles cleanup
use shadcnio to pull the source of pricing-grouped-comparison-table and tell me which parts would need changing to show 4 tiers instead of 3

Response shape

Same shape as get_item, with content populated on every file:

{
"$schema": "https://ui.shadcn.com/schema/registry-item.json",
"name": "hero-announcement",
"type": "registry:block",
"title": "React Announcement Hero Block",
"description": "A hero section with an announcement banner above the headline.",
"author": "shadcn.io",
"homepage": "https://www.shadcn.io/blocks/hero-announcement",
"dependencies": ["lucide-react"],
"registryDependencies": ["button", "badge"],
"files": [
  {
    "path": "blocks/hero/hero-announcement.tsx",
    "type": "registry:block",
    "target": "components/blocks/hero/hero-announcement.tsx",
    "content": "\"use client\"\n\nimport { ArrowRight } from \"lucide-react\"\n..."
  }
]
}

The returned source is already sanitized: JSDoc blocks stripped, @repo/shadcn-ui/ and ~/ path aliases rewritten to @/, so it's paste-compatible with any standard shadcn setup.

Manual invocation

curl -s -X POST "https://www.shadcn.io/api/mcp?token=YOUR_TOKEN" \
-H "content-type: application/json" \
-d '{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "get_item_source",
    "arguments": { "name": "hero-announcement" }
  }
}' | jq -r '.result.content[0].text | fromjson | .files[0].content'

The -r on the final jq emits the file content without JSON-quoting — pipe to a file or to bat for pretty printing.

FAQ

Was this page helpful?

Sign in to leave feedback.