Skip to main content
Glama
stackzero-labs

stackzero-labs/mcp

getUIComponents

Retrieve a full list of stackzero-labs/ui components via the MCP protocol, enabling seamless integration with applications like Claude Desktop and Cursor.

Instructions

Provides a comprehensive list of all stackzero-labs/ui components.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • src/server.ts:25-53 (registration)
    Registers the getUIComponents tool with the MCP server. The handler fetches UI components using fetchUIComponents and returns them as JSON text.
    server.tool(
      "getUIComponents",
      "Provides a comprehensive list of all stackzero-labs/ui components.",
      {},
      async () => {
        try {
          const uiComponents = await fetchUIComponents();
    
          return {
            content: [
              {
                type: "text",
                text: JSON.stringify(uiComponents, null, 2),
              },
            ],
          };
        } catch (error) {
          return {
            content: [
              {
                type: "text",
                text: "Failed to fetch stackzero-labs/ui components",
              },
            ],
            isError: true,
          };
        }
      }
    );
  • Core helper function that fetches the registry, filters components, and validates them using ComponentSchema.
    export async function fetchUIComponents() {
      try {
        const response = await fetch(mcpConfig.registryFileUrl);
        if (!response.ok) {
          throw new Error(
            `Failed to fetch registry.json: ${response.statusText} - Status: ${response.status}`
          );
        }
        const data = await response.json();
    
        return data.registry
          .filter((item: any) => item.type === "registry:component")
          .map((item: any) => {
            try {
              return ComponentSchema.parse({
                name: item.name,
                type: item.type,
                description: item.description,
              });
            } catch (parseError) {
              return null;
            }
          });
      } catch (error) {
        return [];
      }
    }
  • Zod schema for validating UI component objects used in fetchUIComponents.
    export const ComponentSchema = z.object({
      name: z.string(),
      type: z.string(),
      description: z.string().optional(),
    });
Install Server

Other Tools

Related Tools

Latest Blog Posts

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/stackzero-labs/mcp'

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