Skip to main content
Glama

@jpisnice/shadcn-ui-mcp-server

by Jpisnice
get-block.ts1.36 kB
import { getAxiosImplementation, getFramework } from "../../utils/framework.js"; import { logError } from "../../utils/logger.js"; export async function handleGetBlock({ blockName, includeComponents = true, }: { blockName: string; includeComponents?: boolean; }) { const framework = getFramework(); if (framework === "react-native") { return { content: [ { type: "text", text: `Blocks are not available for React Native framework. The react-native-reusables repository does not provide block templates.`, }, ], }; } try { const axios = await getAxiosImplementation(); const blockData = await axios.getBlockCode(blockName, includeComponents); return { content: [{ type: "text", text: JSON.stringify(blockData, null, 2) }], }; } catch (error) { logError(`Failed to get block "${blockName}"`, error); throw new Error( `Failed to get block "${blockName}": ${ error instanceof Error ? error.message : String(error) }` ); } } export const schema = { blockName: { type: "string", description: 'Name of the block (e.g., "calendar-01", "dashboard-01", "login-02")', }, includeComponents: { type: "boolean", description: "Whether to include component files for complex blocks (default: true)", }, };

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Jpisnice/shadcn-ui-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server