Get Block Meta Content
get-block-meta-contentFetch block metadata content from the FlyonUI MCP server to retrieve detailed information about UI components for Tailwind-based development.
Instructions
Fetch the content of the block metadata from the FlyonUI MCP server. Use this tool to retrieve the block metadata content.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| endpoint | Yes |
Implementation Reference
- src/index.ts:141-173 (registration)Registration of the 'get-block-meta-content' tool using server.registerTool(), with inputSchema requiring an 'endpoint' string parameter.
// A tool to get the metadata of the block. server.registerTool( "get-block-meta-content", { title: "Get Block Meta Content", description: "Fetch the content of the block metadata from the FlyonUI MCP server. Use this tool to retrieve the block metadata content.", inputSchema: { endpoint: z.string() }, }, async ({ endpoint }) => { try { const url = endpoint + "?type=mcp"; const response = await apiClient.get(url); if (response.status !== 200) { throw new Error(`Failed to fetch block meta content: ${response.status}`); } return { content: [ { type: "text", text: JSON.stringify(response.data, null, 2), } ], }; } catch (error) { console.error("Error fetching block meta content:", error); throw new Error("Failed to fetch block meta content"); } } ); - src/index.ts:149-172 (handler)Handler function for the tool that takes an 'endpoint' parameter, appends '?type=mcp', calls apiClient.get() to fetch block meta content from the FlyonUI MCP server, and returns the JSON response as text.
async ({ endpoint }) => { try { const url = endpoint + "?type=mcp"; const response = await apiClient.get(url); if (response.status !== 200) { throw new Error(`Failed to fetch block meta content: ${response.status}`); } return { content: [ { type: "text", text: JSON.stringify(response.data, null, 2), } ], }; } catch (error) { console.error("Error fetching block meta content:", error); throw new Error("Failed to fetch block meta content"); } } - src/index.ts:144-148 (schema)Schema definition for the 'get-block-meta-content' tool: title 'Get Block Meta Content', description, and inputSchema with a required 'endpoint' string parameter validated by Zod.
{ title: "Get Block Meta Content", description: "Fetch the content of the block metadata from the FlyonUI MCP server. Use this tool to retrieve the block metadata content.", inputSchema: { endpoint: z.string() }, }, - src/utils/http-client.ts:1-66 (helper)The apiClient used by the handler to make HTTP GET requests, configured with BASE_URL 'https://flyonui.com/api/mcp' and optional x-license-key header.
import { config } from "./config.js"; const API_KEY = config.apiKey || process.env.API_KEY; export const BASE_URL = "https://flyonui.com/api/mcp"; type HttpMethod = "GET" | "POST" | "PUT" | "DELETE" | "PATCH"; interface HttpClient { get<T>( endpoint: string, options?: RequestInit ): Promise<{ status: number; data: T }>; post<T>( endpoint: string, data?: unknown, options?: RequestInit ): Promise<{ status: number; data: T }>; put<T>( endpoint: string, data?: unknown, options?: RequestInit ): Promise<{ status: number; data: T }>; delete<T>( endpoint: string, data?: unknown, options?: RequestInit ): Promise<{ status: number; data: T }>; patch<T>( endpoint: string, data?: unknown, options?: RequestInit ): Promise<{ status: number; data: T }>; } const createMethod = (method: HttpMethod) => { return async <T>( endpoint: string, data?: unknown, options: RequestInit = {} ) => { const headers: HeadersInit = { "Content-Type": "application/json", ...(API_KEY ? { "x-license-key": API_KEY } : {}), ...options.headers, }; const response = await fetch(`${BASE_URL}${endpoint}`, { ...options, method, headers, ...(data ? { body: JSON.stringify(data) } : {}), }); return { status: response.status, data: (await response.json()) as T }; }; }; export const apiClient: HttpClient = { get: createMethod("GET"), post: createMethod("POST"), put: createMethod("PUT"), delete: createMethod("DELETE"), patch: createMethod("PATCH"), };