# magicuidesign/mcp architecture

> Architecture diagram of the GitHub repository magicuidesign/mcp, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-12). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/magicuidesign/mcp
- Repository: https://github.com/magicuidesign/mcp

## Overview

This is an MCP server for browsing, searching, and retrieving Magic UI registry items. An IDE or other MCP client invokes one of three tools; the server registers those tools, which delegate requests to a registry service. The service fetches and validates live registry data, builds catalog results or item details, and returns formatted tool responses. The README documents optional source, related-item, and example details. Edges reflect the shown calls and documented live-registry behavior; unsampled internals are not expanded.

Main entry points: [`src/services/registry-service.ts`](https://github.com/magicuidesign/mcp/blob/main/src/services/registry-service.ts) (Registry Service), [`src/tools/register-generic-tools.ts`](https://github.com/magicuidesign/mcp/blob/main/src/tools/register-generic-tools.ts) (Registry Tools), [`src/registry/client.ts`](https://github.com/magicuidesign/mcp/blob/main/src/registry/client.ts) (Registry Client), [`src/server.ts`](https://github.com/magicuidesign/mcp/blob/main/src/server.ts) (MCP Server)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_mcp["MCP Interface"]
  node_server["MCP Server<br/>[server.ts]"]
  node_tools["Registry Tools"]
  node_responses["Tool Responses<br/>[responses.ts]"]
end

subgraph group_registry["Registry Access"]
  node_registry_client["Registry Client<br/>[client.ts]"]
  node_schemas["Registry Schemas<br/>[schemas.ts]"]
  node_domain["Registry Models<br/>[registry.ts]"]
end

subgraph group_service["Catalog Services"]
  node_service["Registry Service"]
  node_service_types["Service Types<br/>[types.ts]"]
  node_formatters["Name Formatters<br/>[formatters.ts]"]
  node_search["Search Normalizer<br/>[search.ts]"]
end

node_client(("MCP Client"))
node_magic_registry["Magic UI Registry"]

node_client -->|"sends MCP requests"| node_server
node_server -->|"registers tools"| node_tools
node_tools -->|"calls registry operations"| node_service
node_tools -->|"formats tool results"| node_responses
node_service -->|"fetches registry data"| node_registry_client
node_registry_client -->|"fetches live data"| node_magic_registry
node_registry_client -->|"validates payloads"| node_schemas
node_domain -->|"derives data types"| node_schemas
node_service -->|"formats names"| node_formatters
node_service -->|"normalizes queries"| node_search

click node_server "https://github.com/magicuidesign/mcp/blob/main/src/server.ts"
click node_tools "https://github.com/magicuidesign/mcp/blob/main/src/tools/register-generic-tools.ts"
click node_responses "https://github.com/magicuidesign/mcp/blob/main/src/tools/responses.ts"
click node_service "https://github.com/magicuidesign/mcp/blob/main/src/services/registry-service.ts"
click node_service_types "https://github.com/magicuidesign/mcp/blob/main/src/services/types.ts"
click node_formatters "https://github.com/magicuidesign/mcp/blob/main/src/utils/formatters.ts"
click node_search "https://github.com/magicuidesign/mcp/blob/main/src/utils/search.ts"
click node_registry_client "https://github.com/magicuidesign/mcp/blob/main/src/registry/client.ts"
click node_schemas "https://github.com/magicuidesign/mcp/blob/main/src/registry/schemas.ts"
click node_domain "https://github.com/magicuidesign/mcp/blob/main/src/domain/registry.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_server,node_tools,node_responses,node_client,node_magic_registry toneBlue
class node_registry_client,node_schemas,node_domain toneAmber
class node_service,node_service_types,node_formatters,node_search toneMint
```

## Components

### MCP Interface

- [MCP Server](https://github.com/magicuidesign/mcp/blob/main/src/server.ts): `src/server.ts`
- [Registry Tools](https://github.com/magicuidesign/mcp/blob/main/src/tools/register-generic-tools.ts): `src/tools/register-generic-tools.ts`
- [Tool Responses](https://github.com/magicuidesign/mcp/blob/main/src/tools/responses.ts): `src/tools/responses.ts`

### Registry Access

- [Registry Client](https://github.com/magicuidesign/mcp/blob/main/src/registry/client.ts): `src/registry/client.ts`
- [Registry Schemas](https://github.com/magicuidesign/mcp/blob/main/src/registry/schemas.ts): `src/registry/schemas.ts`
- [Registry Models](https://github.com/magicuidesign/mcp/blob/main/src/domain/registry.ts): `src/domain/registry.ts`

### Catalog Services

- [Registry Service](https://github.com/magicuidesign/mcp/blob/main/src/services/registry-service.ts): `src/services/registry-service.ts`
- [Service Types](https://github.com/magicuidesign/mcp/blob/main/src/services/types.ts): `src/services/types.ts`
- [Name Formatters](https://github.com/magicuidesign/mcp/blob/main/src/utils/formatters.ts): `src/utils/formatters.ts`
- [Search Normalizer](https://github.com/magicuidesign/mcp/blob/main/src/utils/search.ts): `src/utils/search.ts`

### Other components

- **MCP Client**
- **Magic UI Registry**

## Connections

- MCP Client → MCP Server: sends MCP requests (evidence: `src/server.ts`)
- MCP Server → Registry Tools: registers tools (evidence: `src/server.ts`)
- Registry Tools → Registry Service: calls registry operations (evidence: `src/tools/register-generic-tools.ts`)
- Registry Tools → Tool Responses: formats tool results (evidence: `src/tools/register-generic-tools.ts`)
- Registry Service → Registry Client: fetches registry data (evidence: `src/services/registry-service.ts`)
- Registry Client → Magic UI Registry: fetches live data (evidence: `src/registry/client.ts`)
- Registry Client → Registry Schemas: validates payloads (evidence: `src/registry/client.ts`)
- Registry Models → Registry Schemas: derives data types (evidence: `src/domain/registry.ts`)
- Registry Service → Name Formatters: formats names (evidence: `src/services/registry-service.ts`)
- Registry Service → Search Normalizer: normalizes queries (evidence: `src/services/registry-service.ts`)
